added test file (clang-compiled). fixed readelf handling of unknown attributes
authorEli Bendersky <eliben@gmail.com>
Fri, 16 Dec 2011 06:13:48 +0000 (08:13 +0200)
committerEli Bendersky <eliben@gmail.com>
Fri, 16 Dec 2011 06:13:48 +0000 (08:13 +0200)
scripts/readelf.py
tests/testfiles/penalty_64.o.elf [deleted file]
tests/testfiles/penalty_64_clang.o.elf [new file with mode: 0644]
tests/testfiles/penalty_64_gcc.o.elf [new file with mode: 0644]

index a7296f52feee3bff039b83ed2a06da7b0ef9fdb8..051a21a71dc16aca2c6e9b4d3ce03fa5ab3f204a 100755 (executable)
@@ -543,9 +543,13 @@ class ReadElf(object):
                     die.tag))
                 
                 for attr in die.attributes.itervalues():
+                    name = attr.name
+                    # Unknown attribute values are passed-through as integers
+                    if isinstance(name, int):
+                        name = 'Unknown AT value: %x' % name
                     self._emitline('    <%2x>   %-18s: %s' % (
                         attr.offset,
-                        attr.name,
+                        name,
                         describe_attr_value(
                             attr, die, section_offset)))
                 
diff --git a/tests/testfiles/penalty_64.o.elf b/tests/testfiles/penalty_64.o.elf
deleted file mode 100644 (file)
index aca100b..0000000
Binary files a/tests/testfiles/penalty_64.o.elf and /dev/null differ
diff --git a/tests/testfiles/penalty_64_clang.o.elf b/tests/testfiles/penalty_64_clang.o.elf
new file mode 100644 (file)
index 0000000..91d207d
Binary files /dev/null and b/tests/testfiles/penalty_64_clang.o.elf differ
diff --git a/tests/testfiles/penalty_64_gcc.o.elf b/tests/testfiles/penalty_64_gcc.o.elf
new file mode 100644 (file)
index 0000000..aca100b
Binary files /dev/null and b/tests/testfiles/penalty_64_gcc.o.elf differ