This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] 'set step-mode' to control the step command.
- To: gdb-patches at sources dot redhat dot com
- Subject: [RFA] 'set step-mode' to control the step command.
- From: Christopher Faylor <cgf at redhat dot com>
- Date: Mon, 6 Nov 2000 14:46:34 -0500
This patch is from a net contributor (assignment on file) who has added
an interesting new feature. To quote:
"Set mode of the step operation. When set, doing a step on a function
without debug line information will stop at the first instruction of
that function. Otherwise, the function is skipped and the step command
stops at a different source line."
Does this look reasonable?
cgf
Mon Nov 6 14:34:37 2000 Stephane Carrez <Stephane.Carrez@sun.com>
* inferior.h (step_stop_if_no_debug): New variable.
* infrun.c (step_stop_if_no_debug): Declare.
(handle_inferior_event): Stop the step command if we entered
a function without line info.
(_initialize_infrun): New command 'set step-mode' to control
the step command.
* infcmd.c (step_once): Switch to stepi mode if there is no line
info (and switching is enabled).
Index: inferior.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/inferior.h,v
retrieving revision 1.86
retrieving revision 1.86.14.2
diff -u -p -r1.86 -r1.86.14.2
--- inferior.h 2000/08/01 17:38:48 1.86
+++ inferior.h 2000/11/02 00:40:20 1.86.14.2
@@ -125,6 +125,11 @@ extern void clear_proceed_status (void);
extern void proceed (CORE_ADDR, enum target_signal, int);
+/* When set, stop the 'step' command if we enter a function which has
+ no line number information. The normal behavior is that we step
+ over such function. */
+extern int step_stop_if_no_debug;
+
extern void kill_inferior (void);
extern void generic_mourn_inferior (void);
Index: infrun.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/infrun.c,v
retrieving revision 1.287
retrieving revision 1.287.8.1
diff -u -p -r1.287 -r1.287.8.1
--- infrun.c 2000/09/07 12:34:15 1.287
+++ infrun.c 2000/10/30 23:55:20 1.287.8.1
@@ -84,6 +84,11 @@ void _initialize_infrun (void);
int inferior_ignoring_startup_exec_events = 0;
int inferior_ignoring_leading_exec_events = 0;
+/* When set, stop the 'step' command if we enter a function which has
+ no line number information. The normal behavior is that we step
+ over such function. */
+int step_stop_if_no_debug = 0;
+
/* In asynchronous mode, but simulating synchronous execution. */
int sync_execution = 0;
@@ -2810,6 +2815,18 @@ handle_inferior_event (struct execution_
return;
}
}
+
+ /* If we have no line number and the step-stop-if-no-debug
+ is set, we stop the step so that the user has a chance to
+ switch in assembly mode. */
+ if (step_over_calls < 0 && step_stop_if_no_debug)
+ {
+ stop_step = 1;
+ print_stop_reason (END_STEPPING_RANGE, 0);
+ stop_stepping (ecs);
+ return;
+ }
+
step_over_function (ecs);
keep_going (ecs);
return;
@@ -4308,5 +4325,14 @@ step == scheduler locked during every si
&setlist);
c->function.sfunc = set_schedlock_func; /* traps on target vector */
+ add_show_from_set (c, &showlist);
+
+ c = add_set_cmd ("step-mode", class_run,
+ var_boolean, (char*) &step_stop_if_no_debug,
+"Set mode of the step operation. When set, doing a step on a\n\
+function without debug line information will stop at the first\n\
+instruction of that function. Otherwise, the function is skipped and\n\
+the step command stops at a different source line.",
+ &setlist);
add_show_from_set (c, &showlist);
}
Index: infcmd.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/infcmd.c,v
retrieving revision 1.173
retrieving revision 1.173.8.1
diff -u -p -r1.173 -r1.173.8.1
--- infcmd.c 2000/09/07 12:34:15 1.173
+++ infcmd.c 2000/10/30 23:55:20 1.173.8.1
@@ -607,7 +607,13 @@ step_once (int skip_subroutines, int sin
if (!single_inst)
{
find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
- if (step_range_end == 0)
+
+ /* If we have no line info, switch to stepi mode. */
+ if (step_range_end == 0 && step_stop_if_no_debug)
+ {
+ step_range_start = step_range_end = 1;
+ }
+ else if (step_range_end == 0)
{
char *name;
if (find_pc_partial_function (stop_pc, &name, &step_range_start,