From: Valery Khromov <valery.khromov@gmail.com>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <alves.ped@gmail.com>,
Mark Kettenis <mark.kettenis@xs4all.nl>,
Valery Khromov <valery.khromov@gmail.com>
Subject: [PATCH 1/2] FreeBSD/amd64: Updates for the recent changes that Pedro Alves made.
Date: Tue, 20 Dec 2011 17:53:00 -0000 [thread overview]
Message-ID: <1324403515-11898-1-git-send-email-valery.khromov@gmail.com> (raw)
In-Reply-To: <ED59EC2B-8A8A-4A79-8275-ABF6ABDB8E13@gmail.com>
2011-12-20 Valery Khromov <valery.khromov@gmail.com>
* amd64bsd-nat.c (amd64bsd_dr_get): New.
(amd64bsd_dr_reset_addr): Delete.
(amd64bsd_dr_get_addr): New.
(amd64bsd_dr_get_status): Use amd64bsd_dr_get.
(amd64bsd_dr_get_control): New.
* amd64bsd-nat.h (amd64bsd_dr_reset_addr): Delete.
(amd64bsd_dr_get_addr): New.
(amd64bsd_dr_get_control): New.
* amd64fbsd-nat.c (_initialize_amd64fbsd_nat): No longer install
i386_dr_low.reset_addr and i386_dr_low.unset_status. Install
amd64bsd_dr_get_control as i386_dr_low.get_control. Install
amd64bsd_dr_get_addr as i386_dr_low.get_addr.
---
gdb/amd64bsd-nat.c | 41 +++++++++++++++++++++--------------------
gdb/amd64bsd-nat.h | 4 +++-
gdb/amd64fbsd-nat.c | 3 ++-
3 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/gdb/amd64bsd-nat.c b/gdb/amd64bsd-nat.c
index 8b2f678..b31002f 100644
--- a/gdb/amd64bsd-nat.c
+++ b/gdb/amd64bsd-nat.c
@@ -138,6 +138,18 @@ amd64bsd_target (void)
#define DBREG_DRX(d, x) ((&d->dr0)[x])
#endif
+static unsigned long
+amd64bsd_dr_get (ptid_t ptid, int regnum)
+{
+ struct dbreg dbregs;
+
+ if (ptrace (PT_GETDBREGS, PIDGET (inferior_ptid),
+ (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
+ perror_with_name (_("Couldn't read debug registers"));
+
+ return DBREG_DRX ((&dbregs), regnum);
+}
+
static void
amd64bsd_dr_set (int regnum, unsigned long value)
{
@@ -173,33 +185,22 @@ amd64bsd_dr_set_addr (int regnum, CORE_ADDR addr)
amd64bsd_dr_set (regnum, addr);
}
-void
-amd64bsd_dr_reset_addr (int regnum)
+CORE_ADDR
+amd64bsd_dr_get_addr (int regnum)
{
- gdb_assert (regnum >= 0 && regnum <= 4);
-
- amd64bsd_dr_set (regnum, 0);
+ return amd64bsd_dr_get (inferior_ptid, regnum);
}
unsigned long
amd64bsd_dr_get_status (void)
{
- struct dbreg dbregs;
-
- /* FIXME: kettenis/2001-03-31: Calling perror_with_name if the
- ptrace call fails breaks debugging remote targets. The correct
- way to fix this is to add the hardware breakpoint and watchpoint
- stuff to the target vector. For now, just return zero if the
- ptrace call fails. */
- if (ptrace (PT_GETDBREGS, PIDGET (inferior_ptid),
- (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
-#if 0
- perror_with_name (_("Couldn't read debug registers"));
-#else
- return 0;
-#endif
+ return amd64bsd_dr_get (inferior_ptid, 6);
+}
- return DBREG_DRX ((&dbregs), 6);
+unsigned long
+amd64bsd_dr_get_control (void)
+{
+ return amd64bsd_dr_get (inferior_ptid, 7);
}
#endif /* PT_GETDBREGS */
diff --git a/gdb/amd64bsd-nat.h b/gdb/amd64bsd-nat.h
index 0048f54..25eb8d4 100644
--- a/gdb/amd64bsd-nat.h
+++ b/gdb/amd64bsd-nat.h
@@ -28,8 +28,10 @@ extern void amd64bsd_dr_set_control (unsigned long control);
extern void amd64bsd_dr_set_addr (int regnum, CORE_ADDR addr);
-extern void amd64bsd_dr_reset_addr (int regnum);
+extern CORE_ADDR amd64bsd_dr_get_addr (int regnum);
extern unsigned long amd64bsd_dr_get_status (void);
+extern unsigned long amd64bsd_dr_get_control (void);
+
#endif /* amd64bsd-nat.h */
diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
index 8ffd42b..a0ff739 100644
--- a/gdb/amd64fbsd-nat.c
+++ b/gdb/amd64fbsd-nat.c
@@ -206,8 +206,9 @@ _initialize_amd64fbsd_nat (void)
i386_dr_low.set_control = amd64bsd_dr_set_control;
i386_dr_low.set_addr = amd64bsd_dr_set_addr;
- i386_dr_low.reset_addr = amd64bsd_dr_reset_addr;
+ i386_dr_low.get_addr = amd64bsd_dr_get_addr;
i386_dr_low.get_status = amd64bsd_dr_get_status;
+ i386_dr_low.get_control = amd64bsd_dr_get_control;
i386_set_debug_register_length (8);
#endif /* HAVE_PT_GETDBREGS */
--
WBR,
Valery Khromov
next prev parent reply other threads:[~2011-12-20 17:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 2:41 [PATCH] Fix PR gdb/12953: No hardware watchpoints on FreeBSD amd64 Valery Khromov
2011-12-20 14:52 ` Tom Tromey
2011-12-20 18:30 ` Valery Khromov
2011-12-21 6:45 ` Joel Brobecker
2011-12-20 15:04 ` Mark Kettenis
2011-12-20 16:12 ` Pedro Alves
2011-12-20 17:52 ` Valery Khromov
2011-12-20 17:53 ` Valery Khromov [this message]
2011-12-20 17:56 ` [PATCH 2/2] FreeBSD: Removed definition of DBREG_DRX macro because it is already in FreeBSD Valery Khromov
2011-12-20 19:44 ` [PATCH] Fix PR gdb/12953: No hardware watchpoints on FreeBSD amd64 Mark Kettenis
2011-12-20 20:38 ` [PATCH v2] " Valery Khromov
2012-01-31 17:50 ` Valery Khromov
2012-02-01 20:27 ` Tom Tromey
2012-02-02 9:03 ` Valery Khromov
2012-02-11 18:51 ` Mark Kettenis
2012-02-11 21:03 ` Valery Khromov
2012-02-09 16:10 ` Pedro Alves
2011-12-20 16:05 ` [PATCH] " Pedro Alves
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=1324403515-11898-1-git-send-email-valery.khromov@gmail.com \
--to=valery.khromov@gmail.com \
--cc=alves.ped@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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