Make lwp_info.arch_private handling shared
[deliverable/binutils-gdb.git] / gdb / x86-linux-nat.c
index 74b48e378ee3238be06731c5a50bb60aa7e9208b..10ccbd67968d4593e7021e5f7a5cabae50098184 100644 (file)
@@ -39,6 +39,7 @@
 #include "x86-xstate.h"
 #include "nat/linux-btrace.h"
 #include "nat/linux-nat.h"
+#include "nat/x86-linux.h"
 
 /* Per-thread arch-specific data we want to keep.  */
 
@@ -133,12 +134,9 @@ x86_linux_dr_get_status (void)
 static int
 update_debug_registers_callback (struct lwp_info *lwp, void *arg)
 {
-  if (lwp->arch_private == NULL)
-    lwp->arch_private = XCNEW (struct arch_lwp_info);
-
   /* 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.  */
@@ -181,13 +179,7 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
   ptid_t ptid = ptid_of_lwp (lwp);
   int clear_status = 0;
 
-  /* NULL means this is the main thread still going through the shell,
-     or, no watchpoint has been set yet.  In that case, there's
-     nothing to do.  */
-  if (lwp->arch_private == NULL)
-    return;
-
-  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));
@@ -222,7 +214,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
@@ -233,11 +225,7 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
 static void
 x86_linux_new_thread (struct lwp_info *lp)
 {
-  struct arch_lwp_info *info = XCNEW (struct arch_lwp_info);
-
-  info->debug_registers_changed = 1;
-
-  lp->arch_private = info;
+  lwp_set_debug_registers_changed (lp, 1);
 }
 \f
 
This page took 0.025031 seconds and 4 git commands to generate.