Move debug_reg_change_callback and aarch64_notify_debug_reg_change to nat/aarch64...
authorYao Qi <yao.qi@linaro.org>
Tue, 25 Aug 2015 10:38:29 +0000 (11:38 +0100)
committerYao Qi <yao.qi@linaro.org>
Tue, 25 Aug 2015 10:39:13 +0000 (11:39 +0100)
gdb:

2015-08-25  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (struct arch64_dr_update_callback_param):
Move it to nat/aarch64-linux-hw-point.c.
(debug_reg_change_callback): Likewise.
(aarch64_notify_debug_reg_change): :Likewise.
* nat/aarch64-linux-hw-point.c: Include nat/linux-nat.h.
(aarch64_dr_update_callback_param): New.
(debug_reg_change_callback): New function.
(aarch64_notify_debug_reg_change): Likewise.
* nat/aarch64-linux-hw-point.h (aarch64_notify_debug_reg_change):
Remove the declaration.

gdb/gdbserver:

2015-08-25  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (struct arch64_dr_update_callback_param):
Remove.
(debug_reg_change_callback): Remove.
(aarch64_notify_debug_reg_change): Remove.

gdb/ChangeLog
gdb/aarch64-linux-nat.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-aarch64-low.c
gdb/nat/aarch64-linux-hw-point.c
gdb/nat/aarch64-linux-hw-point.h

index 06d741135b32d9eba09a76cdafc5fa06d3ffb611..4945f773a788fa9be383bb0a19b39da7b9cc6974 100644 (file)
@@ -1,3 +1,16 @@
+2015-08-25  Yao Qi  <yao.qi@linaro.org>
+
+       * aarch64-linux-nat.c (struct arch64_dr_update_callback_param):
+       Move it to nat/aarch64-linux-hw-point.c.
+       (debug_reg_change_callback): Likewise.
+       (aarch64_notify_debug_reg_change): :Likewise.
+       * nat/aarch64-linux-hw-point.c: Include nat/linux-nat.h.
+       (aarch64_dr_update_callback_param): New.
+       (debug_reg_change_callback): New function.
+       (aarch64_notify_debug_reg_change): Likewise.
+       * nat/aarch64-linux-hw-point.h (aarch64_notify_debug_reg_change):
+       Remove the declaration.
+
 2015-08-25  Yao Qi  <yao.qi@linaro.org>
 
        * aarch64-linux-nat.c (aarch64_notify_debug_reg_change):
index 354d8f8da7f209c77fb9d0f5abc1cf7033e65d8d..9bae9ce324c56f964daf08a588ed5a18984cff2a 100644 (file)
@@ -147,91 +147,6 @@ aarch64_get_debug_reg_state (pid_t pid)
   return &aarch64_process_info_get (pid)->state;
 }
 
-struct aarch64_dr_update_callback_param
-{
-  int is_watchpoint;
-  unsigned int idx;
-};
-
-/* Callback for iterate_over_lwps.  Records the
-   information about the change of one hardware breakpoint/watchpoint
-   setting for the thread LWP.
-   The information is passed in via PTR.
-   N.B.  The actual updating of hardware debug registers is not
-   carried out until the moment the thread is resumed.  */
-
-static int
-debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
-{
-  struct aarch64_dr_update_callback_param *param_p
-    = (struct aarch64_dr_update_callback_param *) ptr;
-  int pid = ptid_get_pid (ptid_of_lwp (lwp));
-  int idx = param_p->idx;
-  int is_watchpoint = param_p->is_watchpoint;
-  struct arch_lwp_info *info = lwp->arch_private;
-  dr_changed_t *dr_changed_ptr;
-  dr_changed_t dr_changed;
-
-  if (info == NULL)
-    info = lwp->arch_private = XCNEW (struct arch_lwp_info);
-
-  if (show_debug_regs)
-    {
-      debug_printf ("debug_reg_change_callback: \n\tOn entry:\n");
-      debug_printf ("\tpid%d, dr_changed_bp=0x%s, "
-                   "dr_changed_wp=0x%s\n", pid,
-                   phex (info->dr_changed_bp, 8),
-                   phex (info->dr_changed_wp, 8));
-    }
-
-  dr_changed_ptr = is_watchpoint ? &info->dr_changed_wp
-    : &info->dr_changed_bp;
-  dr_changed = *dr_changed_ptr;
-
-  gdb_assert (idx >= 0
-             && (idx <= (is_watchpoint ? aarch64_num_wp_regs
-                         : aarch64_num_bp_regs)));
-
-  /* The actual update is done later just before resuming the lwp,
-     we just mark that one register pair needs updating.  */
-  DR_MARK_N_CHANGED (dr_changed, idx);
-  *dr_changed_ptr = dr_changed;
-
-  /* If the lwp isn't stopped, force it to momentarily pause, so
-     we can update its debug registers.  */
-  if (!lwp->stopped)
-    linux_stop_lwp (lwp);
-
-  if (show_debug_regs)
-    {
-      debug_printf ("\tOn exit:\n\tpid%d, dr_changed_bp=0x%s, "
-                   "dr_changed_wp=0x%s\n", pid,
-                   phex (info->dr_changed_bp, 8),
-                   phex (info->dr_changed_wp, 8));
-    }
-
-  /* Continue the iteration.  */
-  return 0;
-}
-
-/* Notify each thread that their IDXth breakpoint/watchpoint register
-   pair needs to be updated.  The message will be recorded in each
-   thread's arch-specific data area, the actual updating will be done
-   when the thread is resumed.  */
-
-void
-aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
-                                int is_watchpoint, unsigned int idx)
-{
-  struct aarch64_dr_update_callback_param param;
-  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ()));
-
-  param.is_watchpoint = is_watchpoint;
-  param.idx = idx;
-
-  iterate_over_lwps (pid_ptid, debug_reg_change_callback, (void *) &param);
-}
-
 /* Fill GDB's register array with the general-purpose register values
    from the current thread.  */
 
