调试另一个选择器,而使用lldb单步执行Xcode [英] Debug another selector while single stepping in Xcode using lldb

查看:189
本文介绍了调试另一个选择器,而使用lldb单步执行Xcode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码停在(lldb)提示符处的断点处。我可以发送消息对象并将其值显示在控制台上。

 (lldb)p [self computePI] 
浮点数)$ 1 = 3.0

哇!这时出错了我希望能够进入computePI作为一个捷径,以确定哪些变量被弄乱了。但是,如果我在该选择器上放置了一个断点,然后再次尝试:

 (lldb)p [self computePI] 
错误:执行中断,原因:断点5.1。
执行之前,进程已返回到状态。

在这一点上我可以以某种方式进入computePI,这将是一个实时的保护。这是可能吗?我一直在看 http://lldb.llvm.org ,并没有看到任何东西。感谢您的帮助。



更新:根据Jason Molenda的回答,我使用以下便利的别名更新了我的〜/ .lldbinit文件: p>

 命令别名nup expr -u 0  -  
命令别名nupo expr -u 0 -o -
这可以让我使用nup(代替p)和nupo(代替po)。

解决方案

p 命令真的是一个 expr - expr 的选项之一是 -u - 解除错误 - 在这种情况下,断点被视为一个错误(它可能被认为是一个错误 - 本身就是有争议的,有一些使用情况,它不会直观地表现为这样的行为。 )



无论如何,您应该可以执行

 (lldb )expr -u false  -  [self computePI] 

,它将在断点处停止。 - 这里指向 expr ,它应该停止执行选项分析,之后的所有内容都是要评估的表达式。


I am in my code stopped at a breakpoint at the (lldb) prompt. I can message objects and get their value printed on the console.

(lldb) p [self computePI]
(float) $1 = 3.0

Whoa! Something is wrong at this point. I would like to be able to step into computePI as a shortcut to figuring out which variables are messed up. However, if I put a breakpoint on that selector and try again I get:

(lldb) p [self computePI]
error: Execution was interrupted, reason: breakpoint 5.1.
The process has been returned to the state before execution.

It would be a real time saver if I could somehow step into computePI at this point. Is this possible or not? I have been looking at http://lldb.llvm.org and haven't seen anything. Thanks for your help.

UPDATE: Based on Jason Molenda's answer I updated my ~/.lldbinit file with the following handy aliases:

command alias nup expr -u 0 -- 
command alias nupo expr -u 0 -o --

That lets me use nup (in place of p) and nupo (in place of po).

解决方案

The p command is really an alias to expr --. One of the options to expr is -u or --unwind-on-error -- in this case a breakpoint is treated as an "error" (which might be considered a bug in and of itself - it's debatable, there are use cases where it would be nonintuitive for this to behave differently.)

Anyway, you should be able to do

(lldb) expr -u false -- [self computePI]

and it will stop at the breakpoint. The -- here indicates to expr that it should stop doing option parsing and everything after that is an expression to evaluate.

这篇关于调试另一个选择器,而使用lldb单步执行Xcode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