Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. Set a watchpoint on a variable when it is written to.
  2. (lldb) watchpoint set variable -w write global_var
  3. (lldb) watch set var -w write global_var
  4. (gdb) watch global_var
  5. Set a watchpoint on a memory location when it is written into. The size of the region to watch for defaults to the pointer size if no '-x byte_size' is specified. This command takes raw input, evaluated as an expression returning an unsigned integer pointing to the start of the region, after the '--' option terminator.
  6. (lldb) watchpoint set expression -w write -- my_ptr
  7. (lldb) watch set exp -w write -- my_ptr
  8. (gdb) watch -location g_char_ptr
  9. Set a condition on a watchpoint.
  10. (lldb) watch set var -w write global
  11. (lldb) watchpoint modify -c '(global==5)'
  12. (lldb) c
  13. ...
  14. (lldb) bt
  15. * thread #1: tid = 0x1c03, 0x0000000100000ef5 a.out`modify + 21 at main.cpp:16, stop reason = watchpoint 1
  16. frame #0: 0x0000000100000ef5 a.out`modify + 21 at main.cpp:16
  17. frame #1: 0x0000000100000eac a.out`main + 108 at main.cpp:25
  18. frame #2: 0x00007fff8ac9c7e1 libdyld.dylib`start + 1
  19. (lldb) frame var global
  20. (int32_t) global = 5
  21. List all watchpoints.
  22. (lldb) watchpoint list
  23. (lldb) watch l
  24. (gdb) info break
  25. Delete a watchpoint.
  26. (lldb) watchpoint delete 1
  27. (lldb) watch del 1
  28. (gdb) delete 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement