aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/breakpoint.c8
-rw-r--r--gdb/cli/cli-cmds.c5
-rw-r--r--gdb/f-valprint.c24
-rw-r--r--gdb/findvar.c2
-rw-r--r--gdb/frame.c10
-rw-r--r--gdb/frame.h28
-rw-r--r--gdb/infcmd.c41
-rw-r--r--gdb/inflow.c5
-rw-r--r--gdb/infrun.c4
-rw-r--r--gdb/macroscope.c15
-rw-r--r--gdb/parse.c2
-rw-r--r--gdb/regcache.h2
-rw-r--r--gdb/sh64-tdep.c3
-rw-r--r--gdb/stack.c23
-rw-r--r--gdb/tui/tui-disasm.c2
-rw-r--r--gdb/tui/tui-hooks.c12
-rw-r--r--gdb/tui/tui-source.c2
-rw-r--r--gdb/tui/tui-win.c6
-rw-r--r--gdb/tui/tui-winsource.c2
-rw-r--r--gdb/tui/tui.c4
-rw-r--r--gdb/valops.c16
-rw-r--r--gdb/varobj.c6
23 files changed, 106 insertions, 130 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 12cdcd2..a95a673 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2007-02-27 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * frame.c (deprecated_selected_frame): Rename to...
+ (selected_frame): ...this. Make static.
+ (get_selected_frame, select_frame): Update.
+ * frame.h (deprected_select_frame): Delete.
+ (deprecated_safe_get_selected_frame): Update comments.
+
+ * breakpoint.c, cli/cli-cmds.c, f-valprint.c, infcmd.c, inflow.c,
+ infrun.c, stack.c, tui/tui-disasm.c, tui/tui-source.c,
+ tui/tui-winsource.c, valops.c, varobj.c, findvar.c, macroscope.c,
+ parse.c, regcache.h, sh64-tdep.c, tui/tui-hooks.c, tui/tui-win.c,
+ tui/tui.c: Replace references to deprecated_selected_frame.
+
2007-02-27 Fred Fish <fnf@specifix.com>
* rs6000-tdep.c (skip_prologue): Recognize addi instructions that
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index e50c99a..aebd95d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1045,7 +1045,7 @@ Note: automatically using hardware breakpoints for read-only addresses.\n"));
/* FIXME drow/2003-09-09: It would be nice if evaluate_expression
took a frame parameter, so that we didn't have to change the
selected frame. */
- saved_frame_id = get_frame_id (deprecated_selected_frame);
+ saved_frame_id = get_frame_id (get_selected_frame (NULL));
/* Determine if the watchpoint is within scope. */
if (bpt->owner->exp_valid_block == NULL)
@@ -6053,7 +6053,8 @@ until_break_command (char *arg, int from_tty, int anywhere)
{
struct symtabs_and_lines sals;
struct symtab_and_line sal;
- struct frame_info *prev_frame = get_prev_frame (deprecated_selected_frame);
+ struct frame_info *frame = get_selected_frame (NULL);
+ struct frame_info *prev_frame = get_prev_frame (frame);
struct breakpoint *breakpoint;
struct cleanup *old_chain;
struct continuation_arg *arg1;
@@ -6089,8 +6090,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
else
/* Otherwise, specify the current frame, because we want to stop only
at the very same frame. */
- breakpoint = set_momentary_breakpoint (sal,
- get_frame_id (deprecated_selected_frame),
+ breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame),
bp_until);
if (!target_can_async_p ())
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index a9a8c9a..611f126 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -915,10 +915,7 @@ disassemble_command (char *arg, int from_tty)
name = NULL;
if (!arg)
{
- if (!deprecated_selected_frame)
- error (_("No frame selected."));
-
- pc = get_frame_pc (deprecated_selected_frame);
+ pc = get_frame_pc (get_selected_frame (_("No frame selected.")));
if (find_pc_partial_function (pc, &name, &low, &high) == 0)
error (_("No function contains program counter for selected frame."));
#if defined(TUI)
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 480074b..41a9771 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -65,13 +65,15 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2];
int
f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
{
+ struct frame_info *frame;
CORE_ADDR current_frame_addr;
CORE_ADDR ptr_to_lower_bound;
switch (TYPE_ARRAY_LOWER_BOUND_TYPE (type))
{
case BOUND_BY_VALUE_ON_STACK:
- current_frame_addr = get_frame_base (deprecated_selected_frame);
+ frame = deprecated_safe_get_selected_frame ();
+ current_frame_addr = get_frame_base (frame);
if (current_frame_addr > 0)
{
*lower_bound =
@@ -95,7 +97,8 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
break;
case BOUND_BY_REF_ON_STACK:
- current_frame_addr = get_frame_base (deprecated_selected_frame);
+ frame = deprecated_safe_get_selected_frame ();
+ current_frame_addr = get_frame_base (frame);
if (current_frame_addr > 0)
{
ptr_to_lower_bound =
@@ -123,13 +126,15 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
int
f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
{
+ struct frame_info *frame;
CORE_ADDR current_frame_addr = 0;
CORE_ADDR ptr_to_upper_bound;
switch (TYPE_ARRAY_UPPER_BOUND_TYPE (type))
{
case BOUND_BY_VALUE_ON_STACK:
- current_frame_addr = get_frame_base (deprecated_selected_frame);
+ frame = deprecated_safe_get_selected_frame ();
+ current_frame_addr = get_frame_base (frame);
if (current_frame_addr > 0)
{
*upper_bound =
@@ -158,7 +163,8 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
break;
case BOUND_BY_REF_ON_STACK:
- current_frame_addr = get_frame_base (deprecated_selected_frame);
+ frame = deprecated_safe_get_selected_frame ();
+ current_frame_addr = get_frame_base (frame);
if (current_frame_addr > 0)
{
ptr_to_upper_bound =
@@ -643,10 +649,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 = deprecated_selected_frame;
-
- if (fi == NULL)
- error (_("No frame selected"));
+ fi = get_selected_frame (_("No frame selected"));
/* The following is generally ripped off from stack.c's routine
print_frame_info() */
@@ -735,10 +738,7 @@ there_is_a_visible_common_named (char *comname)
if (comname == NULL)
error (_("Cannot deal with NULL common name!"));
- fi = deprecated_selected_frame;
-
- if (fi == NULL)
- error (_("No frame selected"));
+ fi = get_selected_frame (_("No frame selected"));
/* The following is generally ripped off from stack.c's routine
print_frame_info() */
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 7241724..0969388 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -378,7 +378,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 deprecated_selected_frame. */
+ If FRAME is NULL, use the selected frame. */
struct value *
read_var_value (struct symbol *var, struct frame_info *frame)
diff --git a/gdb/frame.c b/gdb/frame.c
index b32e0be..e84371c4 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -935,7 +935,7 @@ get_current_frame (void)
/* 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;
+static struct frame_info *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
@@ -944,7 +944,7 @@ struct frame_info *deprecated_selected_frame;
struct frame_info *
get_selected_frame (const char *message)
{
- if (deprecated_selected_frame == NULL)
+ if (selected_frame == NULL)
{
if (message != NULL && (!target_has_registers
|| !target_has_stack
@@ -956,8 +956,8 @@ get_selected_frame (const char *message)
select_frame (get_current_frame ());
}
/* There is always a frame. */
- gdb_assert (deprecated_selected_frame != NULL);
- return deprecated_selected_frame;
+ gdb_assert (selected_frame != NULL);
+ return selected_frame;
}
/* This is a variant of get_selected_frame() which can be called when
@@ -979,7 +979,7 @@ select_frame (struct frame_info *fi)
{
struct symtab *s;
- deprecated_selected_frame = fi;
+ selected_frame = fi;
/* NOTE: cagney/2002-05-04: FI can be NULL. This occurs when the
frame is being invalidated. */
if (deprecated_selected_frame_level_changed_hook)
diff --git a/gdb/frame.h b/gdb/frame.h
index 4739622..bce43ed 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -665,10 +665,10 @@ extern void (*deprecated_selected_frame_level_changed_hook) (int);
extern void return_command (char *, int);
-/* NOTE: cagney/2002-11-27:
+/* Notes (cagney/2002-11-27, drow/2003-09-06):
- You might think that the below global can simply be replaced by a
- call to either get_selected_frame() or select_frame().
+ You might think that calls to this function can simply be replaced by a
+ call to get_selected_frame().
Unfortunately, it isn't that easy.
@@ -680,25 +680,17 @@ extern void return_command (char *, int);
The only real exceptions occur at the edge (in the CLI code) where
user commands need to pick up the selected frame before proceeding.
+ There are also some functions called with a NULL frame meaning either "the
+ program is not running" or "use the selected frame".
+
This is important. GDB is trying to stamp out the hack:
- saved_frame = deprecated_selected_frame;
- deprecated_selected_frame = ...;
+ saved_frame = deprecated_safe_get_selected_frame ();
+ select_frame (...);
hack_using_global_selected_frame ();
- deprecated_selected_frame = saved_frame;
-
- Take care! */
-
-extern struct frame_info *deprecated_selected_frame;
-
-/* NOTE: drow/2003-09-06:
+ select_frame (saved_frame);
- This function is "a step sideways" for uses of deprecated_selected_frame.
- They should be fixed as above, but meanwhile, we needed a solution for
- cases where functions are called with a NULL frame meaning either "the
- program is not running" or "use the selected frame". Lazy building of
- deprecated_selected_frame confuses the situation, because now
- deprecated_selected_frame can be NULL even when the inferior is running.
+ Take care!
This function calls get_selected_frame if the inferior should have a
frame, or returns NULL otherwise. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index c47326f..f3a61f2 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1295,10 +1295,8 @@ 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 (deprecated_selected_frame == NULL)
- error (_("No selected frame."));
- frame = get_prev_frame (deprecated_selected_frame);
+ frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
if (frame == 0)
error (_("\"finish\" not meaningful in the outermost frame."));
@@ -1316,7 +1314,7 @@ finish_command (char *arg, int from_tty)
/* Find the function we will return from. */
- function = find_pc_function (get_frame_pc (deprecated_selected_frame));
+ function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
/* Print info on the selected frame, including level number but not
source. */
@@ -1677,18 +1675,18 @@ default_print_registers_info (struct gdbarch *gdbarch,
void
registers_info (char *addr_exp, int fpregs)
{
+ struct frame_info *frame;
int regnum, numregs;
char *end;
if (!target_has_registers)
error (_("The program has no registers now."));
- if (deprecated_selected_frame == NULL)
- error (_("No selected frame."));
+ frame = get_selected_frame (NULL);
if (!addr_exp)
{
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, -1, fpregs);
+ frame, -1, fpregs);
return;
}
@@ -1721,12 +1719,12 @@ registers_info (char *addr_exp, int fpregs)
/* A register name? */
{
- int regnum = frame_map_name_to_regnum (deprecated_selected_frame,
+ int regnum = frame_map_name_to_regnum (frame,
start, end - start);
if (regnum >= 0)
{
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, regnum, fpregs);
+ frame, regnum, fpregs);
continue;
}
}
@@ -1740,7 +1738,7 @@ registers_info (char *addr_exp, int fpregs)
&& regnum < NUM_REGS + NUM_PSEUDO_REGS)
{
gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, regnum, fpregs);
+ frame, regnum, fpregs);
continue;
}
}
@@ -1766,7 +1764,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, deprecated_selected_frame,
+ gdb_stdout, frame,
regnum, fpregs);
}
continue;
@@ -1794,11 +1792,6 @@ static void
print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, const char *args)
{
- if (!target_has_registers)
- error (_("The program has no registers now."));
- if (deprecated_selected_frame == NULL)
- error (_("No selected frame."));
-
if (gdbarch_print_vector_info_p (gdbarch))
gdbarch_print_vector_info (gdbarch, file, frame, args);
else
@@ -1822,7 +1815,11 @@ 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, deprecated_selected_frame, args);
+ if (!target_has_registers)
+ error (_("The program has no registers now."));
+
+ print_vector_info (current_gdbarch, gdb_stdout,
+ get_selected_frame (NULL), args);
}
@@ -2012,11 +2009,6 @@ static void
print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, const char *args)
{
- if (!target_has_registers)
- error (_("The program has no registers now."));
- if (deprecated_selected_frame == NULL)
- error (_("No selected frame."));
-
if (gdbarch_print_float_info_p (gdbarch))
gdbarch_print_float_info (gdbarch, file, frame, args);
else
@@ -2041,8 +2033,11 @@ No floating-point info available for this processor.\n");
static void
float_info (char *args, int from_tty)
{
+ if (!target_has_registers)
+ error (_("The program has no registers now."));
+
print_float_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, args);
+ get_selected_frame (NULL), args);
}
static void
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 9b002c6..323e79f 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -588,10 +588,7 @@ kill_command (char *arg, int from_tty)
if (target_has_stack)
{
printf_filtered (_("In %s,\n"), target_longname);
- if (deprecated_selected_frame == NULL)
- fputs_filtered ("No selected stack frame.\n", gdb_stdout);
- else
- print_stack_frame (get_selected_frame (NULL), 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 1cdfadf..09467db 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3173,7 +3173,7 @@ Further execution is probably impossible.\n"));
bpstat_print() contains the logic deciding in detail
what to print, based on the event(s) that just occurred. */
- if (stop_print_frame && deprecated_selected_frame)
+ if (stop_print_frame)
{
int bpstat_ret;
int source_flag;
@@ -3692,7 +3692,7 @@ save_inferior_status (int restore_stack_info)
inf_status->registers = regcache_dup (current_regcache);
- inf_status->selected_frame_id = get_frame_id (deprecated_selected_frame);
+ inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL));
return inf_status;
}
diff --git a/gdb/macroscope.c b/gdb/macroscope.c
index d90e075..569a9e9 100644
--- a/gdb/macroscope.c
+++ b/gdb/macroscope.c
@@ -84,17 +84,14 @@ default_macro_scope (void)
{
struct symtab_and_line sal;
struct macro_scope *ms;
+ struct frame_info *frame;
- /* If there's a selected frame, use its PC. */
- if (deprecated_selected_frame)
- sal = find_pc_line (get_frame_pc (deprecated_selected_frame), 0);
+ /* If there's a selected frame, use its PC. */
+ frame = deprecated_safe_get_selected_frame ();
+ if (frame)
+ sal = find_pc_line (get_frame_pc (frame), 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. */
- else if (target_has_registers)
- sal = find_pc_line (read_pc (), 0);
-
- /* If all else fails, fall back to the current listing position. */
+ /* Fall back to the current listing position. */
else
{
/* Don't call select_source_symtab here. That can raise an
diff --git a/gdb/parse.c b/gdb/parse.c
index 2b73bd7..6ba5a45 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -509,7 +509,7 @@ write_dollar_variable (struct stoken str)
/* Handle tokens that refer to machine registers:
$ followed by a register name. */
- i = frame_map_name_to_regnum (deprecated_selected_frame,
+ i = frame_map_name_to_regnum (deprecated_safe_get_selected_frame (),
str.ptr + 1, str.length - 1);
if (i >= 0)
goto handle_register;
diff --git a/gdb/regcache.h b/gdb/regcache.h
index c6ce2e3..fc24559 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -163,7 +163,7 @@ 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 deprecated_selected_frame) and instead refer to
+ current_gdbarch or the 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
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index dbab7c0..25eb893 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -1408,8 +1408,7 @@ sh64_show_compact_regs (void)
void
sh64_show_regs (void)
{
- if (deprecated_selected_frame
- && pc_is_isa32 (get_frame_pc (deprecated_selected_frame)))
+ if (pc_is_isa32 (get_frame_pc (get_selected_frame (NULL))))
sh64_show_media_regs ();
else
sh64_show_compact_regs ();
diff --git a/gdb/stack.c b/gdb/stack.c
index 5126911..0267d0b 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1592,24 +1592,7 @@ get_selected_block (CORE_ADDR *addr_in_block)
if (!target_has_stack)
return 0;
- /* NOTE: cagney/2002-11-28: Why go to all this effort to not create
- a selected/current frame? Perhaps this function is called,
- indirectly, by WFI in "infrun.c" where avoiding the creation of
- an inner most frame is very important (it slows down single
- step). I suspect, though that this was true in the deep dark
- 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 (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 (deprecated_selected_frame, addr_in_block);
+ return get_frame_block (get_selected_frame (NULL), addr_in_block);
}
/* Find a frame a certain number of levels away from FRAME.
@@ -1933,7 +1916,7 @@ func_command (char *arg, int from_tty)
if (!found)
printf_filtered (_("'%s' not within current stack frame.\n"), arg);
- else if (frame != deprecated_selected_frame)
+ else if (frame != get_selected_frame (NULL))
select_and_print_frame (frame);
}
@@ -1942,7 +1925,7 @@ func_command (char *arg, int from_tty)
enum language
get_frame_language (void)
{
- struct frame_info *frame = deprecated_selected_frame;
+ struct frame_info *frame = deprecated_safe_get_selected_frame ();
if (frame)
{
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 3fce663..e7bf2d1 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -386,7 +386,7 @@ tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction,
content = (tui_win_content) TUI_DISASM_WIN->generic.content;
if (cursal.symtab == (struct symtab *) NULL)
- s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+ s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
else
s = cursal.symtab;
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 2e1f1f1..f40c528 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -132,8 +132,8 @@ tui_registers_changed_hook (void)
{
struct frame_info *fi;
- fi = deprecated_selected_frame;
- if (fi && tui_refreshing_registers == 0)
+ fi = get_selected_frame (NULL);
+ if (tui_refreshing_registers == 0)
{
tui_refreshing_registers = 1;
#if 0
@@ -148,8 +148,8 @@ tui_register_changed_hook (int regno)
{
struct frame_info *fi;
- fi = deprecated_selected_frame;
- if (fi && tui_refreshing_registers == 0)
+ fi = get_selected_frame (NULL);
+ if (tui_refreshing_registers == 0)
{
tui_refreshing_registers = 1;
tui_check_data_values (fi);
@@ -230,7 +230,7 @@ tui_selected_frame_level_changed_hook (int level)
{
struct frame_info *fi;
- fi = deprecated_selected_frame;
+ fi = get_selected_frame (NULL);
/* 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)
@@ -264,7 +264,7 @@ tui_print_frame_info_listing_hook (struct symtab *s, int line,
int stopline, int noerror)
{
select_source_symtab (s);
- tui_show_frame_info (deprecated_selected_frame);
+ tui_show_frame_info (get_selected_frame (NULL));
}
/* Called when the target process died or is detached.
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 385ea91..89f024e 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -338,7 +338,7 @@ tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction,
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (cursal.symtab == (struct symtab *) NULL)
- s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+ s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
else
s = cursal.symtab;
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 2ed1920..9b85833 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -1328,13 +1328,13 @@ make_visible_with_new_height (struct tui_win_info * win_info)
tui_free_win_content (&win_info->generic);
tui_update_source_window (win_info, cursal.symtab, line_or_addr, TRUE);
}
- else if (deprecated_selected_frame != (struct frame_info *) NULL)
+ else if (deprecated_safe_get_selected_frame () != NULL)
{
struct tui_line_or_address line;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ struct frame_info *frame = deprecated_safe_get_selected_frame ();
-
- s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+ s = find_pc_symtab (get_frame_pc (frame));
if (win_info->generic.type == SRC_WIN)
{
line.loa = LOA_LINE;
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 36f46b5..4431001 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -314,7 +314,7 @@ tui_horizontal_source_scroll (struct tui_win_info * win_info,
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (cursal.symtab == (struct symtab *) NULL)
- s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+ s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
else
s = cursal.symtab;
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 84df832..a552f42 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -408,8 +408,8 @@ tui_enable (void)
tui_setup_io (1);
tui_active = 1;
- if (deprecated_selected_frame)
- tui_show_frame_info (deprecated_selected_frame);
+ if (deprecated_safe_get_selected_frame ())
+ tui_show_frame_info (deprecated_safe_get_selected_frame ());
/* Restore TUI keymap. */
tui_set_key_mode (tui_current_key_mode);
diff --git a/gdb/valops.c b/gdb/valops.c
index 51304be..d7ecb2a 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -578,7 +578,7 @@ value_assign (struct value *toval, struct value *fromval)
/* Since modifying a register can trash the frame chain, and modifying memory
can trash the frame cache, we save the old frame and then restore the new
frame afterwards. */
- old_frame = get_frame_id (deprecated_selected_frame);
+ old_frame = get_frame_id (deprecated_safe_get_selected_frame ());
switch (VALUE_LVAL (toval))
{
@@ -2667,16 +2667,18 @@ value_of_local (const char *name, int complain)
struct symbol *func, *sym;
struct block *b;
struct value * ret;
+ struct frame_info *frame;
- if (deprecated_selected_frame == 0)
+ if (complain)
+ frame = get_selected_frame (_("no frame selected"));
+ else
{
- if (complain)
- error (_("no frame selected"));
- else
+ frame = deprecated_safe_get_selected_frame ();
+ if (frame == 0)
return 0;
}
- func = get_frame_function (deprecated_selected_frame);
+ func = get_frame_function (frame);
if (!func)
{
if (complain)
@@ -2705,7 +2707,7 @@ value_of_local (const char *name, int complain)
return NULL;
}
- ret = read_var_value (sym, deprecated_selected_frame);
+ ret = read_var_value (sym, frame);
if (ret == 0 && complain)
error (_("`%s' argument unreadable"), name);
return ret;
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 21d8337..a2fd1c8 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -440,7 +440,7 @@ varobj_create (char *objname,
/* Allow creator to specify context of variable */
if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME))
- fi = deprecated_selected_frame;
+ fi = deprecated_safe_get_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
@@ -487,7 +487,7 @@ varobj_create (char *objname,
if (fi != NULL)
{
var->root->frame = get_frame_id (fi);
- old_fi = deprecated_selected_frame;
+ old_fi = get_selected_frame (NULL);
select_frame (fi);
}
@@ -1064,7 +1064,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. */
- old_fid = get_frame_id (deprecated_selected_frame);
+ old_fid = get_frame_id (deprecated_safe_get_selected_frame ());
/* Update the root variable. value_of_root can return NULL
if the variable is no longer around, i.e. we stepped out of