XCode: Problems with the debugger

I am having serious issues with the debugger NOT stopping at break points, doing a step into or step over causes the program to just run and not step to the next statement.

I have the debug mode on, I have it set to zero optimizations, full symbols, full debug. What else do I need to do so I can step through my code without it running away? I have done cleans, and full rebuilds, tweaked some linker flags, but no matter what I do, I can't step through a program reliably and even if I have 50 break points in, it will skip them all.

EMac, Mac Mini, Mac OS X (10.4.6)

Posted on Sep 16, 2008 10:02 AM

Reply
19 replies

Sep 16, 2008 1:32 PM in response to Mark Szymczyk

I checked it, and its not checked. Load CFM symbol info is checked, and the disassembly style is AT&T, but I suppose that is because the mac I am working on has a PPC.

I am checking out other parts of my code, and it seems that the debugger gets "out of sync" with the app easily. For example I had bit of code like this:

if ( flag == true )
{
sleep(5);
}

I had the break point at the IF statement. I hit "Step Over" and it takes 5 seconds to get to the sleep statement. I hit step over again, and it takes ANOTHER 5 seconds. After that further instructions were would "Step Over" Instantly. It was like the real program counter was on the sleep statement when the debugger thought it was on the IF statement. It executes the sleep, not the IF. Then the debugger resets the PC to be on the sleep again and it is done a second time.

Sep 29, 2008 11:04 AM in response to Russell Finn

That is off by default for me. There is something odd though I have noticed in general. Whenever I make a new project, both the debug and release builds have identical configurations. People have said when they start new projects that debug and release are set in the correct manner. The only thing I can think of is that I have had several Xcode upgrades, you know 2.1 to 2.2 all the way to 2.5. I run 10.4 so I can't get the latest version. Maybe something has gotten hosed along the way.

There isn't any kind of uninstall tool on the Mac, right? Like blow away all things XCode, and do a fresh install.

Thanks for the reply, this was an old post so you must have been going through many pages to find it. Generally the clean and rebuild tends to help a lot and the debugger doesn't really follow the code step by step.

For example if you have several nested if-then statements, and a nested one is false and would end up exiting the first if-then scope, when you are at the outer if-then (which would return true) doing the next step will take you outside of the first if then scope rather then stepping to the inner one which would fail and then take you out of the first scope. So you never see the conditional values that failed the inner test.

Another problem I have (and have given up one) is if you are running to applications at the same time in debug and they share some common CPP files, you are unable to put break points in the common file for the 2nd application. It puts the break point in the first application.

Sep 29, 2008 1:25 PM in response to TheSilverHammer

If your debug and release builds have identical configurations, then your debug build may have compiler optimization turned on. That would certainly account for the behavior you're seeing.

To completely uninstall Xcode 2.5, you can run the script at /Developer/Library/uninstall-devtools at the command line. This is mentioned in the release notes document ("About Xcode Tools.pdf") that is found on the Xcode 2.5 distribution disk image. (This used to be recommended procedure for installing new pre-release version of Xcode, and I got into the habit of doing it every time.)

So, as you suggest, you could try completely removing the existing installation, reinstalling from scratch, and then recreating your project from the newly reinstalled template. That should give you the correct configuration.

Sep 30, 2008 12:48 PM in response to Russell Finn

That sounds like a good idea. Do you know where I can get an XCode 2.5 DMG file? I used to easily find it on apple's site, but its either hidden well or gone. All I can get XCode 3.0, which I can't run (os x 10.4) and they are charging for. Apple really needs to give those tools out for free to encourage as much SW development as possible. While MS charges a lot for their Dev set, its not to hard to get it for free. Just register as an official MS developer and they will send it to you. You can even download the "lite" version without registering for anything. If you are a MSDN subscriber, they send you everything under the sun, but you need to be "certified" first which means passing some of their tests.

Oct 1, 2008 6:24 AM in response to Russell Finn

I uninstalled XCode and all its tools, rebooted, installed XCode 2.5, rebooted, created a new project and once again the debug and release configs are identical. Debug still has strip all symbols, fully optimize and all that.

I guess Ill just have to keep manually changing debug configs into actual debug configs. BTW what is the better debug mode, Stabs or Dwarf?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

XCode: Problems with the debugger

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.