index df5b914d68c66c035d845c48e79b4a8d72d72401..de56e19bb43459b925f8a395d8b60f823d9275b2 100644 (file)
@@ -1,3 +1,10 @@
+2015-08-25  Yao Qi  <yao.qi@linaro.org>
+
+       * linux-aarch64-low.c (struct arch64_dr_update_callback_param):
+       Remove.
+       (debug_reg_change_callback): Remove.
+       (aarch64_notify_debug_reg_change): Remove.
+
 2015-08-25  Yao Qi  <yao.qi@linaro.org>
 
        * linux-aarch64-low.c (aarch64_notify_debug_reg_change):
index 4c482a92d31166855b0109deb20af316a2abb7c7..3968aee2b7116ac838cad791d3b7019b42afe549 100644 (file)
@@ -234,88 +234,6 @@ aarch64_init_debug_reg_state (struct aarch64_debug_reg_state *state)
     }
 }
 
-struct aarch64_dr_update_callback_param
-{
-  int is_watchpoint;
-  unsigned int idx;
-};
-
-/* Callback for iterate_over_lwps.  Records the
-   information about the change of one hardware breakpoint/watchpoint
-   setting for the thread LWP.
-   The information is passed in via PTR.
-   N.B.  The actual updating of hardware debug registers is not
-   carried out until the moment the thread is resumed.  */
-
-static int
-debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
-{
-  struct aarch64_dr_update_callback_param *param_p
-    = (struct aarch64_dr_update_callback_param *) ptr;
-  int pid = ptid_get_pid (ptid_of_lwp (lwp));
-  int idx = param_p->idx;
-  int is_watchpoint = param_p->is_watchpoint;
-  struct arch_lwp_info *info = lwp->arch_private;
-  dr_changed_t *dr_changed_ptr;
-  dr_changed_t dr_changed;
-
-  if (show_debug_regs)
-    {
-      debug_printf ("debug_reg_change_callback: \n\tOn entry:\n");
-      debug_printf ("\tpid%d, dr_changed_bp=0x%s, "
-                   "dr_changed_wp=0x%s\n", pid,
-                   phex (info->dr_changed_bp, 8),
-                   phex (info->dr_changed_wp, 8));
-    }
-
-  dr_changed_ptr = is_watchpoint ? &info->dr_changed_wp
-    : &info->dr_changed_bp;
-  dr_changed = *dr_changed_ptr;
-
-  gdb_assert (idx >= 0
-             && (idx <= (is_watchpoint ? aarch64_num_wp_regs
-                         : aarch64_num_bp_regs)));
-
-  /* The actual update is done later just before resuming the lwp,
-     we just mark that one register pair needs updating.  */
-  DR_MARK_N_CHANGED (dr_changed, idx);
-  *dr_changed_ptr = dr_changed;
-
-  /* If the lwp isn't stopped, force it to momentarily pause, so
-     we can update its debug registers.  */
-  if (!lwp->stopped)
-    linux_stop_lwp (lwp);
-
-  if (show_debug_regs)
-    {
-      debug_printf ("\tOn exit:\n\tpid%d, dr_changed_bp=0x%s, "
-                   "dr_changed_wp=0x%s\n", pid,
-                   phex (info->dr_changed_bp, 8),
-                   phex (info->dr_changed_wp, 8));
-    }
-
-  return 0;
-}
-
-/* Notify each thread that their IDXth breakpoint/watchpoint register
-   pair needs to be updated.  The message will be recorded in each
-   thread's arch-specific data area, the actual updating will be done
-   when the thread is resumed.  */
-
-void
-aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
-                                int is_watchpoint, unsigned int idx)
-{
-  struct aarch64_dr_update_callback_param param;
-  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ()));
-
-  param.is_watchpoint = is_watchpoint;
-  param.idx = idx;
-
-  iterate_over_lwps (pid_ptid, debug_reg_change_callback, (void *) &param);
-}
-
-
 /* Return the pointer to the debug register state structure in the
    current process' arch-specific data area.  */
 
