diff options
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/breakpoint.c | 2 | ||||
-rw-r--r-- | gdb/bsd-kvm.c | 6 | ||||
-rw-r--r-- | gdb/corelow.c | 2 | ||||
-rw-r--r-- | gdb/eval.c | 4 | ||||
-rw-r--r-- | gdb/frame.c | 18 | ||||
-rw-r--r-- | gdb/frame.h | 6 | ||||
-rw-r--r-- | gdb/infcmd.c | 2 | ||||
-rw-r--r-- | gdb/inflow.c | 2 | ||||
-rw-r--r-- | gdb/infrun.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 2 | ||||
-rw-r--r-- | gdb/ocd.c | 2 | ||||
-rw-r--r-- | gdb/remote-e7000.c | 2 | ||||
-rw-r--r-- | gdb/remote-mips.c | 2 | ||||
-rw-r--r-- | gdb/remote-rdp.c | 2 | ||||
-rw-r--r-- | gdb/sh-tdep.c | 4 | ||||
-rw-r--r-- | gdb/sh64-tdep.c | 4 | ||||
-rw-r--r-- | gdb/stack.c | 46 | ||||
-rw-r--r-- | gdb/thread.c | 8 | ||||
-rw-r--r-- | gdb/tracepoint.c | 2 |
21 files changed, 70 insertions, 66 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cfce5eaf157..d9600811ef6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index eac34b8534f..5537673321f 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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 = diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c index 300379d954f..818a588892a 100644 --- a/gdb/bsd-kvm.c +++ b/gdb/bsd-kvm.c @@ -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 diff --git a/gdb/corelow.c b/gdb/corelow.c index f91ec590ad0..c130cf8b4c3 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -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 { diff --git a/gdb/eval.c b/gdb/eval.c index 4418e0ad29b..a07df58e92b 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -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; } diff --git a/gdb/frame.c b/gdb/frame.c index 0d0e2c9094d..d9de0e6d766 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -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). */ diff --git a/gdb/frame.h b/gdb/frame.h index f4b10891b46..d49192f7f4b 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -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. */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index afa07c474f0..25a5f4f23a3 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -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 diff --git a/gdb/inflow.c b/gdb/inflow.c index eb5c89bda57..fbbbbb131ee 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -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 (); } diff --git a/gdb/infrun.c b/gdb/infrun.c index 7cf9953044a..2624713e111 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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 (); diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 37d0846c82e..cafd45c518d 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -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) diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 6961992d548..74336ab4b6e 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -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; } diff --git a/gdb/ocd.c b/gdb/ocd.c index dffc176688a..320f06a7f8b 100644 --- a/gdb/ocd.c +++ b/gdb/ocd.c @@ -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 */ diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 405a6b53411..e223c2cbdc4 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -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; } diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 175a4f96f03..ab66a904977 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -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); } diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index d480d5331ee..f8d9d8b77b1 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -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); } diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index a745e44fe3e..e8d7c52e031 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -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, diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index fac6617a3ff..526a2e98726 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -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, diff --git a/gdb/stack.c b/gdb/stack.c index 5d7af0a1959..2c5145c7b76 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -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 ()))) diff --git a/gdb/thread.c b/gdb/thread.c index a52395bd144..c77585e3fc0 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -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; } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 5d8b076cce1..cf064a7e974 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -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 (); } } |