diff options
| author | losynix <louis@losynix.net> | 2018-05-09 15:24:12 +0200 |
|---|---|---|
| committer | losynix <louis@losynix.net> | 2018-05-09 16:34:36 +0200 |
| commit | 9a0eda072a973f50509bc62aa2613fa81a067e42 (patch) | |
| tree | 4b69d2b81b98bb0e98f61d211e62223a4d5edef0 /miasm2/core/asmblock.py | |
| parent | 8f5a42ae2b659f10bdf52adbd8e382e0784f74a1 (diff) | |
| download | miasm-9a0eda072a973f50509bc62aa2613fa81a067e42.tar.gz miasm-9a0eda072a973f50509bc62aa2613fa81a067e42.zip | |
add getby_offset in AsmCFG
Diffstat (limited to 'miasm2/core/asmblock.py')
| -rw-r--r-- | miasm2/core/asmblock.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/miasm2/core/asmblock.py b/miasm2/core/asmblock.py index 07b8ceeb..8740aeb7 100644 --- a/miasm2/core/asmblock.py +++ b/miasm2/core/asmblock.py @@ -736,6 +736,14 @@ class AsmCFG(DiGraph): yield predecessor done.add(predecessor) + def getby_offset(self, offset): + """Return block containing @offset""" + for block in self: + if block.lines[0].offset <= offset < \ + (block.lines[-1].offset + block.lines[-1].l): + return block + return None + def sanity_check(self): """Do sanity checks on blocks' constraints: * no pendings |