From: Andrew Cagney Date: Fri, 29 Nov 2002 19:15:16 +0000 (+0000) Subject: 2002-11-29 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e7f8b9cbab2b8bc4517ece86ae0c7f4f7d7599a;p=binutils-gdb.git 2002-11-29 Andrew Cagney * stack.c (selected_frame, select_frame): Move from here ... * frame.c (selected_frame, select_frame): ... to here. Include "language.h". * Makefile.in (frame.o): Update dependencies. * frame.c (get_selected_frame): New function. * frame.h (get_selected_frame): Declare. (deprecated_selected_frame): Rename selected_frame. * ada-lang.c, ada-tasks.c, breakpoint.c, corelow.c: Update. * eval.c, f-valprint.c, findvar.c, frame.c, frame.h: Update. * h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, infcmd.c: Update. * inflow.c, infrun.c, macroscope.c, mips-tdep.c: Update. * mn10300-tdep.c, ocd.c, regcache.h, remote-e7000.c: Update. * remote-mips.c, remote-rdp.c, sh-tdep.c, sparc-tdep.c: Update. * stack.c, thread.c, tracepoint.c, valops.c, varobj.c: Update. * z8k-tdep.c, cli/cli-cmds.c: Update. Index: mi/ChangeLog 2002-11-29 Andrew Cagney * mi/mi-cmd-stack.c, mi/mi-main.c: Update to use deprecated_selected_frame. Index: tui/ChangeLog 2002-11-29 Andrew Cagney * tui/tui-hooks.c: Update to use deprecated_selected_frame. * tui/tui.c, tui/tuiDisassem.c, tui/tuiRegs.c: Ditto. * tui/tuiSource.c, tui/tuiSourceWin.c, tui/tuiWin.c: Ditto. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 472568b6d31..9ae7b76058f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +2002-11-29 Andrew Cagney + + * stack.c (selected_frame, select_frame): Move from here ... + * frame.c (selected_frame, select_frame): ... to here. Include + "language.h". + * Makefile.in (frame.o): Update dependencies. + * frame.c (get_selected_frame): New function. + * frame.h (get_selected_frame): Declare. + (deprecated_selected_frame): Rename selected_frame. + * ada-lang.c, ada-tasks.c, breakpoint.c, corelow.c: Update. + * eval.c, f-valprint.c, findvar.c, frame.c, frame.h: Update. + * h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, infcmd.c: Update. + * inflow.c, infrun.c, macroscope.c, mips-tdep.c: Update. + * mn10300-tdep.c, ocd.c, regcache.h, remote-e7000.c: Update. + * remote-mips.c, remote-rdp.c, sh-tdep.c, sparc-tdep.c: Update. + * stack.c, thread.c, tracepoint.c, valops.c, varobj.c: Update. + * z8k-tdep.c, cli/cli-cmds.c: Update. + 2002-11-29 Andrew Cagney * frame.h (get_selected_block): Add comments. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 5b625724e15..c9d65c8fa31 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1706,8 +1706,9 @@ fork-child.o: fork-child.c $(defs_h) $(gdb_string_h) $(frame_h) \ $(terminal_h) $(gdbthread_h) $(command_h) # OBSOLETE fr30-tdep.o: fr30-tdep.c frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \ - $(regcache_h) $(gdb_assert_h) $(gdb_obstack_h) $(dummy_frame_h) \ - $(gdbcore_h) $(annotate_h) + $(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(builtin_regs_h) \ + $(gdb_obstack_h) $(dummy_frame_h) $(gdbcore_h) $(annotate_h) \ + $(language_h) frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ $(arch_utils_h) $(regcache_h) gcore.o: gcore.c $(defs_h) $(cli_decode_h) $(inferior_h) $(gdbcore_h) \ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 04d2183a1d2..84ec71beb60 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3536,7 +3536,7 @@ add_symbols_from_enclosing_procs (const char *name, namespace_enum namespace, -(long) TYPE_LENGTH (SYMBOL_TYPE (static_link)); } - frame = selected_frame; + frame = deprecated_selected_frame; while (frame != NULL && ndefns == 0) { struct block *block; @@ -5043,7 +5043,7 @@ find_printable_frame (struct frame_info *fi, int level) STREQ (sal.symtab->objfile->name, "/usr/shlib/libpthread.so")) continue; #endif - selected_frame = fi; + deprecated_selected_frame = fi; break; } } diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 2e6bff3b18e..ad67cba10fe 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -795,10 +795,10 @@ task_command (char *tidstr, int from_tty) { /* FIXME: find_printable_frame should be defined in frame.h, and implemented in ada-lang.c */ - /* find_printable_frame (selected_frame, frame_relative_level (selected_frame)); */ + /* find_printable_frame (deprecated_selected_frame, frame_relative_level (deprecated_selected_frame)); */ printf_filtered ("[Switching to task %d]\n", num); - print_stack_frame (selected_frame, - frame_relative_level (selected_frame), 1); + print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 1); } else printf_filtered ("Unable to switch to task %d\n", num); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 4fc247b28c8..dfe9851162d 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -952,8 +952,8 @@ insert_breakpoints (void) /* Save the current frame and level so we can restore it after evaluating the watchpoint expression on its own frame. */ - saved_frame = selected_frame; - saved_level = frame_relative_level (selected_frame); + saved_frame = deprecated_selected_frame; + saved_level = frame_relative_level (deprecated_selected_frame); /* Determine if the watchpoint is within scope. */ if (b->exp_valid_block == NULL) @@ -1049,8 +1049,8 @@ insert_breakpoints (void) } /* Restore the frame and level. */ - if ((saved_frame != selected_frame) || - (saved_level != frame_relative_level (selected_frame))) + if ((saved_frame != deprecated_selected_frame) || + (saved_level != frame_relative_level (deprecated_selected_frame))) select_frame (saved_frame); if (val) @@ -4963,9 +4963,9 @@ break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty) if (default_breakpoint_valid) { - if (selected_frame) + if (deprecated_selected_frame) { - selected_pc = selected_frame->pc; + selected_pc = deprecated_selected_frame->pc; if (arg) if_arg = 1; } @@ -5041,10 +5041,10 @@ break_at_finish_command_1 (char *arg, int flag, int from_tty) { if (default_breakpoint_valid) { - if (selected_frame) + if (deprecated_selected_frame) { addr_string = (char *) xmalloc (15); - sprintf (addr_string, "*0x%s", paddr_nz (selected_frame->pc)); + sprintf (addr_string, "*0x%s", paddr_nz (deprecated_selected_frame->pc)); if (arg) if_arg = 1; } @@ -5583,7 +5583,7 @@ until_break_command (char *arg, int from_tty) { struct symtabs_and_lines sals; struct symtab_and_line sal; - struct frame_info *prev_frame = get_prev_frame (selected_frame); + struct frame_info *prev_frame = get_prev_frame (deprecated_selected_frame); struct breakpoint *breakpoint; struct cleanup *old_chain; struct continuation_arg *arg1; @@ -5612,7 +5612,7 @@ until_break_command (char *arg, int from_tty) resolve_sal_pc (&sal); - breakpoint = set_momentary_breakpoint (sal, selected_frame, bp_until); + breakpoint = set_momentary_breakpoint (sal, deprecated_selected_frame, bp_until); if (!event_loop_p || !target_can_async_p ()) old_chain = make_cleanup_delete_breakpoint (breakpoint); @@ -5770,10 +5770,10 @@ get_catch_sals (int this_level_only) /* Not sure whether an error message is always the correct response, but it's better than a core dump. */ - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) error ("No selected frame."); - block = get_frame_block (selected_frame, 0); - pc = selected_frame->pc; + block = get_frame_block (deprecated_selected_frame, 0); + pc = deprecated_selected_frame->pc; sals.nelts = 0; sals.sals = NULL; @@ -7368,8 +7368,8 @@ is valid is not currently in scope.\n", bpt->number); return; } - save_selected_frame = selected_frame; - save_selected_frame_level = frame_relative_level (selected_frame); + save_selected_frame = deprecated_selected_frame; + save_selected_frame_level = frame_relative_level (deprecated_selected_frame); select_frame (fr); } diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 9d582917709..97c666ffd38 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -844,10 +844,10 @@ disassemble_command (char *arg, int from_tty) name = NULL; if (!arg) { - if (!selected_frame) + if (!deprecated_selected_frame) error ("No frame selected.\n"); - pc = get_frame_pc (selected_frame); + pc = get_frame_pc (deprecated_selected_frame); if (find_pc_partial_function (pc, &name, &low, &high) == 0) error ("No function contains program counter for selected frame.\n"); #if defined(TUI) diff --git a/gdb/corelow.c b/gdb/corelow.c index d2b26a2ef99..8b172b7d9c3 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -364,8 +364,8 @@ 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 (selected_frame, - frame_relative_level (selected_frame), 1); + print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 1); } else { diff --git a/gdb/eval.c b/gdb/eval.c index cbcf862e53a..65631752d67 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -445,7 +445,7 @@ 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, selected_frame); + struct value *val = value_of_register (regno, deprecated_selected_frame); (*pos) += 2; if (val == NULL) error ("Value of register %s not available.", diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 4bd01cc9ab2..7c57e0d82d2 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -74,7 +74,7 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound) switch (TYPE_ARRAY_LOWER_BOUND_TYPE (type)) { case BOUND_BY_VALUE_ON_STACK: - current_frame_addr = selected_frame->frame; + current_frame_addr = deprecated_selected_frame->frame; if (current_frame_addr > 0) { *lower_bound = @@ -98,7 +98,7 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound) break; case BOUND_BY_REF_ON_STACK: - current_frame_addr = selected_frame->frame; + current_frame_addr = deprecated_selected_frame->frame; if (current_frame_addr > 0) { ptr_to_lower_bound = @@ -132,7 +132,7 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound) switch (TYPE_ARRAY_UPPER_BOUND_TYPE (type)) { case BOUND_BY_VALUE_ON_STACK: - current_frame_addr = selected_frame->frame; + current_frame_addr = deprecated_selected_frame->frame; if (current_frame_addr > 0) { *upper_bound = @@ -161,7 +161,7 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound) break; case BOUND_BY_REF_ON_STACK: - current_frame_addr = selected_frame->frame; + current_frame_addr = deprecated_selected_frame->frame; if (current_frame_addr > 0) { ptr_to_upper_bound = @@ -587,7 +587,7 @@ info_common_command (char *comname, int from_tty) first make sure that it is visible and if so, let us display its contents */ - fi = selected_frame; + fi = deprecated_selected_frame; if (fi == NULL) error ("No frame selected"); @@ -679,7 +679,7 @@ there_is_a_visible_common_named (char *comname) if (comname == NULL) error ("Cannot deal with NULL common name!"); - fi = selected_frame; + fi = deprecated_selected_frame; if (fi == NULL) error ("No frame selected"); diff --git a/gdb/findvar.c b/gdb/findvar.c index a95c6aa45dd..9a34b851c9e 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -303,7 +303,7 @@ value_of_register (int regnum, struct frame_info *frame) /* Builtin registers lie completly outside of the range of normal registers. Catch them early so that the target never sees them. */ if (regnum >= NUM_REGS + NUM_PSEUDO_REGS) - return value_of_builtin_reg (regnum, selected_frame); + return value_of_builtin_reg (regnum, deprecated_selected_frame); get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval); @@ -418,7 +418,7 @@ symbol_read_needs_frame (struct symbol *sym) and a stack frame id, read the value of the variable and return a (pointer to a) struct value containing the value. If the variable cannot be found, return a zero pointer. - If FRAME is NULL, use the selected_frame. */ + If FRAME is NULL, use the deprecated_selected_frame. */ struct value * read_var_value (register struct symbol *var, struct frame_info *frame) @@ -435,7 +435,7 @@ read_var_value (register struct symbol *var, struct frame_info *frame) len = TYPE_LENGTH (type); if (frame == NULL) - frame = selected_frame; + frame = deprecated_selected_frame; switch (SYMBOL_CLASS (var)) { diff --git a/gdb/frame.c b/gdb/frame.c index 1918114bdec..1ece65b2318 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -33,6 +33,7 @@ #include "dummy-frame.h" #include "gdbcore.h" #include "annotate.h" +#include "language.h" /* Return a frame uniq ID that can be used to, later re-find the frame. */ @@ -442,6 +443,65 @@ set_current_frame (struct frame_info *frame) current_frame = frame; } +/* The "selected" stack frame is used by default for local and arg + access. May be zero, for no selected frame. */ + +struct frame_info *deprecated_selected_frame; + +/* Return the selected frame. Always non-null (unless there isn't an + inferior sufficient for creating a frame) in which case an error is + thrown. */ + +struct frame_info * +get_selected_frame (void) +{ + 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 ()); + /* There is always a frame. */ + gdb_assert (deprecated_selected_frame != NULL); + return deprecated_selected_frame; +} + +/* Select frame FI (or NULL - to invalidate the current frame). */ + +void +select_frame (struct frame_info *fi) +{ + register struct symtab *s; + + deprecated_selected_frame = fi; + /* NOTE: cagney/2002-05-04: FI can be NULL. This occures when the + frame is being invalidated. */ + if (selected_frame_level_changed_hook) + selected_frame_level_changed_hook (frame_relative_level (fi)); + + /* FIXME: kseitz/2002-08-28: It would be nice to call + selected_frame_level_changed_event right here, but due to limitations + in the current interfaces, we would end up flooding UIs with events + because select_frame is used extensively internally. + + Once we have frame-parameterized frame (and frame-related) commands, + the event notification can be moved here, since this function will only + be called when the users selected frame is being changed. */ + + /* Ensure that symbols for this frame are read in. Also, determine the + source language of this frame, and switch to it if desired. */ + if (fi) + { + s = find_pc_symtab (fi->pc); + if (s + && s->language != current_language->la_language + && s->language != language_unknown + && language_mode == language_mode_auto) + { + set_language (s->language); + } + } +} + /* Return the register saved in the simplistic ``saved_regs'' cache. If the value isn't here AND a value is needed, try the next inner most frame. */ diff --git a/gdb/frame.h b/gdb/frame.h index 98045c1d787..419511c6a40 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -73,15 +73,24 @@ extern struct frame_info *get_current_frame (void); flush_cached_frames() and reinit_frame_cache() is that the latter explicitly sets the selected frame back to the current frame there isn't any real difference (except that one delays the selection of - a new frame). There should instead be a get_selected_frame() - method that reinit's the frame cache on-demand. As for - invalidating the cache, there should be two methods one that - reverts the thread's selected frame back to current frame (for when - the inferior resumes) and one that does not (for when the user - modifies the target invalidating the frame cache). */ + a new frame). Code can instead simply rely on get_selected_frame() + to reinit's the selected frame as needed. As for invalidating the + cache, there should be two methods one that reverts the thread's + selected frame back to current frame (for when the inferior + resumes) and one that does not (for when the user modifies the + target invalidating the frame cache). */ 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. */ +/* 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); + /* Select a specific frame. NULL, apparently implies re-select the inner most frame. */ extern void select_frame (struct frame_info *); @@ -564,21 +573,21 @@ extern void return_command (char *, int); The relevant code needs to be audited to determine if it is possible (or pratical) to instead pass the applicable frame in as a parameter. For instance, DEPRECATED_DO_REGISTERS_INFO() relied on - the selected_frame global, but its replacement, + the deprecated_selected_frame global, while its replacement, PRINT_REGISTERS_INFO(), is parameterized with the selected frame. The only real exceptions occure at the edge (in the CLI code) where user commands need to pick up the selected frame before proceeding. This is important. GDB is trying to stamp out the hack: - saved_frame = selected_frame; - selected_frame = ...; + saved_frame = deprecated_selected_frame; + deprecated_selected_frame = ...; hack_using_global_selected_frame (); - selected_frame = saved_frame; + deprecated_selected_frame = saved_frame; Take care! */ -extern struct frame_info *selected_frame; +extern struct frame_info *deprecated_selected_frame; /* NOTE: cagney/2002-11-28: diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index ac7d9397f00..e89a24e5d92 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -904,7 +904,7 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, int C, Z, N, V; unsigned char b[h8300h_reg_size]; unsigned char l; - frame_register_read (selected_frame, regno, b); + frame_register_read (deprecated_selected_frame, regno, b); l = b[REGISTER_VIRTUAL_SIZE (E_CCR_REGNUM) - 1]; fprintf_filtered (file, "\t"); fprintf_filtered (file, "I-%d ", (l & 0x80) != 0); @@ -945,7 +945,7 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, /* EXR register */ unsigned char b[h8300h_reg_size]; unsigned char l; - frame_register_read (selected_frame, regno, b); + frame_register_read (deprecated_selected_frame, regno, b); l = b[REGISTER_VIRTUAL_SIZE (E_EXR_REGNUM) - 1]; fprintf_filtered (file, "\t"); fprintf_filtered (file, "T-%d - - - ", (l & 0x80) != 0); diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c index d7ccb1a8e52..a3d61b134f7 100644 --- a/gdb/h8500-tdep.c +++ b/gdb/h8500-tdep.c @@ -186,7 +186,7 @@ h8500_print_register_hook (int regno) unsigned char b[2]; unsigned char l; - frame_register_read (selected_frame, regno, b); + frame_register_read (deprecated_selected_frame, regno, b); l = b[1]; printf_unfiltered ("\t"); printf_unfiltered ("I-%d - ", (l & 0x80) != 0); @@ -328,7 +328,7 @@ h8500_print_registers_info (struct gdbarch *gdbarch, void h8500_do_registers_info (int regnum, int all) { - h8500_print_registers_info (current_gdbarch, gdb_stdout, selected_frame, + h8500_print_registers_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, regnum, all); } @@ -617,10 +617,10 @@ h8500_value_of_trapped_internalvar (struct internalvar *var) break; } - get_saved_register (regbuf, NULL, NULL, selected_frame, page_regnum, NULL); + get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, page_regnum, NULL); regval = regbuf[0] << 16; - get_saved_register (regbuf, NULL, NULL, selected_frame, regnum, NULL); + get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, regnum, NULL); regval |= regbuf[0] << 8 | regbuf[1]; /* XXX host/target byte order */ xfree (var->value); /* Free up old value */ diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 5875011f3cd..9d90312f1fb 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2511,7 +2511,7 @@ pa_do_registers_info (int regnum, int fpregs) /* Make a copy of gdb's save area (may cause actual reads from the target). */ for (i = 0; i < NUM_REGS; i++) - frame_register_read (selected_frame, i, raw_regs + REGISTER_BYTE (i)); + frame_register_read (deprecated_selected_frame, i, raw_regs + REGISTER_BYTE (i)); if (regnum == -1) pa_print_registers (raw_regs, regnum, fpregs); @@ -2555,7 +2555,7 @@ pa_do_strcat_registers_info (int regnum, int fpregs, struct ui_file *stream, /* Make a copy of gdb's save area (may cause actual reads from the target). */ for (i = 0; i < NUM_REGS; i++) - frame_register_read (selected_frame, i, raw_regs + REGISTER_BYTE (i)); + frame_register_read (deprecated_selected_frame, i, raw_regs + REGISTER_BYTE (i)); if (regnum == -1) pa_strcat_registers (raw_regs, regnum, fpregs, stream); @@ -2807,7 +2807,7 @@ pa_print_fp_reg (int i) char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE]; /* Get 32bits of data. */ - frame_register_read (selected_frame, i, raw_buffer); + frame_register_read (deprecated_selected_frame, i, raw_buffer); /* Put it in the buffer. No conversions are ever necessary. */ memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i)); @@ -2825,7 +2825,7 @@ pa_print_fp_reg (int i) if ((i % 2) == 0) { /* Get the data in raw format for the 2nd half. */ - frame_register_read (selected_frame, i + 1, raw_buffer); + frame_register_read (deprecated_selected_frame, i + 1, raw_buffer); /* Copy it into the appropriate part of the virtual buffer. */ memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buffer, @@ -2853,7 +2853,7 @@ pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision) print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), stream); /* Get 32bits of data. */ - frame_register_read (selected_frame, i, raw_buffer); + frame_register_read (deprecated_selected_frame, i, raw_buffer); /* Put it in the buffer. No conversions are ever necessary. */ memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i)); @@ -2864,7 +2864,7 @@ pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision) char raw_buf[MAX_REGISTER_RAW_SIZE]; /* Get the data in raw format for the 2nd half. */ - frame_register_read (selected_frame, i + 1, raw_buf); + frame_register_read (deprecated_selected_frame, i + 1, raw_buf); /* Copy it into the appropriate part of the virtual buffer. */ memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buf, REGISTER_RAW_SIZE (i)); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 65995d3fb69..6b4d7ae367a 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1263,10 +1263,10 @@ finish_command (char *arg, int from_tty) error ("The \"finish\" command does not take any arguments."); if (!target_has_execution) error ("The program is not running."); - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) error ("No selected frame."); - frame = get_prev_frame (selected_frame); + frame = get_prev_frame (deprecated_selected_frame); if (frame == 0) error ("\"finish\" not meaningful in the outermost frame."); @@ -1284,15 +1284,15 @@ finish_command (char *arg, int from_tty) /* Find the function we will return from. */ - function = find_pc_function (selected_frame->pc); + function = find_pc_function (deprecated_selected_frame->pc); /* Print info on the selected frame, including level number but not source. */ if (from_tty) { printf_filtered ("Run till exit from "); - print_stack_frame (selected_frame, - frame_relative_level (selected_frame), 0); + print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 0); } /* If running asynchronously and the target support asynchronous @@ -1680,13 +1680,13 @@ registers_info (char *addr_exp, int fpregs) if (!target_has_registers) error ("The program has no registers now."); - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) error ("No selected frame."); if (!addr_exp) { gdbarch_print_registers_info (current_gdbarch, gdb_stdout, - selected_frame, -1, fpregs); + deprecated_selected_frame, -1, fpregs); return; } @@ -1723,7 +1723,7 @@ registers_info (char *addr_exp, int fpregs) if (regnum >= 0) { gdbarch_print_registers_info (current_gdbarch, gdb_stdout, - selected_frame, regnum, fpregs); + deprecated_selected_frame, regnum, fpregs); continue; } } @@ -1737,7 +1737,7 @@ registers_info (char *addr_exp, int fpregs) && regnum < NUM_REGS + NUM_PSEUDO_REGS) { gdbarch_print_registers_info (current_gdbarch, gdb_stdout, - selected_frame, regnum, fpregs); + deprecated_selected_frame, regnum, fpregs); continue; } } @@ -1763,7 +1763,7 @@ registers_info (char *addr_exp, int fpregs) if (gdbarch_register_reggroup_p (current_gdbarch, regnum, (*group))) gdbarch_print_registers_info (current_gdbarch, - gdb_stdout, selected_frame, + gdb_stdout, deprecated_selected_frame, regnum, fpregs); } continue; @@ -1793,7 +1793,7 @@ print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, { if (!target_has_registers) error ("The program has no registers now."); - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) error ("No selected frame."); if (gdbarch_print_vector_info_p (gdbarch)) @@ -1819,7 +1819,7 @@ print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, static void vector_info (char *args, int from_tty) { - print_vector_info (current_gdbarch, gdb_stdout, selected_frame, args); + print_vector_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, args); } @@ -1960,7 +1960,7 @@ print_float_info (struct gdbarch *gdbarch, struct ui_file *file, { if (!target_has_registers) error ("The program has no registers now."); - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) error ("No selected frame."); if (gdbarch_print_float_info_p (gdbarch)) @@ -1994,7 +1994,7 @@ No floating-point info available for this processor.\n"); static void float_info (char *args, int from_tty) { - print_float_info (current_gdbarch, gdb_stdout, selected_frame, args); + print_float_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, args); } /* ARGSUSED */ diff --git a/gdb/inflow.c b/gdb/inflow.c index d286b5e36dc..c8df106fe9a 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -608,11 +608,11 @@ kill_command (char *arg, int from_tty) if (target_has_stack) { printf_filtered ("In %s,\n", target_longname); - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) fputs_filtered ("No selected stack frame.\n", gdb_stdout); else - print_stack_frame (selected_frame, - frame_relative_level (selected_frame), 1); + print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 1); } } diff --git a/gdb/infrun.c b/gdb/infrun.c index 49b90a6a2b4..73eed1f577a 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3342,7 +3342,7 @@ normal_stop (void) bpstat_print() contains the logic deciding in detail what to print, based on the event(s) that just occurred. */ - if (stop_print_frame && selected_frame) + if (stop_print_frame && deprecated_selected_frame) { int bpstat_ret; int source_flag; @@ -3386,7 +3386,7 @@ normal_stop (void) LOCATION: Print only location SRC_AND_LOC: Print location and source line */ if (do_frame_printing) - show_and_print_stack_frame (selected_frame, -1, source_flag); + show_and_print_stack_frame (deprecated_selected_frame, -1, source_flag); /* Display the auto-display expressions. */ do_displays (); @@ -3856,7 +3856,7 @@ save_inferior_status (int restore_stack_info) inf_status->registers = regcache_dup (current_regcache); - get_frame_id (selected_frame, &inf_status->selected_frame_id); + get_frame_id (deprecated_selected_frame, &inf_status->selected_frame_id); return inf_status; } diff --git a/gdb/macroscope.c b/gdb/macroscope.c index b482068637c..c6da69891cd 100644 --- a/gdb/macroscope.c +++ b/gdb/macroscope.c @@ -87,8 +87,8 @@ default_macro_scope (void) struct macro_scope *ms; /* If there's a selected frame, use its PC. */ - if (selected_frame) - sal = find_pc_line (selected_frame->pc, 0); + if (deprecated_selected_frame) + sal = find_pc_line (deprecated_selected_frame->pc, 0); /* If the target has any registers at all, then use its PC. Why we would have registers but no stack, I'm not sure. */ diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index a28bab34303..f7e91b66eaa 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,8 @@ +2002-11-29 Andrew Cagney + + * mi/mi-cmd-stack.c, mi/mi-main.c: Update to use + deprecated_selected_frame. + 2002-11-13 Andrew Cagney * mi-main.c (mi_cmd_data_write_register_values): Use diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 74cb126af80..34fb3082189 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -142,7 +142,7 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc) if (argc != 1) error ("mi_cmd_stack_list_locals: Usage: PRINT_VALUES"); - list_args_or_locals (1, atoi (argv[0]), selected_frame); + list_args_or_locals (1, atoi (argv[0]), deprecated_selected_frame); return MI_CMD_DONE; } diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 8af91cc0bba..536e8a5b054 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -183,8 +183,8 @@ 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. */ - show_and_print_stack_frame (selected_frame, - frame_relative_level (selected_frame), + show_and_print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), LOC_AND_ADDRESS); return MI_CMD_DONE; @@ -397,7 +397,7 @@ register_changed_p (int regnum) { char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); - if (! frame_register_read (selected_frame, regnum, raw_buffer)) + if (! frame_register_read (deprecated_selected_frame, regnum, raw_buffer)) return -1; if (memcmp (&old_regs[REGISTER_BYTE (regnum)], raw_buffer, @@ -518,7 +518,8 @@ get_register (int regnum, int format) if (format == 'N') format = 0; - get_saved_register (raw_buffer, &optim, (CORE_ADDR *) NULL, selected_frame, + get_saved_register (raw_buffer, &optim, (CORE_ADDR *) NULL, + deprecated_selected_frame, regnum, (enum lval_type *) NULL); if (optim) { diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index f0a943d7e6a..dc80ff297c9 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -3941,7 +3941,7 @@ mips_read_fp_register_single (int regno, char *rare_buffer) int raw_size = REGISTER_RAW_SIZE (regno); char *raw_buffer = alloca (raw_size); - if (!frame_register_read (selected_frame, regno, raw_buffer)) + if (!frame_register_read (deprecated_selected_frame, regno, raw_buffer)) error ("can't read register %d (%s)", regno, REGISTER_NAME (regno)); if (raw_size == 8) { @@ -3975,7 +3975,7 @@ mips_read_fp_register_double (int regno, char *rare_buffer) { /* We have a 64-bit value for this register, and we should use all 64 bits. */ - if (!frame_register_read (selected_frame, regno, rare_buffer)) + if (!frame_register_read (deprecated_selected_frame, regno, rare_buffer)) error ("can't read register %d (%s)", regno, REGISTER_NAME (regno)); } else @@ -4006,7 +4006,7 @@ mips_print_register (int regnum, int all) char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); /* Get the data in raw format. */ - if (!frame_register_read (selected_frame, regnum, raw_buffer)) + if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer)) { printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum)); return; @@ -4186,7 +4186,7 @@ do_gp_register_row (int regnum) if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT) break; /* end row: reached FP register */ /* OK: get the data in raw format. */ - if (!frame_register_read (selected_frame, regnum, raw_buffer)) + if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer)) error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum)); /* pad small registers */ for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_VIRTUAL_SIZE (regnum)); byte++) diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 72002c36906..5a0a0d68418 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1012,7 +1012,7 @@ mn10300_print_register (const char *name, int regnum, int reg_width) printf_filtered ("%s: ", name); /* Get the data */ - if (!frame_register_read (selected_frame, regnum, raw_buffer)) + if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer)) { printf_filtered ("[invalid]"); return; diff --git a/gdb/ocd.c b/gdb/ocd.c index 9dd90e9c992..d7935800860 100644 --- a/gdb/ocd.c +++ b/gdb/ocd.c @@ -256,7 +256,7 @@ ocd_start_remote (PTR dummy) stop_pc = read_pc (); set_current_frame (create_new_frame (read_fp (), stop_pc)); select_frame (get_current_frame ()); - print_stack_frame (selected_frame, -1, 1); + print_stack_frame (deprecated_selected_frame, -1, 1); buf[0] = OCD_LOG_FILE; buf[1] = 3; /* close existing WIGGLERS.LOG */ diff --git a/gdb/regcache.h b/gdb/regcache.h index de6a321620c..8dfd2e92633 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -159,13 +159,13 @@ extern void regcache_cpy_no_passthrough (struct regcache *dest, struct regcache simple substitution is required when updating the code. The change, as far as practical, should avoid adding references to global variables (e.g., current_regcache, current_frame, - current_gdbarch or selected_frame) and instead refer to the FRAME - or REGCACHE that has been passed into the containing function as - parameters. Consequently, the change typically involves modifying - the containing function so that it takes a FRAME or REGCACHE - parameter. In the case of an architecture vector method, there - should already be a non-deprecated variant that is parameterized - with FRAME or REGCACHE. */ + current_gdbarch or deprecated_selected_frame) and instead refer to + the FRAME or REGCACHE that has been passed into the containing + function as parameters. Consequently, the change typically + involves modifying the containing function so that it takes a FRAME + or REGCACHE parameter. In the case of an architecture vector + method, there should already be a non-deprecated variant that is + parameterized with FRAME or REGCACHE. */ extern char *deprecated_grub_regcache_for_registers (struct regcache *); extern char *deprecated_grub_regcache_for_register_valid (struct regcache *); diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 33e5c00f0f8..d7545193f6b 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -631,7 +631,7 @@ e7000_start_remote (void *dummy) stop_pc = read_pc (); set_current_frame (create_new_frame (read_fp (), stop_pc)); select_frame (get_current_frame ()); - print_stack_frame (selected_frame, -1, 1); + print_stack_frame (deprecated_selected_frame, -1, 1); return 1; } diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index abd590bef2b..b77e5e0e033 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1622,7 +1622,7 @@ device is attached to the target board (e.g., /dev/ttya).\n" stop_pc = read_pc (); set_current_frame (create_new_frame (read_fp (), stop_pc)); select_frame (get_current_frame ()); - print_stack_frame (selected_frame, -1, 1); + print_stack_frame (deprecated_selected_frame, -1, 1); xfree (serial_port_name); } diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 20ed5160250..dd38f1d1ecc 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -1165,7 +1165,7 @@ remote_rdp_open (char *args, int from_tty) stop_pc = read_pc (); set_current_frame (create_new_frame (read_fp (), stop_pc)); select_frame (get_current_frame ()); - print_stack_frame (selected_frame, -1, 1); + print_stack_frame (deprecated_selected_frame, -1, 1); } diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 0e1d7c9c906..9a542ec4df7 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2937,7 +2937,7 @@ sh64_show_compact_regs (void) static void sh64_show_regs (void) { - if (pc_is_isa32 (selected_frame->pc)) + if (pc_is_isa32 (deprecated_selected_frame->pc)) sh64_show_media_regs (); else sh64_show_compact_regs (); @@ -3919,7 +3919,7 @@ sh_do_fp_register (int regnum) raw_buffer = (char *) alloca (REGISTER_RAW_SIZE (FP0_REGNUM)); /* Get the data in raw format. */ - if (!frame_register_read (selected_frame, regnum, raw_buffer)) + if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer)) error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum)); /* Get the register as a number */ @@ -4001,7 +4001,7 @@ sh_do_register (int regnum) print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), gdb_stdout); /* Get the data in raw format. */ - if (!frame_register_read (selected_frame, regnum, raw_buffer)) + if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer)) printf_filtered ("*value not available*\n"); val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, 0, @@ -4112,7 +4112,7 @@ sh_compact_do_registers_info (int regnum, int fpregs) void sh64_do_registers_info (int regnum, int fpregs) { - if (pc_is_isa32 (selected_frame->pc)) + if (pc_is_isa32 (deprecated_selected_frame->pc)) sh_do_registers_info (regnum, fpregs); else sh_compact_do_registers_info (regnum, fpregs); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index a7619785cb1..149aa88a059 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -816,10 +816,10 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, /* error ("No selected frame."); */ if (!target_has_registers) error ("The program has no registers now."); - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) error ("No selected frame."); /* Try to use selected frame */ - frame = get_prev_frame (selected_frame); + frame = get_prev_frame (deprecated_selected_frame); if (frame == 0) error ("Cmd not meaningful in the outermost frame."); } @@ -1871,8 +1871,8 @@ sparc_print_register_hook (int regno) { char value[16]; - if (frame_register_read (selected_frame, regno, value) - && frame_register_read (selected_frame, regno + 1, value + 4)) + if (frame_register_read (deprecated_selected_frame, regno, value) + && frame_register_read (deprecated_selected_frame, regno + 1, value + 4)) { printf_unfiltered ("\t"); print_floating (value, builtin_type_double, gdb_stdout); @@ -1880,8 +1880,8 @@ sparc_print_register_hook (int regno) #if 0 /* FIXME: gdb doesn't handle long doubles */ if ((regno & 3) == 0) { - if (frame_register_read (selected_frame, regno + 2, value + 8) - && frame_register_read (selected_frame, regno + 3, value + 12)) + if (frame_register_read (deprecated_selected_frame, regno + 2, value + 8) + && frame_register_read (deprecated_selected_frame, regno + 3, value + 12)) { printf_unfiltered ("\t"); print_floating (value, builtin_type_long_double, gdb_stdout); @@ -1900,8 +1900,8 @@ sparc_print_register_hook (int regno) { char value[16]; - if (frame_register_read (selected_frame, regno, value) - && frame_register_read (selected_frame, regno + 1, value + 8)) + if (frame_register_read (deprecated_selected_frame, regno, value) + && frame_register_read (deprecated_selected_frame, regno + 1, value + 8)) { printf_unfiltered ("\t"); print_floating (value, builtin_type_long_double, gdb_stdout); @@ -2150,7 +2150,7 @@ sparc_print_registers_info (struct gdbarch *gdbarch, void sparc_do_registers_info (int regnum, int all) { - sparc_print_registers_info (current_gdbarch, gdb_stdout, selected_frame, + sparc_print_registers_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, regnum, all); } @@ -2166,8 +2166,8 @@ sparclet_print_registers_info (struct gdbarch *gdbarch, void sparclet_do_registers_info (int regnum, int all) { - sparclet_print_registers_info (current_gdbarch, gdb_stdout, selected_frame, - regnum, all); + sparclet_print_registers_info (current_gdbarch, gdb_stdout, + deprecated_selected_frame, regnum, all); } diff --git a/gdb/stack.c b/gdb/stack.c index 999de6fde4c..76cd4a58c36 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -110,11 +110,6 @@ static void frame_info (char *, int); extern int addressprint; /* Print addresses, or stay symbolic only? */ -/* The "selected" stack frame is used by default for local and arg access. - May be zero, for no selected frame. */ - -struct frame_info *selected_frame; - /* Zero means do things normally; we are interacting directly with the user. One means print the full filename and linenumber when a frame is printed, and do so in a format emacs18/emacs19.22 can @@ -659,9 +654,9 @@ parse_frame_specification (char *frame_exp) switch (numargs) { case 0: - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) error ("No selected frame."); - return selected_frame; + return deprecated_selected_frame; /* NOTREACHED */ case 1: { @@ -798,10 +793,10 @@ frame_info (char *addr_exp, int from_tty) } calling_frame_info = get_prev_frame (fi); - if (!addr_exp && frame_relative_level (selected_frame) >= 0) + if (!addr_exp && frame_relative_level (deprecated_selected_frame) >= 0) { printf_filtered ("Stack level %d, frame at ", - frame_relative_level (selected_frame)); + frame_relative_level (deprecated_selected_frame)); print_address_numeric (fi->frame, 1, gdb_stdout); printf_filtered (":\n"); } @@ -1367,9 +1362,9 @@ print_frame_label_vars (register struct frame_info *fi, int this_level_only, void locals_info (char *args, int from_tty) { - if (!selected_frame) + if (!deprecated_selected_frame) error ("No frame selected."); - print_frame_local_vars (selected_frame, 0, gdb_stdout); + print_frame_local_vars (deprecated_selected_frame, 0, gdb_stdout); } static void @@ -1386,17 +1381,17 @@ catch_info (char *ignore, int from_tty) system to find the list of active handlers, etc. */ fprintf_filtered (gdb_stdout, "Info catch not supported with this target/compiler combination.\n"); #if 0 - if (!selected_frame) + if (!deprecated_selected_frame) error ("No frame selected."); #endif } else { /* Assume g++ compiled code -- old v 4.16 behaviour */ - if (!selected_frame) + if (!deprecated_selected_frame) error ("No frame selected."); - print_frame_label_vars (selected_frame, 0, gdb_stdout); + print_frame_label_vars (deprecated_selected_frame, 0, gdb_stdout); } } @@ -1462,9 +1457,9 @@ print_frame_arg_vars (register struct frame_info *fi, void args_info (char *ignore, int from_tty) { - if (!selected_frame) + if (!deprecated_selected_frame) error ("No frame selected."); - print_frame_arg_vars (selected_frame, gdb_stdout); + print_frame_arg_vars (deprecated_selected_frame, gdb_stdout); } @@ -1476,44 +1471,6 @@ args_plus_locals_info (char *ignore, int from_tty) } -/* Select frame FI (or NULL - to invalidate the current frame). */ - -void -select_frame (struct frame_info *fi) -{ - register struct symtab *s; - - selected_frame = fi; - /* NOTE: cagney/2002-05-04: FI can be NULL. This occures when the - frame is being invalidated. */ - if (selected_frame_level_changed_hook) - selected_frame_level_changed_hook (frame_relative_level (fi)); - - /* FIXME: kseitz/2002-08-28: It would be nice to call - selected_frame_level_changed_event right here, but due to limitations - in the current interfaces, we would end up flooding UIs with events - because select_frame is used extensively internally. - - Once we have frame-parameterized frame (and frame-related) commands, - the event notification can be moved here, since this function will only - be called when the users selected frame is being changed. */ - - /* Ensure that symbols for this frame are read in. Also, determine the - source language of this frame, and switch to it if desired. */ - if (fi) - { - s = find_pc_symtab (fi->pc); - if (s - && s->language != current_language->la_language - && s->language != language_unknown - && language_mode == language_mode_auto) - { - set_language (s->language); - } - } -} - - /* Select frame FI. Also print the stack frame and show the source if this is the tui version. */ static void @@ -1547,15 +1504,16 @@ get_selected_block (CORE_ADDR *addr_in_block) past but is no longer the case. A mindless look at all the callers tends to support this theory. I think we should be able to assume that there is always a selcted frame. */ - /* gdb_assert (selected_frame != NULL); So, do you feel lucky? */ - if (!selected_frame) + /* gdb_assert (deprecated_selected_frame != NULL); So, do you feel + lucky? */ + if (!deprecated_selected_frame) { CORE_ADDR pc = read_pc (); if (addr_in_block != NULL) *addr_in_block = pc; return block_for_pc (pc); } - return get_frame_block (selected_frame, addr_in_block); + return get_frame_block (deprecated_selected_frame, addr_in_block); } /* Find a frame a certain number of levels away from FRAME. @@ -1616,7 +1574,7 @@ static void select_frame_command (char *level_exp, int from_tty) { struct frame_info *frame; - int level = frame_relative_level (selected_frame); + int level = frame_relative_level (deprecated_selected_frame); if (!target_has_stack) error ("No stack."); @@ -1624,8 +1582,8 @@ select_frame_command (char *level_exp, int from_tty) frame = parse_frame_specification (level_exp); select_frame (frame); - if (level != frame_relative_level (selected_frame)) - selected_frame_level_changed_event (frame_relative_level (selected_frame)); + if (level != frame_relative_level (deprecated_selected_frame)) + selected_frame_level_changed_event (frame_relative_level (deprecated_selected_frame)); } /* The "frame" command. With no arg, print selected frame briefly. @@ -1636,8 +1594,8 @@ void frame_command (char *level_exp, int from_tty) { select_frame_command (level_exp, from_tty); - show_and_print_stack_frame (selected_frame, - frame_relative_level (selected_frame), 1); + show_and_print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 1); } /* The XDB Compatibility command to print the current frame. */ @@ -1645,10 +1603,10 @@ frame_command (char *level_exp, int from_tty) static void current_frame_command (char *level_exp, int from_tty) { - if (target_has_stack == 0 || selected_frame == 0) + if (target_has_stack == 0 || deprecated_selected_frame == 0) error ("No stack."); - print_only_stack_frame (selected_frame, - frame_relative_level (selected_frame), 1); + print_only_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 1); } /* Select the frame up one or COUNT stack levels @@ -1664,14 +1622,14 @@ up_silently_base (char *count_exp) count = parse_and_eval_long (count_exp); count1 = count; - if (target_has_stack == 0 || selected_frame == 0) + if (target_has_stack == 0 || deprecated_selected_frame == 0) error ("No stack."); - fi = find_relative_frame (selected_frame, &count1); + fi = find_relative_frame (deprecated_selected_frame, &count1); if (count1 != 0 && count_exp == 0) error ("Initial frame selected; you cannot go up."); select_frame (fi); - selected_frame_level_changed_event (frame_relative_level (selected_frame)); + selected_frame_level_changed_event (frame_relative_level (deprecated_selected_frame)); } static void @@ -1684,8 +1642,8 @@ static void up_command (char *count_exp, int from_tty) { up_silently_base (count_exp); - show_and_print_stack_frame (selected_frame, - frame_relative_level (selected_frame), 1); + show_and_print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 1); } /* Select the frame down one or COUNT stack levels @@ -1701,10 +1659,10 @@ down_silently_base (char *count_exp) count = -parse_and_eval_long (count_exp); count1 = count; - if (target_has_stack == 0 || selected_frame == 0) + if (target_has_stack == 0 || deprecated_selected_frame == 0) error ("No stack."); - frame = find_relative_frame (selected_frame, &count1); + frame = find_relative_frame (deprecated_selected_frame, &count1); if (count1 != 0 && count_exp == 0) { @@ -1717,7 +1675,7 @@ down_silently_base (char *count_exp) } select_frame (frame); - selected_frame_level_changed_event (frame_relative_level (selected_frame)); + selected_frame_level_changed_event (frame_relative_level (deprecated_selected_frame)); } /* ARGSUSED */ @@ -1731,8 +1689,8 @@ static void down_command (char *count_exp, int from_tty) { down_silently_base (count_exp); - show_and_print_stack_frame (selected_frame, - frame_relative_level (selected_frame), 1); + show_and_print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 1); } void @@ -1744,11 +1702,11 @@ return_command (char *retval_exp, int from_tty) struct frame_info *frame; struct value *return_value = NULL; - if (selected_frame == NULL) + if (deprecated_selected_frame == NULL) error ("No selected frame."); - thisfun = get_frame_function (selected_frame); - selected_frame_addr = get_frame_base (selected_frame); - selected_frame_pc = selected_frame->pc; + thisfun = get_frame_function (deprecated_selected_frame); + selected_frame_addr = get_frame_base (deprecated_selected_frame); + selected_frame_pc = deprecated_selected_frame->pc; /* Compute the return value (if any -- possibly getting errors here). */ @@ -1788,7 +1746,7 @@ return_command (char *retval_exp, int from_tty) } /* Do the real work. Pop until the specified frame is current. We - use this method because the selected_frame is not valid after + use this method because the deprecated_selected_frame is not valid after a POP_FRAME. The pc comparison makes this work even if the selected frame shares its fp with another frame. */ @@ -1877,7 +1835,7 @@ func_command (char *arg, int from_tty) if (!found) printf_filtered ("'%s' not within current stack frame.\n", arg); - else if (fp != selected_frame) + else if (fp != deprecated_selected_frame) select_and_print_frame (fp); } @@ -1889,9 +1847,9 @@ get_frame_language (void) register struct symtab *s; enum language flang; /* The language of the current frame */ - if (selected_frame) + if (deprecated_selected_frame) { - s = find_pc_symtab (selected_frame->pc); + s = find_pc_symtab (deprecated_selected_frame->pc); if (s) flang = s->language; else diff --git a/gdb/thread.c b/gdb/thread.c index fa5eb27b15c..06503e1c60a 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -422,12 +422,12 @@ info_threads_command (char *arg, int from_tty) struct thread_info *tp; ptid_t current_ptid; struct frame_info *cur_frame; - int saved_frame_level = frame_relative_level (selected_frame); + int saved_frame_level = frame_relative_level (deprecated_selected_frame); int counter; char *extra_info; /* Avoid coredumps which would happen if we tried to access a NULL - selected_frame. */ + deprecated_selected_frame. */ if (!target_has_stack) error ("No stack."); @@ -453,8 +453,8 @@ info_threads_command (char *arg, int from_tty) puts_filtered (" "); switch_to_thread (tp->ptid); - if (selected_frame) - print_only_stack_frame (selected_frame, -1, 0); + if (deprecated_selected_frame) + print_only_stack_frame (deprecated_selected_frame, -1, 0); else printf_filtered ("[No stack.]\n"); } @@ -468,12 +468,12 @@ info_threads_command (char *arg, int from_tty) * of the stack (leaf frame). */ counter = saved_frame_level; - cur_frame = find_relative_frame (selected_frame, &counter); + cur_frame = find_relative_frame (deprecated_selected_frame, &counter); if (counter != 0) { /* Ooops, can't restore, tell user where we are. */ warning ("Couldn't restore frame in current thread, at frame 0"); - print_stack_frame (selected_frame, -1, 0); + print_stack_frame (deprecated_selected_frame, -1, 0); } else { @@ -714,7 +714,8 @@ do_captured_thread_select (struct ui_out *uiout, #endif ui_out_text (uiout, ")]"); - print_stack_frame (selected_frame, frame_relative_level (selected_frame), 1); + print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), 1); return GDB_RC_OK; } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index d68f2411a28..4915df561b2 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1954,7 +1954,8 @@ finish_tfind_command (char *msg, else source_only = 1; - print_stack_frame (selected_frame, frame_relative_level (selected_frame), + print_stack_frame (deprecated_selected_frame, + frame_relative_level (deprecated_selected_frame), source_only); do_displays (); } diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 779360d5668..639d03942cc 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,9 @@ +2002-11-29 Andrew Cagney + + * tui/tui-hooks.c: Update to use deprecated_selected_frame. + * tui/tui.c, tui/tuiDisassem.c, tui/tuiRegs.c: Ditto. + * tui/tuiSource.c, tui/tuiSourceWin.c, tui/tuiWin.c: Ditto. + 2002-11-28 Andrew Cagney * tuiStack.c (tuiShowFrameInfo): Use find_frame_sal instead of diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index e1c4c126c7b..ff36d497780 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -147,7 +147,7 @@ tui_registers_changed_hook (void) { struct frame_info *fi; - fi = selected_frame; + fi = deprecated_selected_frame; if (fi && tui_refreshing_registers == 0) { tui_refreshing_registers = 1; @@ -163,7 +163,7 @@ tui_register_changed_hook (int regno) { struct frame_info *fi; - fi = selected_frame; + fi = deprecated_selected_frame; if (fi && tui_refreshing_registers == 0) { tui_refreshing_registers = 1; @@ -245,7 +245,7 @@ tui_selected_frame_level_changed_hook (int level) { struct frame_info *fi; - fi = selected_frame; + fi = deprecated_selected_frame; /* Ensure that symbols for this frame are read in. Also, determine the source language of this frame, and switch to it if desired. */ if (fi) @@ -279,7 +279,7 @@ tui_print_frame_info_listing_hook (struct symtab *s, int line, int stopline, int noerror) { select_source_symtab (s); - tuiShowFrameInfo (selected_frame); + tuiShowFrameInfo (deprecated_selected_frame); } /* Called when the target process died or is detached. diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index a7c16bcbe0c..d5cde22e70f 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -395,8 +395,8 @@ tui_enable (void) tui_version = 1; tui_active = 1; - if (selected_frame) - tuiShowFrameInfo (selected_frame); + if (deprecated_selected_frame) + tuiShowFrameInfo (deprecated_selected_frame); /* Restore TUI keymap. */ tui_set_key_mode (tui_current_key_mode); diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c index f79cc12ab66..93d2df42dc9 100644 --- a/gdb/tui/tuiDisassem.c +++ b/gdb/tui/tuiDisassem.c @@ -420,7 +420,7 @@ tuiVerticalDisassemScroll (TuiScrollDirection scrollDirection, content = (TuiWinContent) disassemWin->generic.content; if (cursal.symtab == (struct symtab *) NULL) - s = find_pc_symtab (selected_frame->pc); + s = find_pc_symtab (deprecated_selected_frame->pc); else s = cursal.symtab; diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c index 928eb416fd5..6fc63d9454e 100644 --- a/gdb/tui/tuiRegs.c +++ b/gdb/tui/tuiRegs.c @@ -638,7 +638,7 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum, stream = tui_sfileopen (bufLen); gdb_stdout = stream; cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout); - gdbarch_print_registers_info (current_gdbarch, stream, selected_frame, + gdbarch_print_registers_info (current_gdbarch, stream, deprecated_selected_frame, regNum, 1); /* Save formatted output in the buffer. */ @@ -679,7 +679,7 @@ _tuiSetGeneralRegsContent (int refreshValuesOnly) { return (_tuiSetRegsContent (0, NUM_GENERAL_REGS - 1, - selected_frame, + deprecated_selected_frame, TUI_GENERAL_REGS, refreshValuesOnly)); @@ -705,7 +705,7 @@ _tuiSetSpecialRegsContent (int refreshValuesOnly) endRegNum = FP0_REGNUM - 1; ret = _tuiSetRegsContent (START_SPECIAL_REGS, endRegNum, - selected_frame, + deprecated_selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly); @@ -725,7 +725,7 @@ _tuiSetGeneralAndSpecialRegsContent (int refreshValuesOnly) endRegNum = FP0_REGNUM - 1; ret = _tuiSetRegsContent ( - 0, endRegNum, selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly); + 0, endRegNum, deprecated_selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly); return ret; } /* _tuiSetGeneralAndSpecialRegsContent */ @@ -743,7 +743,7 @@ _tuiSetFloatRegsContent (TuiRegisterDisplayType dpyType, int refreshValuesOnly) startRegNum = FP0_REGNUM; ret = _tuiSetRegsContent (startRegNum, NUM_REGS - 1, - selected_frame, + deprecated_selected_frame, dpyType, refreshValuesOnly); diff --git a/gdb/tui/tuiSource.c b/gdb/tui/tuiSource.c index f682786ce9e..ceccd64532e 100644 --- a/gdb/tui/tuiSource.c +++ b/gdb/tui/tuiSource.c @@ -340,7 +340,7 @@ tuiVerticalSourceScroll (TuiScrollDirection scrollDirection, struct symtab_and_line cursal = get_current_source_symtab_and_line (); if (cursal.symtab == (struct symtab *) NULL) - s = find_pc_symtab (selected_frame->pc); + s = find_pc_symtab (deprecated_selected_frame->pc); else s = cursal.symtab; diff --git a/gdb/tui/tuiSourceWin.c b/gdb/tui/tuiSourceWin.c index c0c786836a3..ae844ce7029 100644 --- a/gdb/tui/tuiSourceWin.c +++ b/gdb/tui/tuiSourceWin.c @@ -355,7 +355,7 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo, struct symtab_and_line cursal = get_current_source_symtab_and_line (); if (cursal.symtab == (struct symtab *) NULL) - s = find_pc_symtab (selected_frame->pc); + s = find_pc_symtab (deprecated_selected_frame->pc); else s = cursal.symtab; diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c index 484c60a6204..b82ce2f153d 100644 --- a/gdb/tui/tuiWin.c +++ b/gdb/tui/tuiWin.c @@ -1397,13 +1397,13 @@ _makeVisibleWithNewHeight (TuiWinInfoPtr winInfo) tuiUpdateSourceWindow (winInfo, cursal.symtab, lineOrAddr, TRUE); } - else if (selected_frame != (struct frame_info *) NULL) + else if (deprecated_selected_frame != (struct frame_info *) NULL) { TuiLineOrAddress line; struct symtab_and_line cursal = get_current_source_symtab_and_line (); - s = find_pc_symtab (selected_frame->pc); + s = find_pc_symtab (deprecated_selected_frame->pc); if (winInfo->generic.type == SRC_WIN) line.lineNo = cursal.line; else diff --git a/gdb/valops.c b/gdb/valops.c index 753a43cc1e8..c0b534f20c6 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -649,7 +649,7 @@ value_assign (struct value *toval, struct value *fromval) /* Since modifying a register can trash the frame chain, we save the old frame and then restore the new frame afterwards. */ - get_frame_id (selected_frame, &old_frame); + get_frame_id (deprecated_selected_frame, &old_frame); /* Figure out which frame this is in currently. */ if (VALUE_LVAL (toval) == lval_register) @@ -3327,7 +3327,7 @@ value_of_local (const char *name, int complain) int i; struct value * ret; - if (selected_frame == 0) + if (deprecated_selected_frame == 0) { if (complain) error ("no frame selected"); @@ -3335,7 +3335,7 @@ value_of_local (const char *name, int complain) return 0; } - func = get_frame_function (selected_frame); + func = get_frame_function (deprecated_selected_frame); if (!func) { if (complain) @@ -3365,7 +3365,7 @@ value_of_local (const char *name, int complain) return NULL; } - ret = read_var_value (sym, selected_frame); + ret = read_var_value (sym, deprecated_selected_frame); if (ret == 0 && complain) error ("`%s' argument unreadable", name); return ret; diff --git a/gdb/varobj.c b/gdb/varobj.c index 30f1c38c59c..35275c92758 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -441,7 +441,7 @@ varobj_create (char *objname, /* Allow creator to specify context of variable */ if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME)) - fi = selected_frame; + fi = deprecated_selected_frame; else /* FIXME: cagney/2002-11-23: This code should be doing a lookup using the frame ID and not just the frame's @@ -488,7 +488,7 @@ varobj_create (char *objname, if (fi != NULL) { get_frame_id (fi, &var->root->frame); - old_fi = selected_frame; + old_fi = deprecated_selected_frame; select_frame (fi); } @@ -898,7 +898,7 @@ varobj_update (struct varobj **varp, struct varobj ***changelist) /* Save the selected stack frame, since we will need to change it in order to evaluate expressions. */ - get_frame_id (selected_frame, &old_fid); + get_frame_id (deprecated_selected_frame, &old_fid); /* Update the root variable. value_of_root can return NULL if the variable is no longer around, i.e. we stepped out of diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c index 2b06d805248..ea4cf361f5e 100644 --- a/gdb/z8k-tdep.c +++ b/gdb/z8k-tdep.c @@ -327,8 +327,8 @@ z8k_print_register_hook (int regno) { unsigned char l[4]; - frame_register_read (selected_frame, regno, l + 0); - frame_register_read (selected_frame, regno + 1, l + 2); + frame_register_read (deprecated_selected_frame, regno, l + 0); + frame_register_read (deprecated_selected_frame, regno + 1, l + 2); printf_unfiltered ("\t"); printf_unfiltered ("0x%02x%02x%02x%02x", l[0], l[1], l[2], l[3]); } @@ -337,10 +337,10 @@ z8k_print_register_hook (int regno) { unsigned char l[8]; - frame_register_read (selected_frame, regno, l + 0); - frame_register_read (selected_frame, regno + 1, l + 2); - frame_register_read (selected_frame, regno + 2, l + 4); - frame_register_read (selected_frame, regno + 3, l + 6); + frame_register_read (deprecated_selected_frame, regno, l + 0); + frame_register_read (deprecated_selected_frame, regno + 1, l + 2); + frame_register_read (deprecated_selected_frame, regno + 2, l + 4); + frame_register_read (deprecated_selected_frame, regno + 3, l + 6); printf_unfiltered ("\t"); printf_unfiltered ("0x%02x%02x%02x%02x%02x%02x%02x%02x", @@ -351,7 +351,7 @@ z8k_print_register_hook (int regno) unsigned short rval; int i; - frame_register_read (selected_frame, regno, (char *) (&rval)); + frame_register_read (deprecated_selected_frame, regno, (char *) (&rval)); printf_unfiltered ("\n"); for (i = 0; i < 10; i += 2) @@ -469,8 +469,8 @@ z8k_print_registers_info (struct gdbarch *gdbarch, void z8k_do_registers_info (int regnum, int all) { - z8k_print_registers_info (current_gdbarch, gdb_stdout, selected_frame, - regnum, all); + z8k_print_registers_info (current_gdbarch, gdb_stdout, + deprecated_selected_frame, regnum, all); } void