Introduce x86_linux_update_debug_registers
authorGary Benson <gbenson@redhat.com>
Tue, 24 Mar 2015 14:05:44 +0000 (14:05 +0000)
committerGary Benson <gbenson@redhat.com>
Tue, 24 Mar 2015 14:05:44 +0000 (14:05 +0000)
This commit moves the entire body of both GDB's and gdbserver's
x86_linux_prepare_to_resume functions into new functions,
x86_linux_update_debug_registers.  This reorganisation allows
all Linux x86 low-level debug register code to be placed in one
shared file, separate from general Linux x86 shared code.

gdb/ChangeLog:

* x86-linux-nat.c (x86_linux_update_debug_registers):
New function, factored out from...
(x86_linux_prepare_to_resume): ...this.

gdb/gdbserver/ChangeLog:

* linux-x86-low.c (x86_linux_update_debug_registers):
New function, factored out from...
(x86_linux_prepare_to_resume): ...this.

gdb/ChangeLog
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-x86-low.c
gdb/x86-linux-nat.c

index 18dff13ad75b12701d4e5c29b5ba985b6c3425fa..a8ad8911afd348216d0b979491c0de0c4a0b1bb1 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-24  Gary Benson  <gbenson@redhat.com>
+
+       * x86-linux-nat.c (x86_linux_update_debug_registers):
+       New function, factored out from...
+       (x86_linux_prepare_to_resume): ...this.
+
 2015-03-24  Gary Benson  <gbenson@redhat.com>
 
        * x86-linux-nat.c (x86_linux_dr_get): Update comments.
index 2df8a029d28adcb08a689ecc79a98952dcfe2f16..f58010377ec5e225b319e45196a340efe6ac7313 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-24  Gary Benson  <gbenson@redhat.com>
+
+       * linux-x86-low.c (x86_linux_update_debug_registers):
+       New function, factored out from...
+       (x86_linux_prepare_to_resume): ...this.
+
 2015-03-24  Gary Benson  <gbenson@redhat.com>
 
        * linux-x86-low.c (x86_linux_dr_get): Update comments.
index c6a2accde90347eed42c9b6c13b1d6eba3c90ccb..e371873296e8bf9bb5c754e390eddf069c464d93 100644 (file)
@@ -776,15 +776,17 @@ x86_debug_reg_state (pid_t pid)
   return &proc->priv->arch_private->debug_reg_state;
 }
 
-/* Called prior to resuming a thread.  Updates the thread's debug
-   registers if the values in our local mirror have been changed.  */
+/* Update the thread's debug registers if the values in our local
+   mirror have been changed.  */
 
 static void
-x86_linux_prepare_to_resume (struct lwp_info *lwp)
+x86_linux_update_debug_registers (struct lwp_info *lwp)
 {
   ptid_t ptid = ptid_of_lwp (lwp);
   int clear_status = 0;
 
+  gdb_assert (lwp_is_stopped (lwp));
+
   if (lwp_debug_registers_changed (lwp))
     {
       struct x86_debug_reg_state *state
@@ -821,6 +823,14 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
       || lwp_stop_reason (lwp) == TARGET_STOPPED_BY_WATCHPOINT)
     x86_linux_dr_set (ptid, DR_STATUS, 0);
 }
+
+/* Called prior to resuming a thread.  */
+
+static void
+x86_linux_prepare_to_resume (struct lwp_info *lwp)
+{
+  x86_linux_update_debug_registers (lwp);
+}
 \f
 /* When GDBSERVER is built as a 64-bit application on linux, the
    PTRACE_GETSIGINFO data is always presented in 64-bit layout.  Since
index b49ef8fbc1d378bae9d94bf3bb1e93d61ed71eb6..9eb82c5cdee9220aaa51863699349890d654f1ee 100644 (file)
@@ -171,15 +171,17 @@ x86_linux_dr_set_addr (int regnum, CORE_ADDR addr)
   iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
 }
 
-/* Called prior to resuming a thread.  Updates the thread's debug
-   registers if the values in our local mirror have been changed.  */
+/* Update the thread's debug registers if the values in our local
+   mirror have been changed.  */
 
 static void
-x86_linux_prepare_to_resume (struct lwp_info *lwp)
+x86_linux_update_debug_registers (struct lwp_info *lwp)
 {
   ptid_t ptid = ptid_of_lwp (lwp);
   int clear_status = 0;
 
+  gdb_assert (lwp_is_stopped (lwp));
+
   if (lwp_debug_registers_changed (lwp))
     {
       struct x86_debug_reg_state *state
@@ -217,6 +219,14 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
     x86_linux_dr_set (ptid, DR_STATUS, 0);
 }
 
+/* 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
This page took 0.038547 seconds and 4 git commands to generate.