如何使用Objective-C中的符号断点获取参数 [英] 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.
我尝试过 - [UITableViewCell setSelected:(BOOL)what]
和 - [UITableViewCell setSelected:what]
哪些不起作用。
I have tried -[UITableViewCell setSelected:(BOOL)what]
and -[UITableViewCell setSelected:what]
which do not work at all.
如何访问参数?
如果这不起作用,我将不得不制作一个 DebugUITableViewCell
,只是为了看看发生了什么,这是一个麻烦,并且触及了很多代码。 / p>
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.
推荐答案
如果您在设备上调试代码,当您点击断点时,参数将始终位于寄存器r0,r1和r2中。如果您使用 po $ r0
,您将看到接收setSelected的对象。如果您使用 po $ r1
,您将获得没有Objective-C描述可用,因为这是选择器。检查$ r2以查看选择是否设置为YES或NO。这是一个类似于i386的故事,但是我记不起手中使用了哪些寄存器。
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.
这篇关于如何使用Objective-C中的符号断点获取参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!