From 09c22a5f544c87bffcb5c68f0965201ae1d29044 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Fri, 8 Sep 2023 22:55:41 +0200 Subject: gdb: add watch -l in watchpoint example --- src/tools/gdb.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/tools/gdb.md') diff --git a/src/tools/gdb.md b/src/tools/gdb.md index 126795e..c8c04df 100644 --- a/src/tools/gdb.md +++ b/src/tools/gdb.md @@ -401,10 +401,16 @@ which its expression is valid. main () at test.c:10 10 set(&s, 2); +# Define the watchpoint on the location of the object to watch. + +(gdb) watch -l s->v + +# This is equivalent to the following. + (gdb) p &s->v $1 = (int *) 0x7fffffffe594 -# Define a watchpoint o the address of the member variable of the s instance. +# Define a watchpoint to 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 -- cgit v1.2.3