Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: gdb: hardware watchpoints not working



In article <ZtBu-aGn8H_ZWHfr%exadelic.gatalith.at@localhost>,
Thomas Klausner  <wiz%NetBSD.org@localhost> wrote:
>Hi!
>
>I just tried in gdb to watch a memory location.
>
>(gdb) watch *0x78f2d98cd040
>Hardware watchpoint 6: *0x78f2d98cd040
>(gdb) c
>Continuing.
>Couldn't write debug registers: Operation not permitted.
>Command aborted.
>(gdb)
>
>Watching an expression worked
>(gdb) watch tws->dirs[0]->name
>Watchpoint 5: tws->dirs[0]->name
>...
>but doesn't work for my use case because
>
>Watchpoint 5 deleted because the program has left the block in
>which its expression is valid.
>
>and I think the variable is changed outside somehow.
>
>That's on gdb 15.1, NetBSD 10.99.12/amd64/20240827.
>
>Is this expected to work?
>Is this a PAX issue and I need to disable (some of) it?

Works as root...

(gdb) watch x
Hardware watchpoint 2: x
(gdb) c
Continuing.

Hardware watchpoint 2: x

Old value = 0
New value = 1
main () at sleep.c:11
11                      sleep(1);
(gdb) c
Continuing.

Breakpoint 1, main () at sleep.c:10
10                      x++;
(gdb) c
Continuing.

Hardware watchpoint 2: x

Old value = 1
New value = 2
main () at sleep.c:11
11                      sleep(1);
(gdb) q
A debugging session is active.


christos



Home | Main Index | Thread Index | Old Index