views:

152

answers:

5

Usually I use gdb backtrace to debug my application, but recently I can no longer do it when testing on iPhone simulator. The blue gdb word stops being displayed on console, and nothing happens when I type "bt" or "backtrace". I can still build and debug properly on the device though.

My XCode version is 3.2.3. Is there any way to manually activate the gdb (more importantly the backtrace)?

A: 

If the program is hanging, which is what this sounds like. You can press the 'Pause' button on the Debugger Console or in the Debugger window to interrupt the app and see where it is currently executing.

Jack Cox
Usually as soon as I launch the app, the blue gdb word should appear on console, and if the app crashes, I can use backtrace. Now I have none of this. Clean, reset simulator, restart simulator, restart XCode, restart Mac... don't help, maybe the only solution left is to reinstall the SDK.
iamj4de
So, does the Xcode just return to the 'app not running state' (i.e. the Task button on the toolbar is grayed out) or does the Task button stay enabled on the toolbar?
Jack Cox
It stays enabled.
iamj4de
Sounds like something is hanging during the load process. I recall seeing this when things were wired incorrectly between the .xib file and the view controller. I don't think it's a problem with your environment, is probably some basic configuration issue with your startup resources. Without seeing code and the other stuff I really cannot say for sure.jack
Jack Cox
A: 

As Jack points out, the Pause button will manually activate gdb & the back trace, which is what you asked. You may have a bad install -- it happens, sometimes, try deleting your /Developer folder & re-installing. XCode 3.2.3 and the debugger work just fine, I use it several times a day.

In particular, CMD-Y is "build & run with debugger", whereas CMD-R is just "build & run" (no debugger, by default), so make sure you're using CMD-Y.

Aside: An issue I keep running into is, after the app quits, the red-stop-sign icon doesn't recognize that the app has finished, so I have to "stop" it again. I believe this is due to iOS-4's keeping apps running in the background.

Olie
A: 

Also, check and make sure your home folder .gdbinit file is in good order. Move it aside if it exists and see if the problem goes away.

tgunr
A: 

Don't know if this is the exact same situation, but it may help. My iPhone was at firmware 4.0.2, but my Xcode SDK was for firmware 4.0.1. Normally Xcode would complain that I would need to upgrade to a newer Xcode that supported 4.0.2, this time it didn't.

Was banging my head why breakpoints could be set but the debugger did not stop at my breakpoint (the breakpoints were orange - signalling that symbols were not loaded). I decided to reboot my iPhone and now Xcode showed the warning (when it didn't before). Upgrading to Xcode for 4.0.2 fixed my problem of course. So perhaps your Xcode is not updated for newer firmware?

Shazron
A: 

Had similar issue, but can't remember the exact circumstances. Turned out the Base SDK (in the project info build tab) was set to the device and not the simulator. Bit of a shot in the dark, but probably worthwhile verifying.

Donald
I don't think it's important. I've tried to switch the Base SDK from device to simulator but the problem still persists, and from my memory it used to work well no matter what value the Base SDK was.
iamj4de