Unable to set guard point in Gdb or lldb

advertisements

I am trying to set a watchpoint while debugging my app on the device. I am unable to set it on either gdb or lldb.

On lldb, I don't see the watchpoint set option in the debugger even though this page mentioned that it exists. When I try to run watchpoint set, lldb tells me that the command is not valid.

On gdb, I do get to set the watchpoint (using watch var), but when I try to continue execution I get this:

Can't set hardware watchpoints without the 'Z2' (write-watchpoint) packet.

I see no further output in the gdb window nor do I think I can interact with it. The app also remains hung at this point.

I am using Xcode 4.3.2 (4E2002) on OS X Lion. I tried setting the watchpoint on devices with iOS 5.1 and iOS 5.0.1 but encounter the same problem on both.


Before Xcode 4.5, watchpoints were not supported for iOS development with either lldb or gdb.

With Xcode 4.5, they are supported for iOS and Mac OS X debugging with lldb.

In Xcode, in the locals window, you can right-click/control-click on a variable and there will be an option to set a watchpoint on it. From the debugger console, to add a watchpoint on a variable called foo, you can do

(lldb) watchpoint set variable foo

the shortest unambiguous command is always valid in lldb so this would do the same thing,

(lldb) w s v foo

The current x86 and arm cpus only support 4 watchpoints being set simultaneously.