This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] 'set step-mode' to control the step command.
On Mon, Nov 06, 2000 at 05:03:32PM -0500, Christopher Faylor wrote:
>So, I will submit a revised patch with a enum'ized step_over_calls but keep
>the step_stop_if_no_debug, if that is ok.
And, here it is. There were no regressions with this patch.
I haven't added a test suite entry for this but it is coming.
Is this ok?
cgf
2000-11-07 Christopher Faylor <cgf@cygnus.com>
* inferior.h (step_over_calls_kind): New enum to clarify values in step_over_calls.
* infcmd.c (step_over_calls): Change definition.
(step_1): Use new enum values in relation to step_over_calls.
(step_once): Ditto.
(until_next_command): Ditto.
* infrun.c (clear_proceed_status): Ditto.
(handle_inferior_event): Ditto.
2000-11-06 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: infcmd.c
===================================================================
RCS file: /cvs/uberbaum/gdb/infcmd.c,v
retrieving revision 1.12
diff -u -p -r1.12 infcmd.c
--- infcmd.c 2000/10/30 15:32:51 1.12
+++ infcmd.c 2000/11/07 06:28:06
@@ -178,12 +178,8 @@ CORE_ADDR step_frame_address;
CORE_ADDR step_sp;
-/* 1 means step over all subroutine calls.
- 0 means don't step over calls (used by stepi).
- -1 means step over calls to undebuggable functions. */
+enum step_over_calls_kind step_over_calls;
-int step_over_calls;
-
/* If stepping, nonzero means step count is > 1
so don't print frame next time inferior stops
if it stops due to stepping. */
@@ -513,11 +509,11 @@ which has no line number information.\n"
/* It is stepi.
Don't step over function calls, not even to functions lacking
line numbers. */
- step_over_calls = 0;
+ step_over_calls = STEP_OVER_NONE;
}
if (skip_subroutines)
- step_over_calls = 1;
+ step_over_calls = STEP_OVER_ALL;
step_multi = (count > 1);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
@@ -607,7 +603,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,
@@ -628,11 +630,11 @@ which has no line number information.\n"
/* It is stepi.
Don't step over function calls, not even to functions lacking
line numbers. */
- step_over_calls = 0;
+ step_over_calls = STEP_OVER_NONE;
}
if (skip_subroutines)
- step_over_calls = 1;
+ step_over_calls = STEP_OVER_ALL;
step_multi = (count > 1);
arg1 =
@@ -958,7 +960,7 @@ until_next_command (int from_tty)
step_range_end = sal.end;
}
- step_over_calls = 1;
+ step_over_calls = STEP_OVER_ALL;
step_frame_address = FRAME_FP (frame);
step_sp = read_sp ();
Index: inferior.h
===================================================================
RCS file: /cvs/uberbaum/gdb/inferior.h,v
retrieving revision 1.11
diff -u -p -r1.11 inferior.h
--- inferior.h 2000/08/01 14:48:01 1.11
+++ inferior.h 2000/11/07 06:28:06
@@ -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);
@@ -335,7 +340,12 @@ extern CORE_ADDR step_sp;
/* 1 means step over all subroutine calls.
-1 means step over calls to undebuggable functions. */
-extern int step_over_calls;
+enum step_over_calls_kind
+ {
+ STEP_OVER_NONE,
+ STEP_OVER_ALL,
+ STEP_OVER_UNDEBUGGABLE,
+ } step_over_calls;
/* If stepping, nonzero means step count is > 1
so don't print frame next time inferior stops
Index: infrun.c
===================================================================
RCS file: /cvs/uberbaum/gdb/infrun.c,v
retrieving revision 1.20
diff -u -p -r1.20 infrun.c
--- infrun.c 2000/10/30 15:32:51 1.20
+++ infrun.c 2000/11/07 06:28:06
@@ -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;
@@ -940,7 +945,7 @@ clear_proceed_status (void)
step_range_start = 0;
step_range_end = 0;
step_frame_address = 0;
- step_over_calls = -1;
+ step_over_calls = STEP_OVER_UNDEBUGGABLE;
stop_after_trap = 0;
stop_soon_quietly = 0;
proceed_to_finish = 0;
@@ -2612,7 +2617,7 @@ handle_inferior_event (struct execution_
loader dynamic symbol resolution code, we keep on single stepping
until we exit the run time loader code and reach the callee's
address. */
- if (step_over_calls < 0 && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc))
+ if (step_over_calls == STEP_OVER_UNDEBUGGABLE && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc))
{
CORE_ADDR pc_after_resolver = SKIP_SOLIB_RESOLVER (stop_pc);
@@ -2733,7 +2738,7 @@ handle_inferior_event (struct execution_
{
/* It's a subroutine call. */
- if (step_over_calls == 0)
+ if (step_over_calls == STEP_OVER_NONE)
{
/* I presume that step_over_calls is only 0 when we're
supposed to be stepping at the assembly language level
@@ -2744,7 +2749,7 @@ handle_inferior_event (struct execution_
return;
}
- if (step_over_calls > 0 || IGNORE_HELPER_CALL (stop_pc))
+ if (step_over_calls == STEP_OVER_ALL || IGNORE_HELPER_CALL (stop_pc))
{
/* We're doing a "next". */
@@ -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 == STEP_OVER_UNDEBUGGABLE && 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;
@@ -3934,7 +3951,7 @@ struct inferior_status
CORE_ADDR step_range_start;
CORE_ADDR step_range_end;
CORE_ADDR step_frame_address;
- int step_over_calls;
+ enum step_over_calls_kind step_over_calls;
CORE_ADDR step_resume_break_address;
int stop_after_trap;
int stop_soon_quietly;
@@ -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 over 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: doc/gdb.texinfo
===================================================================
RCS file: /cvs/uberbaum/gdb/doc/gdb.texinfo,v
retrieving revision 1.28
diff -u -p -r1.28 gdb.texinfo
--- gdb.texinfo 2000/10/16 07:34:02 1.28
+++ gdb.texinfo 2000/11/07 06:28:09
@@ -3323,6 +3323,16 @@ The @code{next} command only stops at th
source line. This prevents multiple stops that could otherwise occur in
switch statements, for loops, etc.
+@kindex set step-mode
+@item set step-mode
+@itemx set step-mode on
+When stepping over functions, cause gdb to stop at the first instruction
+of a function which contains no debug line information.
+
+@itemx set step-mode off
+When stepping over functions, cause gdb to skip over any function which
+contains no debug information. This is the default.
+
@kindex finish
@item finish
Continue running until just after function in the selected stack frame