Search code examples
objective-cxcodedebugginglldb

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.


Solution

  • 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.