summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorRyan Snyder <ryan@vector35.com>2025-01-24 17:57:26 -0500
committerRyan Snyder <ryan@vector35.com>2025-02-14 15:58:56 -0500
commitbcdc0d9b89605936a1cb6cf3ffaaece60d3c5777 (patch)
tree7286bd0963a49d9b90ddccf3a4b70b71c08e6ce5 /rust
parent071811547bded7cf570125a03bb12d0b7c56a5ac (diff)
uidf refactor
Diffstat (limited to 'rust')
-rw-r--r--rust/src/high_level_il/instruction.rs1
-rw-r--r--rust/src/medium_level_il/function.rs9
-rw-r--r--rust/src/medium_level_il/instruction.rs1
-rw-r--r--rust/src/relocs.rs0
-rw-r--r--rust/src/variable.rs3
5 files changed, 10 insertions, 4 deletions
diff --git a/rust/src/high_level_il/instruction.rs b/rust/src/high_level_il/instruction.rs
index 40ac164b..00900de7 100644
--- a/rust/src/high_level_il/instruction.rs
+++ b/rust/src/high_level_il/instruction.rs
@@ -74,6 +74,7 @@ impl HighLevelILInstruction {
HLIL_UNREACHABLE => Op::Unreachable,
HLIL_BP => Op::Bp,
HLIL_UNDEF => Op::Undef,
+ HLIL_FORCE_VER | HLIL_FORCE_VER_SSA | HLIL_ASSERT | HLIL_ASSERT_SSA => Op::Undef,
HLIL_UNIMPL => Op::Unimpl,
HLIL_ADC => Op::Adc(BinaryOpCarry {
left: op.operands[0] as usize,
diff --git a/rust/src/medium_level_il/function.rs b/rust/src/medium_level_il/function.rs
index 8f91c731..ec5d9dec 100644
--- a/rust/src/medium_level_il/function.rs
+++ b/rust/src/medium_level_il/function.rs
@@ -205,6 +205,7 @@ impl MediumLevelILFunction {
var: &Variable,
addr: u64,
value: PossibleValueSet,
+ after: bool,
) -> Result<(), ()> {
let Some(_def_site) = self
.var_definitions(var)
@@ -221,7 +222,7 @@ impl MediumLevelILFunction {
};
let raw_var = BNVariable::from(var);
let raw_value = PossibleValueSet::into_raw(value);
- unsafe { BNSetUserVariableValue(function.handle, &raw_var, &def_site, &raw_value) }
+ unsafe { BNSetUserVariableValue(function.handle, &raw_var, &def_site, after, &raw_value) }
PossibleValueSet::free_owned_raw(raw_value);
Ok(())
}
@@ -230,7 +231,7 @@ impl MediumLevelILFunction {
///
/// * `var` - Variable for which the value was informed
/// * `def_addr` - Address of the definition site of the variable
- pub fn clear_user_var_value(&self, var: &Variable, addr: u64) -> Result<(), ()> {
+ pub fn clear_user_var_value(&self, var: &Variable, addr: u64, after: bool) -> Result<(), ()> {
let Some(_var_def) = self
.var_definitions(var)
.iter()
@@ -247,7 +248,7 @@ impl MediumLevelILFunction {
address: addr,
};
- unsafe { BNClearUserVariableValue(function.handle, &raw_var, &def_site) };
+ unsafe { BNClearUserVariableValue(function.handle, &raw_var, &def_site, after) };
Ok(())
}
@@ -264,7 +265,7 @@ impl MediumLevelILFunction {
/// Clear all user defined variable values.
pub fn clear_user_var_values(&self) -> Result<(), ()> {
for user_var_val in &self.user_var_values() {
- self.clear_user_var_value(&user_var_val.variable, user_var_val.def_site.addr)?;
+ self.clear_user_var_value(&user_var_val.variable, user_var_val.def_site.addr, user_var_val.after)?;
}
Ok(())
}
diff --git a/rust/src/medium_level_il/instruction.rs b/rust/src/medium_level_il/instruction.rs
index 0097e83b..5e201478 100644
--- a/rust/src/medium_level_il/instruction.rs
+++ b/rust/src/medium_level_il/instruction.rs
@@ -75,6 +75,7 @@ impl MediumLevelILInstruction {
MLIL_NORET => Op::Noret,
MLIL_BP => Op::Bp,
MLIL_UNDEF => Op::Undef,
+ MLIL_ASSERT | MLIL_ASSERT_SSA | MLIL_FORCE_VER | MLIL_FORCE_VER_SSA => Op::Undef,
MLIL_UNIMPL => Op::Unimpl,
MLIL_IF => Op::If(MediumLevelILOperationIf {
condition: op.operands[0] as usize,
diff --git a/rust/src/relocs.rs b/rust/src/relocs.rs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/rust/src/relocs.rs
diff --git a/rust/src/variable.rs b/rust/src/variable.rs
index 3fdc1177..f6b0f522 100644
--- a/rust/src/variable.rs
+++ b/rust/src/variable.rs
@@ -219,6 +219,7 @@ unsafe impl CoreArrayProviderInner for NamedVariableWithType {
pub struct UserVariableValue {
pub variable: Variable,
pub def_site: Location,
+ pub after: bool,
pub value: PossibleValueSet,
}
@@ -227,6 +228,7 @@ impl UserVariableValue {
Self {
variable: value.var.into(),
def_site: value.defSite.into(),
+ after: value.after,
value: PossibleValueSet::from_raw(&value.value),
}
}
@@ -235,6 +237,7 @@ impl UserVariableValue {
BNUserVariableValue {
var: value.variable.into(),
defSite: value.def_site.into(),
+ after: value.after,
value: PossibleValueSet::into_raw(value.value),
}
}