summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Snyder <ryan@vector35.com>2019-03-11 21:01:47 -0400
committerRyan Snyder <ryan@vector35.com>2019-03-12 12:44:29 -0400
commit902750648579d32cc83fbd91181ecea2c9e0c9e5 (patch)
treef8ef77532522fd8a47d64d249bff0322522bd757
parent1188d02f0f5aed4a681eeb68c0e33803d5c06155 (diff)
api: update to support getting source blocks from IL blocks
-rw-r--r--binaryninjacore.h2
-rw-r--r--python/basicblock.py8
-rw-r--r--python/lowlevelil.py3
3 files changed, 13 insertions, 0 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 7c8ea970..fcc2937b 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -2584,6 +2584,7 @@ extern "C"
BINARYNINJACOREAPI BNFunction* BNGetBasicBlockFunction(BNBasicBlock* block);
BINARYNINJACOREAPI BNArchitecture* BNGetBasicBlockArchitecture(BNBasicBlock* block);
+ BINARYNINJACOREAPI BNBasicBlock* BNGetBasicBlockSource(BNBasicBlock* block);
BINARYNINJACOREAPI uint64_t BNGetBasicBlockStart(BNBasicBlock* block);
BINARYNINJACOREAPI uint64_t BNGetBasicBlockEnd(BNBasicBlock* block);
BINARYNINJACOREAPI uint64_t BNGetBasicBlockLength(BNBasicBlock* block);
@@ -2955,6 +2956,7 @@ extern "C"
BINARYNINJACOREAPI uint64_t BNLowLevelILGetCurrentAddress(BNLowLevelILFunction* func);
BINARYNINJACOREAPI void BNLowLevelILSetCurrentAddress(BNLowLevelILFunction* func,
BNArchitecture* arch, uint64_t addr);
+ BINARYNINJACOREAPI void BNLowLevelILSetCurrentSourceBlock(BNLowLevelILFunction* func, BNBasicBlock* source);
BINARYNINJACOREAPI size_t BNLowLevelILGetInstructionStart(BNLowLevelILFunction* func,
BNArchitecture* arch, uint64_t addr);
BINARYNINJACOREAPI void BNLowLevelILClearIndirectBranches(BNLowLevelILFunction* func);
diff --git a/python/basicblock.py b/python/basicblock.py
index 849d529f..661eefd5 100644
--- a/python/basicblock.py
+++ b/python/basicblock.py
@@ -176,6 +176,14 @@ class BasicBlock(object):
return self._arch
@property
+ def source_block(self):
+ """Basic block source block (read-only)"""
+ block = core.BNGetBasicBlockSource(self.handle)
+ if block is None:
+ return None
+ return BasicBlock(block, self._view)
+
+ @property
def start(self):
"""Basic block start (read-only)"""
return core.BNGetBasicBlockStart(self.handle)
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index a88182a7..430e5934 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -780,6 +780,9 @@ class LowLevelILFunction(object):
arch = self.arch
core.BNLowLevelILSetCurrentAddress(self.handle, arch.handle, value)
+ def set_current_source_block(self, block):
+ core.BNLowLevelILSetCurrentSourceBlock(self.handle, block.handle)
+
@property
def temp_reg_count(self):
"""Number of temporary registers (read-only)"""