X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fframe.c;h=ae45e22d613d79aaaedc8984d63e622b80a3e13f;hb=8b8da1a9f31941fa167c9f2bd2a80cdd1dccb452;hp=b121892f799a5f0d2089ce5df43087f608d87a17;hpb=50888e42dcd32b30e1144c0aa6d1c1490da45cd9;p=binutils-gdb.git diff --git a/gdb/frame.c b/gdb/frame.c index b121892f799..ae45e22d613 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1,6 +1,6 @@ /* 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. @@ -24,7 +24,7 @@ #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" @@ -339,7 +339,7 @@ static void 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". */ @@ -348,10 +348,10 @@ static void 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". */ @@ -360,9 +360,9 @@ static void 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". */ @@ -371,10 +371,10 @@ static void 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. */ @@ -1238,36 +1238,36 @@ frame_unwind_register_value (frame_info *next_frame, int regnum) { 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 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, "]"); } } @@ -1288,7 +1288,6 @@ frame_unwind_register_signed (frame_info *next_frame, int regnum) { 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); @@ -1304,8 +1303,7 @@ frame_unwind_register_signed (frame_info *next_frame, int regnum) _("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; @@ -2432,12 +2430,12 @@ inside_main_func (frame_info *this_frame) 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. */ @@ -2701,10 +2699,10 @@ find_frame_sal (frame_info *frame) 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 @@ -3129,16 +3127,15 @@ _initialize_frame () 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, _("\