summaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2001-04-06 17:53:39 +0000
committerDavid Smith <dsmith@redhat.com>2001-04-06 17:53:39 +0000
commitf29d0544032462ff31c30a30f1c4ae6b61613bee (patch)
treeae7a721b9013d998f82e97d7e978839fdd889189 /gdb/infrun.c
parentb6d085cc23d14435f42a2fa48a2cf365217250da (diff)
downloadgdb-f29d0544032462ff31c30a30f1c4ae6b61613bee.tar.gz
2001-04-06 David Smith <dsmith@redhat.com>
* 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.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 7c9a38c5ec5..028fe0994a0 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)