gdb/
authorPedro Alves <palves@redhat.com>
Wed, 13 Aug 2008 13:58:45 +0000 (13:58 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 13 Aug 2008 13:58:45 +0000 (13:58 +0000)
* breakpoint.c (always_inserted_auto, always_inserted_on)
(always_inserted_off, always_inserted_enums): New.
(always_inserted_mode): Change type to char* and point to
always_inserted_auto.
(show_always_inserted_mode): In auto mode, also show the current
effect of the option.
(breakpoints_always_inserted_mode): Adjust for the new auto mode.
(_initialize_breakpoint): Make the "set breakpoints
always-inserted" command an enum command.  Extend help to describe
the auto mode.

gdb/doc/
* gdb.texinfo (breakpoint always-inserted) Describe the auto mode
setting, and make it the default.
(Non-Stop Mode): Remove "set breakpoints always-inserted 1" from
non-stop script example.

gdb/ChangeLog
gdb/breakpoint.c
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo

index eed32da..ca1a7ef 100644 (file)
@@ -1,3 +1,16 @@
+2008-08-13  Pedro Alves  <pedro@codesourcery.com>
+
+       * breakpoint.c (always_inserted_auto, always_inserted_on)
+       (always_inserted_off, always_inserted_enums): New.
+       (always_inserted_mode): Change type to char* and point to
+       always_inserted_auto.
+       (show_always_inserted_mode): In auto mode, also show the current
+       effect of the option.
+       (breakpoints_always_inserted_mode): Adjust for the new auto mode.
+       (_initialize_breakpoint): Make the "set breakpoints
+       always-inserted" command an enum command.  Extend help to describe
+       the auto mode.
+
 2008-08-13  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * spu-tdep.c (info_spu_dma_command): Respect TSQV (tag status
index 2a10d61..9bd8c6d 100644 (file)
@@ -249,18 +249,41 @@ Automatic usage of hardware breakpoints is %s.\n"),
                    value);
 }
 
-/* If 1, gdb will keep breakpoints inserted even as inferior is stopped, 
-   and immediately insert any new breakpoints.  If 0, gdb will insert 
-   breakpoints into inferior only when resuming it, and will remove 
-   breakpoints upon stop.  */
-static int always_inserted_mode = 0;
-static void 
+/* If on, gdb will keep breakpoints inserted even as inferior is
+   stopped, and immediately insert any new breakpoints.  If off, gdb
+   will insert breakpoints into inferior only when resuming it, and
+   will remove breakpoints upon stop.  If auto, GDB will behave as ON
+   if in non-stop mode, and as OFF if all-stop mode.*/
+
+static const char always_inserted_auto[] = "auto";
+static const char always_inserted_on[] = "on";
+static const char always_inserted_off[] = "off";
+static const char *always_inserted_enums[] = {
+  always_inserted_auto,
+  always_inserted_off,
+  always_inserted_on,
+  NULL
+};
+static const char *always_inserted_mode = always_inserted_auto;
+static void
 show_always_inserted_mode (struct ui_file *file, int from_tty,
-                          struct cmd_list_element *c, const char *value)
+                    struct cmd_list_element *c, const char *value)
 {
-  fprintf_filtered (file, _("Always inserted breakpoint mode is %s.\n"), value);
+  if (always_inserted_mode == always_inserted_auto)
+    fprintf_filtered (file, _("\
+Always inserted breakpoint mode is %s (currently %s).\n"),
+                     value,
+                     breakpoints_always_inserted_mode () ? "on" : "off");
+  else
+    fprintf_filtered (file, _("Always inserted breakpoint mode is %s.\n"), value);
 }
 
+int
+breakpoints_always_inserted_mode (void)
+{
+  return (always_inserted_mode == always_inserted_on
+         || (always_inserted_mode == always_inserted_auto && non_stop));
+}
 
 void _initialize_breakpoint (void);
 
