* 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-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
{
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 =
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
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
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
/* 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
{
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;
}
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;
{
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). */
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. */
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
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 ();
}
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 ();
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)
/* 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;
}
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 */
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;
}
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);
}
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);
}
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 */
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,
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 */
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,
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
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);
}
}
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);
}
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. */
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
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);
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
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)
{
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);
}
\f
void
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
/* 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 ())))
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 ();
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);
{
/* 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
{
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;
}
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 ();
}
}