aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1998-09-06 23:17:06 +0000
committerNick Clifton <nickc@redhat.com>1998-09-06 23:17:06 +0000
commitc80944f2a5613b1071a6485f9a9466d26c6a8777 (patch)
treef4b7c6a45eae75fd6196405110464c6a487ee2ea /binutils/readelf.c
parentc84d3d69705a2cdd80010fa3a9674f6feb56de4b (diff)
downloadgdb-c80944f2a5613b1071a6485f9a9466d26c6a8777.zip
gdb-c80944f2a5613b1071a6485f9a9466d26c6a8777.tar.gz
gdb-c80944f2a5613b1071a6485f9a9466d26c6a8777.tar.bz2
do not try to dump empty sections
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 698cdb4..1a80e5c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -1023,6 +1023,7 @@ struct option options [] =
{"sections", no_argument, 0, 'S'},
{"section-headers", no_argument, 0, 'S'},
{"symbols", no_argument, 0, 's'},
+ {"syms", no_argument, 0, 's'},
{"relocs", no_argument, 0, 'r'},
{"dynamic", no_argument, 0, 'd'},
{"version-info", no_argument, 0, 'V'},
@@ -1051,7 +1052,7 @@ usage ()
fprintf (stdout, _(" -S or --section-headers or --sections\n"));
fprintf (stdout, _(" Display the sections' header\n"));
fprintf (stdout, _(" -e or --headers Equivalent to: -h -l -S\n"));
- fprintf (stdout, _(" -s or --symbols Display the symbol table\n"));
+ fprintf (stdout, _(" -s or --syms or --symbols Display the symbol table\n"));
fprintf (stdout, _(" -r or --relocs Display the relocations (if present)\n"));
fprintf (stdout, _(" -d or --dynamic Display the dynamic segment (if present)\n"));
fprintf (stdout, _(" -V or --version-info Display the version sections (if present)\n"));
@@ -3200,9 +3201,16 @@ process_section_contents (file)
unsigned char * data;
char * start;
- printf (_("\nHex dump of section '%s':\n"), SECTION_NAME (section));
-
bytes = section->sh_size;
+
+ if (bytes == 0)
+ {
+ printf (_("\nSection %d has no data to dump.\n"), i);
+ continue;
+ }
+ else
+ printf (_("\nHex dump of section '%s':\n"), SECTION_NAME (section));
+
addr = section->sh_addr;
GET_DATA_ALLOC (section->sh_offset, bytes, start, char *,