How to configure Xcode so that GDB prints SIGABRT error information?

I have been using Xcode for several years now and it has stopped providing information in the gdb window when my iOS application receives any SIGABRT or EXEC_BAD_ACCESS etc. Now, when I launch the application and generate any kind of SIGABRT, I get:

Thread 1: Program received signal: "SIGABRT" 

But in the debug output window, where the error description and stack trace, as a rule, I do not get. This makes debugging very difficult - I have to set random breakpoints until I go through the program and find the line that caused SIGABRT, and fixing the problem can be very tedious without any debugging information.

When I enter "information signals" in the gdb window, I get:

 SIGABRT Yes Yes Yes Aborted 

for the signal settings that I think are correct.

The only way to get any information I found is to set a breakpoint using:

 (gdb) fb -[NSException raise] (gdb) fb objc_exception_throw (gdb) fb malloc_error_break 

and then when cigabra happens i use

 (gdb) set $exception = *(id *)($ebp + 8) (gdb) po $exception (gdb) po [$exception name] (gdb) po [$exception reason] 

I should mention that I am using Xcode 4.2 and iOS SDK

+4
source share
1 answer

Try putting these 3 in your ~/.gdbinit :

 fb -[NSException raise] fb -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] fb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] 

All my .gdbinit , if that helps:

 #define NSZombies fb -[NSException raise] fb -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] fb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] fb -[_NSZombie init] fb -[_NSZombie retainCount] fb -[_NSZombie retain] fb -[_NSZombie release] fb -[_NSZombie autorelease] fb -[_NSZombie methodSignatureForSelector:] fb -[_NSZombie respondsToSelector:] fb -[_NSZombie forwardInvocation:] fb -[_NSZombie class] fb -[_NSZombie dealloc] fb szone_error set env MallocHelp=YES set env NSDebugEnabled=YES set env NSZombieEnabled=YES set env NSDeallocateZombies=NO set env MallocCheckHeapEach=100000 set env MallocCheckHeapStart=100000 set env MallocScribble=YES set env MallocGuardEdges=YES set env MallocCheckHeapAbort=1 set env NSAutoreleaseFreedObjectCheckEnabled=YES set env MallocStackLoggingNoCompact=YES set env MallocStackLogging=YES set env CFZombie 5 tty /dev/ttys000 
+4
source

All Articles