From: Seth LaForge Date: Thu, 3 Dec 2015 04:33:45 +0000 (-0800) Subject: Minor changes to readelf formatting. X-Git-Tag: v0.24~13^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c0d78d9062c1f60ad10a622796d54e03aea26f9c;p=pyelftools.git Minor changes to readelf formatting. This makes the output more similar to GNU readelf. It's not identical - in particular there are still a lot of whitespace differences - but at least gets you within striking distance of no changes when comparing with "diff -w". --- diff --git a/scripts/readelf.py b/scripts/readelf.py index f307e95..43cb37b 100755 --- a/scripts/readelf.py +++ b/scripts/readelf.py @@ -873,7 +873,7 @@ class ReadElf(object): # Unknown attribute values are passed-through as integers if isinstance(name, int): name = 'Unknown AT value: %x' % name - self._emitline(' <%2x> %-18s: %s' % ( + self._emitline(' <%x> %-18s: %s' % ( attr.offset, name, describe_attr_value( @@ -1057,7 +1057,7 @@ class ReadElf(object): def _emitline(self, s=''): """ Emit an object to output, followed by a newline """ - self.output.write(str(s) + '\n') + self.output.write(str(s).rstrip() + '\n') SCRIPT_DESCRIPTION = 'Display information about the contents of ELF format files'