Tuesday, May 22, 2012

Objective-c EXC_BREAKPOINT (SIGTRAP) exception without trackback to iPhone app

I have tried

(1) cleaning build folder,

(2) deleting app from the simulator and from my iphone,

(3) rebooting,

(4) and enabling NSZombieEnabled but it does not appear to be doing anything.

(5) using debugger lldb and gdb

(6) and gaurd malloc



I have xcode 4.3.2. This bug occurs on both the simulator and my iphone.
(on the simulator it says EXC_BAD_INSTRUCTION code=i386 subcode=0x0 and on the device it says EXC_BREAKPOINT (SIGTRAP).

Here are two crashes logs:



http://pastie.org/3941419



http://pastie.org/3941427



In the log it prints:



Trace/BPT trap: 5

Segmentation fault: 11



As you can see in the crashes, there is no traceback to any of my ViewControllers. I did a lot of googling before asking (link), but a lot of other people(link) with this error have a traceback to thier app. What are common causes of this app and where should I start looking for a bug? There is not one thing I can do to reproduce, just run a piece of my code like 10 times and it will crash at least once. Thanks!



EDIT:
heres some code



outputPipe = [[NSPipe alloc] init];


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getDataOut:) name:NSFileHandleReadToEndOfFileCompletionNotification object:[outputPipe fileHandleForReading]];



[[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleReadToEndOfFileCompletionNotification object:[outputPipe fileHandleForReading]];



I do release outputPipe later in my code.



EDIT 2: changing [NSPipe pipe]; to [[NSPipe alloc] init]; did not fix it.



Code to switch between observers:



 buttondone.title=@"Done";
//dlog(@"last output notification inbound");
stdoutisdone=YES;

[[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleReadCompletionNotification object:[outputPipe fileHandleForReading]];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getDataOut:) name:NSFileHandleReadToEndOfFileCompletionNotification object:[outputPipe fileHandleForReading]];

[[outputPipe fileHandleForReading] readToEndOfFileInBackgroundAndNotify];




No comments:

Post a Comment