X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fsymmisc.c;h=69d035dc84387b75044abd69a91ddadc78421949;hb=db178f47dd4c9d2882da42a8915018d1fb90ea17;hp=3089c99e2321c6db46f5add3bab80f80163fe6fe;hpb=9bb9b2f9d6d5aa90f579494d8407375a87a9ad0b;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 3089c99e23..69d035dc84 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -36,7 +36,7 @@ #include "typeprint.h" #include "gdbcmd.h" #include "source.h" -#include "readline/readline.h" +#include "readline/tilde.h" #include "psymtab.h" @@ -52,7 +52,7 @@ FILE *std_err; /* Prototypes for local functions */ -static int block_depth (struct block *); +static int block_depth (const struct block *); static void print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, int depth, ui_file *outfile); @@ -236,23 +236,26 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) break; } fprintf_filtered (outfile, "[%2d] %c ", index, ms_type); - fputs_filtered (paddress (gdbarch, MSYMBOL_VALUE_ADDRESS (objfile, - msymbol)), - outfile); - fprintf_filtered (outfile, " %s", MSYMBOL_LINKAGE_NAME (msymbol)); + + /* Use the relocated address as shown in the symbol here -- do + not try to respect copy relocations. */ + CORE_ADDR addr = (msymbol->value.address + + ANOFFSET (objfile->section_offsets, + msymbol->section)); + fputs_filtered (paddress (gdbarch, addr), outfile); + fprintf_filtered (outfile, " %s", msymbol->linkage_name ()); if (section) { if (section->the_bfd_section != NULL) fprintf_filtered (outfile, " section %s", - bfd_section_name (objfile->obfd, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); else fprintf_filtered (outfile, " spurious section %ld", (long) (section - objfile->sections)); } - if (MSYMBOL_DEMANGLED_NAME (msymbol) != NULL) + if (msymbol->demangled_name () != NULL) { - fprintf_filtered (outfile, " %s", MSYMBOL_DEMANGLED_NAME (msymbol)); + fprintf_filtered (outfile, " %s", msymbol->demangled_name ()); } if (msymbol->filename) fprintf_filtered (outfile, " %s", msymbol->filename); @@ -278,7 +281,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) struct linetable *l; const struct blockvector *bv; struct symbol *sym; - struct block *b; + const struct block *b; int depth; fprintf_filtered (outfile, "\nSymtab for file %s\n", @@ -336,11 +339,11 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) if (BLOCK_FUNCTION (b)) { fprintf_filtered (outfile, ", function %s", - SYMBOL_LINKAGE_NAME (BLOCK_FUNCTION (b))); - if (SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)) != NULL) + BLOCK_FUNCTION (b)->linkage_name ()); + if (BLOCK_FUNCTION (b)->demangled_name () != NULL) { fprintf_filtered (outfile, ", %s", - SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b))); + BLOCK_FUNCTION (b)->demangled_name ()); } } fprintf_filtered (outfile, "\n"); @@ -349,16 +352,15 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) block, not any blocks from included symtabs. */ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym) { - TRY + try { print_symbol (gdbarch, sym, depth + 1, outfile); } - CATCH (ex, RETURN_MASK_ERROR) + catch (const gdb_exception_error &ex) { exception_fprintf (gdb_stderr, ex, "Error printing symbol:\n"); } - END_CATCH } } fprintf_filtered (outfile, "\n"); @@ -521,13 +523,12 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, print_spaces (depth, outfile); if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN) { - fprintf_filtered (outfile, "label %s at ", SYMBOL_PRINT_NAME (symbol)); + fprintf_filtered (outfile, "label %s at ", symbol->print_name ()); fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), outfile); if (section) fprintf_filtered (outfile, " section %s\n", - bfd_section_name (section->the_bfd_section->owner, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); else fprintf_filtered (outfile, "\n"); return; @@ -547,7 +548,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, ? "enum" : (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT ? "struct" : "union")), - SYMBOL_LINKAGE_NAME (symbol)); + symbol->linkage_name ()); LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth, &type_print_raw_options); } @@ -560,7 +561,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, if (SYMBOL_TYPE (symbol)) { /* Print details of types, except for enums where it's clutter. */ - LA_PRINT_TYPE (SYMBOL_TYPE (symbol), SYMBOL_PRINT_NAME (symbol), + LA_PRINT_TYPE (SYMBOL_TYPE (symbol), symbol->print_name (), outfile, TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM, depth, @@ -568,7 +569,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, fprintf_filtered (outfile, "; "); } else - fprintf_filtered (outfile, "%s ", SYMBOL_PRINT_NAME (symbol)); + fprintf_filtered (outfile, "%s ", symbol->print_name ()); switch (SYMBOL_CLASS (symbol)) { @@ -583,8 +584,8 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, unsigned i; struct type *type = check_typedef (SYMBOL_TYPE (symbol)); - fprintf_filtered (outfile, "const %u hex bytes:", - TYPE_LENGTH (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]); @@ -597,8 +598,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, outfile); if (section) fprintf_filtered (outfile, " section %s", - bfd_section_name (section->the_bfd_section->owner, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); break; case LOC_REGISTER: @@ -639,8 +639,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, outfile); if (section) fprintf_filtered (outfile, " section %s", - bfd_section_name (section->the_bfd_section->owner, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); break; case LOC_BLOCK: @@ -656,8 +655,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, outfile); if (section) fprintf_filtered (outfile, " section %s", - bfd_section_name (section->the_bfd_section->owner, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); break; case LOC_COMPUTED: @@ -950,7 +948,7 @@ maintenance_expand_symtabs (const char *args, int from_tty) /* Return the nexting depth of a block within other blocks in its symtab. */ static int -block_depth (struct block *block) +block_depth (const struct block *block) { int i = 0;