* 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.
This commit is contained in:
Ulrich Weigand
2009-05-05 13:24:49 +00:00
parent 738a79f669
commit fb14de7bbd
24 changed files with 143 additions and 87 deletions

View File

@ -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.
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 ())))
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);