How to get GNU debugger to wait at main()

Member
Posts: 321
Joined: 2004.10
Post: #1
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.
Quote this message in a reply
Moderator
Posts: 133
Joined: 2008.05
Post: #2
Why not just set a breakpoint at the first line in your main function?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #3
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.
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #4
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 Smile
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
clicking in the left margin of any source file places a breakpoint on that line...
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #6
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.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #7
Auch, I thought you wanted some kind of snazzy catch-all solution. Ohwell, chalk one up for Keith. Wink
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #8
Well, I'm too late to say anything useful, so...

WhatMeWorry Wrote:You could then set breadpoints or step thru the code.
That sounds delicious! Do you have the recipe?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Xcode4: Debugger - how do you view class members? SparkyNZ 4 7,241 Jul 4, 2011 03:08 PM
Last Post: bdsowers
  XCode combining debugger and console?? Toontingy 2 5,364 Feb 16, 2010 07:55 PM
Last Post: Toontingy
  iPhone application always opens with the debugger! frogameleon 0 2,534 Mar 6, 2009 10:02 AM
Last Post: frogameleon
  using the xcode debugger NSDuo 8 5,682 Jan 14, 2009 04:52 PM
Last Post: NSDuo
  How do I use a NIB file for my main menu in SDL? ferum 4 3,696 Aug 11, 2006 01:25 PM
Last Post: ferum