This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[10/10] RFC: some "maint" fixes
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 18 Feb 2013 13:39:52 -0700
- Subject: [10/10] RFC: some "maint" fixes
This just adds section info to the output of a couple of "maint"
commands. I found it handy while debugging. It also helps avoids
occasional crash (maybe only if there is some other gdb symbol reader
bug, I forget -- but that is exactly when it is handy :) in "maint print
msymbols".
Tom
* maint.c (print_bfd_section_info): Print the section index.
* symmisc.c (dump_msymbols): Print the section index.
---
gdb/maint.c | 1 +
gdb/symmisc.c | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/gdb/maint.c b/gdb/maint.c
index bf8521d..43a698e 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -321,6 +321,7 @@ print_bfd_section_info (bfd *abfd,
addr = bfd_section_vma (abfd, asect);
endaddr = addr + bfd_section_size (abfd, asect);
+ printf_filtered (" [%d] ", gdb_bfd_section_index (abfd, asect));
maint_print_section_info (name, flags, addr, endaddr,
asect->filepos, addr_size);
}
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 4156fc6..c4bf97e 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -261,9 +261,15 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
outfile);
fprintf_filtered (outfile, " %s", SYMBOL_LINKAGE_NAME (msymbol));
if (section)
- fprintf_filtered (outfile, " section %s",
- bfd_section_name (objfile->obfd,
- section->the_bfd_section));
+ {
+ if (section->the_bfd_section != NULL)
+ fprintf_filtered (outfile, " section %s",
+ bfd_section_name (objfile->obfd,
+ section->the_bfd_section));
+ else
+ fprintf_filtered (outfile, " spurious section %ld",
+ section - objfile->sections);
+ }
if (SYMBOL_DEMANGLED_NAME (msymbol) != NULL)
{
fprintf_filtered (outfile, " %s", SYMBOL_DEMANGLED_NAME (msymbol));
--
1.7.7.6