From 2dfbc312e6ccb88f838170d8e777d48aacde2ff5 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 13 Nov 2022 14:13:35 +0000 Subject: deploy: 026d679006e5d470bacdc74bb3082072edf31e36 --- tools/awk.html | 2 +- tools/bash.html | 2 +- tools/dot.html | 2 +- tools/emacs.html | 2 +- tools/fish.html | 2 +- tools/gdb.html | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++- tools/gdbserver.html | 2 +- tools/git.html | 2 +- tools/gpg.html | 2 +- tools/index.html | 2 +- tools/pacman.html | 2 +- tools/qemu.html | 2 +- tools/radare2.html | 2 +- tools/tmux.html | 2 +- tools/zsh.html | 2 +- 15 files changed, 84 insertions(+), 15 deletions(-) (limited to 'tools') diff --git a/tools/awk.html b/tools/awk.html index 3234d89..45dec34 100644 --- a/tools/awk.html +++ b/tools/awk.html @@ -75,7 +75,7 @@ diff --git a/tools/bash.html b/tools/bash.html index 84ae3ad..106738b 100644 --- a/tools/bash.html +++ b/tools/bash.html @@ -75,7 +75,7 @@ diff --git a/tools/dot.html b/tools/dot.html index a8cb545..097f337 100644 --- a/tools/dot.html +++ b/tools/dot.html @@ -75,7 +75,7 @@ diff --git a/tools/emacs.html b/tools/emacs.html index b3b556e..8ac5fb8 100644 --- a/tools/emacs.html +++ b/tools/emacs.html @@ -75,7 +75,7 @@ diff --git a/tools/fish.html b/tools/fish.html index ebf52aa..0b0ad4e 100644 --- a/tools/fish.html +++ b/tools/fish.html @@ -75,7 +75,7 @@ diff --git a/tools/gdb.html b/tools/gdb.html index 4880602..7071a0b 100644 --- a/tools/gdb.html +++ b/tools/gdb.html @@ -75,7 +75,7 @@ @@ -373,6 +373,75 @@ define hook-quit break-save quit end +

Watchpoint on struct / class member

+

A symbolic watchpoint defined on a member variable for debugging is only valid +as long as the expression is in scope. Once out of scope the watchpoint gets +deleted.

+

When debugging some memory corruption we want to keep the watchpoint even the +expression goes out of scope to find the location that overrides the variable +and introduces the corruption.

+
(gdb) l
+1  struct S { int v; };
+2
+3  void set(struct S* s, int v) {
+4      s->v = v;
+5  }
+6
+7  int main() {
+8      struct S s;
+9      set(&s, 1);
+10     set(&s, 2);
+11     set(&s, 3);
+...
+
+(gdb) s
+set (s=0x7fffffffe594, v=1) at test.c:4
+4    s->v = v;
+
+# Define a new watchpoint on the member of the struct. The expression however
+# is only valid in the current functions scope.
+
+(gdb) watch s->v
+Hardware watchpoint 2: s->v
+
+(gdb) c
+Hardware watchpoint 2: s->v
+Old value = 0
+New value = 1
+set (s=0x7fffffffe594, v=1) at test.c:5
+5   }
+
+# The watchpoint gets deleted as soon as we leave the function scope.
+
+(gdb) c
+Watchpoint 2 deleted because the program has left the block in
+which its expression is valid.
+main () at test.c:10
+10      set(&s, 2);
+
+(gdb) p &s->v
+$1 = (int *) 0x7fffffffe594
+
+# Define a watchpoint o the address of the member variable of the s instance.
+# This of course only makes sense as long as the s instance is not moved in memory.
+
+(gdb) watch *0x7fffffffe594
+Hardware watchpoint 3: *0x7fffffffe594
+
+(gdb) c
+Hardware watchpoint 3: *0x7fffffffe594
+Old value = 1
+New value = 2
+set (s=0x7fffffffe594, v=2) at test.c:5
+5   }
+
+(gdb) c
+Hardware watchpoint 3: *0x7fffffffe594
+Old value = 2
+New value = 3
+set (s=0x7fffffffe594, v=3) at test.c:5
+5   }
+

Know Bugs

Workaround command + finish bug

When using finish inside a command block, commands after finish are not diff --git a/tools/gdbserver.html b/tools/gdbserver.html index 6cbb806..716afea 100644 --- a/tools/gdbserver.html +++ b/tools/gdbserver.html @@ -75,7 +75,7 @@

diff --git a/tools/git.html b/tools/git.html index c029cce..1d082b6 100644 --- a/tools/git.html +++ b/tools/git.html @@ -75,7 +75,7 @@ diff --git a/tools/gpg.html b/tools/gpg.html index bb4d2fc..87cf955 100644 --- a/tools/gpg.html +++ b/tools/gpg.html @@ -75,7 +75,7 @@ diff --git a/tools/index.html b/tools/index.html index bb47b18..7d51167 100644 --- a/tools/index.html +++ b/tools/index.html @@ -75,7 +75,7 @@ diff --git a/tools/pacman.html b/tools/pacman.html index 92037fc..3af6f21 100644 --- a/tools/pacman.html +++ b/tools/pacman.html @@ -75,7 +75,7 @@ diff --git a/tools/qemu.html b/tools/qemu.html index a7fbf03..73c3647 100644 --- a/tools/qemu.html +++ b/tools/qemu.html @@ -75,7 +75,7 @@ diff --git a/tools/radare2.html b/tools/radare2.html index 0c88832..2b27487 100644 --- a/tools/radare2.html +++ b/tools/radare2.html @@ -75,7 +75,7 @@ diff --git a/tools/tmux.html b/tools/tmux.html index 7dce9f0..cdff34b 100644 --- a/tools/tmux.html +++ b/tools/tmux.html @@ -75,7 +75,7 @@ diff --git a/tools/zsh.html b/tools/zsh.html index db27105..41fa2ed 100644 --- a/tools/zsh.html +++ b/tools/zsh.html @@ -75,7 +75,7 @@ -- cgit v1.2.3