diff options
author | Gary Benson <gbenson@redhat.com> | 2015-03-24 14:05:43 +0000 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-03-24 14:05:43 +0000 |
commit | 7b6690874fa3a8afacd731b70a461d55a5b1311c (patch) | |
tree | 9812e8a6063beb1c5a99a5524879d78f291f69dc /gdb/gdbserver/linux-x86-low.c | |
parent | 15630549010233e9d0f0b1971d27e121cd74bdd0 (diff) | |
download | gdb-7b6690874fa3a8afacd731b70a461d55a5b1311c.zip gdb-7b6690874fa3a8afacd731b70a461d55a5b1311c.tar.gz gdb-7b6690874fa3a8afacd731b70a461d55a5b1311c.tar.bz2 |
Introduce current_lwp_ptid
This commit introduces a new function, current_lwp_ptid, that
shared Linux code can use to obtain the ptid of the current
lightweight process.
gdb/ChangeLog:
* nat/linux-nat.h (current_lwp_ptid): New declaration.
* linux-nat.c (current_lwp_ptid): New function.
* x86-linux-nat.c: Include nat/linux-nat.h.
(x86_linux_dr_get_addr): Use current_lwp_ptid.
(x86_linux_dr_get_control): Likewise.
(x86_linux_dr_get_status): Likewise.
(x86_linux_dr_set_control): Likewise.
(x86_linux_dr_set_addr): Likewise.
gdb/gdbserver/ChangeLog:
* linux-low.c (current_lwp_ptid): New function.
* linux-x86-low.c: Include nat/linux-nat.h.
(x86_dr_low_get_addr): Use current_lwp_ptid.
(x86_dr_low_get_control): Likewise.
(x86_dr_low_get_status): Likewise.
Diffstat (limited to 'gdb/gdbserver/linux-x86-low.c')
-rw-r--r-- | gdb/gdbserver/linux-x86-low.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 72478d8..66dfc5d 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -37,6 +37,7 @@ #include "tdesc.h" #include "tracepoint.h" #include "ax.h" +#include "nat/linux-nat.h" #ifdef __x86_64__ /* Defined in auto-generated file amd64-linux.c. */ @@ -615,11 +616,9 @@ x86_dr_low_set_addr (int regnum, CORE_ADDR addr) static CORE_ADDR x86_dr_low_get_addr (int regnum) { - ptid_t ptid = ptid_of (current_thread); - gdb_assert (DR_FIRSTADDR <= regnum && regnum <= DR_LASTADDR); - return x86_linux_dr_get (ptid, regnum); + return x86_linux_dr_get (current_lwp_ptid (), regnum); } /* Update the inferior's DR7 debug control register from STATE. */ @@ -638,9 +637,7 @@ x86_dr_low_set_control (unsigned long control) static unsigned long x86_dr_low_get_control (void) { - ptid_t ptid = ptid_of (current_thread); - - return x86_linux_dr_get (ptid, DR_CONTROL); + return x86_linux_dr_get (current_lwp_ptid (), DR_CONTROL); } /* Get the value of the DR6 debug status register from the inferior @@ -649,9 +646,7 @@ x86_dr_low_get_control (void) static unsigned long x86_dr_low_get_status (void) { - ptid_t ptid = ptid_of (current_thread); - - return x86_linux_dr_get (ptid, DR_STATUS); + return x86_linux_dr_get (current_lwp_ptid (), DR_STATUS); } /* Low-level function vector. */ |