2004-10-29 Andrew Cagney <cagney@gnu.org>

* frame.h (get_selected_frame): Add message parameter.
	* frame.c (get_selected_frame): Add and use message parameter.
	* stack.c (current_frame_command, return_command, locals_info)
	(catch_info, args_info, up_silently_base, down_silently_base): Use
	get_selected_frame with an explicit message.
	* thread.c, stack.c, sh-tdep.c, sh64-tdep.c: Update.
	* remote-rdp.c, remote-mips.c, remote-e7000.c: Update.
	* ocd.c, mi/mi-main.c, mi/mi-cmd-stack.c: Update.
	* infrun.c, inflow.c, infcmd.c, frame.c: Update.
	* findvar.c, eval.c, corelow.c, bsd-kvm.c: Update.
	* breakpoint.c: Update.
This commit is contained in:
Andrew Cagney 2004-10-29 20:23:17 +00:00
parent 00b25ff323
commit b04f3ab417
21 changed files with 70 additions and 66 deletions

View File

@ -1,4 +1,18 @@
2004-10-27 Andrew Cagney <cagney@gnu.org>
2004-10-29 Andrew Cagney <cagney@gnu.org>
* frame.h (get_selected_frame): Add message parameter.
* frame.c (get_selected_frame): Add and use message parameter.
* stack.c (current_frame_command, return_command, locals_info)
(catch_info, args_info, up_silently_base, down_silently_base): Use
get_selected_frame with an explicit message.
* thread.c, stack.c, sh-tdep.c, sh64-tdep.c: Update.
* remote-rdp.c, remote-mips.c, remote-e7000.c: Update.
* ocd.c, mi/mi-main.c, mi/mi-cmd-stack.c: Update.
* infrun.c, inflow.c, infcmd.c, frame.c: Update.
* findvar.c, eval.c, corelow.c, bsd-kvm.c: Update.
* breakpoint.c: Update.
2004-10-29 Andrew Cagney <cagney@gnu.org>
* trad-frame.c (trad_frame_get_prev_register): Use
frame_unwind_register instead of frame_register_unwind, do not

View File

