Eclipse 的调试器/分析器?
有没有关于在 Eclipse 中调试应用程序/运行分析器的教程?请告诉我谢谢..
Is there any tutorial for debugging applications/ running profiler in eclipse? Please let me know thanks..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将取决于您使用的语言。 PHP 与 C++ 的调试设置方式略有不同,因为它们使用不同的底层工具(PHP - Xdebug 与 C++ - gdb)。
一般来说,您将配置应用程序,就像将其设置为在 Eclipse 中运行一样。在某些情况下,您必须确保在代码库中启用调试信息,以便调试器提供详细信息。从那里您将看到设置断点、单步执行和设置监视,这与 Eclipse 中的“调试透视图”中的语言之间非常相似。
一种常见的情况是通过单击编辑器中的左侧栏并选择切换断点来在代码库中设置断点。然后单击 IDE 中的调试按钮,它应该打开调试视角,并且要么在 main 的开头处中断,要么运行到您在代码中设置的断点。一旦中断被击中,您将能够浏览透视图中某一视图内的堆栈帧,您将看到监视、断点等选项卡。顶部附近的按钮看起来类似于播放,然后是跳跃的箭头点是从断点开始控制执行的方式。如果您单击“跳过”,代码将在您所在的源文件中逐行执行,直到它必须转到另一个文件才能跟随代码的执行。它不会进入函数调用,而是调用它执行它并返回到当前源中的下一行。如果您想进入函数调用并从那里继续调试,则可以使用大多数情况下位于“step over”旁边的“step into”按钮。恢复重新启动常规执行,并将正常运行程序,直到结束或遇到另一个断点。
从那里开始并熟悉它,然后开始使用条件断点和手表之类的东西。条件中断与断点完全相同,但它们仅在满足您指定的条件时停止执行。对于 C++,这通常是通过右键单击断点并在菜单中适当的位置提供条件表达式来完成的。 (我忘记了确切的措辞)
手表允许您监视内存,并在读取、写入内存或同时读取和写入内存时让程序中断,以便您可以检查您的应用程序。
Eclipse 中的某些调试器可能缺少其中一些功能或提供比上面列出的更高级的功能,但这些概念应该可以帮助您顺利进行。
祝你好运!
This will depend on what language you are using. How you setup for debugging PHP vs C++ is a little different as they use different underlying tools (PHP - Xdebug vs C++ - gdb)
In a general sense, you will configure the app much like you would set it up to run within Eclipse. In some cases you will have to be sure to enable debugging information within the code base for the debuggers to provide detailed information. From there you're looking at setting breakpoints, stepping, and setting up watches which is very similar language-to-language within the Debug Perspective in Eclipse.
A common scenario is to set a breakpoint within the codebase by clicking on the left bar in the editor, and selecting toggle breakpoint. Then click the debug button in the IDE and it should open the Debug Perspective and either break at the beginning of main, or will run to the breakpoint you set in the code. Once the break is hit, you will be able to browse the stack frames within one of the views within the perspective and you will see tabs for watches, breakpoints, etc. The buttons near the top that look similar to play, and then arrows jumping over dots are the way you control the execution from your breakpoint. If you click "step over" the code will go line by line in the source file you're in until it must goto another file to follow the execution of your code. It will not go into a function call, rather call it execute it and return to the next line in the current source. If you want to go into the function call and continue debugging from there, you would use the "step into" button which is right next to "step over" in most cases. Resume restarts regular execution and will run your program normally until the end or another breakpoint is hit.
Start from there and get comfortable with it and then start playing with things like conditional breakpoints and watches. Conditional breaks are exactly like breakpoints but they only stop execution if the condition you specify is met. With C++ this is usually done by right clicking on the breakpoint and providing the conditional expression where appropriate in the menu. (I forget the exact verbage)
Watches allow you to watch memory and have the program break when memory is read, written to, or both so you can inspect your application.
Some debuggers in Eclipse may lack some of these features or offer more advanced features than those listed above, but these concepts should get you well on your way.
Good luck!