summaryrefslogtreecommitdiff
path: root/ui/util.h
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2026-04-13 18:04:00 -0700
committerMark Rowe <mark@vector35.com>2026-04-16 15:35:06 -0700
commit617c10d3cb0a9b9bad112c79c85384c08c22c98e (patch)
tree985e265121793f22f72ddfc48cb478291874216e /ui/util.h
parent19a72ab499a5c8f4177b62808921afad48d14fa2 (diff)
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`.
Diffstat (limited to 'ui/util.h')
-rw-r--r--ui/util.h12
1 files changed, 12 insertions, 0 deletions
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<BinaryNinja::PossibleValueSet> BINARYNINJAUIAPI getPossibleValueSe
std::optional<BinaryNinja::PossibleValueSet> BINARYNINJAUIAPI getPossibleValueSetForILToken(View* view, HighlightTokenState token);
std::optional<uint64_t> 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<uint64_t> BINARYNINJAUIAPI getCallInstructionAddress(
+ FunctionRef function,
+ ArchitectureRef arch,
+ BNFunctionGraphType viewType,
+ const HighlightTokenState& highlight,
+ uint64_t cursorAddress,
+ size_t cursorInstrIndex);
+
template <typename T>
std::optional<T> visitILInstructionForToken(View* view, const HighlightTokenState& token,
const std::function<std::optional<T>(BinaryNinja::LowLevelILInstruction&)>& llil,