Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get parameters using symbolic breakpoints in Objective-C

I have a breakpoint that looks like this

-[UITableViewCell setSelected:] 

and it works, but I cannot figure out how to get the value that is being passed in.

I have tried -[UITableViewCell setSelected:(BOOL)what] and -[UITableViewCell setSelected:what] which do not work at all.

How can I access the parameters?

If this doesn't work, I'll have to make a DebugUITableViewCell just to see what's going on, which is a hassle and touches a lot of code.

like image 493
Dan Rosenstark Avatar asked Mar 20 '13 00:03

Dan Rosenstark


People also ask

How do you use a symbolic breakpoint?

To do that, use a symbolic breakpoint. In the Breakpoint navigator, click the Add button (+) in the lower-left corner, and choose Symbolic Breakpoint. Enter the object and symbol in the Symbol field, using the format of the example text. The debugger pauses when the app or your code calls the symbol you specify.

What is symbolic breakpoint?

Symbolic breakpoints are breakpoints that will trigger on certain conditions, like any time a certain method is called on a class. Adding a symbolic breakpoint is achieved by clicking the “+” icon at the lower left of the Breakpoint Navigator and selecting “Symbolic Breakpoint”.

How do breakpoints work in Xcode?

What are breakpoints in Xcode? A breakpoint can be placed at a certain line of code and pauses your app during execution in order to inspect the state of your app at that point. Breakpoints can be set at any time, before and while your app is running.

How do I debug in Xcode?

When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.


1 Answers

If you debug your code on the device the parameters when you hit your breakpoint will consistently be in registers r0, r1, and r2. If you use po $r0 you'll see the object receiving setSelected. If you use po $r1 you'll get "no Objective-C description available" because that's the selector. Inspect $r2 to see if selected is being set to YES or NO. It's a similar story on i386, but I can't remember off hand which registers are used.

like image 177
Aaron Golden Avatar answered Sep 23 '22 06:09

Aaron Golden