]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Introduce show_debug_regs
authorGary Benson <gbenson@redhat.com>
Thu, 11 Sep 2014 10:19:56 +0000 (11:19 +0100)
committerGary Benson <gbenson@redhat.com>
Thu, 11 Sep 2014 10:19:56 +0000 (11:19 +0100)
This commit adds a new global flag show_debug_regs to common-debug.h
to replace the flag debug_hw_points used by gdbserver and by the
Linux x86 and AArch64 ports, and to replace the flag maint_show_dr
used by the Linux MIPS port.

Note that some debug printing in the AArch64 port was enabled only if
debug_hw_points > 1 but no way to set debug_hw_points to values other
than 0 and 1 was provided; that code was effectively dead.  This
commit enables all debug printing if show_debug_regs is nonzero, so
the AArch64 output will be more verbose than previously.

gdb/ChangeLog:

* common/common-debug.h (show_debug_regs): Declare.
* common/common-debug.c (show_debug_regs): Define.
* aarch64-linux-nat.c (debug_hw_points): Don't define.  Replace
all uses with show_debug_regs.  Replace all uses that considered
debug_hw_points as a multi-value integer with straight boolean
uses.
* x86-nat.c (debug_hw_points): Don't define.  Replace all uses
with show_debug_regs.
* nat/x86-dregs.c (debug_hw_points): Don't declare.  Replace
all uses with show_debug_regs.
* mips-linux-nat.c (maint_show_dr): Don't define.  Replace all
uses with show_debug_regs.

gdb/gdbserver/ChangeLog:

* server.h (debug_hw_points): Don't declare.
* server.c (debug_hw_points): Don't define.  Replace all uses
with show_debug_regs.
* linux-aarch64-low.c (debug_hw_points): Don't define.  Replace
all uses with show_debug_regs.

gdb/ChangeLog
gdb/aarch64-linux-nat.c
gdb/common/common-debug.c
gdb/common/common-debug.h
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-aarch64-low.c
gdb/gdbserver/server.c
gdb/gdbserver/server.h
gdb/mips-linux-nat.c
gdb/nat/x86-dregs.c
gdb/x86-nat.c

index 8faf764d73cd21a9d422d6d8cb7f3b6233ca3e9f..916b093a1e3a95e16fec0ad057c4018e1ceddef8 100644 (file)
@@ -1,3 +1,18 @@
+2014-09-11  Gary Benson  <gbenson@redhat.com>
+
+       * common/common-debug.h (show_debug_regs): Declare.
+       * common/common-debug.c (show_debug_regs): Define.
+       * aarch64-linux-nat.c (debug_hw_points): Don't define.  Replace
+       all uses with show_debug_regs.  Replace all uses that considered
+       debug_hw_points as a multi-value integer with straight boolean
+       uses.
+       * x86-nat.c (debug_hw_points): Don't define.  Replace all uses
+       with show_debug_regs.
+       * nat/x86-dregs.c (debug_hw_points): Don't declare.  Replace
+       all uses with show_debug_regs.
+       * mips-linux-nat.c (maint_show_dr): Don't define.  Replace all
+       uses with show_debug_regs.
+
 2014-09-10  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * findvar.c (address_from_register): Handle targets requiring
index 1184197fe2e60f55a6bc560a776e1cca11f86c79..1c1832f0b6f0c322bf7d028365bc5db8f9032235 100644 (file)
@@ -119,10 +119,6 @@ get_thread_id (ptid_t ptid)
 static int aarch64_num_bp_regs;
 static int aarch64_num_wp_regs;
 
-/* Debugging of hardware breakpoint/watchpoint support.  */
-
-static int debug_hw_points;
-
 /* Each bit of a variable of this type is used to indicate whether a
    hardware breakpoint or watchpoint setting has been changed since
    the last update.
@@ -363,7 +359,7 @@ debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
   if (info == NULL)
     info = lwp->arch_private = XCNEW (struct arch_lwp_info);
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     {
       fprintf_unfiltered (gdb_stdlog,
                          "debug_reg_change_callback: \n\tOn entry:\n");
@@ -392,7 +388,7 @@ debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
   if (!lwp->stopped)
     linux_stop_lwp (lwp);
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     {
       fprintf_unfiltered (gdb_stdlog,
                          "\tOn exit:\n\tpid%d, dr_changed_bp=0x%s, "
@@ -677,7 +673,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
       struct aarch64_debug_reg_state *state
        = aarch64_get_debug_reg_state (ptid_get_pid (lwp->ptid));
 
-      if (debug_hw_points)
+      if (show_debug_regs)
        fprintf_unfiltered (gdb_stdlog, "prepare_to_resume thread %d\n", tid);
 
       /* Watchpoints.  */
