public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28412] New: syscall that writes memory does not trigger hardware watchpoint.
@ 2021-10-02 19:16 yyc1992 at gmail dot com
  2021-10-09 11:25 ` [Bug gdb/28412] " ssbssa at sourceware dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: yyc1992 at gmail dot com @ 2021-10-02 19:16 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28412
           Summary: syscall that writes memory does not trigger hardware
                    watchpoint.
           Product: gdb
           Version: 11.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: yyc1992 at gmail dot com
  Target Milestone: ---

Debugging the following program (on x64). (Compile with -O0 -ggdb3 to make it
easy to set a watch at the beginning).

```
#include <unistd.h>
#include <stdio.h>

int main()
{
    char c = 0;
    printf("%d\n", c);
    read(0, &c, 1);
    printf("%d\n", c);

    return 0;
}
```

When a watchpoint is set on `c` with `watch -l c` or `watch c`, the value is
changed by `read` without triggering the watch point. Turning off hardware
watchpoint fixes the issue. Seems that when hardware watch point is used,
checks needs to be added around syscalls to see if they modify memory?

(Initially noticed from `ptrace` but it seems that other syscalls have the same
problem.) I didn't find any document saying syscall modifying memory needs to
be watched differently and since it works without hardware watchpoint I assume
this is a bug.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-06 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 19:16 [Bug gdb/28412] New: syscall that writes memory does not trigger hardware watchpoint yyc1992 at gmail dot com
2021-10-09 11:25 ` [Bug gdb/28412] " ssbssa at sourceware dot org
2021-10-09 17:26 ` simark at simark dot ca
2022-03-06 17:15 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).