This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [5/7] infrun cleanup: ecs->wait_some_more
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Sun, 7 Dec 2008 01:19:35 +0100 (CET)
- Subject: [rfc] [5/7] infrun cleanup: ecs->wait_some_more
Hello,
this removes the ecs->wait_some_more member (the only "output operand"
of handle_inferior_event), and replaces it by an boolean return value
of that routine.
As ecs->wait_some_more is only ever set by stop_stepping (to 0) and
prepare_to_wait (to 1), and those functions are not doing anything else,
this patch removes them completely.
Within handle_inferior_event (and its subroutines), every path that
ends in
stop_stepping (ecs);
return;
is replaced by
return 0;
and likewise every path that ends in
prepare_to_wait (ecs);
return
is replaced by
return 1;
The keep_going routine will either call stop_stepping or prepare_to_wait,
so it also gets an int return value, and every call to
keep_going (ecs);
return;
is replaced by;
return keep_going (ecs).
Finally, the same needs to be done to handle_step_into_function and
handle_step_into_function_backward.
(Note that every call to any of the above routines was already immmediately
followed by a return statement, so the procedure replaces all calls to
those routines.)
Bye,
Ulrich
ChangeLog:
* infrun.c (struct execution_control_state): Remove wait_some_more.
(handle_inferior_event): Return boolean value instead of setting
ecs->wait_some_more; update subroutine calls accordingly.
(handle_step_into_function): Likewise.
(handle_step_into_function_backward): Likewise.
(keep_going): Likewise.
(stop_stepping, prepare_to_wait): Remove functions.
(infrun_thread_stop_requested_callback): Use return value of
handle_inferior_event instead of checking ecs->wait_some_more.
(wait_for_inferior): Likewise.
(fetch_inferior_event): Likewise.
Index: gdb-head/gdb/infrun.c
===================================================================
--- gdb-head.orig/gdb/infrun.c
+++ gdb-head/gdb/infrun.c
@@ -1571,23 +1571,20 @@ struct execution_control_state
struct thread_info *event_thread;
struct target_waitstatus ws;
- int wait_some_more;
};
-static void handle_inferior_event (struct execution_control_state *ecs);
+static int handle_inferior_event (struct execution_control_state *ecs);
-static void handle_step_into_function (struct execution_control_state *ecs,
- CORE_ADDR, CORE_ADDR);
-static void handle_step_into_function_backward (struct execution_control_state *ecs);
+static int handle_step_into_function (struct execution_control_state *ecs,
+ CORE_ADDR, CORE_ADDR);
+static int handle_step_into_function_backward (struct execution_control_state *ecs);
static void insert_step_resume_breakpoint_at_frame (struct frame_info *step_frame);
static void insert_step_resume_breakpoint_at_caller (struct frame_info *);
static void insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
struct frame_id sr_id);
static void insert_longjmp_resume_breakpoint (CORE_ADDR);
-static void stop_stepping (struct execution_control_state *ecs);
-static void prepare_to_wait (struct execution_control_state *ecs);
-static void keep_going (struct execution_control_state *ecs);
+static int keep_going (struct execution_control_state *ecs);
static void print_stop_reason (enum inferior_stop_reason stop_reason,
int stop_info);
@@ -1628,9 +1625,7 @@ infrun_thread_stop_requested_callback (s
ecs->ws.kind = TARGET_WAITKIND_STOPPED;
ecs->ws.value.sig = TARGET_SIGNAL_0;
- handle_inferior_event (ecs);
-
- if (!ecs->wait_some_more)
+ if (!handle_inferior_event (ecs))
{
struct thread_info *tp;
@@ -1774,9 +1769,7 @@ wait_for_inferior (void)
ecs->ptid = target_wait (waiton_ptid, &ecs->ws);
/* Now figure out what to do with the result of the result. */
- handle_inferior_event (ecs);
-
- if (!ecs->wait_some_more)
+ if (!handle_inferior_event (ecs))
break;
}
@@ -1837,9 +1830,7 @@ fetch_inferior_event (void *client_data)
context_switch (ecs->ptid);
/* Now figure out what to do with the result of the result. */
- handle_inferior_event (ecs);
-
- if (!ecs->wait_some_more)
+ if (!handle_inferior_event (ecs))
{
struct inferior *inf = current_inferior ();
@@ -2056,7 +2047,7 @@ ensure_not_running (void)
by an event from the inferior, figure out what it means and take
appropriate action. */
-static void
+static int
handle_inferior_event (struct execution_control_state *ecs)
{
int stopped_by_watchpoint;
@@ -2202,10 +2193,7 @@ handle_inferior_event (struct execution_
and place breakpoints in initializer routines for
dynamically loaded objects (among other things). */
if (stop_on_solib_events)
- {
- stop_stepping (ecs);
- return;
- }
+ return 0;
/* NOTE drow/2007-05-11: This might be a good place to check
for "catch load". */
@@ -2223,8 +2211,7 @@ handle_inferior_event (struct execution_
&& !breakpoints_always_inserted_mode ())
insert_breakpoints ();
resume (0, TARGET_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
+ return 1;
}
break;
@@ -2233,8 +2220,7 @@ handle_inferior_event (struct execution_
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SPURIOUS\n");
resume (0, TARGET_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
+ return 1;
case TARGET_WAITKIND_EXITED:
if (debug_infrun)
@@ -2251,8 +2237,7 @@ handle_inferior_event (struct execution_
target_mourn_inferior ();
singlestep_breakpoints_inserted_p = 0;
stop_print_frame = 0;
- stop_stepping (ecs);
- return;
+ return 0;
case TARGET_WAITKIND_SIGNALLED:
if (debug_infrun)
@@ -2269,8 +2254,7 @@ handle_inferior_event (struct execution_
print_stop_reason (SIGNAL_EXITED, ecs->ws.value.sig);
singlestep_breakpoints_inserted_p = 0;
- stop_stepping (ecs);
- return;
+ return 0;
/* The following are the only cases in which we keep going;
the above cases end in a continue or goto. */
@@ -2297,8 +2281,7 @@ handle_inferior_event (struct execution_
if (!bpstat_explains_signal (ecs->event_thread->stop_bpstat))
{
ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
ecs->event_thread->stop_signal = TARGET_SIGNAL_TRAP;
goto process_event_stop_test;
@@ -2330,8 +2313,7 @@ handle_inferior_event (struct execution_
if (!bpstat_explains_signal (ecs->event_thread->stop_bpstat))
{
ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
ecs->event_thread->stop_signal = TARGET_SIGNAL_TRAP;
goto process_event_stop_test;
@@ -2342,8 +2324,7 @@ handle_inferior_event (struct execution_
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SYSCALL_ENTRY\n");
resume (0, TARGET_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
+ return 1;
/* Before examining the threads further, step this thread to
get it entirely out of the syscall. (We get notice of the
@@ -2354,8 +2335,7 @@ handle_inferior_event (struct execution_
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SYSCALL_RETURN\n");
target_resume (ecs->ptid, 1, TARGET_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
+ return 1;
case TARGET_WAITKIND_STOPPED:
if (debug_infrun)
@@ -2367,8 +2347,7 @@ handle_inferior_event (struct execution_
/* Reverse execution: target ran out of history info. */
stop_pc = read_pc ();
print_stop_reason (NO_HISTORY, 0);
- stop_stepping (ecs);
- return;
+ return 0;
/* We had an event in the inferior, but we are not interested
in handling it at this level. The lower layers have already
@@ -2382,8 +2361,7 @@ handle_inferior_event (struct execution_
case TARGET_WAITKIND_IGNORE:
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_IGNORE\n");
- prepare_to_wait (ecs);
- return;
+ return 1;
}
if (new_thread_event)
@@ -2403,8 +2381,7 @@ targets should add new threads to the th
continue all threads in order to make progress. */
target_resume (RESUME_ALL, 0, TARGET_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
+ return 1;
}
if (ecs->ws.kind == TARGET_WAITKIND_STOPPED)
@@ -2468,8 +2445,7 @@ targets should add new threads to the th
deprecated_context_hook (pid_to_thread_id (ecs->ptid));
resume (1, TARGET_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
+ return 1;
}
}
@@ -2501,8 +2477,7 @@ targets should add new threads to the th
previous_inferior_ptid = inferior_ptid;
resume (1, TARGET_SIGNAL_0);
- prepare_to_wait (ecs);
- return;
+ return 1;
}
deferred_step_ptid = null_ptid;
@@ -2639,8 +2614,7 @@ targets should add new threads to the th
}
ecs->event_thread->stepping_over_breakpoint = 1;
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
}
}
@@ -2705,8 +2679,7 @@ targets should add new threads to the th
infwait_state = infwait_step_watch_state;
else
infwait_state = infwait_nonstep_watch_state;
- prepare_to_wait (ecs);
- return;
+ return 1;
}
stop_func_start = 0;
@@ -2743,8 +2716,7 @@ targets should add new threads to the th
/* The user issued a continue when stopped at a breakpoint.
Set up for another trap and get out of here. */
ecs->event_thread->stepping_over_breakpoint = 1;
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
else if (step_through_delay)
{
@@ -2760,8 +2732,8 @@ targets should add new threads to the th
/* Look at the cause of the stop, and decide what to do.
The alternatives are:
- 1) stop_stepping and return; to really stop and return to the debugger,
- 2) keep_going and return to start up again
+ 1) return 0; to really stop and return to the debugger,
+ 2) call keep_going and return to start up again
(set ecs->event_thread->stepping_over_breakpoint to 1 to single step once)
3) set stopped_by_random_signal to 1, and the decision between 1 and 2
will be made according to the signal handling tables. */
@@ -2794,8 +2766,7 @@ targets should add new threads to the th
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: stopped\n");
stop_print_frame = 0;
- stop_stepping (ecs);
- return;
+ return 0;
}
/* This is originated from start_remote(), start_inferior() and
@@ -2804,8 +2775,7 @@ targets should add new threads to the th
{
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: quietly stopped\n");
- stop_stepping (ecs);
- return;
+ return 0;
}
/* This originates from attach_command(). We need to overwrite
@@ -2833,9 +2803,8 @@ targets should add new threads to the th
|| ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP
|| ecs->event_thread->stop_signal == TARGET_SIGNAL_0))
{
- stop_stepping (ecs);
ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
- return;
+ return 0;
}
/* See if there is a breakpoint at the current PC. */
@@ -2913,10 +2882,7 @@ process_event_stop_test:
if (stop_soon != NO_STOP_QUIETLY
|| ecs->event_thread->stop_requested
|| signal_stop_state (ecs->event_thread->stop_signal))
- {
- stop_stepping (ecs);
- return;
- }
+ return 0;
/* If not going to stop, give terminal back
if we took it away. */
else if (printed)
@@ -2947,8 +2913,7 @@ process_event_stop_test:
insert_step_resume_breakpoint_at_frame (get_current_frame ());
ecs->event_thread->step_after_step_resume_breakpoint = 1;
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
if (ecs->event_thread->step_range_end != 0
@@ -2974,8 +2939,7 @@ process_event_stop_test:
"single-step range\n");
insert_step_resume_breakpoint_at_frame (get_current_frame ());
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* Note: step_resume_breakpoint may be non-NULL. This occures
@@ -2984,8 +2948,7 @@ process_event_stop_test:
(leaving the inferior at the step-resume-breakpoint without
actually executing it). Either way continue until the
breakpoint is really hit. */
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* Handle cases caused by hitting a breakpoint. */
@@ -3020,8 +2983,7 @@ process_event_stop_test:
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "\
infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* We're going to replace the current step-resume breakpoint
@@ -3031,8 +2993,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
/* Insert a breakpoint at resume address. */
insert_longjmp_resume_breakpoint (jmp_buf_pc);
- keep_going (ecs);
- return;
+ return keep_going (ecs);
case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME:
if (debug_infrun)
@@ -3044,8 +3005,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
- return;
+ return 0;
case BPSTAT_WHAT_SINGLE:
if (debug_infrun)
@@ -3062,9 +3022,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
/* We are about to nuke the step_resume_breakpointt via the
cleanup chain, so no need to worry about it here. */
-
- stop_stepping (ecs);
- return;
+ return 0;
case BPSTAT_WHAT_STOP_SILENT:
if (debug_infrun)
@@ -3073,9 +3031,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
/* We are about to nuke the step_resume_breakpoin via the
cleanup chain, so no need to worry about it here. */
-
- stop_stepping (ecs);
- return;
+ return 0;
case BPSTAT_WHAT_STEP_RESUME:
if (debug_infrun)
@@ -3089,8 +3045,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
to doing that. */
ecs->event_thread->step_after_step_resume_breakpoint = 0;
ecs->event_thread->stepping_over_breakpoint = 1;
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
if (stop_pc == stop_func_start
&& execution_direction == EXEC_REVERSE)
@@ -3100,8 +3055,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
address of the function. Go back to single-stepping,
which should take us back to the function call. */
ecs->event_thread->stepping_over_breakpoint = 1;
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
break;
@@ -3142,16 +3096,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
and place breakpoints in initializer routines for
dynamically loaded objects (among other things). */
if (stop_on_solib_events || stop_stack_dummy)
- {
- stop_stepping (ecs);
- return;
- }
- else
- {
- /* We want to step over this breakpoint, then keep going. */
- ecs->event_thread->stepping_over_breakpoint = 1;
- break;
- }
+ return 0;
+
+ /* We want to step over this breakpoint, then keep going. */
+ ecs->event_thread->stepping_over_breakpoint = 1;
}
break;
@@ -3184,10 +3132,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
if ((ecs->event_thread->trap_expected
&& ecs->event_thread->stop_signal != TARGET_SIGNAL_TRAP)
|| ecs->event_thread->stepping_over_breakpoint)
- {
- keep_going (ecs);
- return;
- }
+ return keep_going (ecs);
/* Otherwise, we no longer expect a trap in the current thread.
Clear the trap_expected flag before switching back -- this is
@@ -3201,8 +3146,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
ecs->event_thread = tp;
ecs->ptid = tp->ptid;
context_switch (ecs->ptid);
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
}
@@ -3218,8 +3162,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: stepping in dynamic linker\n");
ecs->event_thread->stepping_over_breakpoint = 1;
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
#endif
if (debug_infrun)
@@ -3232,8 +3175,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
= bpstat_copy (ecs->event_thread->stepping_through_solib_catchpoints);
bpstat_clear (&ecs->event_thread->stepping_through_solib_catchpoints);
stop_print_frame = 1;
- stop_stepping (ecs);
- return;
+ return 0;
}
if (ecs->event_thread->step_resume_breakpoint)
@@ -3245,8 +3187,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
/* Having a step-resume breakpoint overrides anything
else having to do with stepping commands until
that breakpoint is reached. */
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
if (ecs->event_thread->step_range_end == 0)
@@ -3254,8 +3195,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: no stepping, continue\n");
/* Likewise if we aren't even stepping. */
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* If stepping through a line, keep going if still within it.
@@ -3280,12 +3220,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
{
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
+ return 0;
}
- else
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* We stepped out of the stepping range. */
@@ -3314,8 +3252,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
}
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
if (ecs->event_thread->step_range_end != 1
@@ -3330,8 +3267,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
the signal handler returning). Just single-step until the
inferior leaves the trampoline (either by calling the handler
or returning). */
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* Check for subroutine calls. The check for the current frame
@@ -3366,8 +3302,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
well. FENN */
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
- return;
+ return 0;
}
if (ecs->event_thread->step_over_calls == STEP_OVER_ALL)
@@ -3398,8 +3333,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
Just keep stepping, we'll soon be home.
*/
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* Normal (staticly linked) function call return. */
init_sal (&sr_sal);
@@ -3409,8 +3343,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
else
insert_step_resume_breakpoint_at_caller (get_current_frame ());
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* If we are in a function call trampoline (a stub between the
@@ -3432,8 +3365,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
sr_sal.pc = stop_func_start;
insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* If we have line number information for the function we are
@@ -3449,10 +3381,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
if (tmp_sal.line != 0)
{
if (execution_direction == EXEC_REVERSE)
- handle_step_into_function_backward (ecs);
+ return handle_step_into_function_backward (ecs);
else
- handle_step_into_function (ecs, stop_func_start, stop_func_end);
- return;
+ return handle_step_into_function (ecs, stop_func_start,
+ stop_func_end);
}
}
@@ -3464,8 +3396,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
{
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
- return;
+ return 0;
}
if (execution_direction == EXEC_REVERSE)
@@ -3482,8 +3413,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
at which the caller will resume). */
insert_step_resume_breakpoint_at_caller (get_current_frame ());
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
/* If we're in the return path from a shared library trampoline,
@@ -3516,8 +3446,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
/* Restart without fiddling with the step ranges or
other state. */
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
}
@@ -3549,16 +3478,14 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
switch in assembly mode. */
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
- return;
+ return 0;
}
else
{
/* Set a breakpoint at callee's return address (the address
at which the caller will resume). */
insert_step_resume_breakpoint_at_caller (get_current_frame ());
- keep_going (ecs);
- return;
+ return keep_going (ecs);
}
}
@@ -3570,8 +3497,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
fprintf_unfiltered (gdb_stdlog, "infrun: stepi/nexti\n");
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
- return;
+ return 0;
}
if (stop_pc_sal.line == 0)
@@ -3584,8 +3510,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
fprintf_unfiltered (gdb_stdlog, "infrun: no line number info\n");
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
- return;
+ return 0;
}
if ((stop_pc == stop_pc_sal.pc)
@@ -3600,8 +3525,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
fprintf_unfiltered (gdb_stdlog, "infrun: stepped to a different line\n");
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
- return;
+ return 0;
}
/* We aren't done stepping.
@@ -3619,7 +3543,8 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: keep going\n");
- keep_going (ecs);
+
+ return keep_going (ecs);
}
/* Are we in the middle of stepping? */
@@ -3650,7 +3575,7 @@ currently_stepping (struct thread_info *
we should not step over. Do step to the first line of code in
it. */
-static void
+static int
handle_step_into_function (struct execution_control_state *ecs,
CORE_ADDR stop_func_start, CORE_ADDR stop_func_end)
{
@@ -3700,8 +3625,7 @@ handle_step_into_function (struct execut
/* We are already there: stop now. */
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
- return;
+ return 0;
}
else
{
@@ -3718,14 +3642,15 @@ handle_step_into_function (struct execut
/* And make sure stepping stops right away then. */
ecs->event_thread->step_range_end = ecs->event_thread->step_range_start;
}
- keep_going (ecs);
+
+ return keep_going (ecs);
}
/* Inferior has stepped backward into a subroutine call with source
code that we should not step over. Do step to the beginning of the
last line of code in it. */
-static void
+static int
handle_step_into_function_backward (struct execution_control_state *ecs)
{
struct symtab_and_line stop_func_sal;
@@ -3737,7 +3662,7 @@ handle_step_into_function_backward (stru
/* We're there already. Just stop stepping now. */
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
- stop_stepping (ecs);
+ return 0;
}
else
{
@@ -3746,9 +3671,8 @@ handle_step_into_function_backward (stru
epilogues, which can have multiple entry paths. */
ecs->event_thread->step_range_start = stop_func_sal.pc;
ecs->event_thread->step_range_end = stop_func_sal.end;
- keep_going (ecs);
+ return keep_going (ecs);
}
- return;
}
/* Insert a "step-resume breakpoint" at SR_SAL with frame ID SR_ID.
@@ -3849,21 +3773,11 @@ insert_longjmp_resume_breakpoint (CORE_A
set_momentary_breakpoint_at_pc (pc, bp_longjmp_resume);
}
-static void
-stop_stepping (struct execution_control_state *ecs)
-{
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: stop_stepping\n");
-
- /* Let callers know we don't want to wait for the inferior anymore. */
- ecs->wait_some_more = 0;
-}
-
/* This function handles various cases where we need to continue
waiting for the inferior. */
/* (Used to be the keep_going: label in the old wait_for_inferior) */
-static void
+static int
keep_going (struct execution_control_state *ecs)
{
/* Save the pc before execution, to compare with pc after stop. */
@@ -3914,10 +3828,7 @@ keep_going (struct execution_control_sta
insert_breakpoints ();
}
if (e.reason < 0)
- {
- stop_stepping (ecs);
- return;
- }
+ return 0;
}
ecs->event_thread->trap_expected = ecs->event_thread->stepping_over_breakpoint;
@@ -3942,30 +3853,14 @@ keep_going (struct execution_control_sta
ecs->event_thread->stop_signal);
}
- prepare_to_wait (ecs);
-}
-
-/* This function normally comes after a resume, before
- handle_inferior_event exits. It takes care of any last bits of
- housekeeping, and sets the all-important wait_some_more flag. */
-
-static void
-prepare_to_wait (struct execution_control_state *ecs)
-{
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog, "infrun: prepare_to_wait\n");
-
- /* This is the old end of the while loop. Let everybody know we
- want to wait for the inferior some more and get called again
- soon. */
- ecs->wait_some_more = 1;
+ return 1;
}
/* Print why the inferior has stopped. We always print something when
the inferior exits, or receives a signal. The rest of the cases are
dealt with later on in normal_stop() and print_it_typical(). Ideally
there should be a call to this function from handle_inferior_event()
- each time stop_stepping() is called.*/
+ each time it returns 0. */
static void
print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info)
{
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com