/* Cache and manage frames for GDB, the GNU debugger.
- Copyright (C) 1986-2021 Free Software Foundation, Inc.
+ Copyright (C) 1986-2022 Free Software Foundation, Inc.
This file is part of GDB.
#include "inferior.h" /* for inferior_ptid */
#include "regcache.h"
#include "user-regs.h"
-#include "gdb_obstack.h"
+#include "gdbsupport/gdb_obstack.h"
#include "dummy-frame.h"
#include "sentinel-frame.h"
#include "gdbcore.h"
show_frame_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("Frame debugging is %s.\n"), value);
+ gdb_printf (file, _("Frame debugging is %s.\n"), value);
}
/* Implementation of "show backtrace past-main". */
show_backtrace_past_main (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file,
- _("Whether backtraces should "
- "continue past \"main\" is %s.\n"),
- value);
+ gdb_printf (file,
+ _("Whether backtraces should "
+ "continue past \"main\" is %s.\n"),
+ value);
}
/* Implementation of "show backtrace past-entry". */
show_backtrace_past_entry (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("Whether backtraces should continue past the "
- "entry point of a program is %s.\n"),
- value);
+ gdb_printf (file, _("Whether backtraces should continue past the "
+ "entry point of a program is %s.\n"),
+ value);
}
/* Implementation of "show backtrace limit". */
show_backtrace_limit (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file,
- _("An upper bound on the number "
- "of backtrace levels is %s.\n"),
- value);
+ gdb_printf (file,
+ _("An upper bound on the number "
+ "of backtrace levels is %s.\n"),
+ value);
}
/* See frame.h. */
{
string_file debug_file;
- fprintf_unfiltered (&debug_file, " ->");
+ gdb_printf (&debug_file, " ->");
if (value_optimized_out (value))
{
- fprintf_unfiltered (&debug_file, " ");
+ gdb_printf (&debug_file, " ");
val_print_not_saved (&debug_file);
}
else
{
if (VALUE_LVAL (value) == lval_register)
- fprintf_unfiltered (&debug_file, " register=%d",
- VALUE_REGNUM (value));
+ gdb_printf (&debug_file, " register=%d",
+ VALUE_REGNUM (value));
else if (VALUE_LVAL (value) == lval_memory)
- fprintf_unfiltered (&debug_file, " address=%s",
- paddress (gdbarch,
- value_address (value)));
+ gdb_printf (&debug_file, " address=%s",
+ paddress (gdbarch,
+ value_address (value)));
else
- fprintf_unfiltered (&debug_file, " computed");
+ gdb_printf (&debug_file, " computed");
if (value_lazy (value))
- fprintf_unfiltered (&debug_file, " lazy");
+ gdb_printf (&debug_file, " lazy");
else
{
int i;
- const gdb_byte *buf = value_contents (value).data ();
+ gdb::array_view<const gdb_byte> buf = value_contents (value);
- fprintf_unfiltered (&debug_file, " bytes=");
- fprintf_unfiltered (&debug_file, "[");
+ gdb_printf (&debug_file, " bytes=");
+ gdb_printf (&debug_file, "[");
for (i = 0; i < register_size (gdbarch, regnum); i++)
- fprintf_unfiltered (&debug_file, "%02x", buf[i]);
- fprintf_unfiltered (&debug_file, "]");
+ gdb_printf (&debug_file, "%02x", buf[i]);
+ gdb_printf (&debug_file, "]");
}
}
{
struct gdbarch *gdbarch = frame_unwind_arch (next_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int size = register_size (gdbarch, regnum);
struct value *value = frame_unwind_register_value (next_frame, regnum);
gdb_assert (value != NULL);
_("Register %d is not available"), regnum);
}
- LONGEST r = extract_signed_integer (value_contents_all (value).data (), size,
- byte_order);
+ LONGEST r = extract_signed_integer (value_contents_all (value), byte_order);
release_value (value);
return r;
if (bs.symbol == nullptr)
return false;
- const struct block *block = SYMBOL_BLOCK_VALUE (bs.symbol);
+ const struct block *block = bs.symbol->value_block ();
gdb_assert (block != nullptr);
- sym_addr = BLOCK_START (block);
+ sym_addr = block->start ();
}
else
- sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
+ sym_addr = msymbol.value_address ();
/* Convert any function descriptor addresses into the actual function
code address. */
gdb_assert (sym);
symtab_and_line sal;
- if (SYMBOL_LINE (sym) != 0)
+ if (sym->line () != 0)
{
- sal.symtab = symbol_symtab (sym);
- sal.line = SYMBOL_LINE (sym);
+ sal.symtab = sym->symtab ();
+ sal.line = sym->line ();
}
else
/* If the symbol does not have a location, we don't know where
gdb::observers::target_changed.attach (frame_observer_target_changed,
"frame");
- add_basic_prefix_cmd ("backtrace", class_maintenance, _("\
+ add_setshow_prefix_cmd ("backtrace", class_maintenance,
+ _("\
Set backtrace specific variables.\n\
Configure backtrace variables such as the backtrace limit"),
- &set_backtrace_cmdlist,
- 0/*allow-unknown*/, &setlist);
- add_show_prefix_cmd ("backtrace", class_maintenance, _("\
+ _("\
Show backtrace specific variables.\n\
Show backtrace variables such as the backtrace limit."),
- &show_backtrace_cmdlist,
- 0/*allow-unknown*/, &showlist);
+ &set_backtrace_cmdlist, &show_backtrace_cmdlist,
+ &setlist, &showlist);
add_setshow_uinteger_cmd ("limit", class_obscure,
&user_set_backtrace_options.backtrace_limit, _("\