Xcode won't step over crash

So, this happened several times in a number of different projects. I will debug my application in Xcode when Xcode breaks on error. Looking at this, I would click the Step Forward or Continue button ... and did nothing. More precisely, he acted as if he had stepped, but in fact did not go anywhere. As far as I can tell, this can be repeated endlessly. One of the reasons this is problematic is because it never gives me a crash log because it never ends in a crash. I only get the crash log when the application crashes and it is not debugging (which means I have to get it through Crittercism or by checking the device logs).

Does anyone see this before and / or know why he does it? I did not see mention of this elsewhere, but this happened to me in several projects.

For example, in one project, we use SocketRocket and every time at that time (for an unknown reason) it crashes in SRWebSocket.m as follows:

- (void)main; { @autoreleasepool { _runLoop = [NSRunLoop currentRunLoop]; dispatch_group_leave(_waitGroup); NSTimer *timer = [[NSTimer alloc] initWithFireDate:[NSDate distantFuture] interval:0.0 target:nil selector:nil userInfo:nil repeats:NO]; [_runLoop addTimer:timer forMode:NSDefaultRunLoopMode]; int i = 0; while ([_runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) { NSLog(@"_runLoop %i %@", i++, [NSDate date]); } assert(NO); } } 

It crashes on the while line. (By the way, I added the NSLog line). When I click Continue or Step by Step, the line indicator flashes instantly and then reappears on the same line. Note that it does not continue the NSLog line, and nothing is written to the console at all. I'm still trying to collapse it again (this crash is unpredictable), but if I remember correctly, the line indicator says EXC_BAD_ACCESS , possibly a prematurely freed object.

+6
source share
3 answers

An ObjC error out of range will throw an ObjC exception that ends - if not displayed - in the interrupt. The interruption really just triggers the BSD (SIGKILL) signal. It is easy for the debugger to pass the process so that it can die naturally.

EXC_BAD_ACCESS and EXC_BAD_INSTRUCTION are fun exceptions, as they first come in the direction of the Mach OS. For proper distribution, they should be processed initially as Mach exceptions, if there is a handler for them, and if not, they should be passed to some system handler, which turns them into an equivalent BSD exception (SIGSEGV), which will then be passed to the BSD signal handler and which will will ultimately lead to the exit of your program.

There is a longstanding bug in the kernel interfaces provided to the debugger that makes it impossible for the debugger to effectively act on this little dance from the outside. Therefore, if you get EXC_BAD_ACCESS, you are pretty much stuck there. For the most part, it doesn't really matter; your program was just about to turn around and die anyway. You would not get any idea of ​​your failure by watching this.

This only matters if you have installed and want to debug the SIGSEGV handler. It has been tricky for MacOS X for a decade or more. Fortunately, only very few people really need to do this ...

+1
source

You are missing the Step by Step point. When you go through a line, you say that you are executing the current line and proceeding to the next one apparently, regardless of whether the current line calls another procedure.

If the code crashes at any point, you will not be able to continue executing lines of code.

+3
source

To add to previous answers; When debugging, EXC_BAD_ACCESS can sometimes help "Include zombie objects" in your circuit. If you are accessing an object that has been freed, zombie objects will tell you which object you should not try to make a call to, and the method you tried to call.

0
source

All Articles