From 617c10d3cb0a9b9bad112c79c85384c08c22c98e Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Mon, 13 Apr 2026 18:04:00 -0700 Subject: Fix context menus for calls when call target is HLIL_IMPORT Add a `getCallInstructionAddress` helper that maps from view highlight state to the address of the corresponding call instruction, if one is highlighted. This logic was previously duplicated between `LinearView` and `FlowGraphWidget`. --- ui/uitypes.h | 2 +- ui/util.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ui/uitypes.h b/ui/uitypes.h index dde77c4a..4c2e9404 100644 --- a/ui/uitypes.h +++ b/ui/uitypes.h @@ -6,7 +6,7 @@ // there are changes to the API that affect linking, including new functions, // new types, modifications to existing functions or types, or new versions // of the Qt libraries. -#define BN_CURRENT_UI_ABI_VERSION 13 +#define BN_CURRENT_UI_ABI_VERSION 14 // Minimum ABI version that is supported for loading of plugins. Plugins that // are linked to an ABI version less than this will not be able to load and diff --git a/ui/util.h b/ui/util.h index 9b5a907d..1123b9c6 100644 --- a/ui/util.h +++ b/ui/util.h @@ -30,6 +30,18 @@ std::optional BINARYNINJAUIAPI getPossibleValueSe std::optional BINARYNINJAUIAPI getPossibleValueSetForILToken(View* view, HighlightTokenState token); std::optional BINARYNINJAUIAPI getAddressOfILTokenExpr(View* view, HighlightTokenState token); +// Resolve the address of the call instruction that the user is currently on, +// given the active function, architecture, IL view, highlight, and cursor +// position. This is the address of the calling instruction itself, not the +// call target. +std::optional BINARYNINJAUIAPI getCallInstructionAddress( + FunctionRef function, + ArchitectureRef arch, + BNFunctionGraphType viewType, + const HighlightTokenState& highlight, + uint64_t cursorAddress, + size_t cursorInstrIndex); + template std::optional visitILInstructionForToken(View* view, const HighlightTokenState& token, const std::function(BinaryNinja::LowLevelILInstruction&)>& llil, -- cgit v1.3.1