Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
851 views
in Technique[技术] by (71.8m points)

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...