Honour PRIVATE keyword
[deliverable/binutils-gdb.git] / gdb / breakpoint.c
index 3c7ba46ed3cf72a5873fdb870e3b941cf8511408..01a46b39f41973790188e1524de6e804d1e09c53 100644 (file)
@@ -212,6 +212,12 @@ static void ep_skip_leading_whitespace (char **s);
    if such is available. */
 static int can_use_hw_watchpoints;
 
+/* If AUTO_BOOLEAN_FALSE, gdb will not attempt to create pending breakpoints.
+   If AUTO_BOOLEAN_TRUE, gdb will automatically create pending breakpoints
+   for unrecognized breakpoint locations.  
+   If AUTO_BOOLEAN_AUTO, gdb will query when breakpoints are unrecognized.  */
+static enum auto_boolean pending_break_support;
+
 void _initialize_breakpoint (void);
 
 extern int addressprint;       /* Print machine addresses? */
@@ -3471,13 +3477,7 @@ print_one_breakpoint (struct breakpoint *b,
          {
            annotate_field (4);
            if (b->pending)
-             {
-               ui_out_field_string (uiout, "addr", "<PENDING>");
-               if (TARGET_ADDR_BIT <= 32)
-                 ui_out_spaces (uiout, 2);
-               else
-                 ui_out_spaces (uiout, 8);
-             }
+             ui_out_field_string (uiout, "addr", "<PENDING>");
            else
              ui_out_field_core_addr (uiout, "addr", b->loc->address);
          }
@@ -4269,61 +4269,6 @@ remove_thread_event_breakpoints (void)
       delete_breakpoint (b);
 }
 
-#ifdef SOLIB_ADD
-void
-remove_solib_event_breakpoints (void)
-{
-  struct breakpoint *b, *temp;
-
-  ALL_BREAKPOINTS_SAFE (b, temp)
-    if (b->type == bp_shlib_event)
-      delete_breakpoint (b);
-}
-
-struct breakpoint *
-create_solib_event_breakpoint (CORE_ADDR address)
-{
-  struct breakpoint *b;
-
-  b = create_internal_breakpoint (address, bp_shlib_event);
-  return b;
-}
-
-/* Disable any breakpoints that are on code in shared libraries.  Only
-   apply to enabled breakpoints, disabled ones can just stay disabled.  */
-
-void
-disable_breakpoints_in_shlibs (int silent)
-{
-  struct breakpoint *b;
-  int disabled_shlib_breaks = 0;
-
-  /* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK. */
-  ALL_BREAKPOINTS (b)
-  {
-#if defined (PC_SOLIB)
-    if (((b->type == bp_breakpoint) ||
-        (b->type == bp_hardware_breakpoint)) &&
-       breakpoint_enabled (b) &&
-       !b->loc->duplicate &&
-       PC_SOLIB (b->loc->address))
-      {
-       b->enable_state = bp_shlib_disabled;
-       if (!silent)
-         {
-           if (!disabled_shlib_breaks)
-             {
-               target_terminal_ours_for_output ();
-               warning ("Temporarily disabling shared library breakpoints:");
-             }
-           disabled_shlib_breaks = 1;
-           warning ("breakpoint #%d ", b->number);
-         }
-      }
-#endif
-  }
-}
-
 struct captured_parse_breakpoint_args
   {
     char **arg_p;
@@ -4384,6 +4329,61 @@ resolve_pending_breakpoint (struct breakpoint *b)
   return rc;
 }
 
+#ifdef SOLIB_ADD
+void
+remove_solib_event_breakpoints (void)
+{
+  struct breakpoint *b, *temp;
+
+  ALL_BREAKPOINTS_SAFE (b, temp)
+    if (b->type == bp_shlib_event)
+      delete_breakpoint (b);
+}
+
+struct breakpoint *
+create_solib_event_breakpoint (CORE_ADDR address)
+{
+  struct breakpoint *b;
+
+  b = create_internal_breakpoint (address, bp_shlib_event);
+  return b;
+}
+
+/* Disable any breakpoints that are on code in shared libraries.  Only
+   apply to enabled breakpoints, disabled ones can just stay disabled.  */
+
+void
+disable_breakpoints_in_shlibs (int silent)
+{
+  struct breakpoint *b;
+  int disabled_shlib_breaks = 0;
+
+  /* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK. */
+  ALL_BREAKPOINTS (b)
+  {
+#if defined (PC_SOLIB)
+    if (((b->type == bp_breakpoint) ||
+        (b->type == bp_hardware_breakpoint)) &&
+       breakpoint_enabled (b) &&
+       !b->loc->duplicate &&
+       PC_SOLIB (b->loc->address))
+      {
+       b->enable_state = bp_shlib_disabled;
+       if (!silent)
+         {
+           if (!disabled_shlib_breaks)
+             {
+               target_terminal_ours_for_output ();
+               warning ("Temporarily disabling shared library breakpoints:");
+             }
+           disabled_shlib_breaks = 1;
+           warning ("breakpoint #%d ", b->number);
+         }
+      }
+#endif
+  }
+}
+
 /* Try to reenable any breakpoints in shared libraries.  */
 void
 re_enable_breakpoints_in_shlibs (void)
