summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2024-08-02 12:10:15 +0800
committerXusheng <xusheng@vector35.com>2024-10-03 11:56:29 +0800
commite9c53f3c9a8cb2f28ea8047c1b9b12f0ea31968f (patch)
tree92c7e2eb5f16ba90208d97f0a2e51ef2d34cb366
parent7e8d66a089e35d2424879a4121f47c9ea808a86f (diff)
Support forward type propagation for function/variable. Fix https://github.com/Vector35/binaryninja-api/issues/2725
-rw-r--r--docs/guide/index.md1
-rw-r--r--ui/commands.h3
-rw-r--r--ui/flowgraphwidget.h3
-rw-r--r--ui/linearview.h3
4 files changed, 10 insertions, 0 deletions
diff --git a/docs/guide/index.md b/docs/guide/index.md
index d8f44780..8f5a7930 100644
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@ -516,6 +516,7 @@ To search in the keybindings list, just click to make sure it's focused and star
- `i` : Cycle between disassembly, LLIL, MLIL and HLIL
- `t` : Switch to type view
- `y` : Change type of currently selected element
+ - `q` : Forward propagate the type of the selected function or variable
- `a` : Change the data type to an ASCII string
- `[SHIFT] a` : Change the data type to a `wchar_t` string
- `[OPT-SHIFT] a` (macOS) : Change the data type to a `wchar32_t` string
diff --git a/ui/commands.h b/ui/commands.h
index b0798a9b..3af4f11b 100644
--- a/ui/commands.h
+++ b/ui/commands.h
@@ -61,6 +61,9 @@ std::optional<size_t> getVariableDefinitionInstructionIndex(
std::optional<size_t> getVariableDefinitionAddress(
FunctionRef func, BNFunctionGraphType funcType, const BinaryNinja::Variable& var, size_t ilInstructionIndex);
+bool IsDefaultArgumentOrParameterName(const std::string& name);
+std::optional<std::string> GetVariableNameFromExpr(BinaryNinja::Function* func,
+ const BinaryNinja::HighLevelILInstruction& instr);
/*!
@}
diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h
index 7c6ad26c..667d088c 100644
--- a/ui/flowgraphwidget.h
+++ b/ui/flowgraphwidget.h
@@ -354,6 +354,9 @@ class BINARYNINJAUIAPI FlowGraphWidget :
void createFuncWithPlatform(PlatformRef platform, bool autoSelect = false);
void changeType();
void inferStructureType(const UIActionContext& context);
+ void forwardPropagateType();
+ void inferFunctionType();
+ void propagateVariableTypeAndName();
void comment();
void addUserXref();
void functionComment();
diff --git a/ui/linearview.h b/ui/linearview.h
index 29021a7a..caa0b439 100644
--- a/ui/linearview.h
+++ b/ui/linearview.h
@@ -331,6 +331,9 @@ private Q_SLOTS:
void editFunctionProperties();
void undefineFunc();
void reanalyze();
+ void forwardPropagateType();
+ void inferFunctionType();
+ void propagateVariableTypeAndName();
void comment();
void commentAccepted();
void addUserXref();