/* Do various things to symbol tables (other than lookup), for GDB.
- Copyright (C) 1986-2022 Free Software Foundation, Inc.
+ Copyright (C) 1986-2023 Free Software Foundation, Inc.
This file is part of GDB.
gdb_printf ("\nObject file %s: ", objfile_name (objfile));
gdb_printf ("Objfile at %s, bfd at %s, %d minsyms\n\n",
host_address_to_string (objfile),
- host_address_to_string (objfile->obfd),
+ host_address_to_string (objfile->obfd.get ()),
objfile->per_bfd->minimal_symbol_count);
objfile->dump ();
/* Use the relocated address as shown in the symbol here -- do
not try to respect copy relocations. */
- CORE_ADDR addr = (msymbol->value_raw_address ()
+ CORE_ADDR addr = (CORE_ADDR (msymbol->unrelocated_address ())
+ objfile->section_offsets[msymbol->section_index ()]);
gdb_puts (paddress (gdbarch, addr), outfile);
gdb_printf (outfile, " %s", msymbol->linkage_name ());
bfd_section_name (section->the_bfd_section));
else
gdb_printf (outfile, " spurious section %ld",
- (long) (section - objfile->sections));
+ (long) (section - objfile->sections_start));
}
if (msymbol->demangled_name () != NULL)
{
{
struct objfile *objfile = symtab->compunit ()->objfile ();
struct gdbarch *gdbarch = objfile->arch ();
- int i;
- struct mdict_iterator miter;
- int len;
- struct linetable *l;
- const struct blockvector *bv;
- struct symbol *sym;
- const struct block *b;
+ const struct linetable *l;
int depth;
gdb_printf (outfile, "\nSymtab for file %s at %s\n",
if (l)
{
gdb_printf (outfile, "\nLine table:\n\n");
- len = l->nitems;
- for (i = 0; i < len; i++)
+ int len = l->nitems;
+ for (int i = 0; i < len; i++)
{
gdb_printf (outfile, " line %d at ", l->item[i].line);
- gdb_puts (paddress (gdbarch, l->item[i].pc), outfile);
+ gdb_puts (paddress (gdbarch, l->item[i].pc (objfile)), outfile);
if (l->item[i].is_stmt)
gdb_printf (outfile, "\t(stmt)");
gdb_printf (outfile, "\n");
if (is_main_symtab_of_compunit_symtab (symtab))
{
gdb_printf (outfile, "\nBlockvector:\n\n");
- bv = symtab->compunit ()->blockvector ();
- len = BLOCKVECTOR_NBLOCKS (bv);
- for (i = 0; i < len; i++)
+ const blockvector *bv = symtab->compunit ()->blockvector ();
+ for (int i = 0; i < bv->num_blocks (); i++)
{
- b = BLOCKVECTOR_BLOCK (bv, i);
+ const block *b = bv->block (i);
depth = block_depth (b) * 2;
gdb_printf (outfile, "%*sblock #%03d, object at %s",
depth, "", i,
host_address_to_string (b));
- if (BLOCK_SUPERBLOCK (b))
+ if (b->superblock ())
gdb_printf (outfile, " under %s",
- host_address_to_string (BLOCK_SUPERBLOCK (b)));
+ host_address_to_string (b->superblock ()));
/* drow/2002-07-10: We could save the total symbols count
even if we're using a hashtable, but nothing else but this message
wants it. */
- gdb_printf (outfile, ", %d syms/buckets in ",
- mdict_size (BLOCK_MULTIDICT (b)));
- gdb_puts (paddress (gdbarch, BLOCK_START (b)), outfile);
+ gdb_printf (outfile, ", %d symbols in ",
+ mdict_size (b->multidict ()));
+ gdb_puts (paddress (gdbarch, b->start ()), outfile);
gdb_printf (outfile, "..");
- gdb_puts (paddress (gdbarch, BLOCK_END (b)), outfile);
- if (BLOCK_FUNCTION (b))
+ gdb_puts (paddress (gdbarch, b->end ()), outfile);
+ if (b->function ())
{
gdb_printf (outfile, ", function %s",
- BLOCK_FUNCTION (b)->linkage_name ());
- if (BLOCK_FUNCTION (b)->demangled_name () != NULL)
+ b->function ()->linkage_name ());
+ if (b->function ()->demangled_name () != NULL)
{
gdb_printf (outfile, ", %s",
- BLOCK_FUNCTION (b)->demangled_name ());
+ b->function ()->demangled_name ());
}
}
gdb_printf (outfile, "\n");
/* Now print each symbol in this block (in no particular order, if
we're using a hashtable). Note that we only want this
block, not any blocks from included symtabs. */
- ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym)
+ for (struct symbol *sym : b->multidict_symbols ())
{
try
{
gdb_printf (outfile, "Compunit user: %s\n", addr);
}
if (cust->includes != nullptr)
- for (i = 0; ; ++i)
+ for (int i = 0; ; ++i)
{
struct compunit_symtab *include = cust->includes[i];
if (include == nullptr)
because certain routines used during dump_symtab() use the current
language to print an image of the symbol. We'll restore it later.
But use only real languages, not placeholders. */
- if (symtab->language () != language_unknown
- && symtab->language () != language_auto)
+ if (symtab->language () != language_unknown)
{
scoped_restore_current_language save_lang;
set_language (symtab->language ());
struct type *type = check_typedef (symbol->type ());
gdb_printf (outfile, "const %s hex bytes:",
- pulongest (TYPE_LENGTH (type)));
- for (i = 0; i < TYPE_LENGTH (type); i++)
+ pulongest (type->length ()));
+ for (i = 0; i < type->length (); i++)
gdb_printf (outfile, " %02x",
(unsigned) symbol->value_bytes ()[i]);
}
gdb_printf
(outfile, "block object %s, %s..%s",
host_address_to_string (symbol->value_block ()),
- paddress (gdbarch, BLOCK_START (symbol->value_block ())),
- paddress (gdbarch, BLOCK_END (symbol->value_block ())));
+ paddress (gdbarch, symbol->value_block()->start ()),
+ paddress (gdbarch, symbol->value_block()->end ()));
if (section)
gdb_printf (outfile, " section %s",
bfd_section_name (section->the_bfd_section));
{
int i = 0;
- while ((block = BLOCK_SUPERBLOCK (block)) != NULL)
+ while ((block = block->superblock ()) != NULL)
{
i++;
}
static int
maintenance_print_one_line_table (struct symtab *symtab, void *data)
{
- struct linetable *linetable;
+ const struct linetable *linetable;
struct objfile *objfile;
objfile = symtab->compunit ()->objfile ();
/* Leave space for 6 digits of index and line number. After that the
tables will just not format as well. */
struct ui_out *uiout = current_uiout;
- ui_out_emit_table table_emitter (uiout, 5, -1, "line-table");
+ ui_out_emit_table table_emitter (uiout, 6, -1, "line-table");
uiout->table_header (6, ui_left, "index", _("INDEX"));
uiout->table_header (6, ui_left, "line", _("LINE"));
- uiout->table_header (18, ui_left, "address", _("ADDRESS"));
+ uiout->table_header (18, ui_left, "rel-address", _("REL-ADDRESS"));
+ uiout->table_header (18, ui_left, "unrel-address", _("UNREL-ADDRESS"));
uiout->table_header (7, ui_left, "is-stmt", _("IS-STMT"));
uiout->table_header (12, ui_left, "prologue-end", _("PROLOGUE-END"));
uiout->table_body ();
for (int i = 0; i < linetable->nitems; ++i)
{
- struct linetable_entry *item;
+ const linetable_entry *item;
item = &linetable->item [i];
ui_out_emit_tuple tuple_emitter (uiout, nullptr);
uiout->field_signed ("line", item->line);
else
uiout->field_string ("line", _("END"));
- uiout->field_core_addr ("address", objfile->arch (),
- item->pc);
+ uiout->field_core_addr ("rel-address", objfile->arch (),
+ item->pc (objfile));
+ uiout->field_core_addr ("unrel-address", objfile->arch (),
+ CORE_ADDR (item->unrelocated_pc ()));
uiout->field_string ("is-stmt", item->is_stmt ? "Y" : "");
uiout->field_string ("prologue-end", item->prologue_end ? "Y" : "");
uiout->text ("\n");