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.
I've read that there is a command
(gdb) break main
which will accomplish the same behavior when running from the command line.
At the moment I do NOT have a .gdbinit file.
At the moment gdb doesn't stop on entering main when running from the command line, but it does when running from Eclipse.
How do I make GDB stop breaking on entering main by default within Eclipse?
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.
EDIT: you can see a screen-shot here: Method/Function Breakpoints in Eclipse CDT
To set it for any new launch, On the menu Window->Preferences, Select C/C++->Debug->GDB item on the left, and then go to the Debug Configurations Defaults section and uncheck the "Stop at startup at:" checkbox on CDT 8.0 or later.
You can see the details here: How do I prevent the debugger from stopping on the first line?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With