aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-03-24 14:05:45 +0000
committerGary Benson <gbenson@redhat.com>2015-03-24 14:05:45 +0000
commit369f6daa21bf33a09ef67b002e4cec3595eddfe7 (patch)
tree4da77bcb79beb7c74b77ef6666006ee89b870ffa
parent8e5d40700492597d103ebdb68eab733456b66fad (diff)
downloadgdb-369f6daa21bf33a09ef67b002e4cec3595eddfe7.zip
gdb-369f6daa21bf33a09ef67b002e4cec3595eddfe7.tar.gz
gdb-369f6daa21bf33a09ef67b002e4cec3595eddfe7.tar.bz2
Move duplicated Linux x86 code to nat/x86-linux.c
This commit moves two identical functions from gdb/x86-linux-nat.c and gdb/gdbserver/linux-x86-low.c into the shared file gdb/nat/x86-linux.c. gdb/ChangeLog: * nat/x86-linux.h (x86_linux_new_thread): New declaration. (x86_linux_prepare_to_resume): Likewise. * x86-linux-nat.c (x86_linux_new_thread): Moved to nat/x86-linux.c. (x86_linux_prepare_to_resume): Likewise. * nat/x86-linux.c (x86_linux_new_thread): New function. (x86_linux_prepare_to_resume): Likewise. gdb/gdbserver/ChangeLog: * linux-x86-low.c (x86_linux_new_thread): Moved to nat/x86-linux.c. (x86_linux_prepare_to_resume): Likewise.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/linux-x86-low.c16
-rw-r--r--gdb/nat/x86-linux.c17
-rw-r--r--gdb/nat/x86-linux.h8
-rw-r--r--gdb/x86-linux-nat.c16
6 files changed, 41 insertions, 32 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7dcec1f..62a8a44 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2015-03-24 Gary Benson <gbenson@redhat.com>
+ * nat/x86-linux.h (x86_linux_new_thread): New declaration.
+ (x86_linux_prepare_to_resume): Likewise.
+ * x86-linux-nat.c (x86_linux_new_thread):
+ Moved to nat/x86-linux.c.
+ (x86_linux_prepare_to_resume): Likewise.
+ * nat/x86-linux.c (x86_linux_new_thread): New function.
+ (x86_linux_prepare_to_resume): Likewise.
+
+2015-03-24 Gary Benson <gbenson@redhat.com>
+
* nat/x86-linux-dregs.h: New file.
* nat/x86-linux-dregs.c: Likewise.
* Makefile.in (HFILES_NO_SRCDIR): Add nat/x86-linux-dregs.h.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 8d1d844..d9bc729 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_new_thread): Moved to
+ nat/x86-linux.c.
+ (x86_linux_prepare_to_resume): Likewise.
+
+2015-03-24 Gary Benson <gbenson@redhat.com>
+
* Makefile.in (x86-linux-dregs.o): New rule.
* configure.srv: Add x86-linux-dregs.o to relevant targets.
* linux-x86-low.c: Include nat/x86-linux-dregs.h.
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 8a3b5a8..e293ba4 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -640,14 +640,6 @@ x86_linux_new_process (void)
return info;
}
-/* Called when a new thread is detected. */
-
-static void
-x86_linux_new_thread (struct lwp_info *lwp)
-{
- lwp_set_debug_registers_changed (lwp, 1);
-}
-
/* See nat/x86-dregs.h. */
struct x86_debug_reg_state *
@@ -657,14 +649,6 @@ x86_debug_reg_state (pid_t pid)
return &proc->priv->arch_private->debug_reg_state;
}
-
-/* Called prior to resuming a thread. */
-
-static void
-x86_linux_prepare_to_resume (struct lwp_info *lwp)
-{
- x86_linux_update_debug_registers (lwp);
-}
/* When GDBSERVER is built as a 64-bit application on linux, the
PTRACE_GETSIGINFO data is always presented in 64-bit layout. Since
diff --git a/gdb/nat/x86-linux.c b/gdb/nat/x86-linux.c
index a2bd368..e783156 100644
--- a/gdb/nat/x86-linux.c
+++ b/gdb/nat/x86-linux.c
@@ -19,6 +19,7 @@
#include "common-defs.h"
#include "x86-linux.h"
+#include "x86-linux-dregs.h"
/* Per-thread arch-specific data we want to keep. */
@@ -55,3 +56,19 @@ lwp_debug_registers_changed (struct lwp_info *lwp)
return info->debug_registers_changed;
}
+
+/* See nat/x86-linux.h. */
+
+void
+x86_linux_new_thread (struct lwp_info *lwp)
+{
+ lwp_set_debug_registers_changed (lwp, 1);
+}
+
+/* See nat/x86-linux.h. */
+
+void
+x86_linux_prepare_to_resume (struct lwp_info *lwp)
+{
+ x86_linux_update_debug_registers (lwp);
+}
diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h
index 8dd66e4..327a005 100644
--- a/gdb/nat/x86-linux.h
+++ b/gdb/nat/x86-linux.h
@@ -35,4 +35,12 @@ extern void lwp_set_debug_registers_changed (struct lwp_info *lwp,
extern int lwp_debug_registers_changed (struct lwp_info *lwp);
+/* Function to call when a new thread is detected. */
+
+extern void x86_linux_new_thread (struct lwp_info *lwp);
+
+/* Function to call prior to resuming a thread. */
+
+extern void x86_linux_prepare_to_resume (struct lwp_info *lwp);
+
#endif /* X86_LINUX_H */
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 84021fb..f8eb236 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -52,22 +52,6 @@ struct arch_lwp_info
/* Does the current host support PTRACE_GETREGSET? */
int have_ptrace_getregset = -1;
-
-/* Called prior to resuming a thread. */
-
-static void
-x86_linux_prepare_to_resume (struct lwp_info *lwp)
-{
- x86_linux_update_debug_registers (lwp);
-}
-
-/* Called when a new thread is detected. */
-
-static void
-x86_linux_new_thread (struct lwp_info *lwp)
-{
- lwp_set_debug_registers_changed (lwp, 1);
-}
/* linux_nat_new_fork hook. */