From 905382cc267cc1d0ee5e3c6e122819b869f46701 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Sat, 24 Oct 2020 22:18:28 -0400 Subject: PossibleValueSet dialog pulls existing values and miscellaneous cleanup. --- ui/commands.h | 2 +- ui/possiblevaluesetdialog.h | 60 +++++++++++++-------------------------------- 2 files changed, 18 insertions(+), 44 deletions(-) (limited to 'ui') diff --git a/ui/commands.h b/ui/commands.h index d033fd21..d0e8b981 100644 --- a/ui/commands.h +++ b/ui/commands.h @@ -23,7 +23,7 @@ bool BINARYNINJAUIAPI createInferredMember(QWidget* parent, BinaryViewRef data, FunctionRef func, BNFunctionGraphType type); bool BINARYNINJAUIAPI inputPossibleValueSet(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction, - HighlightTokenState& highlight, uint64_t defSiteAddress); + HighlightTokenState& highlight, uint64_t defSiteAddress, size_t ilInstructionIndex = BN_INVALID_EXPR); bool BINARYNINJAUIAPI overwriteCode(BinaryViewRef data, ArchitectureRef arch, uint64_t addr, size_t len, const BinaryNinja::DataBuffer& buffer); diff --git a/ui/possiblevaluesetdialog.h b/ui/possiblevaluesetdialog.h index 5b5550a3..d2229de7 100644 --- a/ui/possiblevaluesetdialog.h +++ b/ui/possiblevaluesetdialog.h @@ -2,59 +2,33 @@ #include #include -#include #include #include -#include -#include -#include -#include "binaryninjaapi.h" -#include "dialogtextedit.h" -#include "clickablelabel.h" + +#include "uitypes.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; + uint64_t m_addr; + + QComboBox* m_combo; + QLineEdit* m_input; 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&); + QLabel* m_formatLabel; + + std::map m_typeText; + std::map m_formatText; + std::map m_regValueTypes; + BNRegisterValueType m_curRegValueType; + + BinaryNinja::PossibleValueSet m_valueSet; public: - PossibleValueSetDialog(QWidget* parent, BinaryViewRef view, uint64_t here); - BinaryNinja::PossibleValueSet getPossibleValueSet() const { return m_valueSet; } - static BNRegisterValueType getRegisterValueTypeFromString(const std::string& stateStr); -}; + PossibleValueSetDialog(QWidget* parent, BinaryViewRef view, uint64_t addr, BinaryNinja::PossibleValueSet existingValue); -static const QStringList valueSets = { - "ConstantValue", - "ConstantPointerValue", - "StackFrameOffset", - "SignedRangeValue", - "UnsignedRangeValue", - "InSetOfValues", - "NotInSetOfValues", - "UndeterminedValue", + BinaryNinja::PossibleValueSet getPossibleValueSet() const { return m_valueSet; } + void validate(const QString& input); }; -- cgit v1.3.1