Xcode LLDB 观察点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11199421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode LLDB watchpoints
提问by the Reverend
Is there any way to watch a variable in Xcode using LLDB ? Or is this only possible with GDB ?
I'm trying to use the command watchpoint set variable
but I get the message:
有什么方法可以使用 LLDB 在 Xcode 中观察变量吗?或者这只能通过 GDB 实现?我正在尝试使用该命令,watchpoint set variable
但收到以下消息:
invalid command 'watchpoint set'
无效的命令“观察点集”
回答by Jason Molenda
Watchpoints are supported for iOS and Mac OS X debugging as of Xcode 4.5. To set a breakpoint on a variable named foo
, do
从 Xcode 4.5 开始,iOS 和 Mac OS X 调试支持观察点。要在名为 的变量上设置断点foo
,请执行
(lldb) watchpoint set variable foo
you can always use the shortest unambiguous name for commands in the lldb console so
您始终可以在 lldb 控制台中为命令使用最短的明确名称
(lldb) w s v foo
would also work here.
也会在这里工作。
In Xcode, in the locals window you can right-click/control-click on variables and you'll have an option to set a watchpoint on it.
在 Xcode 中,在 locals 窗口中,您可以右键单击/控制单击变量,您将可以选择在其上设置观察点。
The current arm and x86 cpus only support 4 watchpoints being active at the same time.
当前 arm 和 x86 cpu 仅支持 4 个观察点同时处于活动状态。
回答by leecbaker
Try using
尝试使用
frame variable -w
instead. The 'watchpoint set' command is in lldb's development branch, and will likely make it in to a future version of Xcode.
反而。'watchpoint set' 命令位于 lldb 的开发分支中,很可能会出现在 Xcode 的未来版本中。
For example:
例如:
frame variable -w write myvar
EDIT: The watch set variable
syntax mentioned in the original post is now supported in lldb in XCode 4.4 and greater.
编辑:watch set variable
XCode 4.4 及更高版本的 lldb 现在支持原始帖子中提到的语法。