如何阻止 GDB 执行“break main"默认情况下在 Eclipse 中?

2022-01-20 00:00:00 c break gdb eclipse

我正在使用 Eclipse 和 MinGW 开发一个 C 项目.运行此项目的调试版本时,gdb 总是在输入 main() 时中断.我明白为什么这很有用,但对于我当前的项目,我不希望发生这种情况.

I'm working on a C project with Eclipse and MinGW. When running a debug build of this project, gdb always breaks on entering main(). I can see why this could be useful, but for my current project I don't want that to happen.

我读到有一个命令

(gdb) break main

从命令行运行时会完成相同的行为.

which will accomplish the same behavior when running from the command line.

目前我没有 .gdbinit 文件.

At the moment I do NOT have a .gdbinit file.

目前 gdb 在从命令行运行时不会在进入 main 时停止,但在从 Eclipse 运行时会停止.

At the moment gdb doesn't stop on entering main when running from the command line, but it does when running from Eclipse.

如何让 GDB 在 Eclipse 中默认进入 main 时停止中断?

How do I make GDB stop breaking on entering main by default within Eclipse?

推荐答案

确保你在 c++ 透视图中,然后转到菜单 Run -> Debug Configurations.确保在左侧窗格中选择了您的应用程序,按 Debugger 选项卡,然后取消选中 Stop on startup at: 复选框.

Make sure you are in the c++ perspective, then go to menu Run -> Debug Configurations. Make sure your application is chosen in the left pane, press the Debugger tab, and uncheck Stop on startup at: checkbox.

您可以在此处查看屏幕截图:Method/Eclipse CDT 中的函数断点

you can see a screen-shot here: Method/Function Breakpoints in Eclipse CDT

相关文章