()
| 56 | } |
| 57 | |
| 58 | pub fn insert_workflow() { |
| 59 | let matcher_activity = |ctx: &AnalysisContext| { |
| 60 | let view = ctx.view(); |
| 61 | let undo_id = view.file().begin_undo_actions(true); |
| 62 | let background_task = BackgroundTask::new("Matching on functions...", false); |
| 63 | let start = Instant::now(); |
| 64 | view.functions() |
| 65 | .iter() |
| 66 | .for_each(|function| cached_function_matcher(&function)); |
| 67 | log::info!("Function matching took {:?}", start.elapsed()); |
| 68 | background_task.finish(); |
| 69 | view.file().commit_undo_actions(undo_id); |
| 70 | // Now we want to trigger re-analysis. |
| 71 | view.update_analysis(); |
| 72 | }; |
| 73 | |
| 74 | let guid_activity = |ctx: &AnalysisContext| { |
| 75 | let function = ctx.function(); |
| 76 | // TODO: Returning RegularNonSSA means we cant modify the il (the lifting code was written just for lifted il, that needs to be fixed) |
| 77 | if let Some(llil) = unsafe { ctx.llil_function::<RegularNonSSA>() } { |
| 78 | cached_function_guid(&function, &llil); |
| 79 | } |
| 80 | }; |
| 81 | |
| 82 | let old_function_meta_workflow = Workflow::instance("core.function.metaAnalysis"); |
| 83 | let function_meta_workflow = old_function_meta_workflow.clone_to("core.function.metaAnalysis"); |
| 84 | let guid_activity = Activity::new_with_action(GUID_ACTIVITY_CONFIG, guid_activity); |
| 85 | function_meta_workflow |
| 86 | .register_activity(&guid_activity) |
| 87 | .unwrap(); |
| 88 | function_meta_workflow.insert("core.function.runFunctionRecognizers", [GUID_ACTIVITY_NAME]); |
| 89 | function_meta_workflow.register().unwrap(); |
| 90 | |
| 91 | let old_module_meta_workflow = Workflow::instance("core.module.metaAnalysis"); |
| 92 | let module_meta_workflow = old_module_meta_workflow.clone_to("core.module.metaAnalysis"); |
| 93 | let matcher_activity = Activity::new_with_action(MATCHER_ACTIVITY_CONFIG, matcher_activity); |
| 94 | module_meta_workflow |
| 95 | .register_activity(&matcher_activity) |
| 96 | .unwrap(); |
| 97 | module_meta_workflow.insert( |
| 98 | "core.module.deleteUnusedAutoFunctions", |
| 99 | [MATCHER_ACTIVITY_NAME], |
| 100 | ); |
| 101 | module_meta_workflow.register().unwrap(); |
| 102 | } |
no test coverage detected