index 1d9664ea1c02a31ed830e7ef93289e0f8a6a6e17..ba235e54c783b74c403ab3dd05417b65bba94065 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "common-defs.h"
 #include "break-common.h"
+#include "nat/linux-nat.h"
 #include "aarch64-linux-hw-point.h"
 
 #include <sys/uio.h>
@@ -220,6 +221,93 @@ aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p,
     *next_len_p = len;
 }
 
+struct aarch64_dr_update_callback_param
+{
+  int is_watchpoint;
+  unsigned int idx;
+};
+
+/* Callback for iterate_over_lwps.  Records the
+   information about the change of one hardware breakpoint/watchpoint
+   setting for the thread LWP.
+   The information is passed in via PTR.
+   N.B.  The actual updating of hardware debug registers is not
+   carried out until the moment the thread is resumed.  */
+
+static int
+debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
+{
+  struct aarch64_dr_update_callback_param *param_p
+    = (struct aarch64_dr_update_callback_param *) ptr;
+  int pid = ptid_get_pid (ptid_of_lwp (lwp));
+  int idx = param_p->idx;
+  int is_watchpoint = param_p->is_watchpoint;
+  struct arch_lwp_info *info = lwp_arch_private_info (lwp);
+  dr_changed_t *dr_changed_ptr;
+  dr_changed_t dr_changed;
+
+  if (info == NULL)
+    {
+      info = XCNEW (struct arch_lwp_info);
+      lwp_set_arch_private_info (lwp, info);
+    }
+
+  if (show_debug_regs)
+    {
+      debug_printf ("debug_reg_change_callback: \n\tOn entry:\n");
+      debug_printf ("\tpid%d, dr_changed_bp=0x%s, "
+                   "dr_changed_wp=0x%s\n", pid,
+                   phex (info->dr_changed_bp, 8),
+                   phex (info->dr_changed_wp, 8));
+    }
+
+  dr_changed_ptr = is_watchpoint ? &info->dr_changed_wp
+    : &info->dr_changed_bp;
+  dr_changed = *dr_changed_ptr;
+
+  gdb_assert (idx >= 0
+             && (idx <= (is_watchpoint ? aarch64_num_wp_regs
+                         : aarch64_num_bp_regs)));
+
+  /* The actual update is done later just before resuming the lwp,
+     we just mark that one register pair needs updating.  */
+  DR_MARK_N_CHANGED (dr_changed, idx);
+  *dr_changed_ptr = dr_changed;
+
+  /* If the lwp isn't stopped, force it to momentarily pause, so
+     we can update its debug registers.  */
+  if (!lwp_is_stopped (lwp))
+    linux_stop_lwp (lwp);
+
+  if (show_debug_regs)
+    {
+      debug_printf ("\tOn exit:\n\tpid%d, dr_changed_bp=0x%s, "
+                   "dr_changed_wp=0x%s\n", pid,
+                   phex (info->dr_changed_bp, 8),
+                   phex (info->dr_changed_wp, 8));
+    }
+
+  return 0;
+}
+
+/* Notify each thread that their IDXth breakpoint/watchpoint register
+   pair needs to be updated.  The message will be recorded in each
+   thread's arch-specific data area, the actual updating will be done
+   when the thread is resumed.  */
+
+static void
+aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
+                                int is_watchpoint, unsigned int idx)
+{
+  struct aarch64_dr_update_callback_param param;
+  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (current_lwp_ptid ()));
+
+  param.is_watchpoint = is_watchpoint;
+  param.idx = idx;
+
+  iterate_over_lwps (pid_ptid, debug_reg_change_callback, (void *) &param);
+}
+
 /* Record the insertion of one breakpoint/watchpoint, as represented
    by ADDR and CTRL, in the process' arch-specific data area *STATE.  */
 
index a430a8fcb8dbcfb6a96830d8ae8d516c1894e276..17cc42058e248e3d71b17072f8aaa21dfd425eaf 100644 (file)
@@ -171,9 +171,6 @@ int aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
                               int len, int is_insert,
                               struct aarch64_debug_reg_state *state);
 
-void aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state,
-                                     int is_watchpoint, unsigned int idx);
-
 void aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state,
                                   int tid, int watchpoint);
 
This page took 0.036011 seconds and 4 git commands to generate.