aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog24
-rw-r--r--gdb/arch-utils.c60
-rw-r--r--gdb/arch-utils.h6
-rw-r--r--gdb/config/i386/nm-x86-64linux.h4
-rw-r--r--gdb/config/nm-linux.h3
-rw-r--r--gdb/config/pa/nm-hppah.h5
-rw-r--r--gdb/gdbarch.c34
-rw-r--r--gdb/gdbarch.h15
-rwxr-xr-xgdb/gdbarch.sh1
-rw-r--r--gdb/hppa-tdep.c3
-rw-r--r--gdb/hppah-nat.c10
-rw-r--r--gdb/infrun.c62
-rw-r--r--gdb/infttrace.c70
-rw-r--r--gdb/lin-lwp.c40
14 files changed, 78 insertions, 259 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2594b86..82c739c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,27 @@
+2003-06-19 Daniel Jacobowitz <drow@mvista.com>
+
+ * 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.
+
2003-06-18 Theodore A. Roth <troth@openavr.org>
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index f3be320..043600e 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -272,66 +272,6 @@ no_op_reg_to_regnum (int reg)
return reg;
}
-/* Default prepare_to_procced(). */
-int
-default_prepare_to_proceed (int select_it)
-{
- return 0;
-}
-
-/* Generic prepare_to_proceed(). This one should be suitable for most
- targets that support threads. */
-int
-generic_prepare_to_proceed (int select_it)
-{
- 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 ())
- {
- if (select_it)
- {
- /* 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;
-
-}
-
CORE_ADDR
init_frame_pc_noop (int fromleaf, struct frame_info *prev)
{
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 8952ed3..234257d 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -105,12 +105,6 @@ extern CORE_ADDR core_addr_identity (CORE_ADDR addr);
extern int no_op_reg_to_regnum (int reg);
-/* Default prepare_to_procced. */
-
-extern int default_prepare_to_proceed (int select_it);
-
-extern int generic_prepare_to_proceed (int select_it);
-
/* Versions of init_frame_pc(). Do nothing; do the default. */
extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev);
diff --git a/gdb/config/i386/nm-x86-64linux.h b/gdb/config/i386/nm-x86-64linux.h
index 4df2f5d..8ff8095 100644
--- a/gdb/config/i386/nm-x86-64linux.h
+++ b/gdb/config/i386/nm-x86-64linux.h
@@ -60,9 +60,5 @@ extern unsigned long x86_64_linux_dr_get_status (void);
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
-
-
-/* FIXME: kettenis/20030416: Why? */
-#undef PREPARE_TO_PROCEED
#endif /* NM_X86_64_LINUX_H */
diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h
index 6890cca..e4ac629 100644
--- a/gdb/config/nm-linux.h
+++ b/gdb/config/nm-linux.h
@@ -51,9 +51,6 @@ struct target_waitstatus;
extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
#define CHILD_WAIT
-extern int lin_lwp_prepare_to_proceed (void);
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
diff --git a/gdb/config/pa/nm-hppah.h b/gdb/config/pa/nm-hppah.h
index 74bfa20..05e7db2 100644
--- a/gdb/config/pa/nm-hppah.h
+++ b/gdb/config/pa/nm-hppah.h
@@ -53,11 +53,6 @@
#define CHILD_XFER_MEMORY
#define CHILD_FOLLOW_FORK
-/* While this is for use by threaded programs, it doesn't appear
- * to hurt non-threaded ones. This is used in infrun.c: */
-#define PREPARE_TO_PROCEED(select_it) generic_prepare_to_proceed(select_it)
-extern int generic_prepare_to_proceed (int select_it);
-
/* In infptrace.c or infttrace.c: */
#define CHILD_PID_TO_EXEC_FILE
#define CHILD_POST_STARTUP_INFERIOR
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index c1ce57a..7918b0c 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -237,7 +237,6 @@ struct gdbarch
gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
CORE_ADDR decr_pc_after_break;
- gdbarch_prepare_to_proceed_ftype *prepare_to_proceed;
CORE_ADDR function_start_offset;
gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
CORE_ADDR frame_args_skip;
@@ -405,7 +404,6 @@ struct gdbarch startup_gdbarch =
0, /* memory_insert_breakpoint */
0, /* memory_remove_breakpoint */
0, /* decr_pc_after_break */
- 0, /* prepare_to_proceed */
0, /* function_start_offset */
generic_remote_translate_xfer_address, /* remote_translate_xfer_address */
0, /* frame_args_skip */
@@ -545,7 +543,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
current_gdbarch->decr_pc_after_break = -1;
- current_gdbarch->prepare_to_proceed = default_prepare_to_proceed;
current_gdbarch->function_start_offset = -1;
current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
current_gdbarch->frame_args_skip = -1;
@@ -713,7 +710,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->decr_pc_after_break == -1))
fprintf_unfiltered (log, "\n\tdecr_pc_after_break");
- /* Skip verify of prepare_to_proceed, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->function_start_offset == -1))
fprintf_unfiltered (log, "\n\tfunction_start_offset");
@@ -2027,17 +2023,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->pointer_to_address
/*POINTER_TO_ADDRESS ()*/);
#endif
-#ifdef PREPARE_TO_PROCEED
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "PREPARE_TO_PROCEED(select_it)",
- XSTRING (PREPARE_TO_PROCEED (select_it)));
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: PREPARE_TO_PROCEED = <0x%08lx>\n",
- (long) current_gdbarch->prepare_to_proceed
- /*PREPARE_TO_PROCEED ()*/);
-#endif
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_print_float_info_p() = %d\n",
@@ -4858,25 +4843,6 @@ set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch,
gdbarch->decr_pc_after_break = decr_pc_after_break;
}
-int
-gdbarch_prepare_to_proceed (struct gdbarch *gdbarch, int select_it)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch->prepare_to_proceed == 0)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_prepare_to_proceed invalid");
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_prepare_to_proceed called\n");
- return gdbarch->prepare_to_proceed (select_it);
-}
-
-void
-set_gdbarch_prepare_to_proceed (struct gdbarch *gdbarch,
- gdbarch_prepare_to_proceed_ftype prepare_to_proceed)
-{
- gdbarch->prepare_to_proceed = prepare_to_proceed;
-}
-
CORE_ADDR
gdbarch_function_start_offset (struct gdbarch *gdbarch)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index af6916d..a0e09b2 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -2172,21 +2172,6 @@ extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR
#define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch))
#endif
-/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (PREPARE_TO_PROCEED)
-#define PREPARE_TO_PROCEED(select_it) (default_prepare_to_proceed (select_it))
-#endif
-
-typedef int (gdbarch_prepare_to_proceed_ftype) (int select_it);
-extern int gdbarch_prepare_to_proceed (struct gdbarch *gdbarch, int select_it);
-extern void set_gdbarch_prepare_to_proceed (struct gdbarch *gdbarch, gdbarch_prepare_to_proceed_ftype *prepare_to_proceed);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PREPARE_TO_PROCEED)
-#error "Non multi-arch definition of PREPARE_TO_PROCEED"
-#endif
-#if !defined (PREPARE_TO_PROCEED)
-#define PREPARE_TO_PROCEED(select_it) (gdbarch_prepare_to_proceed (current_gdbarch, select_it))
-#endif
-
extern CORE_ADDR gdbarch_function_start_offset (struct gdbarch *gdbarch);
extern void set_gdbarch_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR function_start_offset);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FUNCTION_START_OFFSET)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 6f216de..a5b2bf9 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -617,7 +617,6 @@ f::BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr,
f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0
f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0
v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1
-f:2:PREPARE_TO_PROCEED:int:prepare_to_proceed:int select_it:select_it::0:default_prepare_to_proceed::0
v:2:FUNCTION_START_OFFSET:CORE_ADDR:function_start_offset::::0:-1
#
m::REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 7c8e762..37aa44b 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -129,9 +129,6 @@ static int restore_pc_queue (CORE_ADDR *);
static int hppa_alignof (struct type *);
-/* To support multi-threading and stepping. */
-int hppa_prepare_to_proceed ();
-
static int prologue_inst_adjust_sp (unsigned long);
static int is_branch (unsigned long);
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index 0b8b04f..380a901 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -930,16 +930,6 @@ hppa_pid_or_tid_to_str (ptid_t id)
return child_pid_to_str (id);
}
-/* This function has no meaning in a non-threaded world. Thus, we
- return 0 (FALSE). See the use of "hppa_prepare_to_proceed" in
- hppa-tdep.c. */
-
-pid_t
-hppa_switched_threads (pid_t pid)
-{
- return (pid_t) 0;
-}
-
void
hppa_ensure_vforking_parent_remains_stopped (int pid)
{
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)
diff --git a/gdb/infttrace.c b/gdb/infttrace.c
index f86ab02..e0238e8 100644
--- a/gdb/infttrace.c
+++ b/gdb/infttrace.c
@@ -142,12 +142,6 @@ static startup_semaphore_t startup_semaphore;
static int vforking_child_pid = 0;
static int vfork_in_flight = 0;
-/* To support PREPARE_TO_PROCEED (hppa_prepare_to_proceed).
- */
-static pid_t old_gdb_pid = 0;
-static pid_t reported_pid = 0;
-static int reported_bpt = 0;
-
/* 1 if ok as results of a ttrace or ttrace_wait call, 0 otherwise.
*/
#define TT_OK( _status, _errno ) \
@@ -2912,12 +2906,6 @@ ptrace_wait (ptid_t ptid, int *status)
*/
return_pid = map_to_gdb_tid (real_tid);
- /* Remember this for later use in "hppa_prepare_to_proceed".
- */
- old_gdb_pid = PIDGET (inferior_ptid);
- reported_pid = return_pid;
- reported_bpt = ((tsp.tts_event & TTEVT_SIGNAL) && (5 == tsp.tts_u.tts_signal.tts_signo));
-
if (real_tid == 0 || return_pid == 0)
{
warning ("Internal error: process-wait failed.");
@@ -5536,64 +5524,6 @@ hppa_pid_or_tid_to_str (ptid_t ptid)
}
-/* If the current pid is not the pid this module reported
- * from "ptrace_wait" with the most recent event, then the
- * user has switched threads.
- *
- * If the last reported event was a breakpoint, then return
- * the old thread id, else return 0.
- */
-pid_t
-hppa_switched_threads (pid_t gdb_pid)
-{
- if (gdb_pid == old_gdb_pid)
- {
- /*
- * Core gdb is working with the same pid that it
- * was before we reported the last event. This
- * is ok: e.g. we reported hitting a thread-specific
- * breakpoint, but we were reporting the wrong
- * thread, so the core just ignored the event.
- *
- * No thread switch has happened.
- */
- return (pid_t) 0;
- }
- else if (gdb_pid == reported_pid)
- {
- /*
- * Core gdb is working with the pid we reported, so
- * any continue or step will be able to figure out
- * that it needs to step over any hit breakpoints
- * without our (i.e. PREPARE_TO_PROCEED's) help.
- */
- return (pid_t) 0;
- }
- else if (!reported_bpt)
- {
- /*
- * The core switched, but we didn't just report a
- * breakpoint, so there's no just-hit breakpoint
- * instruction at "reported_pid"'s PC, and thus there
- * is no need to step over it.
- */
- return (pid_t) 0;
- }
- else
- {
- /* There's been a real switch, and we reported
- * a hit breakpoint. Let "hppa_prepare_to_proceed"
- * know, so it can see whether the breakpoint is
- * still active.
- */
- return reported_pid;
- }
-
- /* Keep compiler happy with an obvious return at the end.
- */
- return (pid_t) 0;
-}
-
void
hppa_ensure_vforking_parent_remains_stopped (int pid)
{
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
index 25c06eb..30dbd96 100644
--- a/gdb/lin-lwp.c
+++ b/gdb/lin-lwp.c
@@ -298,46 +298,6 @@ iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data)
}
-/* Implementation of the PREPARE_TO_PROCEED hook for the GNU/Linux LWP
- layer.
-
- Note that this implementation is potentially redundant now that
- default_prepare_to_proceed() has been added.
-
- FIXME This may not support switching threads after Ctrl-C
- correctly. The default implementation does support this. */
-
-int
-lin_lwp_prepare_to_proceed (void)
-{
- if (!ptid_equal (trap_ptid, null_ptid)
- && !ptid_equal (inferior_ptid, trap_ptid))
- {
- /* Switched over from TRAP_PID. */
- CORE_ADDR stop_pc = read_pc ();
- CORE_ADDR trap_pc;
-
- /* Avoid switching where it wouldn't do any good, i.e. if both
- threads are at the same breakpoint. */
- trap_pc = read_pc_pid (trap_ptid);
- if (trap_pc != stop_pc && breakpoint_here_p (trap_pc))
- {
- /* User hasn't deleted the breakpoint. Return non-zero, and
- switch back to TRAP_PID. */
- inferior_ptid = trap_ptid;
-
- /* FIXME: Is this stuff really necessary? */
- flush_cached_frames ();
- registers_changed ();
-
- return 1;
- }
- }
-
- return 0;
-}
-
-
#if 0
static void
lin_lwp_open (char *args, int from_tty)