/* 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.
for (objfile *objfile : pspace->objfiles ())
{
QUIT;
- printf_filtered (_("Statistics for '%s':\n"), objfile_name (objfile));
+ gdb_printf (_("Statistics for '%s':\n"), objfile_name (objfile));
if (OBJSTAT (objfile, n_stabs) > 0)
- printf_filtered (_(" Number of \"stab\" symbols read: %d\n"),
- OBJSTAT (objfile, n_stabs));
+ gdb_printf (_(" Number of \"stab\" symbols read: %d\n"),
+ OBJSTAT (objfile, n_stabs));
if (objfile->per_bfd->n_minsyms > 0)
- printf_filtered (_(" Number of \"minimal\" symbols read: %d\n"),
- objfile->per_bfd->n_minsyms);
+ gdb_printf (_(" Number of \"minimal\" symbols read: %d\n"),
+ objfile->per_bfd->n_minsyms);
if (OBJSTAT (objfile, n_syms) > 0)
- printf_filtered (_(" Number of \"full\" symbols read: %d\n"),
- OBJSTAT (objfile, n_syms));
+ gdb_printf (_(" Number of \"full\" symbols read: %d\n"),
+ OBJSTAT (objfile, n_syms));
if (OBJSTAT (objfile, n_types) > 0)
- printf_filtered (_(" Number of \"types\" defined: %d\n"),
- OBJSTAT (objfile, n_types));
+ gdb_printf (_(" Number of \"types\" defined: %d\n"),
+ OBJSTAT (objfile, n_types));
i = linetables = 0;
for (compunit_symtab *cu : objfile->compunits ())
}
blockvectors = std::distance (objfile->compunits ().begin (),
objfile->compunits ().end ());
- printf_filtered (_(" Number of symbol tables: %d\n"), i);
- printf_filtered (_(" Number of symbol tables with line tables: %d\n"),
- linetables);
- printf_filtered (_(" Number of symbol tables with blockvectors: %d\n"),
- blockvectors);
+ gdb_printf (_(" Number of symbol tables: %d\n"), i);
+ gdb_printf (_(" Number of symbol tables with line tables: %d\n"),
+ linetables);
+ gdb_printf (_(" Number of symbol tables with blockvectors: %d\n"),
+ blockvectors);
objfile->print_stats (false);
if (OBJSTAT (objfile, sz_strtab) > 0)
- printf_filtered (_(" Space used by string tables: %d\n"),
- OBJSTAT (objfile, sz_strtab));
- printf_filtered (_(" Total memory used for objfile obstack: %s\n"),
- pulongest (obstack_memory_used (&objfile
- ->objfile_obstack)));
- printf_filtered (_(" Total memory used for BFD obstack: %s\n"),
- pulongest (obstack_memory_used (&objfile->per_bfd
- ->storage_obstack)));
-
- printf_filtered (_(" Total memory used for string cache: %d\n"),
- objfile->per_bfd->string_cache.memory_used ());
- printf_filtered (_("Byte cache statistics for '%s':\n"),
- objfile_name (objfile));
+ gdb_printf (_(" Space used by string tables: %d\n"),
+ OBJSTAT (objfile, sz_strtab));
+ gdb_printf (_(" Total memory used for objfile obstack: %s\n"),
+ pulongest (obstack_memory_used (&objfile
+ ->objfile_obstack)));
+ gdb_printf (_(" Total memory used for BFD obstack: %s\n"),
+ pulongest (obstack_memory_used (&objfile->per_bfd
+ ->storage_obstack)));
+
+ gdb_printf (_(" Total memory used for string cache: %d\n"),
+ objfile->per_bfd->string_cache.memory_used ());
+ gdb_printf (_("Byte cache statistics for '%s':\n"),
+ objfile_name (objfile));
objfile->per_bfd->string_cache.print_statistics ("string cache");
objfile->print_stats (true);
}
static void
dump_objfile (struct objfile *objfile)
{
- printf_filtered ("\nObject file %s: ", objfile_name (objfile));
- printf_filtered ("Objfile at %s, bfd at %s, %d minsyms\n\n",
- host_address_to_string (objfile),
- host_address_to_string (objfile->obfd),
- objfile->per_bfd->minimal_symbol_count);
+ 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.get ()),
+ objfile->per_bfd->minimal_symbol_count);
objfile->dump ();
if (objfile->compunit_symtabs != NULL)
{
- printf_filtered ("Symtabs:\n");
+ gdb_printf ("Symtabs:\n");
for (compunit_symtab *cu : objfile->compunits ())
{
for (symtab *symtab : cu->filetabs ())
{
- printf_filtered ("%s at %s",
- symtab_to_filename_for_display (symtab),
- host_address_to_string (symtab));
- if (symtab->objfile () != objfile)
- printf_filtered (", NOT ON CHAIN!");
- printf_filtered ("\n");
+ gdb_printf ("%s at %s",
+ symtab_to_filename_for_display (symtab),
+ host_address_to_string (symtab));
+ if (symtab->compunit ()->objfile () != objfile)
+ gdb_printf (", NOT ON CHAIN!");
+ gdb_printf ("\n");
}
}
- printf_filtered ("\n\n");
+ gdb_printf ("\n\n");
}
}
int index;
char ms_type;
- fprintf_filtered (outfile, "\nObject file %s:\n\n", objfile_name (objfile));
+ gdb_printf (outfile, "\nObject file %s:\n\n", objfile_name (objfile));
if (objfile->per_bfd->minimal_symbol_count == 0)
{
- fprintf_filtered (outfile, "No minimal symbols found.\n");
+ gdb_printf (outfile, "No minimal symbols found.\n");
return;
}
index = 0;
{
struct obj_section *section = msymbol->obj_section (objfile);
- switch (MSYMBOL_TYPE (msymbol))
+ switch (msymbol->type ())
{
case mst_unknown:
ms_type = 'u';
ms_type = '?';
break;
}
- fprintf_filtered (outfile, "[%2d] %c ", index, ms_type);
+ gdb_printf (outfile, "[%2d] %c ", index, ms_type);
/* Use the relocated address as shown in the symbol here -- do
not try to respect copy relocations. */
- CORE_ADDR addr = (msymbol->value.address
+ CORE_ADDR addr = (CORE_ADDR (msymbol->unrelocated_address ())
+ objfile->section_offsets[msymbol->section_index ()]);
- fputs_filtered (paddress (gdbarch, addr), outfile);
- fprintf_filtered (outfile, " %s", msymbol->linkage_name ());
+ gdb_puts (paddress (gdbarch, addr), outfile);
+ gdb_printf (outfile, " %s", msymbol->linkage_name ());
if (section)
{
if (section->the_bfd_section != NULL)
- fprintf_filtered (outfile, " section %s",
- bfd_section_name (section->the_bfd_section));
+ gdb_printf (outfile, " section %s",
+ bfd_section_name (section->the_bfd_section));
else
- fprintf_filtered (outfile, " spurious section %ld",
- (long) (section - objfile->sections));
+ gdb_printf (outfile, " spurious section %ld",
+ (long) (section - objfile->sections_start));
}
if (msymbol->demangled_name () != NULL)
{
- fprintf_filtered (outfile, " %s", msymbol->demangled_name ());
+ gdb_printf (outfile, " %s", msymbol->demangled_name ());
}
if (msymbol->filename)
- fprintf_filtered (outfile, " %s", msymbol->filename);
- fputs_filtered ("\n", outfile);
+ gdb_printf (outfile, " %s", msymbol->filename);
+ gdb_puts ("\n", outfile);
index++;
}
if (objfile->per_bfd->minimal_symbol_count != index)
warning (_("internal error: minimal symbol count %d != %d"),
objfile->per_bfd->minimal_symbol_count, index);
}
- fprintf_filtered (outfile, "\n");
+ gdb_printf (outfile, "\n");
}
static void
dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
{
- struct objfile *objfile = symtab->objfile ();
+ 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;
- fprintf_filtered (outfile, "\nSymtab for file %s at %s\n",
- symtab_to_filename_for_display (symtab),
- host_address_to_string (symtab));
+ gdb_printf (outfile, "\nSymtab for file %s at %s\n",
+ symtab_to_filename_for_display (symtab),
+ host_address_to_string (symtab));
- if (symtab->dirname () != NULL)
- fprintf_filtered (outfile, "Compilation directory is %s\n",
- symtab->dirname ());
- fprintf_filtered (outfile, "Read from object file %s (%s)\n",
- objfile_name (objfile),
- host_address_to_string (objfile));
- fprintf_filtered (outfile, "Language: %s\n",
- language_str (symtab->language ()));
+ if (symtab->compunit ()->dirname () != NULL)
+ gdb_printf (outfile, "Compilation directory is %s\n",
+ symtab->compunit ()->dirname ());
+ gdb_printf (outfile, "Read from object file %s (%s)\n",
+ objfile_name (objfile),
+ host_address_to_string (objfile));
+ gdb_printf (outfile, "Language: %s\n",
+ language_str (symtab->language ()));
/* First print the line table. */
l = symtab->linetable ();
if (l)
{
- fprintf_filtered (outfile, "\nLine table:\n\n");
- len = l->nitems;
- for (i = 0; i < len; i++)
+ gdb_printf (outfile, "\nLine table:\n\n");
+ int len = l->nitems;
+ for (int i = 0; i < len; i++)
{
- fprintf_filtered (outfile, " line %d at ", l->item[i].line);
- fputs_filtered (paddress (gdbarch, l->item[i].pc), outfile);
+ gdb_printf (outfile, " line %d at ", l->item[i].line);
+ gdb_puts (paddress (gdbarch, l->item[i].pc (objfile)), outfile);
if (l->item[i].is_stmt)
- fprintf_filtered (outfile, "\t(stmt)");
- fprintf_filtered (outfile, "\n");
+ gdb_printf (outfile, "\t(stmt)");
+ gdb_printf (outfile, "\n");
}
}
/* Now print the block info, but only for compunit symtabs since we will
print lots of duplicate info otherwise. */
if (is_main_symtab_of_compunit_symtab (symtab))
{
- fprintf_filtered (outfile, "\nBlockvector:\n\n");
- bv = symtab->blockvector ();
- len = BLOCKVECTOR_NBLOCKS (bv);
- for (i = 0; i < len; i++)
+ gdb_printf (outfile, "\nBlockvector:\n\n");
+ 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;
- fprintf_filtered (outfile, "%*sblock #%03d, object at %s",
- depth, "", i,
- host_address_to_string (b));
- if (BLOCK_SUPERBLOCK (b))
- fprintf_filtered (outfile, " under %s",
- host_address_to_string (BLOCK_SUPERBLOCK (b)));
+ gdb_printf (outfile, "%*sblock #%03d, object at %s",
+ depth, "", i,
+ host_address_to_string (b));
+ if (b->superblock ())
+ gdb_printf (outfile, " under %s",
+ 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. */
- fprintf_filtered (outfile, ", %d syms/buckets in ",
- mdict_size (BLOCK_MULTIDICT (b)));
- fputs_filtered (paddress (gdbarch, BLOCK_START (b)), outfile);
- fprintf_filtered (outfile, "..");
- fputs_filtered (paddress (gdbarch, BLOCK_END (b)), outfile);
- if (BLOCK_FUNCTION (b))
+ gdb_printf (outfile, ", %d symbols in ",
+ mdict_size (b->multidict ()));
+ gdb_puts (paddress (gdbarch, b->start ()), outfile);
+ gdb_printf (outfile, "..");
+ gdb_puts (paddress (gdbarch, b->end ()), outfile);
+ if (b->function ())
{
- fprintf_filtered (outfile, ", function %s",
- BLOCK_FUNCTION (b)->linkage_name ());
- if (BLOCK_FUNCTION (b)->demangled_name () != NULL)
+ gdb_printf (outfile, ", function %s",
+ b->function ()->linkage_name ());
+ if (b->function ()->demangled_name () != NULL)
{
- fprintf_filtered (outfile, ", %s",
- BLOCK_FUNCTION (b)->demangled_name ());
+ gdb_printf (outfile, ", %s",
+ b->function ()->demangled_name ());
}
}
- fprintf_filtered (outfile, "\n");
+ 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
{
}
}
}
- fprintf_filtered (outfile, "\n");
+ gdb_printf (outfile, "\n");
}
else
{
const char *compunit_filename
= symtab_to_filename_for_display (compunit->primary_filetab ());
- fprintf_filtered (outfile,
- "\nBlockvector same as owning compunit: %s\n\n",
- compunit_filename);
+ gdb_printf (outfile,
+ "\nBlockvector same as owning compunit: %s\n\n",
+ compunit_filename);
}
/* Print info about the user of this compunit_symtab, and the
{
const char *addr
= host_address_to_string (cust->user->primary_filetab ());
- fprintf_filtered (outfile, "Compunit user: %s\n", addr);
+ 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)
break;
const char *addr
= host_address_to_string (include->primary_filetab ());
- fprintf_filtered (outfile, "Compunit include: %s\n", addr);
+ gdb_printf (outfile, "Compunit include: %s\n", addr);
}
}
}
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 obj_section *section;
if (symbol->is_objfile_owned ())
- section = symbol->obj_section (symbol_objfile (symbol));
+ section = symbol->obj_section (symbol->objfile ());
else
section = NULL;
- print_spaces_filtered (depth, outfile);
+ print_spaces (depth, outfile);
if (symbol->domain () == LABEL_DOMAIN)
{
- fprintf_filtered (outfile, "label %s at ", symbol->print_name ());
- fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)),
- outfile);
+ gdb_printf (outfile, "label %s at ", symbol->print_name ());
+ gdb_puts (paddress (gdbarch, symbol->value_address ()),
+ outfile);
if (section)
- fprintf_filtered (outfile, " section %s\n",
- bfd_section_name (section->the_bfd_section));
+ gdb_printf (outfile, " section %s\n",
+ bfd_section_name (section->the_bfd_section));
else
- fprintf_filtered (outfile, "\n");
+ gdb_printf (outfile, "\n");
return;
}
if (symbol->domain () == STRUCT_DOMAIN)
{
- if (SYMBOL_TYPE (symbol)->name ())
+ if (symbol->type ()->name ())
{
- LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
- &type_print_raw_options);
+ current_language->print_type (symbol->type (), "", outfile, 1, depth,
+ &type_print_raw_options);
}
else
{
- fprintf_filtered (outfile, "%s %s = ",
- (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_ENUM
- ? "enum"
- : (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_STRUCT
- ? "struct" : "union")),
- symbol->linkage_name ());
- LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
- &type_print_raw_options);
+ gdb_printf (outfile, "%s %s = ",
+ (symbol->type ()->code () == TYPE_CODE_ENUM
+ ? "enum"
+ : (symbol->type ()->code () == TYPE_CODE_STRUCT
+ ? "struct" : "union")),
+ symbol->linkage_name ());
+ current_language->print_type (symbol->type (), "", outfile, 1, depth,
+ &type_print_raw_options);
}
- fprintf_filtered (outfile, ";\n");
+ gdb_printf (outfile, ";\n");
}
else
{
if (symbol->aclass () == LOC_TYPEDEF)
- fprintf_filtered (outfile, "typedef ");
- if (SYMBOL_TYPE (symbol))
+ gdb_printf (outfile, "typedef ");
+ if (symbol->type ())
{
/* Print details of types, except for enums where it's clutter. */
- LA_PRINT_TYPE (SYMBOL_TYPE (symbol), symbol->print_name (),
- outfile,
- SYMBOL_TYPE (symbol)->code () != TYPE_CODE_ENUM,
- depth,
- &type_print_raw_options);
- fprintf_filtered (outfile, "; ");
+ current_language->print_type (symbol->type (), symbol->print_name (),
+ outfile,
+ symbol->type ()->code () != TYPE_CODE_ENUM,
+ depth,
+ &type_print_raw_options);
+ gdb_printf (outfile, "; ");
}
else
- fprintf_filtered (outfile, "%s ", symbol->print_name ());
+ gdb_printf (outfile, "%s ", symbol->print_name ());
switch (symbol->aclass ())
{
case LOC_CONST:
- fprintf_filtered (outfile, "const %s (%s)",
- plongest (SYMBOL_VALUE (symbol)),
- hex_string (SYMBOL_VALUE (symbol)));
+ gdb_printf (outfile, "const %s (%s)",
+ plongest (symbol->value_longest ()),
+ hex_string (symbol->value_longest ()));
break;
case LOC_CONST_BYTES:
{
unsigned i;
- struct type *type = check_typedef (SYMBOL_TYPE (symbol));
+ struct type *type = check_typedef (symbol->type ());
- fprintf_filtered (outfile, "const %s hex bytes:",
- pulongest (TYPE_LENGTH (type)));
- for (i = 0; i < TYPE_LENGTH (type); i++)
- fprintf_filtered (outfile, " %02x",
- (unsigned) SYMBOL_VALUE_BYTES (symbol)[i]);
+ gdb_printf (outfile, "const %s hex bytes:",
+ pulongest (type->length ()));
+ for (i = 0; i < type->length (); i++)
+ gdb_printf (outfile, " %02x",
+ (unsigned) symbol->value_bytes ()[i]);
}
break;
case LOC_STATIC:
- fprintf_filtered (outfile, "static at ");
- fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)),
- outfile);
+ gdb_printf (outfile, "static at ");
+ gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile);
if (section)
- fprintf_filtered (outfile, " section %s",
- bfd_section_name (section->the_bfd_section));
+ gdb_printf (outfile, " section %s",
+ bfd_section_name (section->the_bfd_section));
break;
case LOC_REGISTER:
if (symbol->is_argument ())
- fprintf_filtered (outfile, "parameter register %s",
- plongest (SYMBOL_VALUE (symbol)));
+ gdb_printf (outfile, "parameter register %s",
+ plongest (symbol->value_longest ()));
else
- fprintf_filtered (outfile, "register %s",
- plongest (SYMBOL_VALUE (symbol)));
+ gdb_printf (outfile, "register %s",
+ plongest (symbol->value_longest ()));
break;
case LOC_ARG:
- fprintf_filtered (outfile, "arg at offset %s",
- hex_string (SYMBOL_VALUE (symbol)));
+ gdb_printf (outfile, "arg at offset %s",
+ hex_string (symbol->value_longest ()));
break;
case LOC_REF_ARG:
- fprintf_filtered (outfile, "reference arg at %s",
- hex_string (SYMBOL_VALUE (symbol)));
+ gdb_printf (outfile, "reference arg at %s",
+ hex_string (symbol->value_longest ()));
break;
case LOC_REGPARM_ADDR:
- fprintf_filtered (outfile, "address parameter register %s",
- plongest (SYMBOL_VALUE (symbol)));
+ gdb_printf (outfile, "address parameter register %s",
+ plongest (symbol->value_longest ()));
break;
case LOC_LOCAL:
- fprintf_filtered (outfile, "local at offset %s",
- hex_string (SYMBOL_VALUE (symbol)));
+ gdb_printf (outfile, "local at offset %s",
+ hex_string (symbol->value_longest ()));
break;
case LOC_TYPEDEF:
break;
case LOC_LABEL:
- fprintf_filtered (outfile, "label at ");
- fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)),
- outfile);
+ gdb_printf (outfile, "label at ");
+ gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile);
if (section)
- fprintf_filtered (outfile, " section %s",
- bfd_section_name (section->the_bfd_section));
+ gdb_printf (outfile, " section %s",
+ bfd_section_name (section->the_bfd_section));
break;
case LOC_BLOCK:
- fprintf_filtered
+ gdb_printf
(outfile, "block object %s, %s..%s",
- host_address_to_string (SYMBOL_BLOCK_VALUE (symbol)),
- paddress (gdbarch, BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))),
- paddress (gdbarch, BLOCK_END (SYMBOL_BLOCK_VALUE (symbol))));
+ host_address_to_string (symbol->value_block ()),
+ paddress (gdbarch, symbol->value_block()->start ()),
+ paddress (gdbarch, symbol->value_block()->end ()));
if (section)
- fprintf_filtered (outfile, " section %s",
- bfd_section_name (section->the_bfd_section));
+ gdb_printf (outfile, " section %s",
+ bfd_section_name (section->the_bfd_section));
break;
case LOC_COMPUTED:
- fprintf_filtered (outfile, "computed at runtime");
+ gdb_printf (outfile, "computed at runtime");
break;
case LOC_UNRESOLVED:
- fprintf_filtered (outfile, "unresolved");
+ gdb_printf (outfile, "unresolved");
break;
case LOC_OPTIMIZED_OUT:
- fprintf_filtered (outfile, "optimized out");
+ gdb_printf (outfile, "optimized out");
break;
default:
- fprintf_filtered (outfile, "botched symbol class %x",
- symbol->aclass ());
+ gdb_printf (outfile, "botched symbol class %x",
+ symbol->aclass ());
break;
}
}
- fprintf_filtered (outfile, "\n");
+ gdb_printf (outfile, "\n");
}
static void
{
if (! printed_objfile_start)
{
- printf_filtered ("{ objfile %s ", objfile_name (objfile));
+ gdb_printf ("{ objfile %s ", objfile_name (objfile));
gdb_stdout->wrap_here (2);
- printf_filtered ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
+ gdb_printf ("((struct objfile *) %s)\n",
+ host_address_to_string (objfile));
printed_objfile_start = 1;
}
if (! printed_compunit_symtab_start)
{
- printf_filtered (" { ((struct compunit_symtab *) %s)\n",
- host_address_to_string (cust));
- printf_filtered (" debugformat %s\n",
- cust->debugformat ());
- printf_filtered (" producer %s\n",
- (cust->producer () != nullptr
- ? cust->producer () : "(null)"));
- printf_filtered (" dirname %s\n",
- (cust->dirname () != NULL
- ? cust->dirname () : "(null)"));
- printf_filtered (" blockvector"
- " ((struct blockvector *) %s)\n",
- host_address_to_string
- (cust->blockvector ()));
- printf_filtered (" user"
- " ((struct compunit_symtab *) %s)\n",
- cust->user != nullptr
- ? host_address_to_string (cust->user)
- : "(null)");
+ gdb_printf (" { ((struct compunit_symtab *) %s)\n",
+ host_address_to_string (cust));
+ gdb_printf (" debugformat %s\n",
+ cust->debugformat ());
+ gdb_printf (" producer %s\n",
+ (cust->producer () != nullptr
+ ? cust->producer () : "(null)"));
+ gdb_printf (" name %s\n", cust->name);
+ gdb_printf (" dirname %s\n",
+ (cust->dirname () != NULL
+ ? cust->dirname () : "(null)"));
+ gdb_printf (" blockvector"
+ " ((struct blockvector *) %s)\n",
+ host_address_to_string
+ (cust->blockvector ()));
+ gdb_printf (" user"
+ " ((struct compunit_symtab *) %s)\n",
+ cust->user != nullptr
+ ? host_address_to_string (cust->user)
+ : "(null)");
if (cust->includes != nullptr)
{
- printf_filtered (" ( includes\n");
+ gdb_printf (" ( includes\n");
for (int i = 0; ; ++i)
{
struct compunit_symtab *include
break;
const char *addr
= host_address_to_string (include);
- printf_filtered (" (%s %s)\n",
- "(struct compunit_symtab *)",
- addr);
+ gdb_printf (" (%s %s)\n",
+ "(struct compunit_symtab *)",
+ addr);
}
- printf_filtered (" )\n");
+ gdb_printf (" )\n");
}
printed_compunit_symtab_start = 1;
}
- printf_filtered ("\t{ symtab %s ",
- symtab_to_filename_for_display (symtab));
+ gdb_printf ("\t{ symtab %s ",
+ symtab_to_filename_for_display (symtab));
gdb_stdout->wrap_here (4);
- printf_filtered ("((struct symtab *) %s)\n",
- host_address_to_string (symtab));
- printf_filtered ("\t fullname %s\n",
- symtab->fullname != NULL
- ? symtab->fullname
- : "(null)");
- printf_filtered ("\t "
- "linetable ((struct linetable *) %s)\n",
- host_address_to_string
- (symtab->linetable ()));
- printf_filtered ("\t}\n");
+ gdb_printf ("((struct symtab *) %s)\n",
+ host_address_to_string (symtab));
+ gdb_printf ("\t fullname %s\n",
+ symtab->fullname != NULL
+ ? symtab->fullname
+ : "(null)");
+ gdb_printf ("\t "
+ "linetable ((struct linetable *) %s)\n",
+ host_address_to_string
+ (symtab->linetable ()));
+ gdb_printf ("\t}\n");
}
}
if (printed_compunit_symtab_start)
- printf_filtered (" }\n");
+ gdb_printf (" }\n");
}
if (printed_objfile_start)
- printf_filtered ("}\n");
+ gdb_printf ("}\n");
}
}
{
if (! printed_objfile_start)
{
- printf_filtered ("{ objfile %s ", objfile_name (objfile));
+ gdb_printf ("{ objfile %s ", objfile_name (objfile));
gdb_stdout->wrap_here (2);
- printf_filtered ("((struct objfile *) %s)\n",
- host_address_to_string (objfile));
+ gdb_printf ("((struct objfile *) %s)\n",
+ host_address_to_string (objfile));
printed_objfile_start = 1;
}
- printf_filtered (" { symtab %s\n",
- symtab_to_filename_for_display (symtab));
+ gdb_printf (" { symtab %s\n",
+ symtab_to_filename_for_display (symtab));
if (cust->blockvector () == NULL)
- printf_filtered (" NULL blockvector\n");
- printf_filtered (" }\n");
+ gdb_printf (" NULL blockvector\n");
+ gdb_printf (" }\n");
}
}
if (printed_objfile_start)
- printf_filtered ("}\n");
+ gdb_printf ("}\n");
}
}
{
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 ();
- printf_filtered (_("objfile: %ps ((struct objfile *) %s)\n"),
- styled_string (file_name_style.style (),
- objfile_name (objfile)),
- host_address_to_string (objfile));
- printf_filtered (_("compunit_symtab: %s ((struct compunit_symtab *) %s)\n"),
- symtab->compunit ()->name,
- host_address_to_string (symtab->compunit ()));
- printf_filtered (_("symtab: %ps ((struct symtab *) %s)\n"),
- styled_string (file_name_style.style (),
- symtab_to_fullname (symtab)),
- host_address_to_string (symtab));
+ gdb_printf (_("objfile: %ps ((struct objfile *) %s)\n"),
+ styled_string (file_name_style.style (),
+ objfile_name (objfile)),
+ host_address_to_string (objfile));
+ gdb_printf (_("compunit_symtab: %s ((struct compunit_symtab *) %s)\n"),
+ symtab->compunit ()->name,
+ host_address_to_string (symtab->compunit ()));
+ gdb_printf (_("symtab: %ps ((struct symtab *) %s)\n"),
+ styled_string (file_name_style.style (),
+ symtab_to_fullname (symtab)),
+ host_address_to_string (symtab));
linetable = symtab->linetable ();
- printf_filtered (_("linetable: ((struct linetable *) %s):\n"),
- host_address_to_string (linetable));
+ gdb_printf (_("linetable: ((struct linetable *) %s):\n"),
+ host_address_to_string (linetable));
if (linetable == NULL)
- printf_filtered (_("No line table.\n"));
+ gdb_printf (_("No line table.\n"));
else if (linetable->nitems <= 0)
- printf_filtered (_("Line table has no lines.\n"));
+ gdb_printf (_("Line table has no lines.\n"));
else
{
/* 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, 4, -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 (1, ui_left, "is-stmt", _("IS-STMT"));
+ 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");
}
}
|| re_exec (symtab_to_filename_for_display (symtab)))
{
maintenance_print_one_line_table (symtab, NULL);
- printf_filtered ("\n");
+ gdb_printf ("\n");
}
}
}