public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "alexey.lapshin at espressif dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug breakpoints/30233] New: Hardware watchpoint works as software Date: Wed, 15 Mar 2023 07:02:35 +0000 [thread overview] Message-ID: <bug-30233-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=30233 Bug ID: 30233 Summary: Hardware watchpoint works as software Product: gdb Version: 13.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: breakpoints Assignee: unassigned at sourceware dot org Reporter: alexey.lapshin at espressif dot com Target Milestone: --- Test code: ``` // file: test.c static volatile int var = 0; void main() { while(1) { var++; } } ``` Build command: gcc -Og -g test.c If execute gdb and set watchpoint to var I get this: ``` Reading symbols from a.out... (gdb) watch var Hardware watchpoint 1: var (gdb) run Starting program: /home/alex/a.out [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Hardware watchpoint 1: var Old value = 0 New value = 1 main () at hello_world_main.c:4 4 while(1) { (gdb) x/i $pc => 0x401115 <main+15>: jmp 0x401106 <main> (gdb) ``` GDB pointed to a wrong instruction and as a result to the wrong line. From the documentation (https://sourceware.org/gdb/download/onlinedocs/gdb/Set-Watchpoints.html): ``` Hardware watchpoints execute very quickly, and the debugger reports a change in value at the exact instruction where the change occurs. software watchpoint, which executes more slowly and reports the change in value at the next statement, not the instruction, after the change occurs. ``` - why gdb does not stop on the variable change instruction? - how make sure that was set exactly hardware watchpoint (not software)? Also, I did not find any related testcase in gdb tests... Tested with gdb 12.2 and 13.1 (Ubuntu distributives) -- You are receiving this mail because: You are on the CC list for the bug.
reply other threads:[~2023-03-15 7:02 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-30233-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).