Improve DWARF 5 compatibility. (#400)
[pyelftools.git] / elftools / dwarf / structs.py
index 16f29f6341b08a3598b1fe079a839a9c838e893c..79e0d8f230ac10648b6d2161eae3bd0bb31cce8e 100644 (file)
@@ -182,7 +182,9 @@ class DWARFStructs(object):
                     obj.name == 'DW_AT_null' and obj.form == 'DW_FORM_null',
                 Struct('attr_spec',
                     Enum(self.Dwarf_uleb128('name'), **ENUM_DW_AT),
-                    Enum(self.Dwarf_uleb128('form'), **ENUM_DW_FORM))))
+                    Enum(self.Dwarf_uleb128('form'), **ENUM_DW_FORM),
+                    If(lambda ctx: ctx['form'] == 'DW_FORM_implicit_const',
+                        self.Dwarf_sleb128('value')))))
 
     def _create_dw_form(self):
         self.Dwarf_dw_form = dict(
@@ -208,6 +210,7 @@ class DWARFStructs(object):
 
             DW_FORM_string=CString(''),
             DW_FORM_strp=self.Dwarf_offset(''),
+            DW_FORM_line_strp=self.Dwarf_offset(''),
             DW_FORM_strx1=self.Dwarf_uint8(''),
             DW_FORM_strx2=self.Dwarf_uint16(''),
             # DW_FORM_strx3=self.Dwarf_uint24(''),  # TODO