views:

886

answers:

2

Howdy--

Subject says it all really...Is there anywhere a good tutorial for Xcode's Debugger out there? I'm finding dribs and drabs of stuff but nothing comprehensive or that goes deep enough. My problem right now is that this...

#0  0x90d9c688 in objc_msgSend
#1  0x30506515 in NSPopAutoreleasePool
#2  0x30901697 in _UIApplicationHandleEvent
#3  0x32046375 in PurpleEventCallback
#4  0x30245560 in CFRunLoopRunSpecific
#5  0x30244628 in CFRunLoopRunInMode
#6  0x308f930d in -[UIApplication _run]
#7  0x309021ee in UIApplicationMain
#8  0x00001ff8 in main at main.m:14

...combined with this...

0x90d9c688  <+0024>  mov    0x20(%edx),%edi

...and this...

EXC_BAD_ACCESS

...isn't helping much. Or at all, really. I'm resorting to commenting out lines of code and there has to be a better way.

Thanks

UPDATE: I guess perhaps my venting was a bit of a distraction from the real question, though the tips have helped explain things a bit. What I'm really getting at is not only an explanation of the above, but just use of the Debugger in general. The questions that I usually have are:

  • Why does the Debugger sometimes go from the source code view to (what I'm assuming) assembly code when I step over or in? Is there a way for me to see both at the same time all the time?
  • Is there anything specific I should be looking for in the assembly code, or anything that could help in a given situation?
  • It looks as though breakpoints allow for actions, so I'm curious how that might be utilized rather than peppering my code with NSLog statements.

I know these are broad, and probably should be asked individually, but I didn't want to clutter the SO space with these topics that might already be documented elsewhere.

I also noticed there is a nearly duplicate question asked here: http://stackoverflow.com/questions/1366948/what-are-some-objective-c-debugging-tips

+2  A: 

The crash is inside Apple's code (that's why debugger doesn't show you the source) and cause of it is actually somewhere else – you've released a temporary object that was supposed to be released by autorelease pool. This caused autorelease pool to crash.

You're supposed to release only objects which:

  • you've retained yourself using retain
  • were returned by init, copy and new methods only (and their variants containing these words)

Unfortunately you can't learn that one from the debugger, only from documentation and experience…

You can use Clang Analyzer to find such errors (sometimes).

porneL
If I could check both answers as the accepted one, I would, despite the fact that they didn't answer the question the way that I hoped. Not that truly matters here, in the end. So, I'm going with the one that first lead me to the cause of the crash, though I think I need to go over the rules of memory management again to understand why I'm getting the crash. Thanks to both!
Philip Regan