Skip to content

Commit 617c10d

Browse files
committed
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`.
1 parent 19a72ab commit 617c10d

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

ui/uitypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// there are changes to the API that affect linking, including new functions,
77
// new types, modifications to existing functions or types, or new versions
88
// of the Qt libraries.
9-
#define BN_CURRENT_UI_ABI_VERSION 13
9+
#define BN_CURRENT_UI_ABI_VERSION 14
1010

1111
// Minimum ABI version that is supported for loading of plugins. Plugins that
1212
// are linked to an ABI version less than this will not be able to load and

ui/util.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ std::optional<BinaryNinja::PossibleValueSet> BINARYNINJAUIAPI getPossibleValueSe
3030
std::optional<BinaryNinja::PossibleValueSet> BINARYNINJAUIAPI getPossibleValueSetForILToken(View* view, HighlightTokenState token);
3131
std::optional<uint64_t> BINARYNINJAUIAPI getAddressOfILTokenExpr(View* view, HighlightTokenState token);
3232

33+
// Resolve the address of the call instruction that the user is currently on,
34+
// given the active function, architecture, IL view, highlight, and cursor
35+
// position. This is the address of the calling instruction itself, not the
36+
// call target.
37+
std::optional<uint64_t> BINARYNINJAUIAPI getCallInstructionAddress(
38+
FunctionRef function,
39+
ArchitectureRef arch,
40+
BNFunctionGraphType viewType,
41+
const HighlightTokenState& highlight,
42+
uint64_t cursorAddress,
43+
size_t cursorInstrIndex);
44+
3345
template <typename T>
3446
std::optional<T> visitILInstructionForToken(View* view, const HighlightTokenState& token,
3547
const std::function<std::optional<T>(BinaryNinja::LowLevelILInstruction&)>& llil,

0 commit comments

Comments
 (0)