From e02bc4cc30e0425abebd623e4decd1bf37b9e3da Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 6 Apr 2001 17:53:39 +0000 Subject: 2001-04-06 David Smith * arch-utils.c (default_prepare_to_proceed) (generic_prepare_to_proceed): Added new functions. * arch-utils.h: New function declarations for default_prepare_to_proceed() and generic_prepare_to_proceed(). * gdbarch.sh: Added PREPARE_TO_PROCEED. * gdbarch.c: Regenerated. * gdbarch.h: Regenerated. * inferior.h: Added get_last_target_status() declaration. * infrun.c (get_last_target_status): Added new function. (handle_inferior_event): Saves last pid and waitstatus, which will get returned by get_last_target_status(). * hppa-tdep.c (prepare_to_proceed): Added comment stating that prepare_to_proceed() is potentially redundant since default_prepare_to_proceed() has been added. * linux-thread.c (prepare_to_proceed): Ditto. * lin-lwp.c (prepare_to_proceed): Ditto. * m3-nat.c (prepare_to_proceed): Ditto. --- gdb/infrun.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'gdb/infrun.c') diff --git a/gdb/infrun.c b/gdb/infrun.c index 7c9a38c..028fe09 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -406,6 +406,12 @@ static struct breakpoint *through_sigtramp_breakpoint = NULL; currently be running in a syscall. */ static int number_of_threads_in_syscalls; +/* This is a cached copy of the pid/waitstatus of the last event + returned by target_wait()/target_wait_hook(). This information is + returned by get_last_target_status(). */ +static int target_last_wait_pid = -1; +static struct target_waitstatus target_last_waitstatus; + /* This is used to remember when a fork, vfork or exec event was caught by a catchpoint, and thus the event is to be followed at the next resume of the inferior, and not @@ -1407,6 +1413,18 @@ check_for_old_step_resume_breakpoint (void) warning ("GDB bug: infrun.c (wait_for_inferior): dropping old step_resume breakpoint"); } +/* Return the cached copy of the last pid/waitstatus returned by + target_wait()/target_wait_hook(). The data is actually cached by + handle_inferior_event(), which gets called immediately after + target_wait()/target_wait_hook(). */ + +void +get_last_target_status(int *pid, struct target_waitstatus *status) +{ + *pid = target_last_wait_pid; + *status = target_last_waitstatus; +} + /* Given an execution control state that has been freshly filled in by an event from the inferior, figure out what it means and take appropriate action. */ @@ -1417,6 +1435,10 @@ handle_inferior_event (struct execution_control_state *ecs) CORE_ADDR tmp; int stepped_after_stopped_by_watchpoint; + /* Cache the last pid/waitstatus. */ + target_last_wait_pid = ecs->pid; + target_last_waitstatus = *ecs->wp; + /* Keep this extra brace for now, minimizes diffs. */ { switch (ecs->infwait_state) -- cgit v1.1