如何将调试器附加到应用程序 [英] How to attach a debugger to an application

查看:250
本文介绍了如何将调试器附加到应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我正在尝试创建一个应执行以下操作的应用程序:

1.它应该解析一个可执行的C/C ++程序,并在适当的位置插入适当的注释...,例如://主启动....//调用fun1 ... etc.

2.它应创建该应用程序的树形图/控制流程图

3.它应该提供有关输入的动态信息,例如...执行所需的时间以及哪个循环/函数花费的时间最多等.


1和2我能够通过使用flex和bison解析输入程序来实现....第三点是一个问题..因为我不知道该怎么做.....我应该在我的设备上附加调试器吗应用程序..如果是,那么我应该创建它还是可以附加任何一个...或者我可以使用来自自定义构建调试器的信息... plz帮助....

Hi there,
I am trying to create an application which should do the following:

1. It should parse an executable C/C++ program and insert appropriate comments in that at appropriate positions... like: //main starts....//call to fun1...etc.

2. It should create a tree/ control flow graph of the application

3. It should provide the dynamic information about the input like...how much it takes to execute and which loop/function takes the most time etc etc.


1 and 2 I am able to achieve by parsing the input program using flex and bison....third point is a problem..cause I dont have any idea how to do it.....shall I attach a debugger to my application..if yes then shall I create it or I can attach any one...or can I use the information from a custom build debugger...plz help....

推荐答案

它取决于平台,但是看起来您不必附加"调试器.您只需要在调试器下运行代码,并按断点进行操作,然后逐步进行操作即可.

当不可能在调试器下运行代码时,术语附加"调试器是指更为复杂的调试问题.此类情况的示例包括调试Windows服务,该服务在加载OS时启动了某些代码.在某些情况下,您可以将调试器附加到已经运行的进程.我看不到你需要的地方.

有关更多信息,您需要查看调试器的文档:它们都是不同的,尤其是在不同的平台上.

—SA
It depends on the platform, but it looks like your don''t have to "attach" the debugger. You simple need to run the code under debugger and go by breakpoints and then step-by-step.

The term "attach" the debugger refers to much more complex debugging problem when it is not possible to run the code under debugger. Example of such cases include debugging of Windows Service of some code started when the OS is being loaded. In some cases, you can attach the debugger to already running process. I don''t see where you need it.

For more information, you need to see the documentation of your debugger: they are all different, especially on different platforms.

—SA


放置断点并按f5. Microsoft提供了可以包含所有断点行的调试窗口.
无需将任何其他调试器附加到应用程序.
Put the breakpoint and press f5. Microsoft has provided the debug window which can have the all break point lines.
No need to attach any aditional debugger to the application.


它取决于操作系统和调试器(如果您使用的是Windows,则尝试使用该调试器),我建议在调试时附加调试器这不是一个简单的过程,因为您需要提供符号(在编译应用程序时生成)

如果要分析程序(例如探查器)的行为,则需要跟踪堆栈和堆,然后分析所获取的信息.请注意,这不是无关紧要的事情,它可能变得非常复杂

祝你好运!
it depends on the OS and the debugger your attempting to use if its is windows i suggest win debug attaching the debugger is not a simple process as you need to provide the symbols (generated when you compile the application)

if you want to analysis the behavior of a program (like a profiler) you need to trace the stack and heap and then analyse the information acquired. note this not trivial stuff and it can get pretty complex

Good Luck!!


这篇关于如何将调试器附加到应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