在Xcode中的选择器上添加符号断点

在Xcode中的选择器上添加符号断点

问题描述:

我的应用程序中存在一个错误,其中显示了以下(部分)堆栈跟踪:

There's a bug in my app which shows up with the following (partial) stacktrace:

2011-11-25 01:55:59.760 Events2[6650:403] -[Event boolValue]: unrecognized selector sent to instance 0x7fb903928670

要对此进行调试,我决定在-[Event boolValue]上添加一个符号断点,理由是当发送该选择器时,调试器将停止.

To debug this I decided to add a symbolic breakpoint on -[Event boolValue] reasoning that when that selector is sent, the debugger would halt.

但是,什么也没有发生.设置断点后,应用程序将立即启动并生成相同的异常而不会停止.

However, nothing happens. After setting the breakpoint the app just soldiers on and generates the same exception without halting.

我对断点的定义如下:

我在Xcode 4.2中使用LLDB调试器

I'm using the LLDB debugger with Xcode 4.2

在选择器上设置断点将导致lldb在执行该选择器时(而不是在发送该选择器时)停止.在您的情况下,没有选择器-[Event boolValue]",因此永远不会命中该断点.

Setting a breakpoint on a selector causes lldb to halt when that selector is executed, not when it is sent. In your case, there is no selector "-[Event boolValue]", therefore this breakpoint will never be hit.

我将在所有Objective-C异常"上设置一个异常断点.当抛出无法识别的选择器已发送"异常时,将点击此链接,您可以看到问题发生的位置.

I would set an exception breakpoint on "All Objective-C Exceptions". This will be hit when the "unrecognized selector sent" exception is thrown and you can see where the problem occurs.