@@ -1200,7 +1196,7 @@ aarch64_linux_insert_hw_breakpoint (struct target_ops *self,
   const int len = 4;
   const int type = hw_execute;
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     fprintf_unfiltered
       (gdb_stdlog,
        "insert_hw_breakpoint on entry (addr=0x%08lx, len=%d))\n",
@@ -1208,7 +1204,7 @@ aarch64_linux_insert_hw_breakpoint (struct target_ops *self,
 
   ret = aarch64_handle_breakpoint (type, addr, len, 1 /* is_insert */);
 
-  if (debug_hw_points > 1)
+  if (show_debug_regs)
     {
       struct aarch64_debug_reg_state *state
        = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -1233,14 +1229,14 @@ aarch64_linux_remove_hw_breakpoint (struct target_ops *self,
   const int len = 4;
   const int type = hw_execute;
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     fprintf_unfiltered
       (gdb_stdlog, "remove_hw_breakpoint on entry (addr=0x%08lx, len=%d))\n",
        (unsigned long) addr, len);
 
   ret = aarch64_handle_breakpoint (type, addr, len, 0 /* is_insert */);
 
-  if (debug_hw_points > 1)
+  if (show_debug_regs)
     {
       struct aarch64_debug_reg_state *state
        = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -1297,7 +1293,7 @@ aarch64_handle_unaligned_watchpoint (int type, CORE_ADDR addr, int len,
        ret = aarch64_dr_state_remove_one_point (state, type, aligned_addr,
                                                 aligned_len);
 
-      if (debug_hw_points)
+      if (show_debug_regs)
        fprintf_unfiltered (gdb_stdlog,
 "handle_unaligned_watchpoint: is_insert: %d\n"
 "                             aligned_addr: 0x%08lx, aligned_len: %d\n"
@@ -1335,7 +1331,7 @@ aarch64_linux_insert_watchpoint (struct target_ops *self,
 {
   int ret;
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     fprintf_unfiltered (gdb_stdlog,
                        "insert_watchpoint on entry (addr=0x%08lx, len=%d)\n",
                        (unsigned long) addr, len);
@@ -1344,7 +1340,7 @@ aarch64_linux_insert_watchpoint (struct target_ops *self,
 
   ret = aarch64_handle_watchpoint (type, addr, len, 1 /* is_insert */);
 
-  if (debug_hw_points > 1)
+  if (show_debug_regs)
     {
       struct aarch64_debug_reg_state *state
        = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -1368,7 +1364,7 @@ aarch64_linux_remove_watchpoint (struct target_ops *self,
 {
   int ret;
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     fprintf_unfiltered (gdb_stdlog,
                        "remove_watchpoint on entry (addr=0x%08lx, len=%d)\n",
                        (unsigned long) addr, len);
@@ -1377,7 +1373,7 @@ aarch64_linux_remove_watchpoint (struct target_ops *self,
 
   ret = aarch64_handle_watchpoint (type, addr, len, 0 /* is_insert */);
 
-  if (debug_hw_points > 1)
+  if (show_debug_regs)
     {
       struct aarch64_debug_reg_state *state
        = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -1496,7 +1492,7 @@ add_show_debug_regs_command (void)
   /* A maintenance command to enable printing the internal DRi mirror
      variables.  */
   add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
-                          &debug_hw_points, _("\
+                          &show_debug_regs, _("\
 Set whether to show variables that mirror the AArch64 debug registers."), _("\
 Show whether to show variables that mirror the AArch64 debug registers."), _("\
 Use \"on\" to enable, \"off\" to disable.\n\
index 660fc70654586bd4cfbb027bef3384d7f8a4e8de..5cac3bf81ae877071c4cff0ae84cc0f8a8b4e4db 100644 (file)
 
 /* See common/common-debug.h.  */
 
+int show_debug_regs;
+
+/* See common/common-debug.h.  */
+
 void
 debug_printf (const char *fmt, ...)
 {
index c2bb192117699762f1d398a4188fb2c8a32c3581..348b0e3def09e47c11a58cfcb800bb1a7fc1b5f0 100644 (file)
 #ifndef COMMON_DEBUG_H
 #define COMMON_DEBUG_H
 
+/* Set to nonzero to enable debugging of hardware breakpoint/
+   watchpoint support code.  */
+
+extern int show_debug_regs;
+
 /* Print a formatted message to the appropriate channel for
    debugging output for the client.  */
 
index c860daf172c5ff6623c4fffd86d160ebcc8bd1e4..04410fe170c8f123f45f1f10b5220f4d98afffa6 100644 (file)
@@ -1,3 +1,11 @@
+2014-09-11  Gary Benson  <gbenson@redhat.com>
+
+       * server.h (debug_hw_points): Don't declare.
+       * server.c (debug_hw_points): Don't define.  Replace all uses
+       with show_debug_regs.
+       * linux-aarch64-low.c (debug_hw_points): Don't define.  Replace
+       all uses with show_debug_regs.
+
 2014-09-08  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
 
        * linux-ppc-low.c (ppc_collect_ptrace_register): Adjust routine to take
index 6066e1503cbda18f5854faccfa5fd4f1de4145c6..ca096b02c93ca49ccaac9bd164a2f345c8278dc0 100644 (file)
@@ -267,9 +267,6 @@ aarch64_store_fpregset (struct regcache *regcache, const void *buf)
     supply_register (regcache, AARCH64_V0_REGNO + i, &regset->vregs[i]);
 }
 
-/* Debugging of hardware breakpoint/watchpoint support.  */
-extern int debug_hw_points;
-
 /* Enable miscellaneous debugging output.  The name is historical - it
    was originally used to debug LinuxThreads support.  */
 extern int debug_threads;
@@ -626,7 +623,7 @@ debug_reg_change_callback (struct inferior_list_entry *entry, void *ptr)
   dr_changed_t *dr_changed_ptr;
   dr_changed_t dr_changed;
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     {
       fprintf (stderr, "debug_reg_change_callback: \n\tOn entry:\n");
       fprintf (stderr, "\tpid%d, tid: %ld, dr_changed_bp=0x%llx, "
@@ -677,7 +674,7 @@ debug_reg_change_callback (struct inferior_list_entry *entry, void *ptr)
        linux_stop_lwp (lwp);
     }
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     {
       fprintf (stderr, "\tOn exit:\n\tpid%d, tid: %ld, dr_changed_bp=0x%llx, "
               "dr_changed_wp=0x%llx\n",
@@ -917,7 +914,7 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type,
        ret = aarch64_dr_state_remove_one_point (state, type, aligned_addr,
                                                 aligned_len);
 
-      if (debug_hw_points)
+      if (show_debug_regs)
        fprintf (stderr,
  "handle_unaligned_watchpoint: is_insert: %d\n"
  "                             aligned_addr: 0x%s, aligned_len: %d\n"
@@ -973,7 +970,7 @@ aarch64_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
   int ret;
   enum target_hw_bp_type targ_type;
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     fprintf (stderr, "insert_point on entry (addr=0x%08lx, len=%d)\n",
             (unsigned long) addr, len);
 
@@ -987,7 +984,7 @@ aarch64_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
     ret =
       aarch64_handle_breakpoint (targ_type, addr, len, 1 /* is_insert */);
 
-  if (debug_hw_points > 1)
+  if (show_debug_regs > 1)
     aarch64_show_debug_reg_state (aarch64_get_debug_reg_state (),
                                  "insert_point", addr, len, targ_type);
 
@@ -1009,7 +1006,7 @@ aarch64_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
   int ret;
   enum target_hw_bp_type targ_type;
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     fprintf (stderr, "remove_point on entry (addr=0x%08lx, len=%d)\n",
             (unsigned long) addr, len);
 
@@ -1024,7 +1021,7 @@ aarch64_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
     ret =
       aarch64_handle_breakpoint (targ_type, addr, len, 0 /* is_insert */);
 
-  if (debug_hw_points > 1)
+  if (show_debug_regs > 1)
     aarch64_show_debug_reg_state (aarch64_get_debug_reg_state (),
                                  "remove_point", addr, len, targ_type);
 
@@ -1150,7 +1147,7 @@ aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
       struct aarch64_debug_reg_state *state
        = &proc->private->arch_private->debug_reg_state;
 
-      if (debug_hw_points)
+      if (show_debug_regs)
        fprintf (stderr, "prepare_to_resume thread %ld\n", lwpid_of (thread));
 
       /* Watchpoints.  */
index 81cb2e1ca572d9f75f0e97abedaafc81d9537717..8d957619ed20272c1e8941192208ed0eea91aa94 100644 (file)
@@ -69,9 +69,6 @@ int disable_randomization = 1;
 
 static char **program_argv, **wrapper_argv;
 
-/* Enable debugging of h/w breakpoint/watchpoint support.  */
-int debug_hw_points;
-
 int pass_signals[GDB_SIGNAL_LAST];
 int program_signals[GDB_SIGNAL_LAST];
 int program_signals_p;
@@ -1012,12 +1009,12 @@ handle_monitor_command (char *mon, char *own_buf)
     }
   else if (strcmp (mon, "set debug-hw-points 1") == 0)
     {
-      debug_hw_points = 1;
+      show_debug_regs = 1;
       monitor_output ("H/W point debugging output enabled.\n");
     }
   else if (strcmp (mon, "set debug-hw-points 0") == 0)
     {
-      debug_hw_points = 0;
+      show_debug_regs = 0;
       monitor_output ("H/W point debugging output disabled.\n");
     }
   else if (strcmp (mon, "set remote-debug 1") == 0)
index 812f5338fdb2bf891bb6b3c4e04224c22032d7ae..ed54f77136dd6210b1bf287dbd8b936d14079c8e 100644 (file)
@@ -82,7 +82,6 @@ extern ptid_t cont_thread;
 extern ptid_t general_thread;
 
 extern int server_waiting;
-extern int debug_hw_points;
 extern int pass_signals[];
 extern int program_signals[];
 extern int program_signals_p;
index ffc8411ca3bcc3cf7f67c4031353ff35b4085da2..9aada60b65fc0f6f8974b1f9a3b666505a339698 100644 (file)
    we'll clear this and use PTRACE_PEEKUSER instead.  */
 static int have_ptrace_regsets = 1;
 
-/* Whether or not to print the mirrored debug registers.  */
-
-static int maint_show_dr;
-
 /* Saved function pointers to fetch and store a single register using
    PTRACE_PEEKUSER and PTRACE_POKEUSER.  */
 
@@ -690,7 +686,7 @@ mips_linux_insert_watchpoint (struct target_ops *self,
   watch_mirror = regs;
   retval = write_watchpoint_regs ();
 
-  if (maint_show_dr)
+  if (show_debug_regs)
     mips_show_dr ("insert_watchpoint", addr, len, type);
 
   return retval;
@@ -738,7 +734,7 @@ mips_linux_remove_watchpoint (struct target_ops *self,
 
   retval = write_watchpoint_regs ();
 
-  if (maint_show_dr)
+  if (show_debug_regs)
     mips_show_dr ("remove_watchpoint", addr, len, type);
 
   return retval;
@@ -775,7 +771,7 @@ _initialize_mips_linux_nat (void)
   struct target_ops *t;
 
   add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
-                          &maint_show_dr, _("\
+                          &show_debug_regs, _("\
 Set whether to show variables that mirror the mips debug registers."), _("\
 Show whether to show variables that mirror the mips debug registers."), _("\
 Use \"on\" to enable, \"off\" to disable.\n\
index fbb24263e331d80273232052119cec19fe958b5d..c0d1e7277354a7429072f261e1bd205388b6bdd0 100644 (file)
 /* Types of operations supported by x86_handle_nonaligned_watchpoint.  */
 typedef enum { WP_INSERT, WP_REMOVE, WP_COUNT } x86_wp_op_t;
 
-#ifndef GDBSERVER
-/* Whether or not to print the mirrored debug registers.  */
-extern int debug_hw_points;
-#endif
-
 /* Print the values of the mirrored debug registers.  */
 
 static void
@@ -511,7 +506,7 @@ x86_dr_insert_watchpoint (struct x86_debug_reg_state *state,
   if (retval == 0)
     x86_update_inferior_debug_regs (state, &local_state);
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     x86_show_dr (state, "insert_watchpoint", addr, len, type);
 
   return retval;
@@ -550,7 +545,7 @@ x86_dr_remove_watchpoint (struct x86_debug_reg_state *state,
   if (retval == 0)
     x86_update_inferior_debug_regs (state, &local_state);
 
-  if (debug_hw_points)
+  if (show_debug_regs)
     x86_show_dr (state, "remove_watchpoint", addr, len, type);
 
   return retval;
@@ -640,12 +635,12 @@ x86_dr_stopped_data_address (struct x86_debug_reg_state *state,
        {
          addr = x86_dr_low_get_addr (i);
          rc = 1;
-         if (debug_hw_points)
+         if (show_debug_regs)
            x86_show_dr (state, "watchpoint_hit", addr, -1, hw_write);
        }
     }
 
-  if (debug_hw_points && addr == 0)
+  if (show_debug_regs && addr == 0)
     x86_show_dr (state, "stopped_data_addr", 0, 0, hw_write);
 
   if (rc)
index 6a0ca4b2b0706671d1aeaabc1e8588a292e1e07a..a016e6037fda1ddbe90c6a9e14d8c35b13078cd2 100644 (file)
@@ -33,9 +33,6 @@
    The functions below implement debug registers sharing by reference
    counts, and allow to watch regions up to 16 bytes long.  */
 
-/* Whether or not to print the mirrored debug registers.  */
-int debug_hw_points;
-
 /* Low-level function vector.  */
 struct x86_dr_low_type x86_dr_low;
 
@@ -272,7 +269,7 @@ add_show_debug_regs_command (void)
   /* A maintenance command to enable printing the internal DRi mirror
      variables.  */
   add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
-                          &debug_hw_points, _("\
+                          &show_debug_regs, _("\
 Set whether to show variables that mirror the x86 debug registers."), _("\
 Show whether to show variables that mirror the x86 debug registers."), _("\
 Use \"on\" to enable, \"off\" to disable.\n\