PDA

View Full Version : How to get GNU debugger to wait at main()


WhatMeWorry
2005.06.25, 02:59 PM
I used to fire up Codewarrior all the time and by default it would
open a window, load the source code, and wait at main(). You could
then set breadpoints or step thru the code.

Xcode debugger opens up the window and automatically runs the executable.
My small program finishs before I can hit pause or anything.

Do I need to set a breakpoint at main()? If so, how?

thanks.

LongJumper
2005.06.25, 03:53 PM
Why not just set a breakpoint at the first line in your main function?

Fenris
2005.06.25, 04:39 PM
Hm, I can't find it now, but you can set a "symbolic breakpoint" on main, and add that directive to a file that is automatically parsed when gdb starts up. I don't have my books here, but if you can't figure it out by Wednesday, I'll fix it for you.

WhatMeWorry
2005.06.25, 11:25 PM
Good, at least my approach is valid. It's just the details that are eluding me.
I open up the breakpoint window, and there is just a little "blue" box or
something. I try alot of stuff (that doesn't work) and just close in frustration.

I'll keep plugging away at it. Probably posted too early.

New Hardware (mac mini), New OS (OS X), new IDE (Xcode), new compiler, linker, and debugger (GNU).

Like the McDonald's line goes: I'm lovin' it :)

OneSadCookie
2005.06.25, 11:28 PM
clicking in the left margin of any source file places a breakpoint on that line...

WhatMeWorry
2005.06.26, 01:25 PM
Sweet! Well that was too easy. Thought I had to be in the Debugger proper before
I could set breakpoint, but abviously I'm full of it.

Fenris
2005.07.07, 02:55 PM
Auch, I thought you wanted some kind of snazzy catch-all solution. Ohwell, chalk one up for Keith. ;)

Skorche
2005.07.07, 06:59 PM
Well, I'm too late to say anything useful, so...

You could then set breadpoints or step thru the code.
That sounds delicious! Do you have the recipe?