diff options
| author | Josh Ferrell <josh@vector35.com> | 2025-09-24 11:39:00 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2025-09-24 11:39:00 -0400 |
| commit | 0af8344992572b553ed3a423e38373140ead5bf4 (patch) | |
| tree | 5712b77fe2b4a8a7c756f1ae79eafd2688159832 /rust/tests | |
| parent | 8cc5a889e7c87037ba3931b81d79b1bf343a5991 (diff) | |
Fix HighLevelILInstruction CoreArrayProvider using instr index instead of expr index
Diffstat (limited to 'rust/tests')
| -rw-r--r-- | rust/tests/high_level_il.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/rust/tests/high_level_il.rs b/rust/tests/high_level_il.rs index e757301e..d3a4b05a 100644 --- a/rust/tests/high_level_il.rs +++ b/rust/tests/high_level_il.rs @@ -1,4 +1,4 @@ -use binaryninja::binary_view::BinaryViewExt; +use binaryninja::binary_view::{BinaryViewBase, BinaryViewExt}; use binaryninja::headless::Session; use binaryninja::high_level_il::{ HighLevelExpressionIndex, HighLevelILInstructionKind, HighLevelInstructionIndex, @@ -37,3 +37,27 @@ fn test_hlil_info() { _ => panic!("Expected Ret"), } } + +#[test] +fn test_hlil_var_info() { + let _session = Session::new().expect("Failed to initialize session"); + let out_dir = env!("OUT_DIR").parse::<PathBuf>().unwrap(); + let view = binaryninja::load(out_dir.join("atox.obj")).expect("Failed to create view"); + + let function = view + .function_at(&view.default_platform().unwrap(), view.start() + 0x28600) + .unwrap(); + let hlil_function = function.high_level_il(false).unwrap(); + + for v in hlil_function.variables().iter() { + let defs = hlil_function.variable_definitions(v).to_vec(); + if v.index != 0 { + // Make sure non-param vars have a def site + assert!(defs.len() > 0) + } + let _ = hlil_function.variable_uses(v).to_vec(); + for ssa_var in hlil_function.ssa_variables(&v).iter() { + let _ = hlil_function.ssa_variable_uses(ssa_var).to_vec(); + } + } +} |
