aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2003-06-19 15:04:58 +0000
committerDaniel Jacobowitz <drow@false.org>2003-06-19 15:04:58 +0000
commitea67f13b6848d0b7f120703b04b9d7d42bf04195 (patch)
tree5f996d44abfc00ffad365d16b6800fd25b02a271 /gdb/infrun.c
parent4ca61388162d64779d560c00e7bef17a29c9fb4b (diff)
downloadgdb-ea67f13b6848d0b7f120703b04b9d7d42bf04195.zip
gdb-ea67f13b6848d0b7f120703b04b9d7d42bf04195.tar.gz
gdb-ea67f13b6848d0b7f120703b04b9d7d42bf04195.tar.bz2
* arch-utils.c (default_prepare_to_proceed): Remove.
(generic_prepare_to_proceed): Remove. * arch-utils.h (default_prepare_to_proceed): Remove prototype. (generic_prepare_to_proceed): Remove prototype. * gdbarch.sh (PREPARE_TO_PROCEED): Remove. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * hppa-tdep.c (hppa_prepare_to_proceed): Remove dangling prototype. * hppah-nat.c (hppa_switched_threads): Remove. * infrun.c (prepare_to_proceed): New static function, copied from generic_prepare_to_proceed. Remove select_it argument. (proceed): Call prepare_to_proceed. * infttrace.c (old_gdb_pid, reported_pid, reported_bpt): Remove variables. (ptrace_wait): Don't set the removed variables. (hppa_switched_threads): Remove. * lin-lwp.c (lin_lwp_prepare_to_proceed): Remove. * config/nm-linux.h (PREPARE_TO_PROCEED): Don't define. (lin_lwp_prepare_to_proceed): Remove prototype. * config/i386/nm-x86-64linux.h (PREPARE_TO_PROCEED): Don't undefine. * config/pa/nm-hppah.h (PREPARE_TO_PROCEED): Don't define.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index df17968..b2e371e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -79,6 +79,8 @@ static int currently_stepping (struct execution_control_state *ecs);
static void xdb_handle_command (char *args, int from_tty);
+static int prepare_to_proceed (void);
+
void _initialize_infrun (void);
int inferior_ignoring_startup_exec_events = 0;
@@ -667,6 +669,55 @@ clear_proceed_status (void)
bpstat_clear (&stop_bpstat);
}
+/* This should be suitable for any targets that support threads. */
+
+static int
+prepare_to_proceed (void)
+{
+ ptid_t wait_ptid;
+ struct target_waitstatus wait_status;
+
+ /* Get the last target status returned by target_wait(). */
+ get_last_target_status (&wait_ptid, &wait_status);
+
+ /* Make sure we were stopped either at a breakpoint, or because
+ of a Ctrl-C. */
+ if (wait_status.kind != TARGET_WAITKIND_STOPPED
+ || (wait_status.value.sig != TARGET_SIGNAL_TRAP &&
+ wait_status.value.sig != TARGET_SIGNAL_INT))
+ {
+ return 0;
+ }
+
+ if (!ptid_equal (wait_ptid, minus_one_ptid)
+ && !ptid_equal (inferior_ptid, wait_ptid))
+ {
+ /* Switched over from WAIT_PID. */
+ CORE_ADDR wait_pc = read_pc_pid (wait_ptid);
+
+ if (wait_pc != read_pc ())
+ {
+ /* Switch back to WAIT_PID thread. */
+ inferior_ptid = wait_ptid;
+
+ /* FIXME: This stuff came from switch_to_thread() in
+ thread.c (which should probably be a public function). */
+ flush_cached_frames ();
+ registers_changed ();
+ stop_pc = wait_pc;
+ select_frame (get_current_frame ());
+ }
+
+ /* We return 1 to indicate that there is a breakpoint here,
+ so we need to step over it before continuing to avoid
+ hitting it straight away. */
+ if (breakpoint_here_p (wait_pc))
+ return 1;
+ }
+
+ return 0;
+
+}
/* Record the pc of the program the last time it stopped. This is
just used internally by wait_for_inferior, but need to be preserved
@@ -722,7 +773,6 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
write_pc (addr);
}
-#ifdef PREPARE_TO_PROCEED
/* In a multi-threaded task we may select another thread
and then continue or step.
@@ -731,15 +781,11 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
any execution (i.e. it will report a breakpoint hit
incorrectly). So we must step over it first.
- PREPARE_TO_PROCEED checks the current thread against the thread
+ prepare_to_proceed checks the current thread against the thread
that reported the most recent event. If a step-over is required
it returns TRUE and sets the current thread to the old thread. */
- if (PREPARE_TO_PROCEED (1) && breakpoint_here_p (read_pc ()))
- {
- oneproc = 1;
- }
-
-#endif /* PREPARE_TO_PROCEED */
+ if (prepare_to_proceed () && breakpoint_here_p (read_pc ()))
+ oneproc = 1;
#ifdef HP_OS_BUG
if (trap_expected_after_continue)