如何告诉XCode调试器只在断点处停止?(How to tell the XCode debugger to only stop at breakpoints? (and not at excepti

编程入门 行业动态 更新时间:2024-10-11 05:23:11
如何告诉XCode调试器只在断点处停止?(How to tell the XCode debugger to only stop at breakpoints? (and not at exceptions))

我正在为一个闭源应用程序编写第三方插件。 我遇到了XCode调试器的问题。

我想使用调试器来逐步完成我正在编写的插件的代码。 为此,我在代码中设置了一个断点,我已经启动了主机应用程序,然后我将XCode调试器附加到主机应用程序的进程中。 我的问题是,调试器不是停在我的断点处,而是停止在程序的另一部分引发的异常。 (具体来说,这个: Thread 2: EXC_ARITHMETIC (code=EXC_i386_DIV, subcode=0x0) )

这种异常经常被抛出,因此它实际上无法逐步完成我真正感兴趣的代码。

我无法捕获并处理此异常,因为我没有引发它的应用程序部分的源代码。

在这种情况下,有人可以建议我如何能够调试我的代码吗? 有没有办法告诉XCode调试器简单地“忽略”这个特定的EXC_ARITHMETIC异常,而是只停留在我明确设置的断点上?

UPDATE

@ user1118321建议使用断点窗格关闭异常断点。 我尝试使用此处显示的设置执行此操作。

我认为选择“评估后自动继续”可能会使调试器停止运行。 它没有。

我也尝试在停止后向调试器发出cont 。 这似乎也不起作用。

任何人都可以告诉我我应该在这里输入什么设置以防止调试器停止在我的EXC_ARITHMETIC异常上?

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.

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.

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

最满意答案

这是一个整数“除以零”错误异常。 据我所知,它们不会作为C ++异常传播,这就是为什么你不能打破它们。

即使您的插件未加载,是否会发生这种情况? 如果没有,你的插件会以某种方式导致除零。

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.

更多推荐

本文发布于:2023-07-27 15:22:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1292365.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:断点   只在   调试器   XCode   exceptions

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!