How do I set a watchpoint?
How do I set a watchpoint?
- Subject: How do I set a watchpoint?
- From: Jens Alfke <email@hidden>
- Date: Sat, 23 May 2015 12:37:27 -0700
I’m going nuts trying to debug a crash in which an object gets dealloced prematurely (but enabling zombies doesn’t help, i.e. the object is freed regardless, not turned into a zombie.) I’m trying to set a watchpoint on the object’s memory to see what’s freeing it, but I can’t figure out how to do it.
Part of the problem is the object never appears as a named variable, only in a register (it’s a temporary string created by the runtime function swift_convertStringToNSString, apparently.) At the breakpoint I’m at, the object is pointed to by register rax, whose value I can see in the debugger inspector pane. (This is a 64-bit Mac process, btw.) But trying to use $rax from lldb doesn’t work when I’m in a Swift stack frame:
(lldb) x $rax
error: invalid start address expression.
error: address expression "$rax" evaluation failed
(lldb) x rax
error: invalid start address expression.
error: address expression "rax" evaluation failed
(lldb) watch set expression rax
error: expression evaluation of address to watch failed
expression evaluated: rax
(lldb) watch set expression $rax
error: expression evaluation of address to watch failed
expression evaluated: $rax
Fine, whatever, I can read the hex value from the inspector pane and type it into lldb by hand :-p. But even giving the raw address doesn’t work!
(lldb) watch set expression 0x60800b3bdfd0
error: expression did not evaluate to an address
I’ve tried taking out the “0x”, parenthesizing, putting “(void*)” in front … no dice.
(Oh, the handy “Watch” context menu item doesn’t work either. If I right-click the “rax” register in the inspector and choose “Watch”, I get an error alert saying "error: no variable named 'rax' found in this frame”. ARGH.)
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden