From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17344 invoked by alias); 12 Aug 2008 01:52:38 -0000 Received: (qmail 17325 invoked by uid 22791); 12 Aug 2008 01:52:35 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 12 Aug 2008 01:52:00 +0000 Received: (qmail 601 invoked from network); 12 Aug 2008 01:51:58 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 12 Aug 2008 01:51:58 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: Add a third mode to "breakpoints always-inserted", and make it the default Date: Tue, 12 Aug 2008 01:52:00 -0000 User-Agent: KMail/1.9.9 References: <200808120034.25338.pedro@codesourcery.com> In-Reply-To: <200808120034.25338.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_GzOoIxfWCLnCXpM" Message-Id: <200808120252.06475.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00309.txt.bz2 --Boundary-00=_GzOoIxfWCLnCXpM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 2003 Sandra has checked in the initial non-stop user docs, which include an example of the list of commands currently needed to enable non-stop in the CLI. I'm updating this patch to remove the "set breakpoints always-inserted 1" line, because if this patch is installed, it is not needed anymore by default. On Tuesday 12 August 2008 00:34:24, Pedro Alves wrote: > Non-stop mode requires that breakpoints always be inserted > in the inferior. We currently set that with "set breakpoints > always-inserted" prior to switching to non-stop mode with "set non-stop > on". > > The default setting of "set breakpoints always-inserted" is "off", > as that is how GDB has been behaving for ages. > > Since non-stop requires breakpoints always-in, its just cumbersome > to have to issue more than one command to enable non-stop mode. > > So, this patch changes the "set breakpoints always-inserted" setting to > be a three-state. on and off, the same as before, and a new mode, > "follow-non-stop". In the latter mode, GDB will behave as "on", if > we're in non-stop mode, and as "off" if we're in all-stop mode. > > This mode will be the default. > > (gdb) show non-stop > Controlling the inferior in non-stop mode is off. > > We're in all-stop. > > (gdb) show breakpoint always-inserted > Always inserted breakpoint mode is follow-non-stop (currently off). > > GDB shows that the effect is as if "off". > > (gdb) set non-stop on > > Turns non-stop on. > > (gdb) show breakpoint always-inserted > Always inserted breakpoint mode is follow-non-stop (currently on). > > GDB shows that the effect is as if "on". > > (gdb) set non-stop off > > Back to all-stop. > > (gdb) set breakpoint always-inserted on > > Force "on". Useful for testing. > > (gdb) show breakpoint always-inserted > Always inserted breakpoint mode is on. > > Now GDB shows that "on", independently of the non-stop mode. > > What do you think? > > If the idea is sound, does the patch look ok? > How about the docs? -- Pedro Alves --Boundary-00=_GzOoIxfWCLnCXpM Content-Type: text/x-diff; charset="utf-8"; name="always_in_non_stop.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="always_in_non_stop.diff" Content-length: 6441 gdb/ 2008-08-12 Pedro Alves * breakpoint.c (always_inserted_follow_non_stop) (always_inserted_on, always_inserted_off, always_inserted_enums): New. (always_inserted_mode): Change type to char* and point to always_inserted_follow_non_stop. (show_always_inserted_mode): In follow-non-stop mode, also show the current effect of the option. (breakpoints_always_inserted_mode): Adjust for the new follow_non_stop mode mode. (_initialize_breakpoint): Make the "set breakpoints always-inserted" command an enum command. Extend help to describe the follow-non-stop mode. gdb/doc/ 2008-08-12 Pedro Alves * gdb.texinfo (breakpoint always-inserted) Describe the follow-non-stop mode setting, and make it the default. (Non-Stop Mode): Remove "set breakpoints always-inserted 1" from non-stop script example. --- gdb/breakpoint.c | 61 +++++++++++++++++++++++++++++++++++----------------- gdb/doc/gdb.texinfo | 15 +++++++----- 2 files changed, 51 insertions(+), 25 deletions(-) Index: src/gdb/breakpoint.c =================================================================== --- src.orig/gdb/breakpoint.c 2008-08-12 02:44:25.000000000 +0100 +++ src/gdb/breakpoint.c 2008-08-12 02:45:37.000000000 +0100 @@ -249,18 +249,41 @@ Automatic usage of hardware breakpoints 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 follow-non-stop, GDB will + behave as ON if in non-stop mode, and as OFF if all-stop mode.*/ + +static const char always_inserted_follow_non_stop[] = "follow-non-stop"; +static const char always_inserted_on[] = "on"; +static const char always_inserted_off[] = "off"; +static const char *always_inserted_enums[] = { + always_inserted_follow_non_stop, + always_inserted_off, + always_inserted_on, + NULL +}; +static const char *always_inserted_mode = always_inserted_follow_non_stop; +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_follow_non_stop) + fprintf_filtered (file, + _("Always inserted breakpoint mode is %s (currently %s).\n"), + value, non_stop ? "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_follow_non_stop + && non_stop)); +} void _initialize_breakpoint (void); @@ -8197,11 +8220,6 @@ single_step_breakpoint_inserted_here_p ( return 0; } -int breakpoints_always_inserted_mode (void) -{ - return always_inserted_mode; -} - /* 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,19 @@ a warning will be emitted for such break &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 follow-non-stop\n\ +(which is the default), the behaviour depends on the non-stop\n\ +setting (see help set non-stop). In this case, if gdb is controlling\n\ +the inferior in non-stop mode, gdb behaves as if always-inserted mode\n\ +is on; if gdb is controlling the inferior in all-stop mode, gdb behaves\n\ +as if always-inserted mode is off."), NULL, &show_always_inserted_mode, &breakpoint_set_cmdlist, Index: src/gdb/doc/gdb.texinfo =================================================================== --- src.orig/gdb/doc/gdb.texinfo 2008-08-12 02:44:56.000000000 +0100 +++ src/gdb/doc/gdb.texinfo 2008-08-12 02:46:45.000000000 +0100 @@ -3312,10 +3312,16 @@ This behavior can be controlled with the @kindex set breakpoint always-inserted @kindex show breakpoint always-inserted @table @code +@item set breakpoint always-inserted follow-non-stop +This is the default mode. If gdb is controlling the inferior in +non-stop mode (@pxref{Non-Stop Mode}), gdb behaves as if +always-inserted mode is on. If gdb is controlling the inferior in +all-stop mode, gdb behaves as if always-inserted mode is off. + @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 @@ -4571,9 +4577,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 --Boundary-00=_GzOoIxfWCLnCXpM--