@@ -5103,8 +5103,22 @@ break_command_1 (char *arg, int flag, int from_tty, struct breakpoint *pending_b
 
          error_output_message (NULL, err_msg);
          xfree (err_msg);
-         if (!query ("Make breakpoint pending on future shared library load? "))
+
+         /* If pending breakpoint support is turned off, throw error.  */
+
+         if (pending_break_support == AUTO_BOOLEAN_FALSE)
+           throw_exception (RETURN_ERROR);
+
+          /* If pending breakpoint support is auto query and the user selects 
+            no, then simply return the error code.  */
+         if (pending_break_support == AUTO_BOOLEAN_AUTO && 
+             !nquery ("Make breakpoint pending on future shared library load? "))
            return rc;
+
+         /* At this point, either the user was queried about setting a 
+            pending breakpoint and selected yes, or pending breakpoint 
+            behavior is on and thus a pending breakpoint is defaulted 
+            on behalf of the user.  */
          copy_arg = xstrdup (addr_start);
          addr_string = &copy_arg;
          sals.nelts = 1;
@@ -7696,6 +7710,16 @@ enable_delete_command (char *args, int from_tty)
   map_breakpoint_numbers (args, enable_delete_breakpoint);
 }
 \f
+static void
+set_breakpoint_cmd (char *args, int from_tty)
+{
+}
+
+static void
+show_breakpoint_cmd (char *args, int from_tty)
+{
+}
+
 /* Use default_breakpoint_'s, or nothing if they aren't valid.  */
 
 struct symtabs_and_lines
@@ -7720,6 +7744,8 @@ decode_line_spec_1 (char *string, int funfirstline)
 void
 _initialize_breakpoint (void)
 {
+  static struct cmd_list_element *breakpoint_set_cmdlist;
+  static struct cmd_list_element *breakpoint_show_cmdlist;
   struct cmd_list_element *c;
 
   breakpoint_chain = 0;
@@ -8038,4 +8064,34 @@ hardware.)",
   add_show_from_set (c, &showlist);
 
   can_use_hw_watchpoints = 1;
+
+  add_prefix_cmd ("breakpoint", class_maintenance, set_breakpoint_cmd, "\
+Breakpoint specific settings\n\
+Configure various breakpoint-specific variables such as\n\
+pending breakpoint behavior",
+                 &breakpoint_set_cmdlist, "set breakpoint ",
+                 0/*allow-unknown*/, &setlist);
+  add_prefix_cmd ("breakpoint", class_maintenance, show_breakpoint_cmd, "\
+Breakpoint specific settings\n\
+Configure various breakpoint-specific variables such as\n\
+pending breakpoint behavior",
+                 &breakpoint_show_cmdlist, "show breakpoint ",
+                 0/*allow-unknown*/, &showlist);
+
+  add_setshow_auto_boolean_cmd ("pending", no_class, &pending_break_support, "\
+Set debugger's behavior regarding pending breakpoints.\n\
+If on, an unrecognized breakpoint location will cause gdb to create a\n\
+pending breakpoint.  If off, an unrecognized breakpoint location results in\n\
+an error.  If auto, an unrecognized breakpoint location results in a\n\
+user-query to see if a pending breakpoint should be created.","\
+Show debugger's behavior regarding pending breakpoints.\n\
+If on, an unrecognized breakpoint location will cause gdb to create a\n\
+pending breakpoint.  If off, an unrecognized breakpoint location results in\n\
+an error.  If auto, an unrecognized breakpoint location results in a\n\
+user-query to see if a pending breakpoint should be created.",
+                               NULL, NULL,
+                               &breakpoint_set_cmdlist,
+                               &breakpoint_show_cmdlist);
+
+  pending_break_support = AUTO_BOOLEAN_AUTO;
 }
This page took 0.025983 seconds and 4 git commands to generate.