@ -7644,7 +7644,7 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
{
struct frame_id saved_frame_id;
saved_frame_id = get_frame_id (get_selected_frame ());
saved_frame_id = get_frame_id (get_selected_frame (NULL));
if (bpt->exp_valid_block != NULL)
{
struct frame_info *fr =

View File

@ -89,7 +89,7 @@ bsd_kvm_open (char *filename, int from_tty)
flush_cached_frames ();
select_frame (get_current_frame ());
print_stack_frame (get_selected_frame (), -1, 1);
print_stack_frame (get_selected_frame (NULL), -1, 1);
}
static void
@ -245,7 +245,7 @@ bsd_kvm_proc_cmd (char *arg, int fromtty)
flush_cached_frames ();
select_frame (get_current_frame ());
print_stack_frame (get_selected_frame (), -1, 1);
print_stack_frame (get_selected_frame (NULL), -1, 1);
}
#endif
@ -265,7 +265,7 @@ bsd_kvm_pcb_cmd (char *arg, int fromtty)
flush_cached_frames ();
select_frame (get_current_frame ());
print_stack_frame (get_selected_frame (), -1, 1);
print_stack_frame (get_selected_frame (NULL), -1, 1);
}
/* Add the libkvm interface to the list of all possible targets and

View File

@ -402,7 +402,7 @@ core_open (char *filename, int from_tty)
/* Now, set up the frame cache, and print the top of stack. */
flush_cached_frames ();
select_frame (get_current_frame ());
print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
}
else
{

View File

@ -447,11 +447,11 @@ evaluate_subexp_standard (struct type *expect_type,
case OP_REGISTER:
{
int regno = longest_to_int (exp->elts[pc + 1].longconst);
struct value *val = value_of_register (regno, get_selected_frame ());
struct value *val = value_of_register (regno, get_selected_frame (NULL));
(*pos) += 2;
if (val == NULL)
error ("Value of register %s not available.",
frame_map_regnum_to_name (get_selected_frame (), regno));
frame_map_regnum_to_name (get_selected_frame (NULL), regno));
else
return val;
}

View File

@ -822,13 +822,19 @@ struct frame_info *deprecated_selected_frame;
thrown. */
struct frame_info *
get_selected_frame (void)
get_selected_frame (const char *message)
{
if (deprecated_selected_frame == NULL)
/* Hey! Don't trust this. It should really be re-finding the
last selected frame of the currently selected thread. This,
though, is better than nothing. */
select_frame (get_current_frame ());
{
if (message != NULL && (!target_has_registers
|| !target_has_stack
|| !target_has_memory))
error ("%s", message);
/* Hey! Don't trust this. It should really be re-finding the
last selected frame of the currently selected thread. This,
though, is better than nothing. */
select_frame (get_current_frame ());
}
/* There is always a frame. */
gdb_assert (deprecated_selected_frame != NULL);
return deprecated_selected_frame;
@ -843,7 +849,7 @@ deprecated_safe_get_selected_frame (void)
{
if (!target_has_registers || !target_has_stack || !target_has_memory)
return NULL;
return get_selected_frame ();
return get_selected_frame (NULL);
}
/* Select frame FI (or NULL - to invalidate the current frame). */

View File

@ -219,13 +219,15 @@ extern void flush_cached_frames (void);
extern void reinit_frame_cache (void);
/* On demand, create the selected frame and then return it. If the
selected frame can not be created, this function throws an error. */
selected frame can not be created, this function prints then throws
an error. When MESSAGE is non-NULL, use it for the error message,
otherwize use a generic error message. */
/* FIXME: cagney/2002-11-28: At present, when there is no selected
frame, this function always returns the current (inner most) frame.
It should instead, when a thread has previously had its frame
selected (but not resumed) and the frame cache invalidated, find
and then return that thread's previously selected frame. */
extern struct frame_info *get_selected_frame (void);
extern struct frame_info *get_selected_frame (const char *message);
/* Select a specific frame. NULL, apparently implies re-select the
inner most frame. */

View File

@ -1242,7 +1242,7 @@ finish_command (char *arg, int from_tty)
if (from_tty)
{
printf_filtered ("Run till exit from ");
print_stack_frame (get_selected_frame (), 1, LOCATION);
print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
}
/* If running asynchronously and the target support asynchronous

View File

@ -594,7 +594,7 @@ kill_command (char *arg, int from_tty)
if (deprecated_selected_frame == NULL)
fputs_filtered ("No selected stack frame.\n", gdb_stdout);
else
print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
}
bfd_cache_close_all ();
}

View File

@ -3014,7 +3014,7 @@ normal_stop (void)
LOCATION: Print only location
SRC_AND_LOC: Print location and source line */
if (do_frame_printing)
print_stack_frame (get_selected_frame (), 0, source_flag);
print_stack_frame (get_selected_frame (NULL), 0, source_flag);
/* Display the auto-display expressions. */
do_displays ();

View File

@ -139,7 +139,7 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc)
if (argc != 1)
error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES");
frame = get_selected_frame ();
frame = get_selected_frame (NULL);
if (strcmp (argv[0], "0") == 0
|| strcmp (argv[0], "--no-values") == 0)

View File

@ -181,7 +181,7 @@ mi_cmd_exec_return (char *args, int from_tty)
/* Because we have called return_command with from_tty = 0, we need
to print the frame here. */
print_stack_frame (get_selected_frame (), 1, LOC_AND_ADDRESS);
print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS);
return MI_CMD_DONE;
}

View File

