diff options
| author | KyleMiles <krm504@nyu.edu> | 2022-01-27 22:43:28 -0500 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2022-01-28 00:24:06 -0500 |
| commit | 6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 (patch) | |
| tree | dace4156d03148bcaf02df138ab4e0d93e61bc6f /examples/workflows/inliner | |
| parent | 519c9db22367f2659d1a54599fab47e6313be06e (diff) | |
Format All Files
Diffstat (limited to 'examples/workflows/inliner')
| -rw-r--r-- | examples/workflows/inliner/inliner.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/examples/workflows/inliner/inliner.cpp b/examples/workflows/inliner/inliner.cpp index 4ce05a31..da54fbc2 100644 --- a/examples/workflows/inliner/inliner.cpp +++ b/examples/workflows/inliner/inliner.cpp @@ -18,7 +18,7 @@ using namespace BinaryNinja; using namespace std; #if defined(_MSC_VER) -#define snprintf _snprintf + #define snprintf _snprintf #endif @@ -68,7 +68,8 @@ extern "C" if (instr.operation != LLIL_CALL) { - LogWarn("Failed to inline function at: 0x%" PRIx64 ". Mapping to LLIL_CALL Failed!", instr.address); + LogWarn( + "Failed to inline function at: 0x%" PRIx64 ". Mapping to LLIL_CALL Failed!", instr.address); continue; } @@ -79,14 +80,17 @@ extern "C" platformAddr = target.value; else { - LogWarn("Failed to inline function at: 0x%" PRIx64 ". Destination not Constant!", instr.address); + LogWarn( + "Failed to inline function at: 0x%" PRIx64 ". Destination not Constant!", instr.address); continue; } size_t opLen = data->Read(opcode, instr.address, arch->GetMaxInstructionLength()); if (!opLen || !arch->GetInstructionInfo(opcode, instr.address, opLen, iInfo)) continue; - Ref<Platform> platform = iInfo.archTransitionByTargetAddr ? function->GetPlatform()->GetAssociatedPlatformByAddress(platformAddr) : function->GetPlatform(); + Ref<Platform> platform = iInfo.archTransitionByTargetAddr ? + function->GetPlatform()->GetAssociatedPlatformByAddress(platformAddr) : + function->GetPlatform(); if (platform) { Ref<Function> targetFunc = data->GetAnalysisFunction(platform, platformAddr); @@ -145,21 +149,21 @@ extern "C" // }, inlinerIsValid); PluginCommand::RegisterForFunction( - "Optimizer\\Inline Function at Current Call Site", - "Inline function call at current call site.", - [](BinaryView* view, Function* func) { - // TODO func->Inform("inlinedCallSites") - // TODO resolve multiple embedded inlines - std::lock_guard<std::mutex> lock(g_mutex); - g_callSiteInlines[view->GetObject()][func->GetStart()].insert(view->GetCurrentOffset()); - func->Reanalyze(); - }, inlinerIsValid); + "Optimizer\\Inline Function at Current Call Site", "Inline function call at current call site.", + [](BinaryView* view, Function* func) { + // TODO func->Inform("inlinedCallSites") + // TODO resolve multiple embedded inlines + std::lock_guard<std::mutex> lock(g_mutex); + g_callSiteInlines[view->GetObject()][func->GetStart()].insert(view->GetCurrentOffset()); + func->Reanalyze(); + }, + inlinerIsValid); Ref<Workflow> inlinerWorkflow = Workflow::Instance()->Clone("InlinerWorkflow"); inlinerWorkflow->RegisterActivity(new Activity("extension.functionInliner", &FunctionInliner)); inlinerWorkflow->Insert("core.function.translateTailCalls", "extension.functionInliner"); Workflow::RegisterWorkflow(inlinerWorkflow, - R"#({ + R"#({ "title" : "Function Inliner (Example)", "description" : "This analysis stands in as an example to demonstrate Binary Ninja's extensible analysis APIs. ***Note** this feature is under active development and subject to change without notice.", "capabilities" : [] |
