* Add a third mode to "breakpoints always-inserted", and make it the default
@ 2008-08-11 23:34 Pedro Alves
2008-08-12 1:52 ` Pedro Alves
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Pedro Alves @ 2008-08-11 23:34 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1554 bytes --]
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
[-- Attachment #2: always_in_non_stop.diff --]
[-- Type: text/x-diff, Size: 5792 bytes --]
gdb/
2008-08-12 Pedro Alves <pedro@codesourcery.com>
* 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 <pedro@codesourcery.com>
* gdb.texinfo (breakpoint always-inserted) Describe the
follow-non-stop mode setting, and make it the default.
---
gdb/breakpoint.c | 61 +++++++++++++++++++++++++++++++++++-----------------
gdb/doc/gdb.texinfo | 8 +++++-
2 files changed, 49 insertions(+), 20 deletions(-)
Index: src/gdb/breakpoint.c
===================================================================
--- src.orig/gdb/breakpoint.c 2008-08-11 23:25:14.000000000 +0100
+++ src/gdb/breakpoint.c 2008-08-12 00:28:50.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;
-}
-
\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,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-11 23:56:19.000000000 +0100
+++ src/gdb/doc/gdb.texinfo 2008-08-12 00:30:55.000000000 +0100
@@ -3321,8 +3321,14 @@ 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
+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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-11 23:34 Add a third mode to "breakpoints always-inserted", and make it the default Pedro Alves
@ 2008-08-12 1:52 ` Pedro Alves
2008-08-12 6:23 ` Vladimir Prus
2008-08-12 18:18 ` Eli Zaretskii
2 siblings, 0 replies; 12+ messages in thread
From: Pedro Alves @ 2008-08-12 1:52 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 2003 bytes --]
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
[-- Attachment #2: always_in_non_stop.diff --]
[-- Type: text/x-diff, Size: 6441 bytes --]
gdb/
2008-08-12 Pedro Alves <pedro@codesourcery.com>
* 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 <pedro@codesourcery.com>
* 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;
-}
-
\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,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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-11 23:34 Add a third mode to "breakpoints always-inserted", and make it the default Pedro Alves
2008-08-12 1:52 ` Pedro Alves
@ 2008-08-12 6:23 ` Vladimir Prus
2008-08-12 18:18 ` Eli Zaretskii
2 siblings, 0 replies; 12+ messages in thread
From: Vladimir Prus @ 2008-08-12 6:23 UTC (permalink / raw)
To: gdb-patches
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?
Well, this is smart, but do we need it? As I've said in earlier email, I'm no
longer sure we need one command to enable everything.
- Volodya
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-11 23:34 Add a third mode to "breakpoints always-inserted", and make it the default Pedro Alves
2008-08-12 1:52 ` Pedro Alves
2008-08-12 6:23 ` Vladimir Prus
@ 2008-08-12 18:18 ` Eli Zaretskii
2008-08-12 20:07 ` Pedro Alves
2 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2008-08-12 18:18 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
> From: Pedro Alves <pedro@codesourcery.com>
> Date: Tue, 12 Aug 2008 00:34:24 +0100
>
> 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".
How about calling this state "auto"?
> 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.
I think _behave_ as "on" is not a good idea. I suggest that it
actually _set_ the option "on". That way, code elsewhere will need
only to look at a single option, and won't need to know that if the
value is follow-non-stop, it needs to check another flag.
> +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.
We don't use a literal "gdb" in the manual, we use "@value{GDBN}".
Also, it would be helpful to have an index entry here, something like
@cindex non-stop mode, and @code{breakpoint always-inserted}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-12 18:18 ` Eli Zaretskii
@ 2008-08-12 20:07 ` Pedro Alves
2008-08-12 20:12 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2008-08-12 20:07 UTC (permalink / raw)
To: gdb-patches, Eli Zaretskii
[-- Attachment #1: Type: text/plain, Size: 2243 bytes --]
Thanks Eli,
On Tuesday 12 August 2008 19:17:36, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > Date: Tue, 12 Aug 2008 00:34:24 +0100
> >
> > 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".
>
> How about calling this state "auto"?
I like it.
> > 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.
>
> I think _behave_ as "on" is not a good idea. I suggest that it
> actually _set_ the option "on". That way, code elsewhere will need
> only to look at a single option, and won't need to know that if the
> value is follow-non-stop, it needs to check another flag.
All the common code already goes through this predicate:
+int
+breakpoints_always_inserted_mode (void)
+{
+ return (always_inserted_mode == always_inserted_on
+ || (always_inserted_mode == always_inserted_follow_non_stop
+ && non_stop));
+}
-int breakpoints_always_inserted_mode (void)
-{
- return always_inserted_mode;
-}
-
Note that I didn't have to touch any of infrun.c, or breakpoint
management functions in breakpoint.c, where the predicate is checked.
If I kept it as an boolean, I'd have to instead change the "set non-stop"
command implementation, which means I'd have to export a setter for the
internal breakpoint.c variable. Either way, one setting has to know
about the other. This way seemed more centralised.
In any case, I can't seem to come up with a sentence that
describes the auto behaviour without using "behaves as". If you can
suggest any, I'd appreciate it.
> > +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.
>
> We don't use a literal "gdb" in the manual, we use "@value{GDBN}".
Ooops. Fixed.
>
> Also, it would be helpful to have an index entry here, something like
>
> @cindex non-stop mode, and @code{breakpoint always-inserted}
Done, and done, I think.
--
Pedro Alves
[-- Attachment #2: always_in_non_stop.diff --]
[-- Type: text/x-diff, Size: 6562 bytes --]
gdb/
2008-08-12 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.
gdb/doc/
2008-08-12 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.
---
gdb/breakpoint.c | 59 +++++++++++++++++++++++++++++++++++-----------------
gdb/doc/gdb.texinfo | 17 +++++++++-----
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 20:35:20.000000000 +0100
@@ -249,18 +249,40 @@ 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 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, 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_auto && non_stop));
+}
void _initialize_breakpoint (void);
@@ -8197,11 +8219,6 @@ single_step_breakpoint_inserted_here_p (
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 +8621,18 @@ 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 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: 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 21:04:43.000000000 +0100
@@ -3313,15 +3313,23 @@ This behavior can be controlled with the
@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
+@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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-12 20:07 ` Pedro Alves
@ 2008-08-12 20:12 ` Daniel Jacobowitz
2008-08-12 20:37 ` Pedro Alves
2008-08-13 14:01 ` Pedro Alves
0 siblings, 2 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2008-08-12 20:12 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, Eli Zaretskii
On Tue, Aug 12, 2008 at 09:07:19PM +0100, Pedro Alves wrote:
> > How about calling this state "auto"?
>
> I like it.
Me, too.
>
> > > 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.
> >
> > I think _behave_ as "on" is not a good idea. I suggest that it
> > actually _set_ the option "on". That way, code elsewhere will need
> > only to look at a single option, and won't need to know that if the
> > value is follow-non-stop, it needs to check another flag.
>
> All the common code already goes through this predicate:
>
> +int
> +breakpoints_always_inserted_mode (void)
> +{
> + return (always_inserted_mode == always_inserted_on
> + || (always_inserted_mode == always_inserted_follow_non_stop
> + && non_stop));
> +}
> -int breakpoints_always_inserted_mode (void)
> -{
> - return always_inserted_mode;
> -}
> -
>
> Note that I didn't have to touch any of infrun.c, or breakpoint
> management functions in breakpoint.c, where the predicate is checked.
>
> If I kept it as an boolean, I'd have to instead change the "set non-stop"
> command implementation, which means I'd have to export a setter for the
> internal breakpoint.c variable. Either way, one setting has to know
> about the other. This way seemed more centralised.
>
> In any case, I can't seem to come up with a sentence that
> describes the auto behaviour without using "behaves as". If you can
> suggest any, I'd appreciate it.
>
> > > +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.
> >
> > We don't use a literal "gdb" in the manual, we use "@value{GDBN}".
>
> Ooops. Fixed.
>
> >
> > Also, it would be helpful to have an index entry here, something like
> >
> > @cindex non-stop mode, and @code{breakpoint always-inserted}
>
> Done, and done, I think.
No, you added:
> +@cindex non-stop mode
I'm sure that one doesn't go here :-)
> + if (always_inserted_mode == always_inserted_auto)
> + fprintf_filtered (file,
> + _("Always inserted breakpoint mode is %s (currently %s).\n"),
> + value, non_stop ? "on" : "off");
I suggest calling breakpoints_always_inserted_mode here instead of
checking non_stop.
Otherwise, the code looks fine - though I'd like to reach an agreement
with Vladimir about set non-stop first.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-12 20:12 ` Daniel Jacobowitz
@ 2008-08-12 20:37 ` Pedro Alves
2008-08-12 20:41 ` Daniel Jacobowitz
2008-08-13 14:01 ` Pedro Alves
1 sibling, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2008-08-12 20:37 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, Eli Zaretskii
On Tuesday 12 August 2008 21:11:33, Daniel Jacobowitz wrote:
> On Tue, Aug 12, 2008 at 09:07:19PM +0100, Pedro Alves wrote:
> > > Also, it would be helpful to have an index entry here, something like
> > >
> > > @cindex non-stop mode, and @code{breakpoint always-inserted}
> >
> > Done, and done, I think.
>
> No, you added:
> > +@cindex non-stop mode
>
> I'm sure that one doesn't go here :-)
>
Where does it go then? I generated html, and I see two "non-stop mode"
index entries, one of them points here, to the auto option, the other
points to the "set non-stop mode" option.
> > + if (always_inserted_mode == always_inserted_auto)
> > + fprintf_filtered (file,
> > + _("Always inserted breakpoint mode is %s (currently %s).\n"),
> > + value, non_stop ? "on" : "off");
>
> I suggest calling breakpoints_always_inserted_mode here instead of
> checking non_stop.
Sure.
>
> Otherwise, the code looks fine - though I'd like to reach an agreement
> with Vladimir about set non-stop first.
Certainly.
--
Pedro Alves
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-12 20:37 ` Pedro Alves
@ 2008-08-12 20:41 ` Daniel Jacobowitz
2008-08-12 21:45 ` Pedro Alves
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2008-08-12 20:41 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, Eli Zaretskii
On Tue, Aug 12, 2008 at 09:37:00PM +0100, Pedro Alves wrote:
> On Tuesday 12 August 2008 21:11:33, Daniel Jacobowitz wrote:
> > On Tue, Aug 12, 2008 at 09:07:19PM +0100, Pedro Alves wrote:
>
> > > > Also, it would be helpful to have an index entry here, something like
> > > >
> > > > @cindex non-stop mode, and @code{breakpoint always-inserted}
> > >
> > > Done, and done, I think.
> >
> > No, you added:
> > > +@cindex non-stop mode
> >
> > I'm sure that one doesn't go here :-)
> >
>
> Where does it go then? I generated html, and I see two "non-stop mode"
> index entries, one of them points here, to the auto option, the other
> points to the "set non-stop mode" option.
Compare the line you added to the line Eli suggested? Eli's version
will add an index entry for "non-stop mode, and breakpoint
always-inserted".
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-12 20:41 ` Daniel Jacobowitz
@ 2008-08-12 21:45 ` Pedro Alves
2008-08-12 23:06 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: Pedro Alves @ 2008-08-12 21:45 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, Eli Zaretskii
[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]
On Tuesday 12 August 2008 21:40:26, Daniel Jacobowitz wrote:
> On Tue, Aug 12, 2008 at 09:37:00PM +0100, Pedro Alves wrote:
> > On Tuesday 12 August 2008 21:11:33, Daniel Jacobowitz wrote:
> > > On Tue, Aug 12, 2008 at 09:07:19PM +0100, Pedro Alves wrote:
> > > > > Also, it would be helpful to have an index entry here, something
> > > > > like
> > > > >
> > > > > @cindex non-stop mode, and @code{breakpoint always-inserted}
> > > >
> > > > Done, and done, I think.
> > >
> > > No, you added:
> > > > +@cindex non-stop mode
> > >
> > > I'm sure that one doesn't go here :-)
> >
> > Where does it go then? I generated html, and I see two "non-stop mode"
> > index entries, one of them points here, to the auto option, the other
> > points to the "set non-stop mode" option.
>
> Compare the line you added to the line Eli suggested? Eli's version
> will add an index entry for "non-stop mode, and breakpoint
> always-inserted".
Somehow, I understood that he meant two separate issues: add
a cindex; and, wrap the always-inserted references in @code.
Then, I understood that you meant that I should add that line
somewhere else, a bit above, or down...
oh, well...
--
Pedro Alves
[-- Attachment #2: always_in_non_stop.diff --]
[-- Type: text/x-diff, Size: 6631 bytes --]
gdb/
2008-08-12 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.
gdb/doc/
2008-08-12 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.
---
gdb/breakpoint.c | 60 +++++++++++++++++++++++++++++++++++-----------------
gdb/doc/gdb.texinfo | 17 +++++++++-----
2 files changed, 52 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 22:33:13.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 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 (
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 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 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: 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 22:31:49.000000000 +0100
@@ -3313,15 +3313,23 @@ This behavior can be controlled with the
@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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-12 21:45 ` Pedro Alves
@ 2008-08-12 23:06 ` Daniel Jacobowitz
2008-08-13 3:19 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2008-08-12 23:06 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, Eli Zaretskii
On Tue, Aug 12, 2008 at 10:45:22PM +0100, Pedro Alves wrote:
> Somehow, I understood that he meant two separate issues: add
> a cindex; and, wrap the always-inserted references in @code.
> Then, I understood that you meant that I should add that line
> somewhere else, a bit above, or down...
>
> oh, well...
Sorry - now you've got it!
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-12 23:06 ` Daniel Jacobowitz
@ 2008-08-13 3:19 ` Eli Zaretskii
0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2008-08-13 3:19 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: pedro, gdb-patches
> Date: Tue, 12 Aug 2008 19:05:58 -0400
> From: Daniel Jacobowitz <drow@false.org>
> Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
>
> On Tue, Aug 12, 2008 at 10:45:22PM +0100, Pedro Alves wrote:
> > Somehow, I understood that he meant two separate issues: add
> > a cindex; and, wrap the always-inserted references in @code.
> > Then, I understood that you meant that I should add that line
> > somewhere else, a bit above, or down...
> >
> > oh, well...
>
> Sorry - now you've got it!
Yes, the last version is what I meant.
(Having more than one index entry with exactly the same text is not a
good idea, since the reader will not know which one to choose.)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Add a third mode to "breakpoints always-inserted", and make it the default
2008-08-12 20:12 ` Daniel Jacobowitz
2008-08-12 20:37 ` Pedro Alves
@ 2008-08-13 14:01 ` Pedro Alves
1 sibling, 0 replies; 12+ messages in thread
From: Pedro Alves @ 2008-08-13 14:01 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, Eli Zaretskii
On Tuesday 12 August 2008 21:11:33, Daniel Jacobowitz wrote:
> Otherwise, the code looks fine - though I'd like to reach an agreement
> with Vladimir about set non-stop first.
We've talked about these issues on IRC, and agreed on a way forward.
There were no objections to the patch, so I checked it in.
Thanks,
--
Pedro Alves
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-08-13 14:01 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-11 23:34 Add a third mode to "breakpoints always-inserted", and make it the default Pedro Alves
2008-08-12 1:52 ` Pedro Alves
2008-08-12 6:23 ` Vladimir Prus
2008-08-12 18:18 ` Eli Zaretskii
2008-08-12 20:07 ` Pedro Alves
2008-08-12 20:12 ` Daniel Jacobowitz
2008-08-12 20:37 ` Pedro Alves
2008-08-12 20:41 ` Daniel Jacobowitz
2008-08-12 21:45 ` Pedro Alves
2008-08-12 23:06 ` Daniel Jacobowitz
2008-08-13 3:19 ` Eli Zaretskii
2008-08-13 14:01 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox