dB'
dB'

Reputation: 8330

How to tell the XCode debugger to only stop at breakpoints? (and not at exceptions)

I'm writing a 3rd party plug-in for a closed-source application. I'm running into a problem with the XCode debugger.

I'd like to use the debugger to step through the code of the plug-in I'm writing. To do this, I've set a breakpoint in my code, I've launched the host app, and then I've attached the XCode debugger to the host app's process. My problem is that, rather than stopping at my breakpoint, the debugger stops instead at an exception thrown by another part of the program. (Specifically, this: Thread 2: EXC_ARITHMETIC (code=EXC_i386_DIV, subcode=0x0))

This exception is thrown so often that it effectively makes it impossible to step through the code I'm actually interested in.

I can't catch and handle this exception, because I don't have the source code for the part of the app that throws it.

In this situation, can anyone suggest how I might be able to debug my code? Is there any way to tell the XCode debugger to simply "ignore" this particular EXC_ARITHMETIC exception, and, instead, to stop only on the breakpoints that I've explicitly set?

UPDATE

@user1118321 suggested turning off exception breakpoints using the breakpoints pane. I've tried to do so using the settings shown here.

enter image description here

I thought that selecting "Automatically continue after evaluating" might keep the debugger from stopping. It didn't.

I also tried issuing cont to the debugger after stopping. This doesn't seem to work either.

enter image description here

Can anyone you advise me on what settings I should enter here to keep the debugger from stopping on my EXC_ARITHMETIC exception?

Upvotes: 3

Views: 2319

Answers (2)

dB'
dB'

Reputation: 8330

I followed the links suggested by @user1118321. After several hours of head scratching, I couldn't figure out how to either turn off or handle the integer division by zero exception. If anyone has any ideas I'd be happy to hear them.

I did find a workaround, though, which is to use GDB instead of XCode. Unlike XCode, GDB doesn't seem to stop on the EXC_ARITHMETIC and lets me step into my code. So, for the time being I'm going to switch over to GDB for debugging.

EDIT

A second (better) workaround, in my case, involved suspending the thread that was throwing the exception. This also allowed me to step through my plugin's code.

Upvotes: 0

molbdnilo
molbdnilo

Reputation: 66459

That's an integer "division by zero" error exception. They aren't propagated as C++ exceptions as far as I'm aware, which is why you can't not break on them.

Does that happen even if your plugin isn't loaded? If it doesn't, your plugin is causing a division by zero somehow.

Upvotes: 3

Related Questions