From: teawater <teawater@gmail.com>
To: "Pedro Alves" <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org,
"Joel Brobecker" <brobecker@adacore.com>,
"Michael Snyder" <msnyder@vmware.com>
Subject: Re: [RFA] Displaced stepping just enable in non-stop mode
Date: Fri, 10 Oct 2008 03:38:00 -0000 [thread overview]
Message-ID: <daef60380810092037i403d9a5akb8077a4d63a6a437@mail.gmail.com> (raw)
In-Reply-To: <200810091549.26712.pedro@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 4112 bytes --]
Hi Pedro,
Thanks for your example, I make a new patch for infrun.c and other for manual.
2008-10-10 Hui Zhu <teawater@gmail.com>
Displaced stepping can be set to
auto (enable in non-stop mode), on, off.
* infrun.c (can_use_displaced_stepping): Change type to const
char pointer.
(can_use_displaced_stepping_auto): New string.
(can_use_displaced_stepping_on): New string.
(can_use_displaced_stepping_off): New string.
(can_use_displaced_stepping_enum): New array.
(show_can_use_displaced_stepping): In auto mode, also show the
current effect of the option.
(use_displaced_stepping): Return non-zero if displaced stepping
is auto, and can be used with GDBARCH, and in non-stop mode.
Return non-zero if displaced stepping is on, and can be used
with GDBARCH.
(_initialize_infrun): "can-use-displaced-stepping" function
change to add_setshow_enum_cmd.
2008-10-10 Hui Zhu <teawater@gmail.com>
* gdb.texinfo (can-use-displaced-stepping) Describe the auto mode
setting, and make it the default.
Thanks,
Hui
On Thu, Oct 9, 2008 at 22:49, Pedro Alves <pedro@codesourcery.com> wrote:
> Hi,
>
> Thanks for doing this.
>
> On Wednesday 08 October 2008 07:10:43, teawater wrote:
>
>> -int can_use_displaced_stepping = 1;
>> +const char can_use_displaced_stepping_auto[] = "auto";
>> +const char can_use_displaced_stepping_on[] = "on";
>> +const char can_use_displaced_stepping_off[] = "off";
>> +const char *can_use_displaced_stepping_enum[] =
>> +{
>> + can_use_displaced_stepping_auto,
>> + can_use_displaced_stepping_on,
>> + can_use_displaced_stepping_off,
>> + NULL,
>> +};
>> +const char *can_use_displaced_stepping = can_use_displaced_stepping_auto;
>
> Could you make these static while you're at it, please? It was just missed
> in the old boolean setting.
>
>> static void
>> show_can_use_displaced_stepping (struct ui_file *file, int from_tty,
>> struct cmd_list_element *c,
>> @@ -567,12 +579,16 @@ Debugger's willingness to use displaced
>> "breakpoints is %s.\n"), value);
>
> Could you update this function to show what effect the auto setting
> is currently having? See breakpoint.c:show_always_inserted_mode for
> an example.
>
>> }
>>
>> -/* Return non-zero if displaced stepping is enabled, and can be used
>> +/* Return non-zero if displaced stepping is auto, and can be used
>> + with GDBARCH, and in non-stop mode.
>> + Return non-zero if displaced stepping is on, and can be used
>> with GDBARCH. */
>> static int
>> use_displaced_stepping (struct gdbarch *gdbarch)
>> {
>> - return (can_use_displaced_stepping
>> + return (((can_use_displaced_stepping == can_use_displaced_stepping_auto
>> + && non_stop)
>> + || can_use_displaced_stepping == can_use_displaced_stepping_on)
>> && gdbarch_displaced_step_copy_insn_p (gdbarch));
>> }
>>
>> @@ -4857,11 +4873,14 @@ function is skipped and the step command
>> show_step_stop_if_no_debug,
>> &setlist, &showlist);
>>
>> - add_setshow_boolean_cmd ("can-use-displaced-stepping", class_maintenance,
>> + add_setshow_enum_cmd ("can-use-displaced-stepping", class_maintenance,
>> + can_use_displaced_stepping_enum,
>> &can_use_displaced_stepping, _("\
>> Set debugger's willingness to use displaced stepping."), _("\
>> Show debugger's willingness to use displaced stepping."), _("\
>> -If zero, gdb will not use displaced stepping to step over\n\
>> +If auto, gdb will auto use displaced stepping if it need (in non-stop mode).\n\
>> +If on, gdb will use displaced stepping if such is supported by the target.\n\
>> +If off, gdb will not use displaced stepping to step over\n\
>> breakpoints, even if such is supported by the target."),
>
> This also needs to be updated in the manual. I'd suggest borrowing the text
> from breakpoint.c's "always-inserted" command description to make it a
> bit more descriptive, and mention which mode is the default. Should mostly
> be a matter of copy-paste, I think.
>
> --
> Pedro Alves
>
[-- Attachment #2: displaced_step_non_step.txt --]
[-- Type: text/plain, Size: 4201 bytes --]
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2008-10-10 Hui Zhu <teawater@gmail.com>
+
+ Displaced stepping can be set to
+ auto (enable in non-stop mode), on, off.
+
+ * infrun.c (can_use_displaced_stepping): Change type to const
+ char pointer.
+ (can_use_displaced_stepping_auto): New string.
+ (can_use_displaced_stepping_on): New string.
+ (can_use_displaced_stepping_off): New string.
+ (can_use_displaced_stepping_enum): New array.
+ (show_can_use_displaced_stepping): In auto mode, also show the
+ current effect of the option.
+ (use_displaced_stepping): Return non-zero if displaced stepping
+ is auto, and can be used with GDBARCH, and in non-stop mode.
+ Return non-zero if displaced stepping is on, and can be used
+ with GDBARCH.
+ (_initialize_infrun): "can-use-displaced-stepping" function
+ change to add_setshow_enum_cmd.
+
2008-10-09 Pedro Alves <pedro@codesourcery.com>
* remote.c (remote_wait): Rename to...
--- a/infrun.c
+++ b/infrun.c
@@ -553,26 +553,50 @@ static CORE_ADDR displaced_step_original
/* Saved contents of copy area. */
static gdb_byte *displaced_step_saved_copy;
-/* When this is non-zero, we are allowed to use displaced stepping, if
- the architecture supports it. When this is zero, we use
+/* When this is auto, we are allowed to use displaced stepping,
+ If the architecture supports it and in non-stop mode.
+ When this is on, we are allowed to use displaced stepping, if
+ the architecture supports it. When this is off, we use
traditional the hold-and-step approach. */
-int can_use_displaced_stepping = 1;
+static const char can_use_displaced_stepping_auto[] = "auto";
+static const char can_use_displaced_stepping_on[] = "on";
+static const char can_use_displaced_stepping_off[] = "off";
+static const char *can_use_displaced_stepping_enum[] =
+{
+ can_use_displaced_stepping_auto,
+ can_use_displaced_stepping_on,
+ can_use_displaced_stepping_off,
+ NULL,
+};
+static const char *can_use_displaced_stepping =
+ can_use_displaced_stepping_auto;
static void
show_can_use_displaced_stepping (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- fprintf_filtered (file, _("\
-Debugger's willingness to use displaced stepping to step over "
-"breakpoints is %s.\n"), value);
+ if (can_use_displaced_stepping == can_use_displaced_stepping_auto)
+ {
+ fprintf_filtered (file, _("\
+Debugger's willingness to use displaced stepping to step over " "breakpoints is %s (currently %s).\n"), value, non_stop ? "on" : "off");
+ }
+ else
+ {
+ fprintf_filtered (file, _("\
+Debugger's willingness to use displaced stepping to step over " "breakpoints is %s.\n"), value);
+ }
}
-/* Return non-zero if displaced stepping is enabled, and can be used
+/* Return non-zero if displaced stepping is auto, and can be used
+ with GDBARCH, and in non-stop mode.
+ Return non-zero if displaced stepping is on, and can be used
with GDBARCH. */
static int
use_displaced_stepping (struct gdbarch *gdbarch)
{
- return (can_use_displaced_stepping
+ return (((can_use_displaced_stepping == can_use_displaced_stepping_auto
+ && non_stop)
+ || can_use_displaced_stepping == can_use_displaced_stepping_on)
&& gdbarch_displaced_step_copy_insn_p (gdbarch));
}
@@ -4857,11 +4881,14 @@ function is skipped and the step command
show_step_stop_if_no_debug,
&setlist, &showlist);
- add_setshow_boolean_cmd ("can-use-displaced-stepping", class_maintenance,
+ add_setshow_enum_cmd ("can-use-displaced-stepping", class_maintenance,
+ can_use_displaced_stepping_enum,
&can_use_displaced_stepping, _("\
Set debugger's willingness to use displaced stepping."), _("\
Show debugger's willingness to use displaced stepping."), _("\
-If zero, gdb will not use displaced stepping to step over\n\
+If auto, gdb will auto use displaced stepping if it need (in non-stop mode).\n\
+If on, gdb will use displaced stepping if such is supported by the target.\n\
+If off, gdb will not use displaced stepping to step over\n\
breakpoints, even if such is supported by the target."),
NULL,
show_can_use_displaced_stepping,
[-- Attachment #3: displaced_step_non_step_doc.txt --]
[-- Type: text/plain, Size: 1979 bytes --]
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-10 Hui Zhu <teawater@gmail.com>
+
+ * gdb.texinfo (can-use-displaced-stepping) Describe the auto mode
+ setting, and make it the default.
+
2008-10-06 Doug Evans <dje@google.com>
* gdb.texinfo (set debug dwarf2-die): Document it.
--- a/gdb.texinfo
+++ b/gdb.texinfo
@@ -23935,16 +23935,25 @@ Shared library events.
@kindex maint set can-use-displaced-stepping
@kindex maint show can-use-displaced-stepping
-@cindex displaced stepping support
-@cindex out-of-line single-stepping
-@item maint set can-use-displaced-stepping
-@itemx maint show can-use-displaced-stepping
-Control whether or not @value{GDBN} will do @dfn{displaced stepping}
-if the target supports it. The default is on. Displaced stepping is
-a way to single-step over breakpoints without removing them from the
-inferior, by executing an out-of-line copy of the instruction that was
-originally at the breakpoint location. It is also known as
-out-of-line single-stepping.
+@table @code
+@item maint set can-use-displaced-stepping on
+If the target supports it. Gdb behaves are single-step over
+breakpoints without removing them from the inferior, by executing
+an out-of-line copy of the instruction that was originally at the
+breakpoint location. It is also known as out-of-line single-stepping.
+
+@item maint set can-use-displaced-stepping off
+Gdb behaves are single-step over breakpoints with removing them from
+the inferior.
+
+@cindex non-stop mode, and @code{breakpoint always-inserted}
+@item maint set can-use-displaced-stepping 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{can-use-displaced-stepping} mode is on. If @value{GDBN} is
+controlling the inferior in all-stop mode, @value{GDBN} behaves as if
+@code{can-use-displaced-stepping} mode is off.
+@end table
@kindex maint check-symtabs
@item maint check-symtabs
next prev parent reply other threads:[~2008-10-10 3:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-07 6:27 teawater
2008-10-07 12:18 ` Joel Brobecker
2008-10-08 6:11 ` teawater
2008-10-09 14:50 ` Pedro Alves
2008-10-10 3:38 ` teawater [this message]
2008-10-14 7:36 ` teawater
2008-10-16 0:07 ` Pedro Alves
2008-10-16 2:29 ` teawater
2008-10-16 2:39 ` Daniel Jacobowitz
2008-10-16 2:59 ` Pedro Alves
2008-10-22 3:16 ` teawater
2008-10-22 19:48 ` Eli Zaretskii
2008-10-23 8:13 ` teawater
2008-10-23 12:57 ` Pedro Alves
2008-10-24 2:49 ` teawater
2008-10-16 8:13 ` Eli Zaretskii
2008-10-16 12:35 ` Daniel Jacobowitz
2008-10-16 18:27 ` Eli Zaretskii
2008-10-16 18:33 ` Daniel Jacobowitz
2008-10-16 21:19 ` Michael Snyder
2008-10-17 5:46 ` teawater
2008-10-17 10:02 ` Eli Zaretskii
2008-10-17 15:05 ` Pedro Alves
2008-10-17 16:09 ` teawater
2008-10-17 14:48 ` Pedro Alves
2008-10-17 16:01 ` teawater
2008-10-17 17:33 ` Michael Snyder
2008-10-17 19:47 ` Jakob Engblom
2008-10-17 19:49 ` Michael Snyder
2008-10-17 14:51 ` Pedro Alves
2008-10-17 15:53 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=daef60380810092037i403d9a5akb8077a4d63a6a437@mail.gmail.com \
--to=teawater@gmail.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
--cc=pedro@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox