Revert "for sibling of form ref_addr, only sibling value should be used (#268)"
authorEli Bendersky <eliben@gmail.com>
Wed, 8 Jul 2020 00:15:02 +0000 (17:15 -0700)
committerEli Bendersky <eliben@gmail.com>
Wed, 8 Jul 2020 00:15:02 +0000 (17:15 -0700)
This reverts commit 575425338fbab134919cb1206509589a174fb81f.

This breaks the tests:

Test file 'test/testfiles_for_readelf/sibling_ref_addr.elf'

.......................FAIL

....for option "-e"

....Output #1 is readelf, Output #2 is pyelftools

@@ Mismatch on line #13:

>>  flags:                             0x80000000, emb<<

>>  flags:                             0x80000000<<

 ([('equal', 0, 47, 0, 47), ('delete', 47, 52, 47, 47)])

@@ Output #1 dumped to file: /tmp/out1_vn_mmkbu.stdout

@@ Output #2 dumped to file: /tmp/out2_l8_zbr6h.stdout

.......................FAIL

....for option "-n"

....Output #1 is readelf, Output #2 is pyelftools

@@ Mismatch on line #2:

>>  apuinfo              0x00000008 nt_arch (architecture)<<

>>  apuinfo              0x00000008 nt_gnu_hwcap (dso-supplied software hwcap info)<<

 ([('equal', 0, 37, 0, 37), ('insert', 37, 37, 37, 66), ('equal', 37, 39, 66, 68), ('insert', 39, 39, 68, 72), ('equal', 39, 40, 72, 73), ('replace', 40, 41, 73, 75), ('equal', 41, 42, 75, 76), ('delete', 42, 47, 76, 76), ('equal', 47, 48, 76, 77), ('replace', 48, 55, 77, 80), ('equal', 55, 56, 80, 81)])

@@ Output #1 dumped to file: /tmp/out1_kla3jq33.stdout

@@ Output #2 dumped to file: /tmp/out2_qzmuu23z.stdout

@@ aborting - 'test/external_tools/readelf -x.text' returned '1'

Conclusion: FAIL

elftools/dwarf/compileunit.py
test/testfiles_for_readelf/sibling_ref_addr.elf [deleted file]

index 7357655151d667418798a44fbe59760f4d48a0b7..eb66c5710f2273abb43217106a4bbf6c8cef0864 100644 (file)
@@ -155,9 +155,7 @@ class CompileUnit(object):
                 cur_offset += child.size
             elif "DW_AT_sibling" in child.attributes:
                 sibling = child.attributes["DW_AT_sibling"]
-                cur_offset = sibling.value
-                if sibling.form != 'DW_FORM_ref_addr':
-                    cur_offset += self.cu_offset
+                cur_offset = sibling.value + self.cu_offset
             else:
                 # If no DW_AT_sibling attribute is provided by the producer
                 # then the whole child subtree must be parsed to find its next
diff --git a/test/testfiles_for_readelf/sibling_ref_addr.elf b/test/testfiles_for_readelf/sibling_ref_addr.elf
deleted file mode 100755 (executable)
index dc0e107..0000000
Binary files a/test/testfiles_for_readelf/sibling_ref_addr.elf and /dev/null differ