summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-07-24 20:10:18 -0400
committerRusty Wagner <rusty@vector35.com>2017-07-24 20:10:18 -0400
commit111add984b0a517966f133ae69c51d2084dee985 (patch)
tree72af9e99dc062a395a7ffa5435af17481325d8c9
parent23091d4734fede77b4da90bc14d5ba2e49b33fc2 (diff)
Adding size of stack var refs, source operand in MLIL
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h2
-rw-r--r--function.cpp1
-rw-r--r--python/function.py5
-rw-r--r--python/mediumlevelil.py1
5 files changed, 8 insertions, 2 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 4f46cd44..83d12d21 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -2062,6 +2062,7 @@ namespace BinaryNinja
std::string name;
Variable var;
int64_t referencedOffset;
+ size_t size;
};
struct IndirectBranchInfo
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 9bca447d..01c78ff4 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -826,6 +826,7 @@ extern "C"
struct BNMediumLevelILInstruction
{
BNMediumLevelILOperation operation;
+ uint32_t sourceOperand;
size_t size;
uint64_t operands[5];
uint64_t address;
@@ -1253,6 +1254,7 @@ extern "C"
char* name;
uint64_t varIdentifier;
int64_t referencedOffset;
+ size_t size;
};
struct BNIndirectBranchInfo
diff --git a/function.cpp b/function.cpp
index 0e1fa5cf..66b2aade 100644
--- a/function.cpp
+++ b/function.cpp
@@ -358,6 +358,7 @@ vector<StackVariableReference> Function::GetStackVariablesReferencedByInstructio
ref.name = refs[i].name;
ref.var = Variable::FromIdentifier(refs[i].varIdentifier);
ref.referencedOffset = refs[i].referencedOffset;
+ ref.size = refs[i].size;
result.push_back(ref);
}
diff --git a/python/function.py b/python/function.py
index aa0d05eb..c3310b6c 100644
--- a/python/function.py
+++ b/python/function.py
@@ -148,12 +148,13 @@ class PossibleValueSet(object):
class StackVariableReference(object):
- def __init__(self, src_operand, t, name, var, ref_ofs):
+ def __init__(self, src_operand, t, name, var, ref_ofs, size):
self.source_operand = src_operand
self.type = t
self.name = name
self.var = var
self.referenced_offset = ref_ofs
+ self.size = size
if self.source_operand == 0xffffffff:
self.source_operand = None
@@ -621,7 +622,7 @@ class Function(object):
var_type = types.Type(core.BNNewTypeReference(refs[i].type), confidence = refs[i].typeConfidence)
result.append(StackVariableReference(refs[i].sourceOperand, var_type,
refs[i].name, Variable.from_identifier(self, refs[i].varIdentifier, refs[i].name, var_type),
- refs[i].referencedOffset))
+ refs[i].referencedOffset, refs[i].size))
core.BNFreeStackVariableReferenceList(refs, count.value)
return result
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index ba83f7aa..3377ab6a 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -174,6 +174,7 @@ class MediumLevelILInstruction(object):
self.operation = MediumLevelILOperation(instr.operation)
self.size = instr.size
self.address = instr.address
+ self.source_operand = instr.sourceOperand
operands = MediumLevelILInstruction.ILOperations[instr.operation]
self.operands = []
i = 0