(analysis_context: &AnalysisContext)
| 16 | }"#; |
| 17 | |
| 18 | fn example_activity(analysis_context: &AnalysisContext) { |
| 19 | let func = analysis_context.function(); |
| 20 | println!( |
| 21 | "Activity `{}` called in function {} with workflow {:?}!", |
| 22 | RUST_ACTIVITY_NAME, |
| 23 | func.start(), |
| 24 | func.workflow().map(|wf| wf.name()) |
| 25 | ); |
| 26 | // If we have llil available, replace that as well. |
| 27 | if let Some(llil) = unsafe { analysis_context.llil_function() } { |
| 28 | for basic_block in &func.basic_blocks() { |
| 29 | for instr in basic_block.iter() { |
| 30 | if let Some(llil_instr) = llil.instruction_at(instr) { |
| 31 | llil_instr.visit_tree(&mut |expr| { |
| 32 | if let LowLevelILExpressionKind::Const(_op) = expr.kind() { |
| 33 | // Replace all consts with 0x1337. |
| 34 | println!("Replacing llil expression @ 0x{:x} : {}", instr, expr.index); |
| 35 | unsafe { |
| 36 | llil.replace_expression(expr.index, llil.const_int(4, 0x1337)) |
| 37 | }; |
| 38 | } |
| 39 | VisitorAction::Descend |
| 40 | }); |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | analysis_context.set_lifted_il_function(&llil); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | pub fn main() { |
| 49 | println!("Starting session..."); |
nothing calls this directly
no test coverage detected