Commit: Add --decompress option to readelf

Nick Clifton nickc@redhat.com
Fri May 15 16:16:00 GMT 2015


Hi Guys,

  Whilst working on PR 18734 I ran across a problem with readelf's
  section dumping ability: it does not decompress sections before
  dumping them.  This makes a binary inspection of the contents of a
  compressed debug section very difficult.  So I have am applying a
  patch (attached) to add a new command line option to readelf:
  -z/--decompress.  This makes the -x, -p and -R dumping options
  decompress the section before it is displayed.  The patch also
  includes a testcase to make sure that the option works.

  Tested with no regressions on lots of different targets.

Cheers
  Nick

binutils/ChangeLog
2015-05-15  Nick Clifton  <nickc@redhat.com>

	* 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.

binutils/testsuite/ChangeLog
2015-05-15  Nick Clifton  <nickc@redhat.com>

	* 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: readelf-z.patch
Type: text/x-patch
Size: 16100 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150515/ab9d1b32/attachment.bin>


More information about the Binutils mailing list