From: Eli Bendersky Date: Wed, 7 Dec 2011 07:44:06 +0000 (+0200) Subject: using RepeatUntilExcluding for the Dwarf_abbrev_declaration struct - so now no accoun... X-Git-Tag: v0.10~52 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=851211d0b5868363bcd8575798745d3b66dd0d22;p=pyelftools.git using RepeatUntilExcluding for the Dwarf_abbrev_declaration struct - so now no accounting for the empty element is needed when iterating over it --- diff --git a/elftools/dwarf/abbrevtable.py b/elftools/dwarf/abbrevtable.py index ad25aeb..44ccdd5 100644 --- a/elftools/dwarf/abbrevtable.py +++ b/elftools/dwarf/abbrevtable.py @@ -73,9 +73,6 @@ class AbbrevDecl(object): (name, form) pairs. """ for attr_spec in self['attr_spec']: - # Ignore the terminating 'null' spec - if attr_spec.name == 'DW_AT_null': - break yield attr_spec.name, attr_spec.form def __getitem__(self, entry): diff --git a/elftools/dwarf/structs.py b/elftools/dwarf/structs.py index ebf34c6..2c00325 100644 --- a/elftools/dwarf/structs.py +++ b/elftools/dwarf/structs.py @@ -150,7 +150,7 @@ class DWARFStructs(object): self.Dwarf_abbrev_declaration = Struct('Dwarf_abbrev_entry', Enum(self.Dwarf_uleb128('tag'), **ENUM_DW_TAG), Enum(self.Dwarf_uint8('children_flag'), **ENUM_DW_CHILDREN), - RepeatUntil( + RepeatUntilExcluding( lambda obj, ctx: obj.name == 'DW_AT_null' and obj.form == 'DW_FORM_null', Struct('attr_spec',