MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / CorePluginInit

Function CorePluginInit

examples/workflows/inliner/inliner.cpp:135–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133
134
135 BINARYNINJAPLUGIN bool CorePluginInit()
136 {
137 auto inlinerIsValid = [](BinaryView* view, Function* func) {
138 if (auto workflow = func->GetWorkflow(); workflow)
139 return workflow->Contains("extension.functionInliner");
140 return false;
141 };
142
143 // PluginCommand::RegisterForFunction(
144 // "Optimizer\\Inline All Calls to Current Function",
145 // "Inline all calls to the current function.",
146 // [](BinaryView* view, Function* func) {
147 // LogError("TODO Inline Current Function: %" PRIx64, func->GetStart());
148 // }, inlinerIsValid);
149
150 PluginCommand::RegisterForFunction(
151 "Optimizer\\Inline Function at Current Call Site", "Inline function call at current call site.",
152 [](BinaryView* view, Function* func) {
153 // TODO func->Inform("inlinedCallSites")
154 // TODO resolve multiple embedded inlines
155 std::lock_guard<std::mutex> lock(g_mutex);
156 g_callSiteInlines[view->GetObject()][func->GetStart()].insert(view->GetCurrentOffset());
157 func->Reanalyze();
158 },
159 inlinerIsValid);
160
161 Ref<Workflow> inlinerWorkflow = Workflow::Instance("core.function.baseAnalysis")->Clone("InlinerWorkflow");
162 inlinerWorkflow->RegisterActivity(new Activity("extension.functionInliner", &FunctionInliner));
163 inlinerWorkflow->Insert("core.function.translateTailCalls", "extension.functionInliner");
164 Workflow::RegisterWorkflow(inlinerWorkflow,
165 R"#({
166 "title" : "Function Inliner (Example)",
167 "description" : "This analysis stands in as an example to demonstrate Binary Ninja's extensible analysis APIs.",
168 "targetType" : "function"
169 })#");
170
171 return true;
172 }
173}

Callers

nothing calls this directly

Calls 10

CloneMethod · 0.80
RegisterActivityMethod · 0.80
GetWorkflowMethod · 0.45
ContainsMethod · 0.45
insertMethod · 0.45
GetObjectMethod · 0.45
GetStartMethod · 0.45
GetCurrentOffsetMethod · 0.45
ReanalyzeMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected