From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 09/13 v2] Linux x86 low-level debug register code synchronization
Date: Thu, 09 Oct 2014 10:44:00 -0000 [thread overview]
Message-ID: <1412848358-9958-10-git-send-email-gbenson@redhat.com> (raw)
In-Reply-To: <1412848358-9958-1-git-send-email-gbenson@redhat.com>
This commit makes several small changes to the low-level debug
register code for Linux x86, making the code in the GDB and
gdbserver implementations identical.
gdb/ChangeLog:
* x86-linux-nat.c (x86_linux_dr_set_addr): Updated assertion.
(x86_linux_new_thread): Renamed argument.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_dr_get): Add assertion.
Use perror_with_name.
(x86_linux_dr_set): Likewise.
---
gdb/ChangeLog | 5 +++++
gdb/gdbserver/ChangeLog | 6 ++++++
gdb/gdbserver/linux-x86-low.c | 6 ++++--
gdb/x86-linux-nat.c | 6 +++---
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index e5257a3..3064791 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -529,13 +529,14 @@ x86_linux_dr_get (ptid_t ptid, int regnum)
int tid;
unsigned long value;
+ gdb_assert (ptid_lwp_p (ptid));
tid = ptid_get_lwp (ptid);
errno = 0;
value = ptrace (PTRACE_PEEKUSER, tid,
offsetof (struct user, u_debugreg[regnum]), 0);
if (errno != 0)
- error ("Couldn't read debug register");
+ perror_with_name (_("Couldn't read debug register"));
return value;
}
@@ -545,13 +546,14 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
{
int tid;
+ gdb_assert (ptid_lwp_p (ptid));
tid = ptid_get_lwp (ptid);
errno = 0;
ptrace (PTRACE_POKEUSER, tid,
offsetof (struct user, u_debugreg[regnum]), value);
if (errno != 0)
- error ("Couldn't write debug register");
+ perror_with_name (_("Couldn't write debug register"));
}
static int
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index c4387eb..c5c8576 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -156,7 +156,7 @@ x86_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ()));
- gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
+ gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR);
iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
}
@@ -213,9 +213,9 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
}
static void
-x86_linux_new_thread (struct lwp_info *lp)
+x86_linux_new_thread (struct lwp_info *lwp)
{
- lwp_set_debug_registers_changed (lp, 1);
+ lwp_set_debug_registers_changed (lwp, 1);
}
\f
--
1.7.1
next prev parent reply other threads:[~2014-10-09 10:44 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-09 9:53 [PATCH 00/13 v2] Refactor low-level Linux x86 debug register code Gary Benson
2014-10-09 9:53 ` [PATCH 01/13 v2] Introduce current_lwp_ptid Gary Benson
2014-10-28 12:56 ` Pedro Alves
2014-10-28 16:44 ` Doug Evans
2014-10-28 17:12 ` Doug Evans
2014-10-28 17:13 ` Doug Evans
2014-10-28 18:35 ` Pedro Alves
2014-10-28 19:43 ` Doug Evans
2014-10-31 18:57 ` Doug Evans
2014-10-09 9:53 ` [PATCH 04/13 v2] Make linux_stop_lwp be a shared function Gary Benson
2014-10-28 12:56 ` Pedro Alves
2014-10-09 9:53 ` [PATCH 02/13 v2] Add x86_debug_reg_state to gdbserver Gary Benson
2014-10-28 12:56 ` Pedro Alves
2014-10-09 9:54 ` [PATCH 12/13 v2] Move low-level Linux x86 debug register code to a shared file Gary Benson
2014-10-28 13:01 ` Pedro Alves
2014-10-09 10:18 ` [PATCH 07/13 v2] Make lwp_info.arch_private handling shared Gary Benson
2014-10-28 12:57 ` Pedro Alves
2014-10-09 10:18 ` [PATCH 05/13 v2] Introduce basic LWP accessors Gary Benson
2014-10-28 12:57 ` Pedro Alves
2014-10-09 10:18 ` [PATCH 03/13 v2] Add iterate_over_lwps to gdbserver Gary Benson
2014-10-28 12:56 ` Pedro Alves
2014-10-09 10:21 ` [PATCH 08/13 v2] Rename gdbserver's low-level Linux x86 debug register accessors Gary Benson
2014-10-28 12:58 ` Pedro Alves
2014-10-09 10:21 ` [PATCH 10/13 v2] Linux x86 low-level debug register comment synchronization Gary Benson
2014-10-28 12:59 ` Pedro Alves
2014-10-09 10:35 ` [PATCH 06/13 v2] Change signature of linux_target_ops.new_thread Gary Benson
2014-10-28 12:57 ` Pedro Alves
2014-10-09 10:35 ` [PATCH 11/13 v2] Introduce x86_linux_update_debug_registers Gary Benson
2014-10-28 13:00 ` Pedro Alves
2014-10-09 10:44 ` [PATCH 13/13 v2] Move duplicated Linux x86 code to nat/x86-linux.c Gary Benson
2014-10-28 13:01 ` Pedro Alves
2014-10-09 10:44 ` Gary Benson [this message]
2014-10-28 12:59 ` [PATCH 09/13 v2] Linux x86 low-level debug register code synchronization Pedro Alves
2015-03-24 14:11 ` [pushed] Refactor low-level Linux x86 debug register code Gary Benson
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=1412848358-9958-10-git-send-email-gbenson@redhat.com \
--to=gbenson@redhat.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