@@ -2398,10 +2398,11 @@ clear_dangling_display_expressions (struct objfile *objfile)
This function invalidates FRAME. */
void
-print_variable_and_value (const char *name, struct symbol *var,
+print_variable_and_value (const char *name, block_symbol bvar,
frame_info_ptr frame,
struct ui_file *stream, int indent)
{
+ symbol *var = bvar.symbol;
if (!name)
name = var->print_name ();
@@ -2414,11 +2415,7 @@ print_variable_and_value (const char *name, struct symbol *var,
struct value *val;
struct value_print_options opts;
- /* READ_VAR_VALUE needs a block in order to deal with non-local
- references (i.e. to handle nested functions). In this context, we
- print variables that are local to this frame, so we can avoid passing
- a block to it. */
- val = read_var_value (var, NULL, frame);
+ val = read_var_value (bvar, frame);
get_user_print_options (&opts);
opts.deref_ref = true;
common_val_print_checked (val, stream, indent, &opts, current_language);
@@ -2268,6 +2268,7 @@ struct print_variable_and_value_data
int num_tabs;
struct ui_file *stream;
int values_printed;
+ const struct block *block;
void operator() (const char *print_name, struct symbol *sym);
};
@@ -2296,7 +2297,8 @@ print_variable_and_value_data::operator() (const char *print_name,
return;
}
- print_variable_and_value (print_name, sym, frame, stream, num_tabs);
+ print_variable_and_value (print_name, { sym, block }, frame,
+ stream, num_tabs);
/* print_variable_and_value invalidates FRAME. */
frame = NULL;
@@ -2363,6 +2365,7 @@ print_frame_local_vars (frame_info_ptr frame,
cb_data.num_tabs = 4 * num_tabs;
cb_data.stream = stream;
cb_data.values_printed = 0;
+ cb_data.block = block;
/* Temporarily change the selected frame to the given FRAME.
This allows routines that rely on the selected frame instead
@@ -2529,6 +2532,7 @@ print_frame_arg_vars (frame_info_ptr frame,
cb_data.num_tabs = 0;
cb_data.stream = stream;
cb_data.values_printed = 0;
+ cb_data.block = func->value_block ();
iterate_over_block_arg_vars (func->value_block (), cb_data);
@@ -1534,7 +1534,7 @@ extern int val_print_string (struct type *elttype, const char *encoding,
const struct value_print_options *options);
extern void print_variable_and_value (const char *name,
- struct symbol *var,
+ block_symbol var,
frame_info_ptr frame,
struct ui_file *stream,
int indent);