diff options
| author | Chinmay <chinmay1dd@gmail.com> | 2020-08-17 22:53:09 -0700 |
|---|---|---|
| committer | Chinmay Deshpande <chinmay1dd@gmail.com> | 2020-09-08 09:29:18 -0700 |
| commit | 73b649e79d5cd219cb56866abf2ee5e6a64d976a (patch) | |
| tree | 07bbd8c4e5f8b6d743760a3e226a975cc83c2c15 /ui | |
| parent | 62aa529de8a169578c80b14e3969b076f65be205 (diff) | |
UI changes for user-informed dataflow
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/clickablelabel.h | 17 | ||||
| -rw-r--r-- | ui/commands.h | 5 | ||||
| -rw-r--r-- | ui/flowgraphwidget.h | 2 | ||||
| -rw-r--r-- | ui/linearview.h | 2 | ||||
| -rw-r--r-- | ui/possiblevaluesetdialog.h | 60 | ||||
| -rw-r--r-- | ui/typedialog.h | 2 |
6 files changed, 86 insertions, 2 deletions
diff --git a/ui/clickablelabel.h b/ui/clickablelabel.h new file mode 100644 index 00000000..df261494 --- /dev/null +++ b/ui/clickablelabel.h @@ -0,0 +1,17 @@ +#pragma once + +#include <QtWidgets/QLabel> + +class BINARYNINJAUIAPI ClickableLabel: public QLabel +{ + Q_OBJECT + +public: + ClickableLabel(QWidget* parent = nullptr, const QString& name = ""): QLabel(parent) { setText(name); } + +signals: + void clicked(); + +protected: + void mouseReleaseEvent(QMouseEvent* event) override { if (event->button() == Qt::LeftButton) emit clicked(); } +}; diff --git a/ui/commands.h b/ui/commands.h index cdbf16ff..d033fd21 100644 --- a/ui/commands.h +++ b/ui/commands.h @@ -22,6 +22,9 @@ bool BINARYNINJAUIAPI inputNewType(QWidget* parent, BinaryViewRef data, Function bool BINARYNINJAUIAPI createInferredMember(QWidget* parent, BinaryViewRef data, HighlightTokenState& highlight, FunctionRef func, BNFunctionGraphType type); +bool BINARYNINJAUIAPI inputPossibleValueSet(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction, + HighlightTokenState& highlight, uint64_t defSiteAddress); + bool BINARYNINJAUIAPI overwriteCode(BinaryViewRef data, ArchitectureRef arch, uint64_t addr, size_t len, const BinaryNinja::DataBuffer& buffer); bool BINARYNINJAUIAPI overwriteCode(BinaryViewRef data, ArchitectureRef arch, @@ -33,4 +36,4 @@ StructureRef BINARYNINJAUIAPI getInnerMostStructureContainingOffset(BinaryViewRe const std::vector<std::string>& nameList, size_t nameIndex, size_t& offset, TypeRef& type, std::string& typeName); // Auto generate a structure name -std::string BINARYNINJAUIAPI createStructureName(BinaryViewRef data);
\ No newline at end of file +std::string BINARYNINJAUIAPI createStructureName(BinaryViewRef data); diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h index 2a3a8b78..a6e02076 100644 --- a/ui/flowgraphwidget.h +++ b/ui/flowgraphwidget.h @@ -284,6 +284,8 @@ private Q_SLOTS: void followPointer(); void defineName(); void undefineName(); + void setUserVariableValue(); + void clearUserVariableValue(); void defineFuncName(); void undefineFunc(); void createFunc(); diff --git a/ui/linearview.h b/ui/linearview.h index 26c3e9d8..00f02c76 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -197,6 +197,8 @@ private Q_SLOTS: void defineNameAtAddr(uint64_t addr); void defineName(); void undefineName(); + void setUserVariableValue(); + void clearUserVariableValue(); void createFunc(); void createFuncWithPlatform(PlatformRef platform); void defineFuncName(); diff --git a/ui/possiblevaluesetdialog.h b/ui/possiblevaluesetdialog.h new file mode 100644 index 00000000..5b5550a3 --- /dev/null +++ b/ui/possiblevaluesetdialog.h @@ -0,0 +1,60 @@ +#pragma once + +#include <QtWidgets/QDialog> +#include <QtWidgets/QLabel> +#include <QtCore/QStringListModel> +#include <QtWidgets/QComboBox> +#include <QtWidgets/QLineEdit> +#include <QtCore/QTimer> +#include <QtCore/QThread> +#include <QToolTip> +#include "binaryninjaapi.h" +#include "dialogtextedit.h" +#include "clickablelabel.h" + +class BINARYNINJAUIAPI PossibleValueSetDialog: public QDialog +{ + Q_OBJECT + + QComboBox* m_combo; + QLineEdit* m_value; + QStringListModel* m_model; + QLabel* m_prompt; + QString m_promptText; + ClickableLabel* m_valueLabel; + BinaryViewRef m_view; + bool m_resultValid; + QStringList m_historyEntries; + int m_historySize; + QFont m_defaultFont; + bool m_initialTextSelection; + BinaryNinja::PossibleValueSet m_valueSet; + QPushButton* m_acceptButton; + QPalette m_defaultPalette; + QString m_parseError; + uint64_t m_here; + QTimer* m_updateTimer; + +private Q_SLOTS: + void accepted(); + void checkParse(); + void updateTimerEvent(); + void showHelp(); + void stateChanged(const QString&); + +public: + PossibleValueSetDialog(QWidget* parent, BinaryViewRef view, uint64_t here); + BinaryNinja::PossibleValueSet getPossibleValueSet() const { return m_valueSet; } + static BNRegisterValueType getRegisterValueTypeFromString(const std::string& stateStr); +}; + +static const QStringList valueSets = { + "ConstantValue", + "ConstantPointerValue", + "StackFrameOffset", + "SignedRangeValue", + "UnsignedRangeValue", + "InSetOfValues", + "NotInSetOfValues", + "UndeterminedValue", +}; diff --git a/ui/typedialog.h b/ui/typedialog.h index 34b68c07..00a722bc 100644 --- a/ui/typedialog.h +++ b/ui/typedialog.h @@ -64,4 +64,4 @@ public: const QString& prompt = "Enter Type Name", const QString& existing=""); ~TypeDialog() { delete m_updateThread; } BinaryNinja::QualifiedNameAndType getType() const { return m_type; } -};
\ No newline at end of file +}; |
