Is there any way to make it work under an unprivileged user? Maybe some sysctl settings?
On Fri, Aug 30, 2024 at 12:50 AM Christos Zoulas <chris...@astron.com> wrote: > > In article <ztbu-agn8h_zw...@exadelic.gatalith.at>, > Thomas Klausner <w...@netbsd.org> 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 >