aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog54
-rw-r--r--gdb/breakpoint.c12
-rw-r--r--gdb/dink32-rom.c2
-rw-r--r--gdb/hppa-hpux-tdep.c2
-rw-r--r--gdb/infcmd.c2
-rw-r--r--gdb/inferior.h4
-rw-r--r--gdb/infrun.c15
-rw-r--r--gdb/linux-fork.c6
-rw-r--r--gdb/m32r-rom.c8
-rw-r--r--gdb/mips-tdep.c2
-rw-r--r--gdb/monitor.c6
-rw-r--r--gdb/procfs.c3
-rw-r--r--gdb/record.c2
-rw-r--r--gdb/regcache.c12
-rw-r--r--gdb/remote-m32r-sdi.c7
-rw-r--r--gdb/remote-mips.c16
-rw-r--r--gdb/rs6000-nat.c14
-rw-r--r--gdb/solib-darwin.c4
-rw-r--r--gdb/solib-pa64.c4
-rw-r--r--gdb/solib-sunos.c2
-rw-r--r--gdb/solib-svr4.c11
-rw-r--r--gdb/symfile.c5
-rw-r--r--gdb/thread.c2
-rw-r--r--gdb/tracepoint.c37
24 files changed, 144 insertions, 88 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e577908..0435bcd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,59 @@
2009-05-05 Ulrich Weigand <uweigand@de.ibm.com>
+ * inferior.h (read_pc, write_pc): Remove.
+ * regcache.c (read_pc, write_pc): Remove.
+
+ * infrun.c (displaced_step_fixup): Use regcache_read_pc instead
+ of read_pc.
+ (handle_inferior_event): Use regcache_read_pc instead of read_pc
+ when determining value of stop_pc. Replace subsequent uses of
+ read_pc by inspecting already-retrieved stop_pc value.
+ (keep_going): Use regcache_read_pc instead of read_pc.
+
+ * breakpoint.c (watchpoint_check): Use current frame architecture
+ and PC instead of current_gdbarch and read_pc ().
+ * tracepoint.c (set_traceframe_context): Replace PC argument
+ with FRAME argument.
+ (trace_start_command, finish_tfind_command): Update calls.
+ (finish_tfind_command): Compare frame IDs to identify transitions
+ between frames.
+ (trace_find_pc_command): Use regcache_read_pc instead of read_pc.
+ * rs6000-nat.c (exec_one_dummy_insn): Pass in regcache instead
+ of gdbarch. Use regcache_read_pc and regcache_write_pc instead
+ of read_pc and write_pc.
+ (store_register): Make regcache argument non-const. Update call
+ to exec_one_dummy_insn.
+
+ * thread.c (switch_to_thread): Use regcache_read_pc instead of read_pc.
+ * infcmd.c (post_create_inferior): Likewise.
+ * solib-darwin.c (darwin_solib_create_inferior_hook): Likewise.
+ * solib-pa64.c (pa64_solib_create_inferior_hook): Likewise.
+ * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise.
+ * solib-svr4.c (enable_break, svr4_relocate_main_executable): Likewise.
+ * linux-fork.c (fork_load_infrun_state): Likewise.
+ * hppa-hpux-tdep.c (hppa_hpux_push_dummy_code): Likewise.
+ * record.c (record_wait): Likewise.
+ * procfs.c (procfs_wait): Likewise.
+ * remote-mips.c (common_open, mips_wait): Likewise.
+ * remote-m32r-sdi.c (m32r_resume): Likewise.
+
+ * symfile.c (generic_load): Use regcache_write_pc instead of write_pc.
+ * monitor.c (monitor_create_inferior, monitor_load): Likewise.
+ * m32r-rom.c (m32r_load, m32r_upload_command): Likewise.
+ * remote-m32r-sdi.c (m32r_create_inferior, m32r_load): Likewise.
+ * remote-mips.c (mips_create_inferior, mips_load): Likewise.
+
+ * solib-darwin.c: Include "regcache.h".
+ * solib-pa64.c: Include "regcache.h".
+ * solib-svr4.c: Include "regcache.h.".
+
+ * symfile.c: Do not mention read_pc or write_pc in comments.
+ * dink32-rom.c: Likewise.
+ * m32r-rom.c: Likewise.
+ * mips-tdep.c: Likewise.
+
+2009-05-05 Ulrich Weigand <uweigand@de.ibm.com>
+
* fork-child.c (startup_inferior): Move setting stop_pc ...
* infcmd.c (post_create_inferior): ... to here.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c5b93a2..35db0f3 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2712,9 +2712,15 @@ watchpoint_check (void *p)
that the watchpoint frame couldn't be found by frame_find_by_id()
because the current PC is currently in an epilogue. Calling
gdbarch_in_function_epilogue_p() also when fr == NULL fixes that. */
- if ((!within_current_scope || fr == get_current_frame ())
- && gdbarch_in_function_epilogue_p (current_gdbarch, read_pc ()))
- return WP_VALUE_NOT_CHANGED;
+ if (!within_current_scope || fr == get_current_frame ())
+ {
+ struct frame_info *frame = get_current_frame ();
+ struct gdbarch *frame_arch = get_frame_arch (frame);
+ CORE_ADDR frame_pc = get_frame_pc (frame);
+
+ if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
+ return WP_VALUE_NOT_CHANGED;
+ }
if (fr && within_current_scope)
/* If we end up stopping, the current frame will get selected
in normal_stop. So this call to select_frame won't affect
diff --git a/gdb/dink32-rom.c b/gdb/dink32-rom.c
index 0a41163..08dbe29 100644
--- a/gdb/dink32-rom.c
+++ b/gdb/dink32-rom.c
@@ -24,7 +24,7 @@
#include "monitor.h"
#include "serial.h"
#include "symfile.h" /* For generic_load() */
-#include "inferior.h" /* For write_pc() */
+#include "inferior.h"
#include "regcache.h"
static void dink32_open (char *args, int from_tty);
diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index cad04f7..70077f9 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -1108,7 +1108,7 @@ hppa_hpux_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
CORE_ADDR pc, stubaddr;
int argreg = 0;
- pc = read_pc ();
+ pc = regcache_read_pc (regcache);
/* Note: we don't want to pass a function descriptor here; push_dummy_call
fills in the PIC register for us. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index a209848..ec83e34 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -392,7 +392,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
target_find_description ();
/* Now that we know the register layout, retrieve current PC. */
- stop_pc = read_pc ();
+ stop_pc = regcache_read_pc (get_current_regcache ());
/* If the solist is global across processes, there's no need to
refetch it here. */
diff --git a/gdb/inferior.h b/gdb/inferior.h
index c237e6e..c8f321a 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -152,10 +152,6 @@ extern void terminal_save_ours (void);
extern void terminal_ours (void);
-extern CORE_ADDR read_pc (void);
-
-extern void write_pc (CORE_ADDR);
-
extern CORE_ADDR unsigned_pointer_to_address (struct type *type,
const gdb_byte *buf);
extern void unsigned_address_to_pointer (struct type *type, gdb_byte *buf,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 5d9cc77..1876a01 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -838,7 +838,7 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal)
context_switch (ptid);
- actual_pc = read_pc ();
+ actual_pc = regcache_read_pc (get_thread_regcache (ptid));
if (breakpoint_here_p (actual_pc))
{
@@ -2425,7 +2425,7 @@ handle_inferior_event (struct execution_control_state *ecs)
reinit_frame_cache ();
}
- stop_pc = read_pc ();
+ stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
ecs->event_thread->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
@@ -2454,7 +2454,7 @@ handle_inferior_event (struct execution_control_state *ecs)
reinit_frame_cache ();
}
- stop_pc = read_pc ();
+ stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
/* This causes the eventpoints and symbol table to be reset.
Must do this now, before trying to determine whether to
@@ -2504,7 +2504,7 @@ handle_inferior_event (struct execution_control_state *ecs)
case TARGET_WAITKIND_NO_HISTORY:
/* Reverse execution: target ran out of history info. */
- stop_pc = read_pc ();
+ stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
print_stop_reason (NO_HISTORY, 0);
stop_stepping (ecs);
return;
@@ -2852,7 +2852,7 @@ targets should add new threads to the thread list themselves in non-stop mode.")
if (!HAVE_STEPPABLE_WATCHPOINT)
remove_breakpoints ();
/* Single step */
- hw_step = maybe_software_singlestep (current_gdbarch, read_pc ());
+ hw_step = maybe_software_singlestep (current_gdbarch, stop_pc);
target_resume (ecs->ptid, hw_step, TARGET_SIGNAL_0);
registers_changed ();
waiton_ptid = ecs->ptid;
@@ -3083,7 +3083,7 @@ process_event_stop_test:
if (signal_program[ecs->event_thread->stop_signal] == 0)
ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
- if (ecs->event_thread->prev_pc == read_pc ()
+ if (ecs->event_thread->prev_pc == stop_pc
&& ecs->event_thread->trap_expected
&& ecs->event_thread->step_resume_breakpoint == NULL)
{
@@ -4032,7 +4032,8 @@ static void
keep_going (struct execution_control_state *ecs)
{
/* Save the pc before execution, to compare with pc after stop. */
- ecs->event_thread->prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */
+ ecs->event_thread->prev_pc
+ = regcache_read_pc (get_thread_regcache (ecs->ptid));
/* If we did not do break;, it means we should keep running the
inferior and not return to debugger. */
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 861917d..a020743 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -250,7 +250,7 @@ fork_load_infrun_state (struct fork_info *fp)
registers_changed ();
reinit_frame_cache ();
- stop_pc = read_pc ();
+ stop_pc = regcache_read_pc (get_current_regcache ());
nullify_last_target_wait_ptid ();
/* Now restore the file positions of open file descriptors. */
@@ -280,7 +280,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
fp->savedregs = regcache_dup (get_current_regcache ());
fp->clobber_regs = clobber_regs;
- fp->pc = read_pc ();
+ fp->pc = regcache_read_pc (get_current_regcache ());
if (clobber_regs)
{
@@ -501,7 +501,7 @@ info_forks_command (char *arg, int from_tty)
if (ptid_equal (fp->ptid, inferior_ptid))
{
printf_filtered ("* ");
- pc = read_pc ();
+ pc = regcache_read_pc (get_current_regcache ());
}
else
{
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index a078be6..1491f22 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -37,7 +37,7 @@
#include <time.h> /* for time_t */
#include "gdb_string.h"
#include "objfiles.h" /* for ALL_OBJFILES etc. */
-#include "inferior.h" /* for write_pc() */
+#include "inferior.h"
#include <ctype.h>
#include "regcache.h"
@@ -175,7 +175,8 @@ m32r_load (char *filename, int from_tty)
/* Finally, make the PC point at the start address */
if (exec_bfd)
- write_pc (bfd_get_start_address (exec_bfd));
+ regcache_write_pc (get_current_regcache (),
+ bfd_get_start_address (exec_bfd));
inferior_ptid = null_ptid; /* No process now */
@@ -532,7 +533,8 @@ m32r_upload_command (char *args, int from_tty)
gdb_flush (gdb_stdout);
}
/* Finally, make the PC point at the start address */
- write_pc (bfd_get_start_address (abfd));
+ regcache_write_pc (get_current_regcache (),
+ bfd_get_start_address (abfd));
printf_filtered ("Start address 0x%lx\n",
(unsigned long) bfd_get_start_address (abfd));
print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 345053c..fa1c763 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -5796,7 +5796,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
reg_names = mips_generic_reg_names;
}
/* FIXME: cagney/2003-11-15: For MIPS, hasn't gdbarch_pc_regnum been
- replaced by read_pc? */
+ replaced by gdbarch_read_pc? */
set_gdbarch_pc_regnum (gdbarch, regnum->pc + num_regs);
set_gdbarch_sp_regnum (gdbarch, MIPS_SP_REGNUM + num_regs);
set_gdbarch_fp0_regnum (gdbarch, regnum->fp0);
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 60db1dc..1b41a16 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -2007,7 +2007,8 @@ monitor_create_inferior (struct target_ops *ops, char *exec_file,
first_time = 1;
clear_proceed_status ();
- write_pc (bfd_get_start_address (exec_bfd));
+ regcache_write_pc (get_current_regcache (),
+ bfd_get_start_address (exec_bfd));
}
/* Clean up when a program exits.
@@ -2155,7 +2156,8 @@ monitor_load (char *file, int from_tty)
/* Finally, make the PC point at the start address */
if (exec_bfd)
- write_pc (bfd_get_start_address (exec_bfd));
+ regcache_write_pc (get_current_regcache (),
+ bfd_get_start_address (exec_bfd));
/* There used to be code here which would clear inferior_ptid and
call clear_symtab_users. None of that should be necessary:
diff --git a/gdb/procfs.c b/gdb/procfs.c
index adb44f4..f62f075 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -4278,7 +4278,8 @@ wait_again:
then remove it. See comments in procfs_init_inferior()
for more details. */
if (dbx_link_bpt_addr != 0
- && dbx_link_bpt_addr == read_pc ())
+ && dbx_link_bpt_addr
+ == regcache_read_pc (get_current_regcache ()))
remove_dbx_link_breakpoint ();
wstat = (SIGTRAP << 8) | 0177;
diff --git a/gdb/record.c b/gdb/record.c
index 40cc174..df59550 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -608,7 +608,7 @@ record_wait (struct target_ops *ops,
{
/* Check if there is a breakpoint. */
registers_changed ();
- tmp_pc = read_pc ();
+ tmp_pc = regcache_read_pc (get_current_regcache ());
if (breakpoint_inserted_here_p (tmp_pc))
{
/* There is a breakpoint. */
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 2604d28..13b9db4 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -841,12 +841,6 @@ regcache_read_pc (struct regcache *regcache)
return pc_val;
}
-CORE_ADDR
-read_pc (void)
-{
- return regcache_read_pc (get_current_regcache ());
-}
-
void
regcache_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
@@ -862,12 +856,6 @@ regcache_write_pc (struct regcache *regcache, CORE_ADDR pc)
_("regcache_write_pc: Unable to update PC"));
}
-void
-write_pc (CORE_ADDR pc)
-{
- regcache_write_pc (get_current_regcache (), pc);
-}
-
static void
reg_flush_command (char *command, int from_tty)
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index c7f908e..029cc08 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -348,7 +348,7 @@ m32r_create_inferior (struct target_ops *ops, char *execfile,
/* Install inferior's terminal modes. */
target_terminal_inferior ();
- write_pc (entry_pt);
+ regcache_write_pc (get_current_regcache (), entry_pt);
}
/* Open a connection to a remote debugger.
@@ -464,7 +464,7 @@ m32r_resume (struct target_ops *ops,
check_mmu_status ();
- pc_addr = read_pc ();
+ pc_addr = regcache_read_pc (get_current_regcache ());
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "pc <= 0x%lx\n", pc_addr);
@@ -1355,7 +1355,8 @@ m32r_load (char *args, int from_tty)
/* Make the PC point at the start address */
if (exec_bfd)
- write_pc (bfd_get_start_address (exec_bfd));
+ regcache_write_pc (get_current_regcache (),
+ bfd_get_start_address (exec_bfd));
inferior_ptid = null_ptid; /* No process now */
delete_thread_silent (remote_m32r_ptid);
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index b35bb62..152fb37 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1573,7 +1573,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
reinit_frame_cache ();
registers_changed ();
- stop_pc = read_pc ();
+ stop_pc = regcache_read_pc (get_current_regcache ());
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
xfree (serial_port_name);
}
@@ -1792,7 +1792,7 @@ mips_wait (struct target_ops *ops,
fetch breakpoint, not a data watchpoint. FIXME when PMON
provides some way to tell us what type of breakpoint it is. */
int i;
- CORE_ADDR pc = read_pc ();
+ CORE_ADDR pc = regcache_read_pc (get_current_regcache ());
hit_watchpoint = 1;
for (i = 0; i < MAX_LSI_BREAKPOINTS; i++)
@@ -1843,7 +1843,7 @@ mips_wait (struct target_ops *ops,
{
char *func_name;
CORE_ADDR func_start;
- CORE_ADDR pc = read_pc ();
+ CORE_ADDR pc = regcache_read_pc (get_current_regcache ());
find_pc_partial_function (pc, &func_name, &func_start, NULL);
if (func_name != NULL && strcmp (func_name, "_exit") == 0
@@ -2204,7 +2204,7 @@ Can't pass arguments to remote MIPS board; arguments ignored.");
/* FIXME: Should we set inferior_ptid here? */
- write_pc (entry_pt);
+ regcache_write_pc (get_current_regcache (), entry_pt);
}
/* Clean up after a process. Actually nothing to do. */
@@ -3258,6 +3258,8 @@ pmon_load_fast (char *file)
static void
mips_load (char *file, int from_tty)
{
+ struct regcache *regcache;
+
/* Get the board out of remote debugging mode. */
if (mips_exit_debug ())
error ("mips_load: Couldn't get into monitor mode.");
@@ -3270,17 +3272,17 @@ mips_load (char *file, int from_tty)
mips_initialize ();
/* Finally, make the PC point at the start address */
+ regcache = get_current_regcache ();
if (mips_monitor != MON_IDT)
{
/* Work around problem where PMON monitor updates the PC after a load
to a different value than GDB thinks it has. The following ensures
- that the write_pc() WILL update the PC value: */
- struct regcache *regcache = get_current_regcache ();
+ that the regcache_write_pc() WILL update the PC value: */
regcache_invalidate (regcache,
gdbarch_pc_regnum (get_regcache_arch (regcache)));
}
if (exec_bfd)
- write_pc (bfd_get_start_address (exec_bfd));
+ regcache_write_pc (regcache, bfd_get_start_address (exec_bfd));
inferior_ptid = null_ptid; /* No process now */
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 5241183..8aeef25 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -130,7 +130,7 @@ static int objfile_symbol_add (void *);
static void vmap_symtab (struct vmap *);
-static void exec_one_dummy_insn (struct gdbarch *);
+static void exec_one_dummy_insn (struct regcache *);
extern void fixup_breakpoints (CORE_ADDR low, CORE_ADDR high, CORE_ADDR delta);
@@ -267,7 +267,7 @@ fetch_register (struct regcache *regcache, int regno)
/* Store register REGNO back into the inferior. */
static void
-store_register (const struct regcache *regcache, int regno)
+store_register (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int addr[MAX_REGISTER_SIZE];
@@ -303,7 +303,7 @@ store_register (const struct regcache *regcache, int regno)
Otherwise the following ptrace(2) calls will mess up user stack
since kernel will get confused about the bottom of the stack
(%sp). */
- exec_one_dummy_insn (gdbarch);
+ exec_one_dummy_insn (regcache);
/* The PT_WRITE_GPR operation is rather odd. For 32-bit inferiors,
the register's value is passed by value, but for 64-bit inferiors,
@@ -577,7 +577,7 @@ rs6000_wait (struct target_ops *ops,
including u_area. */
static void
-exec_one_dummy_insn (struct gdbarch *gdbarch)
+exec_one_dummy_insn (struct regcache *regcache)
{
#define DUMMY_INSN_ADDR AIX_TEXT_SEGMENT_BASE+0x200
@@ -596,8 +596,8 @@ exec_one_dummy_insn (struct gdbarch *gdbarch)
on. However, rs6000-ibm-aix4.1.3 seems to have screwed this up --
the inferior never hits the breakpoint (it's also worth noting
powerpc-ibm-aix4.1.3 works correctly). */
- prev_pc = read_pc ();
- write_pc (DUMMY_INSN_ADDR);
+ prev_pc = regcache_read_pc (regcache);
+ regcache_write_pc (regcache, DUMMY_INSN_ADDR);
if (ARCH64 ())
ret = rs6000_ptrace64 (PT_CONTINUE, PIDGET (inferior_ptid), 1, 0, NULL);
else
@@ -612,7 +612,7 @@ exec_one_dummy_insn (struct gdbarch *gdbarch)
}
while (pid != PIDGET (inferior_ptid));
- write_pc (prev_pc);
+ regcache_write_pc (regcache, prev_pc);
deprecated_remove_raw_breakpoint (bp);
}
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 3305804..26ff1cc 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -26,6 +26,7 @@
#include "gdbcore.h"
#include "target.h"
#include "inferior.h"
+#include "regcache.h"
#include "gdbthread.h"
#include "gdb_assert.h"
@@ -332,7 +333,8 @@ darwin_solib_create_inferior_hook (void)
/* We find the dynamic linker's base address by examining
the current pc (which should point at the entry point for the
dynamic linker) and subtracting the offset of the entry point. */
- load_addr = (read_pc () - bfd_get_start_address (dyld_bfd));
+ load_addr = (regcache_read_pc (get_current_regcache ())
+ - bfd_get_start_address (dyld_bfd));
}
else
{
diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
index 9cbf5a6..70dc51a 100644
--- a/gdb/solib-pa64.c
+++ b/gdb/solib-pa64.c
@@ -36,6 +36,7 @@
#include "gdbcore.h"
#include "target.h"
#include "inferior.h"
+#include "regcache.h"
#include "hppa-tdep.h"
#include "solist.h"
@@ -421,7 +422,8 @@ pa64_solib_create_inferior_hook (void)
Also note the breakpoint is the second instruction in the
routine. */
- load_addr = read_pc () - tmp_bfd->start_address;
+ load_addr = regcache_read_pc (get_current_regcache ())
+ - tmp_bfd->start_address;
sym_addr = bfd_lookup_symbol (tmp_bfd, "__dld_break");
sym_addr = load_addr + sym_addr + 4;
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index a400e92..8cb2dfe 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -791,7 +791,7 @@ sunos_solib_create_inferior_hook (void)
if (gdbarch_decr_pc_after_break (target_gdbarch))
{
stop_pc -= gdbarch_decr_pc_after_break (target_gdbarch);
- write_pc (stop_pc);
+ regcache_write_pc (get_current_regcache (), stop_pc);
}
if (!disable_break ())
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 781cef5..31c81f8 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -32,6 +32,7 @@
#include "gdbcore.h"
#include "target.h"
#include "inferior.h"
+#include "regcache.h"
#include "gdbthread.h"
#include "gdb_assert.h"
@@ -1289,8 +1290,11 @@ enable_break (void)
fallback method because it has actually been working well in
most cases. */
if (!load_addr_found)
- load_addr = (read_pc ()
- - exec_entry_point (tmp_bfd, tmp_bfd_target));
+ {
+ struct regcache *regcache = get_thread_regcache (inferior_ptid);
+ load_addr = (regcache_read_pc (regcache)
+ - exec_entry_point (tmp_bfd, tmp_bfd_target));
+ }
if (!loader_found_in_list)
{
@@ -1424,7 +1428,8 @@ static void
svr4_relocate_main_executable (void)
{
asection *interp_sect;
- CORE_ADDR pc = read_pc ();
+ struct regcache *regcache = get_thread_regcache (inferior_ptid);
+ CORE_ADDR pc = regcache_read_pc (regcache);
/* Decide if the objfile needs to be relocated. As indicated above,
we will only be here when execution is stopped at the beginning
diff --git a/gdb/symfile.c b/gdb/symfile.c
index af1ab74..527b0d5 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -37,7 +37,8 @@
#include "language.h"
#include "complaints.h"
#include "demangle.h"
-#include "inferior.h" /* for write_pc */
+#include "inferior.h"
+#include "regcache.h"
#include "filenames.h" /* for DOSish file names */
#include "gdb-stabs.h"
#include "gdb_obstack.h"
@@ -1986,7 +1987,7 @@ generic_load (char *args, int from_tty)
ui_out_text (uiout, "\n");
/* We were doing this in remote-mips.c, I suspect it is right
for other targets too. */
- write_pc (entry);
+ regcache_write_pc (get_current_regcache (), entry);
/* FIXME: are we supposed to call symbol_file_add or not? According
to a comment from remote-mips.c (where a call to symbol_file_add
diff --git a/gdb/thread.c b/gdb/thread.c
index 0ce24c6..ffb93be 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -852,7 +852,7 @@ switch_to_thread (ptid_t ptid)
if (!ptid_equal (inferior_ptid, null_ptid)
&& !is_exited (ptid)
&& !is_executing (ptid))
- stop_pc = read_pc ();
+ stop_pc = regcache_read_pc (get_thread_regcache (ptid));
else
stop_pc = ~(CORE_ADDR) 0;
}
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 194d729..dece799 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -224,15 +224,17 @@ set_tracepoint_num (int num)
the traceframe context (line, function, file) */
static void
-set_traceframe_context (CORE_ADDR trace_pc)
+set_traceframe_context (struct frame_info *trace_frame)
{
+ CORE_ADDR trace_pc;
+
static struct type *func_string, *file_string;
static struct type *func_range, *file_range;
struct value *func_val;
struct value *file_val;
int len;
- if (trace_pc == -1) /* Cease debugging any trace buffers. */
+ if (trace_frame == NULL) /* Cease debugging any trace buffers. */
{
traceframe_fun = 0;
traceframe_sal.pc = traceframe_sal.line = 0;
@@ -248,6 +250,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
}
/* Save as globals for internal use. */
+ trace_pc = get_frame_pc (trace_frame);
traceframe_sal = find_pc_line (trace_pc, 0);
traceframe_fun = find_pc_function (trace_pc);
@@ -1319,7 +1322,7 @@ trace_start_command (char *args, int from_tty)
error (_("Bogus reply from target: %s"), target_buf);
set_traceframe_num (-1); /* All old traceframes invalidated. */
set_tracepoint_num (-1);
- set_traceframe_context (-1);
+ set_traceframe_context (NULL);
trace_running_p = 1;
if (deprecated_trace_start_stop_hook)
deprecated_trace_start_stop_hook (1, from_tty);
@@ -1447,12 +1450,10 @@ finish_tfind_command (char **msg,
int from_tty)
{
int target_frameno = -1, target_tracept = -1;
- CORE_ADDR old_frame_addr;
- struct symbol *old_func;
+ struct frame_id old_frame_id;
char *reply;
- old_frame_addr = get_frame_base (get_current_frame ());
- old_func = find_pc_function (read_pc ());
+ old_frame_id = get_frame_id (get_current_frame ());
putpkt (*msg);
reply = remote_get_noisy_reply (msg, sizeof_msg);
@@ -1517,9 +1518,9 @@ finish_tfind_command (char **msg,
set_traceframe_num (target_frameno);
set_tracepoint_num (target_tracept);
if (target_frameno == -1)
- set_traceframe_context (-1);
+ set_traceframe_context (NULL);
else
- set_traceframe_context (read_pc ());
+ set_traceframe_context (get_current_frame ());
if (from_tty)
{
@@ -1529,18 +1530,10 @@ finish_tfind_command (char **msg,
whether we have made a transition from one function to
another. If so, we'll print the "stack frame" (ie. the new
function and it's arguments) -- otherwise we'll just show the
- new source line.
-
- This determination is made by checking (1) whether the
- current function has changed, and (2) whether the current FP
- has changed. Hack: if the FP wasn't collected, either at the
- current or the previous frame, assume that the FP has NOT
- changed. */
-
- if (old_func == find_pc_function (read_pc ()) &&
- (old_frame_addr == 0 ||
- get_frame_base (get_current_frame ()) == 0 ||
- old_frame_addr == get_frame_base (get_current_frame ())))
+ new source line. */
+
+ if (frame_id_eq (old_frame_id,
+ get_frame_id (get_current_frame ())))
print_what = SRC_LINE;
else
print_what = SRC_AND_LOC;
@@ -1635,7 +1628,7 @@ trace_find_pc_command (char *args, int from_tty)
if (target_is_remote ())
{
if (args == 0 || *args == 0)
- pc = read_pc (); /* default is current pc */
+ pc = regcache_read_pc (get_current_regcache ());
else
pc = parse_and_eval_address (args);