aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me+cygwin@cgf.cx>2000-11-10 19:27:45 +0000
committerChristopher Faylor <me+cygwin@cgf.cx>2000-11-10 19:27:45 +0000
commit5fbbeb2988b75ffc72f8bf77dc0c4461ba65cefd (patch)
tree2bac1b4d3cfc6a8ba7d5d7ec0cc61b5dde8e0f3d
parent67e0617e6e9fa493f665a30b4362c9a85cc0c653 (diff)
downloadgdb-5fbbeb2988b75ffc72f8bf77dc0c4461ba65cefd.zip
gdb-5fbbeb2988b75ffc72f8bf77dc0c4461ba65cefd.tar.gz
gdb-5fbbeb2988b75ffc72f8bf77dc0c4461ba65cefd.tar.bz2
* 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. * 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).
-rw-r--r--gdb/ChangeLog22
-rw-r--r--gdb/infcmd.c24
-rw-r--r--gdb/inferior.h12
-rw-r--r--gdb/infrun.c36
4 files changed, 77 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index efa0c9a..1f10f9d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,25 @@
+2000-11-10 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-10 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).
+
2000-11-10 J.T. Conklin <jtc@redback.com>
* target.c (do_xfer_memory): Only perform a single memory transfer
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index d20cb43..343853a 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -178,11 +178,7 @@ 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. */
-
-int step_over_calls;
+enum step_over_calls_kind step_over_calls;
/* If stepping, nonzero means step count is > 1
so don't print frame next time inferior stops
@@ -513,11 +509,11 @@ which has no line number information.\n", name);
/* 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 single_inst, int count)
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", name);
/* 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 ();
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 4c91e83..474d278 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -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
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 57233a8..01db98c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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_control_state *ecs)
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_control_state *ecs)
{
/* 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_control_state *ecs)
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_control_state *ecs)
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;
@@ -4309,4 +4326,13 @@ step == scheduler locked during every single-step operation.\n\
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);
}