Add x86_debug_reg_state to gdbserver
authorGary Benson <gbenson@redhat.com>
Tue, 24 Mar 2015 14:05:43 +0000 (14:05 +0000)
committerGary Benson <gbenson@redhat.com>
Tue, 24 Mar 2015 14:05:43 +0000 (14:05 +0000)
This commit introduces a new function, x86_debug_reg_state, that
shared x86 code can use to access the local mirror of a process's
debug registers.  This function already existed in GDB and was
in use by GDB's x86_linux_prepare_to_resume.  An equivalent was
written for gdbserver and gdbserver's x86_linux_prepare_to_resume
was modified to use it.

gdb/ChangeLog:

* x86-nat.h (x86_debug_reg_state): Move declaration to...
* nat/x86-dregs.h (x86_debug_reg_state): New declaration.

gdb/gdbserver/ChangeLog:

* linux-x86-low.c (x86_debug_reg_state): New function.
(x86_linux_prepare_to_resume): Use the above.

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

index 3ff9280adca189cc2fd8731917542c8464c7a1e3..0be84250848592e2d35ba767b86ad6234cda1b47 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-24  Gary Benson  <gbenson@redhat.com>
+
+       * x86-nat.h (x86_debug_reg_state): Move declaration to...
+       * nat/x86-dregs.h (x86_debug_reg_state): New declaration.
+
 2015-03-24  Gary Benson  <gbenson@redhat.com>
 
        * nat/linux-nat.h (current_lwp_ptid): New declaration.
index 3e51d941a48abf0016f70e56c1057095767434e7..49477df7c9c0c2875c25eabf7363d06fc2d5b5d2 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-24  Gary Benson  <gbenson@redhat.com>
+
+       * linux-x86-low.c (x86_debug_reg_state): New function.
+       (x86_linux_prepare_to_resume): Use the above.
+
 2015-03-24  Gary Benson  <gbenson@redhat.com>
 
        * linux-low.c (current_lwp_ptid): New function.
index 66dfc5d58ddff4c58fe9a50db8bba252895eb73a..fe4fd25726b11d12cb0f661d38298cd09d737cd2 100644 (file)
@@ -776,6 +776,16 @@ x86_linux_new_thread (void)
   return info;
 }
 
+/* See nat/x86-dregs.h.  */
+
+struct x86_debug_reg_state *
+x86_debug_reg_state (pid_t pid)
+{
+  struct process_info *proc = find_process_pid (pid);
+
+  return &proc->priv->arch_private->debug_reg_state;
+}
+
 /* Called when resuming a thread.
    If the debug regs have changed, update the thread's copies.  */
 
@@ -787,11 +797,9 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
 
   if (lwp->arch_private->debug_registers_changed)
     {
-      int i;
-      int pid = ptid_get_pid (ptid);
-      struct process_info *proc = find_process_pid (pid);
       struct x86_debug_reg_state *state
-       = &proc->priv->arch_private->debug_reg_state;
+       = x86_debug_reg_state (ptid_get_pid (ptid));
+      int i;
 
       x86_linux_dr_set (ptid, DR_CONTROL, 0);
 
index a2b992607e25fb2d67261c3aff61a95fa751989f..61a97c807285288dc34440b9c2f24fb2fae460a6 100644 (file)
@@ -92,6 +92,11 @@ struct x86_debug_reg_state
 #define ALL_DEBUG_ADDRESS_REGISTERS(i) \
   for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
 
+/* Return a pointer to the local mirror of the debug registers of
+   process PID.  This function must be provided by the client
+   if required.  */
+extern struct x86_debug_reg_state *x86_debug_reg_state (pid_t pid);
+
 /* Insert a watchpoint to watch a memory region which starts at
    address ADDR and whose length is LEN bytes.  Watch memory accesses
    of the type TYPE.  Return 0 on success, -1 on failure.  */
index c8ebd748250653a738f0d9d95fc7d49c9f188383..dcfef3659ed827151441f993cbfd083ef3b43b1d 100644 (file)
@@ -44,11 +44,6 @@ extern void x86_set_debug_register_length (int len);
 
 extern void x86_cleanup_dregs (void);
 
-/* Return a pointer to the local mirror of the debug registers of
-   process PID.  */
-
-extern struct x86_debug_reg_state *x86_debug_reg_state (pid_t pid);
-
 /* Called whenever GDB is no longer debugging process PID.  It deletes
    data structures that keep track of debug register state.  */
 
This page took 0.035885 seconds and 4 git commands to generate.