Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c

eclipse

break

gdb

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?

like image 879
Timo Avatar asked Nov 25 '10 15:11

Timo


2 Answers

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

like image 162
Itamar Katz Avatar answered Sep 23 '22 23:09

Itamar Katz


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?

like image 25
masaya Avatar answered Sep 24 '22 23:09

masaya