Xcode LLDB watchpoints

前端 未结 2 1676
迷失自我
迷失自我 2020-12-30 00:09

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

相关标签:
2条回答
  • 2020-12-30 00:37

    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.

    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.

    0 讨论(0)
  • 2020-12-30 00:38

    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

    (lldb) watchpoint set variable foo
    

    you can always use the shortest unambiguous name for commands in the lldb console so

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

    The current arm and x86 cpus only support 4 watchpoints being active at the same time.

    0 讨论(0)
提交回复
热议问题