aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-03-24 14:05:44 +0000
committerGary Benson <gbenson@redhat.com>2015-03-24 14:05:44 +0000
commit4b134ca10812e550d8d012cd6096f5229d59f7c6 (patch)
treebb8a594f30a8d3053e61854c64b99df715b12ee6 /gdb/gdbserver
parent34c703da6cb01d8b41e1bfb790c3c2c625088b69 (diff)
downloadfsf-binutils-gdb-4b134ca10812e550d8d012cd6096f5229d59f7c6.zip
fsf-binutils-gdb-4b134ca10812e550d8d012cd6096f5229d59f7c6.tar.gz
fsf-binutils-gdb-4b134ca10812e550d8d012cd6096f5229d59f7c6.tar.bz2
Make lwp_info.arch_private handling shared
This commit moves the code to handle lwp_info.arch_private for Linux x86 into a new shared file, nat/x86-linux.c. gdb/ChangeLog: * nat/x86-linux.h: New file. * nat/x86-linux.c: Likewise. * Makefile.in (HFILES_NO_SRCDIR): Add nat/x86-linux.h. (x86-linux.o): New rule. * config/i386/linux.mh (NATDEPFILES): Add x86-linux.o. * config/i386/linux64.mh (NATDEPFILES): Likewise. * nat/linux-nat.h (struct arch_lwp_info): New forward declaration. (lwp_set_arch_private_info): New declaration. (lwp_arch_private_info): Likewise. * linux-nat.c (lwp_set_arch_private_info): New function. (lwp_arch_private_info): Likewise. * x86-linux-nat.c: Include nat/x86-linux.h. (arch_lwp_info): Removed structure. (update_debug_registers_callback): Use lwp_set_debug_registers_changed. (x86_linux_prepare_to_resume): Use lwp_debug_registers_changed and lwp_set_debug_registers_changed. (x86_linux_new_thread): Use lwp_set_debug_registers_changed. gdb/gdbserver/ChangeLog: * Makefile.in (x86-linux.o): New rule. * configure.srv: Add x86-linux.o to relevant targets. * linux-low.c (lwp_set_arch_private_info): New function. (lwp_arch_private_info): Likewise. * linux-x86-low.c: Include nat/x86-linux.h. (arch_lwp_info): Removed structure. (update_debug_registers_callback): Use lwp_set_debug_registers_changed. (x86_linux_prepare_to_resume): Use lwp_debug_registers_changed and lwp_set_debug_registers_changed. (x86_linux_new_thread): Use lwp_set_debug_registers_changed.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog14
-rw-r--r--gdb/gdbserver/Makefile.in3
-rw-r--r--gdb/gdbserver/configure.srv4
-rw-r--r--gdb/gdbserver/linux-low.c17
-rw-r--r--gdb/gdbserver/linux-x86-low.c21
5 files changed, 41 insertions, 18 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 1f5e4c1..cf858ed 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,19 @@
2015-03-24 Gary Benson <gbenson@redhat.com>
+ * Makefile.in (x86-linux.o): New rule.
+ * configure.srv: Add x86-linux.o to relevant targets.
+ * linux-low.c (lwp_set_arch_private_info): New function.
+ (lwp_arch_private_info): Likewise.
+ * linux-x86-low.c: Include nat/x86-linux.h.
+ (arch_lwp_info): Removed structure.
+ (update_debug_registers_callback):
+ Use lwp_set_debug_registers_changed.
+ (x86_linux_prepare_to_resume): Use lwp_debug_registers_changed
+ and lwp_set_debug_registers_changed.
+ (x86_linux_new_thread): Use lwp_set_debug_registers_changed.
+
+2015-03-24 Gary Benson <gbenson@redhat.com>
+
* linux-low.h (linux_target_ops) <new_thread>: Changed signature.
* linux-arm-low.c (arm_new_thread): Likewise.
* linux-aarch64-low.c (aarch64_linux_new_thread): Likewise.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index b425ee2..7b1e52c 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -609,6 +609,9 @@ linux-personality.o: ../nat/linux-personality.c
btrace-common.o: ../common/btrace-common.c
$(COMPILE) $<
$(POSTCOMPILE)
+x86-linux.o: ../nat/x86-linux.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
aarch64.c : $(srcdir)/../regformats/aarch64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/aarch64.dat aarch64.c
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 98dd0d9..fcb29ff 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -109,7 +109,7 @@ case "${target}" in
srv_xmlfiles="${srv_xmlfiles} $srv_amd64_linux_xmlfiles"
fi
srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
- srv_tgtobj="${srv_tgtobj} linux-btrace.o"
+ srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes
@@ -325,7 +325,7 @@ case "${target}" in
;;
x86_64-*-linux*) srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
- srv_tgtobj="${srv_tgtobj} linux-btrace.o"
+ srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
srv_xmlfiles="$srv_i386_linux_xmlfiles $srv_amd64_linux_xmlfiles"
srv_linux_usrregs=yes # This is for i386 progs.
srv_linux_regsets=yes
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 93656c0..4743f7b 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -148,6 +148,23 @@ ptid_of_lwp (struct lwp_info *lwp)
/* See nat/linux-nat.h. */
+void
+lwp_set_arch_private_info (struct lwp_info *lwp,
+ struct arch_lwp_info *info)
+{
+ lwp->arch_private = info;
+}
+
+/* See nat/linux-nat.h. */
+
+struct arch_lwp_info *
+lwp_arch_private_info (struct lwp_info *lwp)
+{
+ return lwp->arch_private;
+}
+
+/* See nat/linux-nat.h. */
+
int
lwp_is_stopped (struct lwp_info *lwp)
{
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 4a7cf42..7f072a7 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -38,6 +38,7 @@
#include "tracepoint.h"
#include "ax.h"
#include "nat/linux-nat.h"
+#include "nat/x86-linux.h"
#ifdef __x86_64__
/* Defined in auto-generated file amd64-linux.c. */
@@ -152,14 +153,6 @@ struct arch_process_info
struct x86_debug_reg_state debug_reg_state;
};
-/* Per-thread arch-specific data we want to keep. */
-
-struct arch_lwp_info
-{
- /* Non-zero if our copy differs from what's recorded in the thread. */
- int debug_registers_changed;
-};
-
#ifdef __x86_64__
/* Mapping between the general-purpose registers in `struct user'
@@ -579,7 +572,7 @@ update_debug_registers_callback (struct lwp_info *lwp, void *arg)
{
/* The actual update is done later just before resuming the lwp,
we just mark that the registers need updating. */
- lwp->arch_private->debug_registers_changed = 1;
+ lwp_set_debug_registers_changed (lwp, 1);
/* If the lwp isn't stopped, force it to momentarily pause, so
we can update its debug registers. */
@@ -760,11 +753,7 @@ x86_linux_new_process (void)
static void
x86_linux_new_thread (struct lwp_info *lwp)
{
- struct arch_lwp_info *info = XCNEW (struct arch_lwp_info);
-
- info->debug_registers_changed = 1;
-
- lwp->arch_private = info;
+ lwp_set_debug_registers_changed (lwp, 1);
}
/* See nat/x86-dregs.h. */
@@ -786,7 +775,7 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
ptid_t ptid = ptid_of_lwp (lwp);
int clear_status = 0;
- if (lwp->arch_private->debug_registers_changed)
+ if (lwp_debug_registers_changed (lwp))
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (ptid));
@@ -809,7 +798,7 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
if (state->dr_control_mirror != 0)
x86_linux_dr_set (ptid, DR_CONTROL, state->dr_control_mirror);
- lwp->arch_private->debug_registers_changed = 0;
+ lwp_set_debug_registers_changed (lwp, 0);
}
if (clear_status