From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Use CORE_ADDR as return type from x86_dr_low_get_addr
Date: Fri, 3 Sep 2021 10:32:19 -0600 [thread overview]
Message-ID: <20210903163219.2590419-1-tromey@adacore.com> (raw)
On a Windows build locally, watchpoints started failing. I tracked
this down to x86_dr_low_get_addr returning an 'unsigned long'... in
this particular build, this is a 32-bit type, but the inferior is a
64-bit program.
This patch fixes the problem by changing the return type. No other
change is really required, because this matches the function pointer
in struct x86_dr_low_type.
However, I found a spot in windows-nat.c that is a bit clearer if it
uses CORE_ADDR as well, so I've also made this change.
---
gdb/nat/x86-dregs.c | 2 +-
gdb/windows-nat.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index cf8e517eb0d..24751647005 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -52,7 +52,7 @@ x86_dr_low_set_addr (struct x86_debug_reg_state *new_state, int i)
/* Return the inferior's debug register REGNUM. */
-static unsigned long
+static CORE_ADDR
x86_dr_low_get_addr (int i)
{
return x86_dr_low.get_addr (i);
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 0c2d55ef67b..b45de3cab7a 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -122,7 +122,7 @@ enum
| CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS \
| CONTEXT_EXTENDED_REGISTERS
-static uintptr_t dr[8];
+static CORE_ADDR dr[8];
static int debug_registers_changed;
static int debug_registers_used;
@@ -3221,7 +3221,7 @@ cygwin_set_dr (int i, CORE_ADDR addr)
static void
cygwin_set_dr7 (unsigned long val)
{
- dr[7] = (CORE_ADDR) val;
+ dr[7] = val;
debug_registers_changed = 1;
debug_registers_used = 1;
}
--
2.31.1
next reply other threads:[~2021-09-03 16:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-03 16:32 Tom Tromey [this message]
2021-09-03 16:43 ` Simon Marchi via Gdb-patches
2021-09-03 16:48 ` Tom Tromey
2021-09-03 17:00 ` Tom Tromey
2021-09-03 17:17 ` Simon Marchi via Gdb-patches
2021-09-03 17:29 ` Tom Tromey
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=20210903163219.2590419-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@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