Add symbolic breakpoint to selector in Xcode

There is an error in my application that appears 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 in the [Event boolValue] argument that when this selector is sent, the debugger will stop.

However, nothing happens. After setting a breakpoint, the application simply drives and throws the same exception without stopping.

I defined a breakpoint as follows:

enter image description here

I am using LLDB debugger with Xcode 4.2

+6
source share
5 answers

Setting a breakpoint on the selector causes lldb to stop when this selector is executed, and not when it is sent. In your case, there is no selector "- [boolValue event]", so this breakpoint will never be deleted.

I would set the exception breakpoint to “All Objective-C Exceptions”. This will be removed when the “unrecognized selector sent” exception is sent and you will see where the problem occurred.

+7
source

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 should follow this pattern (it is also specified as a placeholder in the Xcode interrupt editor):

 - [name_of_the_class name_of_the_method:] 

For example, I looked who installed my item in the left pane and overrides my settings, I used -[UINavigationItem setLeftBarButtonItem:]

and it worked. Or this one

-[UINavigationController pushViewController:animated:]

+3
source

It seems to me that symbolic breakpoints do not work in LLDB (I am using the latest released version of Xcode at the time of this writing, 4.3.3).

I set a symbolic breakpoint in addAnimation: forKey: in LLDB and it never hits. If I switch my project to GDB, the breakpoint will work as expected.

+2
source

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

which will help us capture situations where the selector is called against the wrong object.

+2
source

The best way to find an unrecognized selector call is to create this selector (as a category) and place a breakpoint in it.

-2
source

Source: https://habr.com/ru/post/902353/


All Articles