From: Eli Bendersky Date: Wed, 8 Jul 2020 00:15:02 +0000 (-0700) Subject: Revert "for sibling of form ref_addr, only sibling value should be used (#268)" X-Git-Tag: v0.27~20 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b87fbea723144100d052a24b3d17a291a49d59e0;p=pyelftools.git Revert "for sibling of form ref_addr, only sibling value should be used (#268)" 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 --- diff --git a/elftools/dwarf/compileunit.py b/elftools/dwarf/compileunit.py index 7357655..eb66c57 100644 --- a/elftools/dwarf/compileunit.py +++ b/elftools/dwarf/compileunit.py @@ -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 index dc0e107..0000000 Binary files a/test/testfiles_for_readelf/sibling_ref_addr.elf and /dev/null differ