From a58e602aeba03423efd1df26003f3172de6bd7ce Mon Sep 17 00:00:00 2001 From: Seva Alekseyev Date: Tue, 7 Jun 2022 19:17:31 -0400 Subject: [PATCH] Support for sibling in form DW_FORM_ref_addr (#408) Co-authored-by: Seva Alekseyev --- elftools/dwarf/compileunit.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/elftools/dwarf/compileunit.py b/elftools/dwarf/compileunit.py index eb66c57..e40dab4 100644 --- a/elftools/dwarf/compileunit.py +++ b/elftools/dwarf/compileunit.py @@ -155,7 +155,12 @@ class CompileUnit(object): cur_offset += child.size elif "DW_AT_sibling" in child.attributes: sibling = child.attributes["DW_AT_sibling"] - cur_offset = sibling.value + self.cu_offset + if sibling.form in ('DW_FORM_ref1', 'DW_FORM_ref2', 'DW_FORM_ref4', 'DW_FORM_ref8', 'DW_FORM_ref'): + cur_offset = sibling.value + self.cu_offset + elif sibling.form == 'DW_FORM_ref_addr': + cur_offset = sibling.value + else: + raise NotImplementedError('Sibling in form %s' % sibling.form) else: # If no DW_AT_sibling attribute is provided by the producer # then the whole child subtree must be parsed to find its next -- 2.30.2