diff options
author | Gary Benson <gbenson@redhat.com> | 2015-03-24 14:05:44 +0000 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-03-24 14:05:44 +0000 |
commit | 5dfe6ca8a8686a37fea66dff3b652e7f4f7fc90c (patch) | |
tree | 971b6195767ad01b525c8118af66f9afdd38669e | |
parent | d33472adfc6b6cdfd12f48e53ee0d6c96677717d (diff) | |
download | gdb-5dfe6ca8a8686a37fea66dff3b652e7f4f7fc90c.zip gdb-5dfe6ca8a8686a37fea66dff3b652e7f4f7fc90c.tar.gz gdb-5dfe6ca8a8686a37fea66dff3b652e7f4f7fc90c.tar.bz2 |
Linux x86 low-level debug register code synchronization
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): Update assertion.
(x86_linux_new_thread): Rename argument.
gdb/gdbserver/ChangeLog:
* linux-x86-low.c (x86_linux_dr_get): Add assertion.
Use perror_with_name. Pass string through gettext.
(x86_linux_dr_set): Likewise.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/linux-x86-low.c | 6 | ||||
-rw-r--r-- | gdb/x86-linux-nat.c | 6 |
4 files changed, 18 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9ea1446..f73b6e2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2015-03-24 Gary Benson <gbenson@redhat.com> + * x86-linux-nat.c (x86_linux_dr_set_addr): Update assertion. + (x86_linux_new_thread): Rename argument. + +2015-03-24 Gary Benson <gbenson@redhat.com> + * nat/x86-linux.h: New file. * nat/x86-linux.c: Likewise. * Makefile.in (HFILES_NO_SRCDIR): Add nat/x86-linux.h. diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 12b46a9..10135ae 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,11 @@ 2015-03-24 Gary Benson <gbenson@redhat.com> + * linux-x86-low.c (x86_linux_dr_get): Add assertion. + Use perror_with_name. Pass string through gettext. + (x86_linux_dr_set): Likewise. + +2015-03-24 Gary Benson <gbenson@redhat.com> + * linux-x86-low.c (x86_dr_low_set_addr): Rename to... (x86_linux_dr_set_addr): ...this. (x86_dr_low_get_addr): Rename to... diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index cdd5b00..5fcc24d 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -544,12 +544,13 @@ 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, u_debugreg_offset (regnum), 0); if (errno != 0) - error ("Couldn't read debug register"); + perror_with_name (_("Couldn't read debug register")); return value; } @@ -559,12 +560,13 @@ 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, u_debugreg_offset (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 10ccbd6..c0cd3a6 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -165,7 +165,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); } @@ -223,9 +223,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); } |