[RFA] set/show enable-software-singlestep

Michael Snyder msnyder@specifix.com
Tue Jun 24 19:32:00 GMT 2008


On Tue, 2008-06-24 at 14:29 -0400, Daniel Jacobowitz wrote:
> On Tue, Jun 24, 2008 at 11:18:54AM -0700, Michael Snyder wrote:
> > 2008-06-23  Michael Snyder  <msnyder@localhost.localdomain>
> > 
> > 	* gdbarch.c (enable_sw_ss): New mode variable.
> 
> This is a generated file...

D'oh!  Oh yeah...


> I recommend you leave the meaning of
> gdbarch_software_single_step_p alone, and do the adjustment at its caller.

Good suggestion.  How about the attached?

On Tue, 2008-06-24 at 21:42 +0300, Eli Zaretskii wrote: 
> It would be, if it were documented in the manual ;-)

I hear thee, O voice crying out in the wilderness.
I was just gonna... wait until we'd hashed out the user interface!
Yeah, that's my story...   ;-)


-------------- next part --------------
2008-06-23  Michael Snyder  <msnyder@specifix.com>

	* infrun.c (can_use_sw_ss): New mode variable.
	(show_can_use_sw_ss): New setshow helper function.
	(resume): Check for can-use-software-singlestep.
	(_initialize_infrun): Add set/show command for 
	can-use-software-singlestep.

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.281
diff -u -p -r1.281 infrun.c
--- infrun.c	13 Jun 2008 20:19:19 -0000	1.281
+++ infrun.c	24 Jun 2008 19:22:49 -0000
@@ -583,6 +583,21 @@ static CORE_ADDR displaced_step_original
 /* Saved contents of copy area.  */
 static gdb_byte *displaced_step_saved_copy;
 
+/* When this is non-zero (default), we are allowed to use software
+   singlestep, if the architecture supports it.  When zero, we will
+   use the normal singlestep model even if the architecture/abi would
+   not normally permit it.  */
+int can_use_sw_ss = 1;
+static void
+show_can_use_sw_ss (struct ui_file *file, int from_tty,
+		    struct cmd_list_element *c,
+		    const char *value)
+{
+  fprintf_filtered (file, _("\
+Debugger's willingness to use software singlestep is %s.\n"),
+		    value);
+}
+
 /* 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.  */
@@ -947,9 +962,9 @@ a command like `return' or `jump' to con
 	return;
     }
 
-  if (step && gdbarch_software_single_step_p (gdbarch))
+  if (step && can_use_sw_ss && gdbarch_software_single_step_p (gdbarch))
     {
-      /* Do it the hard way, w/temp breakpoints */
+      /* Do it the hard way, w/temp breakpoints ("software singlestep").  */
       if (gdbarch_software_single_step (gdbarch, get_current_frame ()))
         {
           /* ...and don't ask hardware to do it.  */
@@ -4634,6 +4649,16 @@ breakpoints, even if such is supported b
 			    &maintenance_set_cmdlist,
 			   &maintenance_show_cmdlist);
 
+  add_setshow_boolean_cmd ("can-use-software-singlestep", class_maintenance, 
+			   &can_use_sw_ss, _("\
+Set debugger's willingness to use software singlestep."), _("\
+Show debugger's willingness to use software singlestep."), _("\
+If zero, gdb will not use software singlestep, even if\n\
+the architecture API would seem to call for it."),
+			   NULL,
+			   show_can_use_sw_ss,
+			   &maintenance_set_cmdlist,
+			   &maintenance_show_cmdlist);
 
   /* ptid initializations */
   null_ptid = ptid_build (0, 0, 0);


More information about the Gdb-patches mailing list