This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC: 2/9] Make step_over_calls per-thread in all-stop, and don't context-switch it
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Sat, 16 Aug 2008 16:31:56 +0100
- Subject: [RFC: 2/9] Make step_over_calls per-thread in all-stop, and don't context-switch it
This patch removes the global step_over_calls, in favour of accessing
the equivalent member in thread_info.
This is already per-thread in non-stop, because in that mode, we can
have more than a simultaneous thread stepping. I didn't change
all-stop at the time, mainly for ensurance, because I wanted to make sure
all-stop didn't break.
But, this can likewise be made per-thread in all-stop, because this is only
used after checking that the thread was stepping --- and that state is
already per-thread.
--
Pedro Alves
2008-08-16 Pedro Alves <pedro@codesourcery.com>
* inferior.h (step_over_calls): Delete.
* gdbthread.h (save_infrun_state, load_infrun_state): Remove
step_over_calls argument.
* thread.c (save_infrun_state, load_infrun_state): Remove
step_over_calls argument. Adjust.
* infcmd.c (step_over_calls): Delete.
(step_1): Adjust.
* infrun.c (clear_proceed_status): Adjust.
(context_switch): Don't context-switch step_over_calls.
(handle_inferior_event, save_inferior_status)
(restore_inferior_status): Adjust.
---
gdb/gdbthread.h | 2 --
gdb/infcmd.c | 12 +++++-------
gdb/inferior.h | 2 --
gdb/infrun.c | 23 +++++++++++------------
gdb/thread.c | 4 ----
5 files changed, 16 insertions(+), 27 deletions(-)
Index: src/gdb/inferior.h
===================================================================
--- src.orig/gdb/inferior.h 2008-08-16 03:36:53.000000000 +0100
+++ src/gdb/inferior.h 2008-08-16 03:36:58.000000000 +0100
@@ -319,8 +319,6 @@ enum step_over_calls_kind
STEP_OVER_UNDEBUGGABLE
};
-extern 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
if it stops due to stepping. */
Index: src/gdb/gdbthread.h
===================================================================
--- src.orig/gdb/gdbthread.h 2008-08-16 03:36:53.000000000 +0100
+++ src/gdb/gdbthread.h 2008-08-16 03:36:58.000000000 +0100
@@ -219,7 +219,6 @@ extern void save_infrun_state (ptid_t pt
struct continuation *continuations,
struct continuation *intermediate_continuations,
int proceed_to_finish,
- enum step_over_calls_kind step_over_calls,
int stop_step,
int step_multi,
enum target_signal stop_signal,
@@ -231,7 +230,6 @@ extern void load_infrun_state (ptid_t pt
struct continuation **continuations,
struct continuation **intermediate_continuations,
int *proceed_to_finish,
- enum step_over_calls_kind *step_over_calls,
int *stop_step,
int *step_multi,
enum target_signal *stop_signal,
Index: src/gdb/thread.c
===================================================================
--- src.orig/gdb/thread.c 2008-08-16 03:36:53.000000000 +0100
+++ src/gdb/thread.c 2008-08-16 03:36:58.000000000 +0100
@@ -446,7 +446,6 @@ load_infrun_state (ptid_t ptid,
struct continuation **continuations,
struct continuation **intermediate_continuations,
int *proceed_to_finish,
- enum step_over_calls_kind *step_over_calls,
int *stop_step,
int *step_multi,
enum target_signal *stop_signal,
@@ -469,7 +468,6 @@ load_infrun_state (ptid_t ptid,
*intermediate_continuations = tp->intermediate_continuations;
tp->intermediate_continuations = NULL;
*proceed_to_finish = tp->proceed_to_finish;
- *step_over_calls = tp->step_over_calls;
*stop_step = tp->stop_step;
*step_multi = tp->step_multi;
*stop_signal = tp->stop_signal;
@@ -488,7 +486,6 @@ save_infrun_state (ptid_t ptid,
struct continuation *continuations,
struct continuation *intermediate_continuations,
int proceed_to_finish,
- enum step_over_calls_kind step_over_calls,
int stop_step,
int step_multi,
enum target_signal stop_signal,
@@ -509,7 +506,6 @@ save_infrun_state (ptid_t ptid,
tp->continuations = continuations;
tp->intermediate_continuations = intermediate_continuations;
tp->proceed_to_finish = proceed_to_finish;
- tp->step_over_calls = step_over_calls;
tp->stop_step = stop_step;
tp->step_multi = step_multi;
tp->stop_signal = stop_signal;
Index: src/gdb/infcmd.c
===================================================================
--- src.orig/gdb/infcmd.c 2008-08-16 03:36:53.000000000 +0100
+++ src/gdb/infcmd.c 2008-08-16 03:36:58.000000000 +0100
@@ -177,8 +177,6 @@ int stop_stack_dummy;
int stopped_by_random_signal;
-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
if it stops due to stepping. */
@@ -842,11 +840,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 = STEP_OVER_NONE;
+ tp->step_over_calls = STEP_OVER_NONE;
}
if (skip_subroutines)
- step_over_calls = STEP_OVER_ALL;
+ tp->step_over_calls = STEP_OVER_ALL;
step_multi = (count > 1);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
@@ -960,11 +958,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 = STEP_OVER_NONE;
+ tp->step_over_calls = STEP_OVER_NONE;
}
if (skip_subroutines)
- step_over_calls = STEP_OVER_ALL;
+ tp->step_over_calls = STEP_OVER_ALL;
step_multi = (count > 1);
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
@@ -1194,7 +1192,7 @@ until_next_command (int from_tty)
tp->step_range_end = sal.end;
}
- step_over_calls = STEP_OVER_ALL;
+ tp->step_over_calls = STEP_OVER_ALL;
tp->step_frame_id = get_frame_id (frame);
step_multi = 0; /* Only one call to proceed */
Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c 2008-08-16 03:36:53.000000000 +0100
+++ src/gdb/infrun.c 2008-08-16 03:36:58.000000000 +0100
@@ -1100,9 +1100,9 @@ clear_proceed_status (void)
tp->step_range_start = 0;
tp->step_range_end = 0;
tp->step_frame_id = null_frame_id;
+ tp->step_over_calls = STEP_OVER_UNDEBUGGABLE;
}
- step_over_calls = STEP_OVER_UNDEBUGGABLE;
stop_after_trap = 0;
stop_soon = NO_STOP_QUIETLY;
proceed_to_finish = 0;
@@ -1704,7 +1704,6 @@ context_switch (ptid_t ptid)
save_infrun_state (inferior_ptid,
cmd_continuation, intermediate_continuation,
proceed_to_finish,
- step_over_calls,
stop_step,
step_multi,
stop_signal,
@@ -1714,7 +1713,6 @@ context_switch (ptid_t ptid)
load_infrun_state (ptid,
&cmd_continuation, &intermediate_continuation,
&proceed_to_finish,
- &step_over_calls,
&stop_step,
&step_multi,
&stop_signal,
@@ -3025,7 +3023,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
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 == STEP_OVER_UNDEBUGGABLE
+ if (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
&& in_solib_dynsym_resolve_code (stop_pc))
{
CORE_ADDR pc_after_resolver =
@@ -3050,8 +3048,8 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
}
if (ecs->event_thread->step_range_end != 1
- && (step_over_calls == STEP_OVER_UNDEBUGGABLE
- || step_over_calls == STEP_OVER_ALL)
+ && (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
+ || ecs->event_thread->step_over_calls == STEP_OVER_ALL)
&& get_frame_type (get_current_frame ()) == SIGTRAMP_FRAME)
{
if (debug_infrun)
@@ -3083,7 +3081,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: stepped into subroutine\n");
- if ((step_over_calls == STEP_OVER_NONE)
+ if ((ecs->event_thread->step_over_calls == STEP_OVER_NONE)
|| ((ecs->event_thread->step_range_end == 1)
&& in_prologue (ecs->event_thread->prev_pc,
ecs->stop_func_start)))
@@ -3100,7 +3098,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
return;
}
- if (step_over_calls == STEP_OVER_ALL)
+ if (ecs->event_thread->step_over_calls == STEP_OVER_ALL)
{
/* We're doing a "next", set a breakpoint at callee's return
address (the address at which the caller will
@@ -3153,7 +3151,8 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
/* 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)
+ if (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
+ && step_stop_if_no_debug)
{
stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
@@ -3208,7 +3207,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
/* NOTE: tausq/2004-05-24: This if block used to be done before all
the trampoline processing logic, however, there are some trampolines
that have no names, so we should do trampoline handling first. */
- if (step_over_calls == STEP_OVER_UNDEBUGGABLE
+ if (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
&& ecs->stop_func_name == NULL
&& stop_pc_sal.line == 0)
{
@@ -4386,7 +4385,7 @@ save_inferior_status (int restore_stack_
inf_status->step_range_start = tp->step_range_start;
inf_status->step_range_end = tp->step_range_end;
inf_status->step_frame_id = tp->step_frame_id;
- inf_status->step_over_calls = step_over_calls;
+ inf_status->step_over_calls = tp->step_over_calls;
inf_status->stop_after_trap = stop_after_trap;
inf_status->stop_soon = stop_soon;
/* Save original bpstat chain here; replace it with copy of chain.
@@ -4440,7 +4439,7 @@ restore_inferior_status (struct inferior
tp->step_range_start = inf_status->step_range_start;
tp->step_range_end = inf_status->step_range_end;
tp->step_frame_id = inf_status->step_frame_id;
- step_over_calls = inf_status->step_over_calls;
+ tp->step_over_calls = inf_status->step_over_calls;
stop_after_trap = inf_status->stop_after_trap;
stop_soon = inf_status->stop_soon;
bpstat_clear (&stop_bpstat);