From 851211d0b5868363bcd8575798745d3b66dd0d22 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Wed, 7 Dec 2011 09:44:06 +0200 Subject: [PATCH] using RepeatUntilExcluding for the Dwarf_abbrev_declaration struct - so now no accounting for the empty element is needed when iterating over it --- elftools/dwarf/abbrevtable.py | 3 --- elftools/dwarf/structs.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) 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', -- 2.30.2