Add --decompress option to readelf to decompress sections before they are dumped.

bin	* readelf.c (options): Add "decompress".
	(usage): Mention -z/--decompress.
	(parse_args): Handle -z.
	(uncompress_section_contents): Move to earlier in the file.
	(dump_section_as_strings): If requested, decompress the section
	before dumping.
	(dump_section_as_bytes): Likewise.
	* doc/binutils.texi: Document the new option.

tests	* binutils-all/z.s: New test.  Checks the --decompress option to
	readelf.
	* binutils-all/readelf.exp: Run the test.
	* binutils-all/readelf.z: Expected output from readelf.
This commit is contained in:
Nick Clifton
2015-05-15 17:16:31 +01:00
parent 4e63d0ac89
commit 0e602686df
7 changed files with 406 additions and 190 deletions

View File

@@ -4344,6 +4344,7 @@ readelf [@option{-a}|@option{--all}]
[@option{-x} <number or name>|@option{--hex-dump=}<number or name>]
[@option{-p} <number or name>|@option{--string-dump=}<number or name>]
[@option{-R} <number or name>|@option{--relocated-dump=}<number or name>]
[@option{-z}|@option{--decompress}]
[@option{-c}|@option{--archive-index}]
[@option{-w[lLiaprmfFsoRt]}|
@option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]]
@@ -4492,6 +4493,12 @@ Displays the contents of the indicated section as printable strings.
A number identifies a particular section by index in the section table;
any other string identifies all sections with that name in the object file.
@item -z
@itemx --decompress
Requests that the section(s) being dumped by @option{x}, @option{R} or
@option{p} options are decompressed before being displayed. If the
section(s) are not compressed then they are displayed as is.
@item -c
@itemx --archive-index
@cindex Archive file symbol index information