How to stop GDB from executing "break main" by default in Eclipse?
Asked Answered
A

2

19

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?

Alkene answered 25/11, 2010 at 15:19 Comment(0)
T
32

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

Telegraph answered 28/11, 2010 at 11:58 Comment(2)
This is settings is for single run configuration. What if I would like to set it globally for all projects for ever?Microsporophyll
Note: The Debugger tab only appears for me during debugging. So I had to start the debug, wait for it to break in main(), then follow the steps above, and it worked.Vocative
P
3

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?

Plug answered 10/9, 2015 at 14:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.