From: "Denio, Mike" <miked@ti.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Confused by watchpoints on remote protocol
Date: Sat, 6 Aug 2022 20:42:55 +0000 [thread overview]
Message-ID: <c85ff35ee751477f8a61fb7e9f4ccdd6@ti.com> (raw)
In GDB 11.2 for RISCV, I am trying to support hardware watchpoints. I think I'm close, but I have 2 questions:
1. I noticed that whether or not GDB will even attempt to use a hardware watch point depends on the how the command it entered. For example:
(gdb) watch *(uint32_t *)(0x80000018)
Hardware watchpoint 1: *(uint32_t *)(0x80000018)
(gdb) watch (uint32_t)ram_table
Watchpoint 2: (uint32_t)ram_table
(gdb) i b
Num Type Disp Enb Address What
1 hw watchpoint keep y *(uint32_t *)(0x80000018)
2 watchpoint keep y (uint32_t)ram_table
When I enter is as "watch *(uint32_t *)(0x80000018)", a hardware watchpoint is used, but when I enter it as
"watch (uint32_t)ram_table", a soft watchpoint is used.
I don't understand this. How can I tell GDB to always use a hardware watchpoint?
Also, FYI, the order doesn't matter (it's not as if GDB assumes only 1 hardware watchpoint). Below we see GDB immediately uses a software watchpoint:
(gdb) watch (uint32_t)ram_table
Watchpoint 1: (uint32_t)ram_table
(gdb) watch *(uint32_t *)(0x80000018)
Hardware watchpoint 2: *(uint32_t *)(0x80000018)
(gdb) i b
Num Type Disp Enb Address What
1 watchpoint keep y (uint32_t)ram_table
2 hw watchpoint keep y *(uint32_t *)(0x80000018)
Now that I think about it, how do I tell GDB how many hardware watchpoints I support?
2. Also a second related question. I noticed that unlike breakpoints, GDB will not remove, single step past, and then replace hardware watchpoints. Is it always assumed that hardware watchpoints break AFTER the operation in question? It makes sense to break after the operation for writes since the user wants to watch a value change, but it wasn't obvious to me for read and access watchpoints. Should all of them break on the following instruction?
Thanks in advance for any help. Please keep my e-mail on the reply as I am not subscribed.
Mike
next reply other threads:[~2022-08-06 20:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-06 20:42 Denio, Mike [this message]
2022-08-07 6:25 ` Denio, Mike
2022-08-07 7:23 ` Andreas Schwab
2022-08-07 7:34 ` [EXTERNAL] " Denio, Mike
2022-08-07 14:43 ` Denio, Mike
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=c85ff35ee751477f8a61fb7e9f4ccdd6@ti.com \
--to=miked@ti.com \
--cc=gdb@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: link
Be 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).