@ -225,7 +225,7 @@ ocd_start_remote (void *dummy)
flush_cached_frames ();
registers_changed ();
stop_pc = read_pc ();
print_stack_frame (get_selected_frame (), 0, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
buf[0] = OCD_LOG_FILE;
buf[1] = 3; /* close existing WIGGLERS.LOG */

View File

@ -630,7 +630,7 @@ e7000_start_remote (void *dummy)
flush_cached_frames ();
registers_changed ();
stop_pc = read_pc ();
print_stack_frame (get_selected_frame (), 0, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
return 1;
}

View File

@ -1586,7 +1586,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
flush_cached_frames ();
registers_changed ();
stop_pc = read_pc ();
print_stack_frame (get_selected_frame (), 0, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
xfree (serial_port_name);
}

View File

@ -1181,7 +1181,7 @@ remote_rdp_open (char *args, int from_tty)
flush_cached_frames ();
registers_changed ();
stop_pc = read_pc ();
print_stack_frame (get_selected_frame (), 0, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
}

View File

@ -2033,7 +2033,7 @@ sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum)
raw_buffer = (char *) alloca (register_size (gdbarch, FP0_REGNUM));
/* Get the data in raw format. */
if (!frame_register_read (get_selected_frame (), regnum, raw_buffer))
if (!frame_register_read (get_selected_frame (NULL), regnum, raw_buffer))
error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
/* Get the register as a number */
@ -2071,7 +2071,7 @@ sh_do_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum)
print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
/* Get the data in raw format. */
if (!frame_register_read (get_selected_frame (), regnum, raw_buffer))
if (!frame_register_read (get_selected_frame (NULL), regnum, raw_buffer))
fprintf_filtered (file, "*value not available*\n");
val_print (gdbarch_register_type (gdbarch, regnum), raw_buffer, 0, 0,

View File

@ -2538,7 +2538,7 @@ sh_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum)
raw_buffer = (char *) alloca (register_size (gdbarch, FP0_REGNUM));
/* Get the data in raw format. */
if (!frame_register_read (get_selected_frame (), regnum, raw_buffer))
if (!frame_register_read (get_selected_frame (NULL), regnum, raw_buffer))
error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
/* Get the register as a number */
@ -2618,7 +2618,7 @@ sh_do_register (struct gdbarch *gdbarch, struct ui_file *file, int regnum)
print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), file);
/* Get the data in raw format. */
if (!frame_register_read (get_selected_frame (), regnum, raw_buffer))
if (!frame_register_read (get_selected_frame (NULL), regnum, raw_buffer))
fprintf_filtered (file, "*value not available*\n");
val_print (gdbarch_register_type (gdbarch, regnum), raw_buffer, 0, 0,

View File

@ -1445,9 +1445,8 @@ print_frame_label_vars (struct frame_info *fi, int this_level_only,
void
locals_info (char *args, int from_tty)
{
if (!deprecated_selected_frame)
error ("No frame selected.");
print_frame_local_vars (deprecated_selected_frame, 0, gdb_stdout);
print_frame_local_vars (get_selected_frame ("No frame selected."),
0, gdb_stdout);
}
static void
@ -1467,10 +1466,8 @@ catch_info (char *ignore, int from_tty)
else
{
/* Assume g++ compiled code -- old v 4.16 behaviour */
if (!deprecated_selected_frame)
error ("No frame selected.");
print_frame_label_vars (deprecated_selected_frame, 0, gdb_stdout);
print_frame_label_vars (get_selected_frame ("No frame selected."),
0, gdb_stdout);
}
}
@ -1537,9 +1534,8 @@ print_frame_arg_vars (struct frame_info *fi,
void
args_info (char *ignore, int from_tty)
{
if (!deprecated_selected_frame)
error ("No frame selected.");
print_frame_arg_vars (deprecated_selected_frame, gdb_stdout);
print_frame_arg_vars (get_selected_frame ("No frame selected."),
gdb_stdout);
}
@ -1662,7 +1658,7 @@ void
frame_command (char *level_exp, int from_tty)
{
select_frame_command (level_exp, from_tty);
print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
}
/* The XDB Compatibility command to print the current frame. */
@ -1670,9 +1666,7 @@ frame_command (char *level_exp, int from_tty)
static void
current_frame_command (char *level_exp, int from_tty)
{
if (target_has_stack == 0 || deprecated_selected_frame == 0)
error ("No stack.");
print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
print_stack_frame (get_selected_frame ("No stack."), 1, SRC_AND_LOC);
}
/* Select the frame up one or COUNT stack levels
@ -1687,10 +1681,7 @@ up_silently_base (char *count_exp)
count = parse_and_eval_long (count_exp);
count1 = count;
if (target_has_stack == 0 || deprecated_selected_frame == 0)
error ("No stack.");
fi = find_relative_frame (deprecated_selected_frame, &count1);
fi = find_relative_frame (get_selected_frame ("No stack."), &count1);
if (count1 != 0 && count_exp == 0)
error ("Initial frame selected; you cannot go up.");
select_frame (fi);
@ -1706,7 +1697,7 @@ static void
up_command (char *count_exp, int from_tty)
{
up_silently_base (count_exp);
print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
}
/* Select the frame down one or COUNT stack levels
@ -1721,10 +1712,7 @@ down_silently_base (char *count_exp)
count = -parse_and_eval_long (count_exp);
count1 = count;
if (target_has_stack == 0 || deprecated_selected_frame == 0)
error ("No stack.");
frame = find_relative_frame (deprecated_selected_frame, &count1);
frame = find_relative_frame (get_selected_frame ("No stack."), &count1);
if (count1 != 0 && count_exp == 0)
{
@ -1749,7 +1737,7 @@ static void
down_command (char *count_exp, int from_tty)
{
down_silently_base (count_exp);
print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
}
void
@ -1759,13 +1747,7 @@ return_command (char *retval_exp, int from_tty)
struct value *return_value = NULL;
const char *query_prefix = "";
/* FIXME: cagney/2003-10-20: Perform a minimal existance test on the
target. If that fails, error out. For the moment don't rely on
get_selected_frame as it's error message is the the singularly
obscure "No registers". */
if (!target_has_registers)
error ("No selected frame.");
thisfun = get_frame_function (get_selected_frame ());
thisfun = get_frame_function (get_selected_frame ("No selected frame."));
/* Compute the return value. If the computation triggers an error,
let it bail. If the return type can't be handled, set
@ -1848,7 +1830,7 @@ If you continue, the return value that you specified will be ignored.\n";
/* First discard all frames inner-to the selected frame (making the
selected frame current). */
{
struct frame_id selected_id = get_frame_id (get_selected_frame ());
struct frame_id selected_id = get_frame_id (get_selected_frame (NULL));
while (!frame_id_eq (selected_id, get_frame_id (get_current_frame ())))
{
if (frame_id_inner (selected_id, get_frame_id (get_current_frame ())))

View File

@ -407,7 +407,7 @@ info_threads_command (char *arg, int from_tty)
struct thread_info *tp;
ptid_t current_ptid;
struct frame_info *cur_frame;
struct frame_id saved_frame_id = get_frame_id (get_selected_frame ());
struct frame_id saved_frame_id = get_frame_id (get_selected_frame (NULL));
char *extra_info;
prune_threads ();
@ -428,7 +428,7 @@ info_threads_command (char *arg, int from_tty)
puts_filtered (" ");
switch_to_thread (tp->ptid);
print_stack_frame (get_selected_frame (), 0, LOCATION);
print_stack_frame (get_selected_frame (NULL), 0, LOCATION);
}
switch_to_thread (current_ptid);
@ -442,7 +442,7 @@ info_threads_command (char *arg, int from_tty)
{
/* Ooops, can't restore, tell user where we are. */
warning ("Couldn't restore frame in current thread, at frame 0");
print_stack_frame (get_selected_frame (), 0, LOCATION);
print_stack_frame (get_selected_frame (NULL), 0, LOCATION);
}
else
{
@ -661,7 +661,7 @@ do_captured_thread_select (struct ui_out *uiout, void *tidstr)
ui_out_text (uiout, target_tid_to_str (inferior_ptid));
ui_out_text (uiout, ")]");
print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
return GDB_RC_OK;
}

View File

@ -1949,7 +1949,7 @@ finish_tfind_command (char *msg,
else
print_what = SRC_AND_LOC;
print_stack_frame (get_selected_frame (), 1, print_what);
print_stack_frame (get_selected_frame (NULL), 1, print_what);
do_displays ();
}
}