[Bug breakpoints/27423] Watchpoint could be hw but is sw

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Mon Feb 15 18:51:01 GMT 2021


https://sourceware.org/bugzilla/show_bug.cgi?id=27423

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
WORKAROUND: Flip the watch expression to "0 == *(int *)0x602260", and you have
a hw watchpoint instead:
...
$ gdb -iex "set trace-commands on" -batch a.out -ex "b 18" -ex run -ex "watch 0
== *(int *)0x602260" -ex cont -ex "info break"     
+b 18
Breakpoint 1 at 0x4005ad: file test.c, line 18.
+run

Breakpoint 1, main () at test.c:18
18        int *ap = malloc (sizeof(int));
+watch 0 == *(int *)0x602260
Hardware watchpoint 2: 0 == *(int *)0x602260
+cont

Hardware watchpoint 2: 0 == *(int *)0x602260

Old value = <unreadable>
New value = 0
main () at test.c:20
20        printf ("%p\n", ap);
+info break
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x00000000004005ad in main at test.c:18
        breakpoint already hit 1 time
2       hw watchpoint  keep y                      0 == *(int *)0x602260
        breakpoint already hit 1 time
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list