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:
invalid command 'watchpoint set'
What is LLDB? A low-level debugger (LLDB) is the default debugger used in Xcode and is part of the LLVM project. LLDB replaced GDB in XCode 5 and has several advantages, such as performance and scriptability.
Xcode uses the LLDB as the default debugging tool. The full form of LLDB is Low-level debugger. Breakpoints help a developer to stop the execution of the program at any point. Stopping the execution of the program at any point helps to know the current state of that program and its properties.
In lldb you can set breakpoints by typing either break or b followed by information on where you want the program to pause. After the b command, you can put either: a function name (e.g., b my_subroutine ) a line number (e.g., b 12 )
LLDB is the default debugger in Xcode and supports debugging Objective-C on iOS devices and the iOS simulator.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With