Omit the "dereference operator" * when setting the watchpoint in lldb, just go to:
watchpoint set expression -- 0x123456
sets the observation point in memory location 0x123456 . You can optionally set the number of bytes to view with --size . Short example:
wse -s 2 -- 0x123456
You can also set a watchpoint for a variable:
watchpoint set variable <variable>
Example: with the following code and breakpoint set on the second line:
int x = 2; x = 5;
I did this in the Xcode debugger console:
(lldb) p & x
(int *) $ 0 = 0xbfffcbd8
(lldb) wse - 0xbfffcbd8
Watchpoint created: Watchpoint 1: addr = 0xbfffcbd8 size = 4 state = enabled type = w
new value: 2
(lldb) n
Watchpoint 1 hit:
old value: 2
new value: 5
(lldb)
Simply put, I could set the observation point using
(lldb) wsvx
Watchpoint created: Watchpoint 1: addr = 0x7fff5fbff7dc size = 4 state = enabled type = w
declare @ '/Users/martin/Documents/tmpprojects/watcher/watcher/main.c:16'
watchpoint spec = 'x'
Martin r
source share