ELFFile: allow filtering of sections by type in iter_sections (#345)
authorAndreas Ziegler <andreas.ziegler@fau.de>
Tue, 12 Jan 2021 00:27:24 +0000 (01:27 +0100)
committerGitHub <noreply@github.com>
Tue, 12 Jan 2021 00:27:24 +0000 (16:27 -0800)
commitd71faebcd58ef26ce973044f2a822a494c42a3c1
tree5dde6e0a36faa51ae861c5c5c51bccaf4bf59494
parentad5375fd8b24efc111a7b3dc9898b77a4c3407aa
ELFFile: allow filtering of sections by type in iter_sections (#345)

As stated in the corresponding issue, we can already filter
the output of Dynamic.iter_tags() by the type of the tag
we're looking for.

Let's adapt the iteration over the sections of the ELF file
so that it only yields sections of a certain type if the
optional type parameter is passed to iter_sections().

By doing this we can also simplify two call sites inside
the ELFFile class.

Fixes: #344
elftools/elf/elffile.py
test/test_elffile.py