12

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

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.

I have defined the breakpoint as follows:

enter image description here

I'm using the LLDB debugger with Xcode 4.2

5 Answers 5

12

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.

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.

9

I was looking for the same answer (symbolic breakpoints) and this link helped: http://www.cocoabuilder.com/archive/cocoa/308967-symbolic-breakpoints.html#308970

You have to follow this pattern (it is also given as a placeholder in Xcode breakpoint editor):

- [name_of_the_class name_of_the_method:]

For example I was looking to see who does set my left bar item and overrides my settings, I used -[UINavigationItem setLeftBarButtonItem:]

and it worked. Or this one

-[UINavigationController pushViewController:animated:]

6

I would set an Symbolic breakpoint with this symbol -[NSObject doesNotRecognizeSelector:] enter image description here

which will help us to capture situations where a selector is being invoked against the wrong object.

3

It looks to me like symbolic breakpoints don't work right in LLDB (I'm running the most recent released version of Xcode as of this writing, 4.3.3).

I set a symbolic breakpoint at addAnimation:forKey: in LLDB, and it never gets hit. If I switch my project to GDB, the breakpoint works as expected.

-2

Best way to find unrecognized selector call is to create this selector (as category) and put a break point in it.

1
  • Not an answer. Improve with more detail and a working example. Sep 18, 2020 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.