aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-05-28 11:02:22 +0000
committerNick Clifton <nickc@redhat.com>2009-05-28 11:02:22 +0000
commit5dff79d83d209d48f13ad385ae8dc3e690bf9295 (patch)
tree7cb1947c2411a8df8a959de8dd74f160e82842b9 /binutils/readelf.c
parent5ebe285860e3d407b0607c06978b6737bff5c1fb (diff)
downloadgdb-5dff79d83d209d48f13ad385ae8dc3e690bf9295.zip
gdb-5dff79d83d209d48f13ad385ae8dc3e690bf9295.tar.gz
gdb-5dff79d83d209d48f13ad385ae8dc3e690bf9295.tar.bz2
* readelf.c (display_debug_section): Do not display debug sections
with the NOBITS section type.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 30bcf66..4727a84 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -8539,6 +8539,15 @@ display_debug_section (Elf_Internal_Shdr * section, FILE * file)
printf (_("\nSection '%s' has no debugging data.\n"), name);
return 0;
}
+ if (section->sh_type == SHT_NOBITS)
+ {
+ /* There is no point in dumping the contents of a debugging section
+ which has the NOBITS type - the bits in the file will be random.
+ This can happen when a file containing a .eh_frame section is
+ stripped with the --only-keep-debug command line option. */
+ printf (_("section '%s' has the NOBITS type - its contents are unreliable.\n"), name);
+ return 0;
+ }
if (const_strneq (name, ".gnu.linkonce.wi."))
name = ".debug_info";