@@ -8197,11 +8220,6 @@ single_step_breakpoint_inserted_here_p (CORE_ADDR pc)
   return 0;
 }
 
-int breakpoints_always_inserted_mode (void)
-{
-  return always_inserted_mode;
-}
-
 \f
 /* This help string is used for the break, hbreak, tbreak and thbreak commands.
    It is defined as a macro to prevent duplication.
@@ -8604,14 +8622,18 @@ a warning will be emitted for such breakpoints."),
                           &breakpoint_set_cmdlist,
                           &breakpoint_show_cmdlist);
 
-  add_setshow_boolean_cmd ("always-inserted", class_support,
-                          &always_inserted_mode, _("\
+  add_setshow_enum_cmd ("always-inserted", class_support,
+                       always_inserted_enums, &always_inserted_mode, _("\
 Set mode for inserting breakpoints."), _("\
 Show mode for inserting breakpoints."), _("\
-When this mode is off (which is the default), breakpoints are inserted in\n\
-inferior when it is resumed, and removed when execution stops.  When this\n\
-mode is on, breakpoints are inserted immediately and removed only when\n\
-the user deletes the breakpoint."),
+When this mode is off, breakpoints are inserted in inferior when it is\n\
+resumed, and removed when execution stops.  When this mode is on,\n\
+breakpoints are inserted immediately and removed only when the user\n\
+deletes the breakpoint.  When this mode is auto (which is the default),\n\
+the behaviour depends on the non-stop setting (see help set non-stop).\n\
+In this case, if gdb is controlling the inferior in non-stop mode, gdb\n\
+behaves as if always-inserted mode is on; if gdb is controlling the\n\
+inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
                           NULL,
                           &show_always_inserted_mode,
                           &breakpoint_set_cmdlist,
index 5b13fb2..f17217e 100644 (file)
@@ -1,3 +1,10 @@
+2008-08-13  Pedro Alves  <pedro@codesourcery.com>
+
+       * gdb.texinfo (breakpoint always-inserted) Describe the auto mode
+       setting, and make it the default.
+       (Non-Stop Mode): Remove "set breakpoints always-inserted 1" from
+       non-stop script example.
+
 2008-08-12  Thiago Jung Bauermann  <bauerman@br.ibm.com>
 
        * gdbint.texinfo (Raw and Virtual Register Representations): Fix
index 8cbef2f..5c851ee 100644 (file)
@@ -3313,15 +3313,23 @@ This behavior can be controlled with the following commands::
 @kindex show breakpoint always-inserted
 @table @code
 @item set breakpoint always-inserted off
-This is the default behaviour.  All breakpoints, including newly added
-by the user, are inserted in the target only when the target is
-resumed.  All breakpoints are removed from the target when it stops.
+All breakpoints, including newly added by the user, are inserted in
+the target only when the target is resumed.  All breakpoints are
+removed from the target when it stops.
 
 @item set breakpoint always-inserted on
 Causes all breakpoints to be inserted in the target at all times.  If
 the user adds a new breakpoint, or changes an existing breakpoint, the
 breakpoints in the target are updated immediately.  A breakpoint is
 removed from the target only when breakpoint itself is removed.
+
+@cindex non-stop mode, and @code{breakpoint always-inserted}
+@item set breakpoint always-inserted auto
+This is the default mode.  If @value{GDBN} is controlling the inferior
+in non-stop mode (@pxref{Non-Stop Mode}), gdb behaves as if
+@code{breakpoint always-inserted} mode is on.  If @value{GDBN} is
+controlling the inferior in all-stop mode, @value{GDBN} behaves as if
+@code{breakpoint always-inserted} mode is off.
 @end table
 
 @cindex negative breakpoint numbers
@@ -4571,9 +4579,6 @@ or attach to your program:
 # For target remote, use remote-async instead of linux-async.
 maint set linux-async 1
 
-# With non-stop, breakpoints have to be always inserted.
-set breakpoint always-inserted 1
-
 # If using the CLI, pagination breaks non-stop.
 set pagination off