/* print_frame_info_print_what[i] maps a choice to the corresponding
print_what enum. */
-static const gdb::optional<enum print_what> print_frame_info_print_what[] =
+static const std::optional<enum print_what> print_frame_info_print_what[] =
{{}, /* Empty value for "auto". */
SRC_LINE, LOCATION, SRC_AND_LOC, LOC_AND_ADDRESS, SHORT_LOCATION};
if (current_uiout->is_mi_like_p ())
print_what = LOC_AND_ADDRESS;
- frame.prepare_reinflate ();
try
{
print_frame_info (user_frame_print_options,
frame, print_level, print_what, 1 /* print_args */,
set_current_sal);
- frame.reinflate ();
if (set_current_sal)
set_current_sal_from_frame (frame);
}
because our standard indentation here is 4 spaces, and
val_print indents 2 for each recurse. */
- annotate_arg_value (value_type (arg->val));
+ annotate_arg_value (arg->val->type ());
/* Use the appropriate language to display our symbol, unless the
user forced the language to a specific language. */
&& SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry != NULL
&& fp_opts.print_entry_values != print_entry_values_no
&& (fp_opts.print_entry_values != print_entry_values_if_needed
- || !val || value_optimized_out (val)))
+ || !val || val->optimized_out ()))
{
try
{
}
}
- if (entryval != NULL && value_optimized_out (entryval))
+ if (entryval != NULL && entryval->optimized_out ())
entryval = NULL;
if (fp_opts.print_entry_values == print_entry_values_compact
if (val && entryval && !current_uiout->is_mi_like_p ())
{
- struct type *type = value_type (val);
+ struct type *type = val->type ();
- if (value_lazy (val))
- value_fetch_lazy (val);
- if (value_lazy (entryval))
- value_fetch_lazy (entryval);
+ if (val->lazy ())
+ val->fetch_lazy ();
+ if (entryval->lazy ())
+ entryval->fetch_lazy ();
- if (value_contents_eq (val, 0, entryval, 0, type->length ()))
+ if (val->contents_eq (0, entryval, 0, type->length ()))
{
/* Initialize it just to avoid a GCC false warning. */
struct value *val_deref = NULL, *entryval_deref;
struct type *type_deref;
val_deref = coerce_ref (val);
- if (value_lazy (val_deref))
- value_fetch_lazy (val_deref);
- type_deref = value_type (val_deref);
+ if (val_deref->lazy ())
+ val_deref->fetch_lazy ();
+ type_deref = val_deref->type ();
entryval_deref = coerce_ref (entryval);
- if (value_lazy (entryval_deref))
- value_fetch_lazy (entryval_deref);
+ if (entryval_deref->lazy ())
+ entryval_deref->fetch_lazy ();
/* If the reference addresses match but dereferenced
content does not match print them. */
if (val != val_deref
- && value_contents_eq (val_deref, 0,
- entryval_deref, 0,
- type_deref->length ()))
+ && val_deref->contents_eq (0,
+ entryval_deref, 0,
+ type_deref->length ()))
val_equal = 1;
}
catch (const gdb_exception_error &except)
if (fp_opts.print_entry_values == print_entry_values_only
|| fp_opts.print_entry_values == print_entry_values_both
|| (fp_opts.print_entry_values == print_entry_values_preferred
- && (!val || value_optimized_out (val))))
+ && (!val || val->optimized_out ())))
{
- entryval = allocate_optimized_out_value (sym->type ());
+ entryval = value::allocate_optimized_out (sym->type ());
entryval_error = NULL;
}
}
if ((fp_opts.print_entry_values == print_entry_values_compact
|| fp_opts.print_entry_values == print_entry_values_if_needed
|| fp_opts.print_entry_values == print_entry_values_preferred)
- && (!val || value_optimized_out (val)) && entryval != NULL)
+ && (!val || val->optimized_out ()) && entryval != NULL)
{
val = NULL;
val_error = NULL;
= (print_names
&& fp_opts.print_frame_arguments != print_frame_arguments_none);
- /* If one of the arguments has a pretty printer that calls a
- function of the inferior to print it, the pointer must be
- reinflatable. */
- frame.prepare_reinflate ();
-
- /* Temporarily change the selected frame to the given FRAME.
- This allows routines that rely on the selected frame instead
- of being given a frame as parameter to use the correct frame. */
- scoped_restore_selected_frame restore_selected_frame;
- select_frame (frame);
-
if (func)
{
const struct block *b = func->value_block ();
- struct block_iterator iter;
- struct symbol *sym;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
struct frame_arg arg, entryarg;
}
first = 0;
- frame.reinflate ();
}
}
Value not present indicates to the caller to use default values
specific to the command being executed. */
-static gdb::optional<enum print_what>
+static std::optional<enum print_what>
print_frame_info_to_print_what (const char *print_frame_info)
{
for (int i = 0; print_frame_info_choices[i] != NULL; i++)
/* See stack.h. */
void
-get_user_print_what_frame_info (gdb::optional<enum print_what> *what)
+get_user_print_what_frame_info (std::optional<enum print_what> *what)
{
*what
= print_frame_info_to_print_what
int location_print;
struct ui_out *uiout = current_uiout;
- frame.prepare_reinflate ();
-
if (!current_uiout->is_mi_like_p ()
&& fp_opts.print_frame_info != print_frame_info_auto)
{
print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
}
- frame.reinflate ();
/* If disassemble-next-line is set to on and there is line debug
messages, output assembly codes for next line. */
{
const char *lib
= solib_name_from_address (get_frame_program_space (frame),
- get_frame_pc (frame));
+ get_frame_address_in_block (frame));
if (lib)
{
gdb_printf (" %d args: ", numargs);
}
- fi.prepare_reinflate ();
print_frame_args (user_frame_print_options,
func, fi, numargs, gdb_stdout);
- fi.reinflate ();
-
gdb_puts ("\n");
}
}
struct value *value = frame_unwind_register_value (fi, sp_regnum);
gdb_assert (value != NULL);
- if (!value_optimized_out (value) && value_entirely_available (value))
+ if (!value->optimized_out () && value->entirely_available ())
{
- if (VALUE_LVAL (value) == not_lval)
+ if (value->lval () == not_lval)
{
CORE_ADDR sp;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int sp_size = register_size (gdbarch, sp_regnum);
sp = extract_unsigned_integer
- (value_contents_all (value).data (), sp_size, byte_order);
+ (value->contents_all ().data (), sp_size, byte_order);
gdb_printf (" Previous frame's sp is ");
gdb_puts (paddress (gdbarch, sp));
gdb_printf ("\n");
}
- else if (VALUE_LVAL (value) == lval_memory)
+ else if (value->lval () == lval_memory)
{
gdb_printf (" Previous frame's sp at ");
- gdb_puts (paddress (gdbarch, value_address (value)));
+ gdb_puts (paddress (gdbarch, value->address ()));
gdb_printf ("\n");
}
- else if (VALUE_LVAL (value) == lval_register)
+ else if (value->lval () == lval_register)
{
gdb_printf (" Previous frame's sp in %s\n",
- gdbarch_register_name (gdbarch,
- VALUE_REGNUM (value)));
+ gdbarch_register_name (gdbarch, value->regnum ()));
}
release_value (value);
frame_info_ptr prev_frame = get_selected_frame ();
select_frame (fi);
if (get_selected_frame () != prev_frame)
- gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME);
+ notify_user_selected_context_changed (USER_SELECTED_FRAME);
}
/* The core of all the "frame" sub-commands. Select frame FI, and if this
frame_info_ptr prev_frame = get_selected_frame ();
select_frame (fi);
if (get_selected_frame () != prev_frame)
- gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME);
+ notify_user_selected_context_changed (USER_SELECTED_FRAME);
else
print_selected_thread_frame (current_uiout, USER_SELECTED_FRAME);
}
for (fi = trailing; fi && count--; fi = get_prev_frame (fi))
{
QUIT;
- fi.prepare_reinflate ();
/* Don't use print_stack_frame; if an error() occurs it probably
means further attempts to backtrace would fail (on the other
print_frame_local_vars (fi, false, NULL, NULL, 1, gdb_stdout);
/* Save the last frame to check for error conditions. */
- fi.reinflate ();
trailing = fi;
}
iterate_over_block_locals (const struct block *b,
iterate_over_block_arg_local_vars_cb cb)
{
- struct block_iterator iter;
- struct symbol *sym;
-
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
switch (sym->aclass ())
{
struct print_variable_and_value_data
{
- gdb::optional<compiled_regex> preg;
- gdb::optional<compiled_regex> treg;
+ std::optional<compiled_regex> preg;
+ std::optional<compiled_regex> treg;
struct frame_id frame_id;
int num_tabs;
struct ui_file *stream;
If REGEXP is NULL, it results in an empty regular expression. */
static void
-prepare_reg (const char *regexp, gdb::optional<compiled_regex> *reg)
+prepare_reg (const char *regexp, std::optional<compiled_regex> *reg)
{
if (regexp != NULL)
{
If T_REGEXP is not NULL, only print local variables whose type
matches T_REGEXP.
If no local variables have been printed and !QUIET, prints a message
- explaining why no local variables could be printed.
-
- This function will invalidate FRAME. */
+ explaining why no local variables could be printed. */
static void
print_frame_local_vars (frame_info_ptr frame,
iterate_over_block_arg_vars (const struct block *b,
iterate_over_block_arg_local_vars_cb cb)
{
- struct block_iterator iter;
- struct symbol *sym, *sym2;
-
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
/* Don't worry about things which aren't arguments. */
if (sym->is_argument ())
float). There are also LOC_ARG/LOC_REGISTER pairs which
are not combined in symbol-reading. */
- sym2 = lookup_symbol_search_name (sym->search_name (),
- b, VAR_DOMAIN).symbol;
+ struct symbol *sym2
+ = lookup_symbol_search_name (sym->search_name (),
+ b, VAR_DOMAIN).symbol;
cb (sym->print_name (), sym2);
}
}
If T_REGEXP is not NULL, only print argument variables whose type
matches T_REGEXP.
If no argument variables have been printed and !QUIET, prints a message
- explaining why no argument variables could be printed.
-
- This function will invalidate FRAME. */
+ explaining why no argument variables could be printed. */
static void
print_frame_arg_vars (frame_info_ptr frame,
struct print_variable_and_value_data cb_data;
struct symbol *func;
CORE_ADDR pc;
- gdb::optional<compiled_regex> preg;
- gdb::optional<compiled_regex> treg;
+ std::optional<compiled_regex> preg;
+ std::optional<compiled_regex> treg;
if (!get_frame_pc_if_available (frame, &pc))
{
iterate_over_block_arg_vars (func->value_block (), cb_data);
- /* do_print_variable_and_value invalidates FRAME. */
- frame = NULL;
-
if (!cb_data.values_printed && !quiet)
{
if (regexp == NULL && t_regexp == NULL)
up_command (const char *count_exp, int from_tty)
{
up_silently_base (count_exp);
- gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME);
+ notify_user_selected_context_changed (USER_SELECTED_FRAME);
}
/* Select the frame down one or COUNT_EXP stack levels from the previously
down_command (const char *count_exp, int from_tty)
{
down_silently_base (count_exp);
- gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME);
+ notify_user_selected_context_changed (USER_SELECTED_FRAME);
}
void
/* Compute the return value. Should the computation fail, this
call throws an error. */
- return_value = evaluate_expression (retval_expr.get ());
+ return_value = retval_expr->evaluate ();
/* Cast return value to the return type of the function. Should
the cast fail, this call throws an error. */
error (_("Return value type not available for selected "
"stack frame.\n"
"Please use an explicit cast of the value to return."));
- return_type = value_type (return_value);
+ return_type = return_value->type ();
}
return_type = check_typedef (return_type);
return_value = value_cast (return_type, return_value);
/* Make sure the value is fully evaluated. It may live in the
stack frame we're about to pop. */
- if (value_lazy (return_value))
- value_fetch_lazy (return_value);
+ if (return_value->lazy ())
+ return_value->fetch_lazy ();
if (thisfun != NULL)
function = read_var_value (thisfun, NULL, thisframe);
return_value = NULL;
else if (thisfun != NULL)
{
- if (is_nocall_function (check_typedef (value_type (function))))
+ if (is_nocall_function (check_typedef (function->type ())))
{
query_prefix =
string_printf ("Function '%s' does not follow the target "
/* Store RETURN_VALUE in the just-returned register set. */
if (return_value != NULL)
{
- struct type *return_type = value_type (return_value);
- struct gdbarch *cache_arch = get_current_regcache ()->arch ();
+ struct type *return_type = return_value->type ();
+ regcache *regcache = get_thread_regcache (inferior_thread ());
+ struct gdbarch *cache_arch = regcache->arch ();
gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
&& rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
- gdbarch_return_value (cache_arch, function, return_type,
- get_current_regcache (), NULL /*read*/,
- value_contents (return_value).data () /*write*/);
+ gdbarch_return_value_as_value
+ (cache_arch, function, return_type, regcache, NULL /*read*/,
+ return_value->contents ().data () /*write*/);
}
/* If we are at the end of a call dummy now, pop the dummy frame