From: Hui Zhu Date: Fri, 24 Oct 2008 02:31:41 +0000 (+0000) Subject: 2008-10-24 Hui Zhu X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fff08868842909b8dda5539656727196f812f7b1;p=binutils-gdb.git 2008-10-24 Hui Zhu Pedro Alves * 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. Return zero otherwise. (_initialize_infrun): Make the "set displaced-stepping" command an enum command. Change its class to class_run. Place it in the top level set list. Extend help to describe the auto mode. 2008-10-24 Hui Zhu Pedro Alves * gdb.texinfo (displaced-stepping): Describe the auto mode setting, and say it's the default. This is now a mainstream setting instead of a maintenance setting. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b8003a4121c..ff4264b0edb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2008-10-24 Hui Zhu + Pedro Alves + + * 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. Return zero otherwise. + (_initialize_infrun): Make the "set displaced-stepping" + command an enum command. Change its class to class_run. + Place it in the top level set list. Extend help to describe + the auto mode. + 2008-10-23 Pedro Alves * defs.h: Mention ptid_is_pid. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 56a04963054..7e350a769b6 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2008-10-24 Hui Zhu + Pedro Alves + + * gdb.texinfo (displaced-stepping): Describe the auto mode + setting, and say it's the default. This is now a mainstream + setting instead of a maintenance setting. + 2008-10-23 Pedro Alves * observer.texi (thread_stop_requested): New. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index c003cd4cd7d..6b5c2a5df19 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -24296,18 +24296,33 @@ Shared library events. @end table -@kindex maint set can-use-displaced-stepping -@kindex maint show can-use-displaced-stepping +@kindex set displaced-stepping +@kindex show 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 +@item set displaced-stepping +@itemx show 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. +if the target supports it. 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 set displaced-stepping on +If the target architecture supports it, @value{GDBN} will use +displaced stepping to step over breakpoints. + +@item set displaced-stepping off +@value{GDBN} will not use displaced stepping to step over breakpoints, +even if such is supported by the target architecture. + +@cindex non-stop mode, and @samp{set displaced-stepping} +@item set displaced-stepping auto +This is the default mode. @value{GDBN} will use displaced stepping +only if non-stop mode is active (@pxref{Non-Stop Mode}) and the target +architecture supports displaced stepping. +@end table @kindex maint check-symtabs @item maint check-symtabs diff --git a/gdb/infrun.c b/gdb/infrun.c index a6d42448d70..552c91f2c06 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -553,26 +553,55 @@ static CORE_ADDR displaced_step_original, displaced_step_copy; /* 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 - traditional the hold-and-step approach. */ -int can_use_displaced_stepping = 1; +/* Enum strings for "set|show displaced-stepping". */ + +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, +}; + +/* If ON, and the architecture supports it, GDB will use displaced + stepping to step over breakpoints. If OFF, or if the architecture + doesn't support it, GDB will instead use the traditional + hold-and-step approach. If AUTO (which is the default), GDB will + decide which technique to use to step over breakpoints depending on + which of all-stop or non-stop mode is active --- displaced stepping + in non-stop mode; hold-and-step in all-stop mode. */ + +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 - with GDBARCH. */ +/* Return non-zero if displaced stepping can/should be used to step + over breakpoints. */ + 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)); } @@ -5241,16 +5270,20 @@ function is skipped and the step command stops at a different source line."), show_step_stop_if_no_debug, &setlist, &showlist); - add_setshow_boolean_cmd ("can-use-displaced-stepping", class_maintenance, - &can_use_displaced_stepping, _("\ + add_setshow_enum_cmd ("displaced-stepping", class_run, + 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\ -breakpoints, even if such is supported by the target."), - NULL, - show_can_use_displaced_stepping, - &maintenance_set_cmdlist, - &maintenance_show_cmdlist); +If on, gdb will use displaced stepping to step over breakpoints if it is\n\ +supported by the target architecture. If off, gdb will not use displaced\n\ +stepping to step over breakpoints, even if such is supported by the target\n\ +architecture. If auto (which is the default), gdb will use displaced stepping\n\ +if the target architecture supports it and non-stop mode is active, but will not\n\ +use it in all-stop mode (see help set non-stop)."), + NULL, + show_can_use_displaced_stepping, + &setlist, &showlist); add_setshow_enum_cmd ("exec-direction", class_run, exec_direction_names, &exec_direction, _("Set direction of execution.\n\