diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2024-08-22 12:55:49 -0600 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2024-10-21 13:56:55 -0400 |
| commit | d8e3001e535fad178c621ff07418f81f25123dc4 (patch) | |
| tree | 54c03cef2f0bdfd9a3b6df4334c81becb63e4993 /ui | |
| parent | 0e281a30d73c0f31ef9442fef0346779164231ad (diff) | |
Allow multiple high level representations for display, add Pseudo Rust and a Pseudo Python example plugin
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/commands.h | 10 | ||||
| -rw-r--r-- | ui/disassemblyview.h | 16 | ||||
| -rw-r--r-- | ui/ilchooser.h | 6 | ||||
| -rw-r--r-- | ui/linearview.h | 8 | ||||
| -rw-r--r-- | ui/util.h | 2 | ||||
| -rw-r--r-- | ui/variablelist.h | 6 | ||||
| -rw-r--r-- | ui/viewframe.h | 26 | ||||
| -rw-r--r-- | ui/xreflist.h | 16 |
8 files changed, 46 insertions, 44 deletions
diff --git a/ui/commands.h b/ui/commands.h index 70ed5778..37ed068a 100644 --- a/ui/commands.h +++ b/ui/commands.h @@ -27,11 +27,11 @@ bool BINARYNINJAUIAPI askForNewType(QWidget* parent, std::optional<BinaryNinja:: bool BINARYNINJAUIAPI inputNewType(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction, uint64_t currentAddr, size_t selectionSize, HighlightTokenState& highlight); bool BINARYNINJAUIAPI createInferredMember(QWidget* parent, BinaryViewRef data, HighlightTokenState& highlight, - FunctionRef func, BNFunctionGraphType ilType, size_t instrIndex); + FunctionRef func, const BinaryNinja::FunctionViewType& ilType, size_t instrIndex); bool BINARYNINJAUIAPI createStructMembers( QWidget* parent, BinaryViewRef data, HighlightTokenState& highlight, FunctionRef func); -bool BINARYNINJAUIAPI inputPossibleValueSet(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction, BNFunctionGraphType funcType, +bool BINARYNINJAUIAPI inputPossibleValueSet(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction, const BinaryNinja::FunctionViewType& funcType, const BinaryNinja::Variable& var, size_t ilInstructionIndex = BN_INVALID_EXPR); bool BINARYNINJAUIAPI getEnumSelection(QWidget* parent, BinaryViewRef data, FunctionRef func, uint64_t constValue, @@ -55,12 +55,12 @@ uint64_t BINARYNINJAUIAPI getInnerMostStructureOffset( std::string BINARYNINJAUIAPI createStructureName(BinaryNinja::TypeContainer types, const std::string& prefix = "struct_"); std::optional<BinaryNinja::Variable> BINARYNINJAUIAPI getSplitVariableForAssignment( - FunctionRef func, BNFunctionGraphType ilType, uint64_t location, const BinaryNinja::Variable& var); + FunctionRef func, const BinaryNinja::FunctionViewType& ilType, uint64_t location, const BinaryNinja::Variable& var); std::optional<size_t> getVariableDefinitionInstructionIndex( - FunctionRef func, BNFunctionGraphType funcType, const BinaryNinja::Variable& var, size_t ilInstructionIndex); + FunctionRef func, const BinaryNinja::FunctionViewType& funcType, const BinaryNinja::Variable& var, size_t ilInstructionIndex); std::optional<size_t> getVariableDefinitionAddress( - FunctionRef func, BNFunctionGraphType funcType, const BinaryNinja::Variable& var, size_t ilInstructionIndex); + FunctionRef func, const BinaryNinja::FunctionViewType& funcType, const BinaryNinja::Variable& var, size_t ilInstructionIndex); bool IsDefaultArgumentOrParameterName(const std::string& name); std::optional<std::string> GetVariableNameFromExpr(BinaryNinja::Function* func, diff --git a/ui/disassemblyview.h b/ui/disassemblyview.h index 3e0408ae..c7595f96 100644 --- a/ui/disassemblyview.h +++ b/ui/disassemblyview.h @@ -31,11 +31,11 @@ */ class BINARYNINJAUIAPI DisassemblyHistoryEntry : public FlowGraphHistoryEntry { - BNFunctionGraphType m_graphType; + BinaryNinja::FunctionViewType m_graphType; public: - BNFunctionGraphType getGraphType() const { return m_graphType; } - void setGraphType(BNFunctionGraphType type) { m_graphType = type; } + const BinaryNinja::FunctionViewType& getGraphType() const { return m_graphType; } + void setGraphType(const BinaryNinja::FunctionViewType& type) { m_graphType = type; } virtual Json::Value serialize() const override; virtual bool deserialize(const Json::Value& value) override; @@ -71,8 +71,8 @@ class BINARYNINJAUIAPI DisassemblyView : public FlowGraphWidget virtual ViewPaneHeaderSubtypeWidget* getHeaderSubtypeWidget() override; virtual QWidget* getHeaderOptionsWidget() override; - virtual BNFunctionGraphType getILViewType() override { return m_ilViewType; }; - virtual void setILViewType(BNFunctionGraphType ilViewType) override; + virtual BinaryNinja::FunctionViewType getILViewType() override { return m_ilViewType; }; + virtual void setILViewType(const BinaryNinja::FunctionViewType& ilViewType) override; void setOption(BNDisassemblyOption option, bool state = true); void toggleOption(BNDisassemblyOption option); @@ -132,7 +132,7 @@ class BINARYNINJAUIAPI DisassemblyView : public FlowGraphWidget void bindActions(); static void addOptionsMenuActions(Menu& menu); - BNFunctionGraphType m_ilViewType; + BinaryNinja::FunctionViewType m_ilViewType; std::set<BNDisassemblyOption> m_options; BNDisassemblyAddressMode m_addressMode; BNDisassemblyCallParameterHints m_callParamHints; @@ -202,7 +202,7 @@ class BINARYNINJAUIAPI DisassemblyFunctionHeader : public QWidget void updateFonts(); void setCurrentFunction(FunctionRef func); - void setILViewType(BNFunctionGraphType ilViewType); + void setILViewType(const BinaryNinja::FunctionViewType& ilViewType); void setHighlightToken(const HighlightTokenState& state); void notifyRefresh(); @@ -235,7 +235,7 @@ class BINARYNINJAUIAPI DisassemblyContainer : public QWidget, public ViewContain void updateFonts(); void refreshHeader(FunctionRef func); void setCurrentFunction(FunctionRef func); - void setILViewType(BNFunctionGraphType ilViewType); + void setILViewType(const BinaryNinja::FunctionViewType& ilViewType); void setHeaderHighlightToken(const HighlightTokenState& state); protected: diff --git a/ui/ilchooser.h b/ui/ilchooser.h index e57b82a6..561e264f 100644 --- a/ui/ilchooser.h +++ b/ui/ilchooser.h @@ -22,10 +22,10 @@ class BINARYNINJAUIAPI ILChooserWidget : public MenuHelper public: ILChooserWidget(QWidget* parent, UIActionHandler* handler, bool longDescription); - void updateStatus(BNFunctionGraphType current); + void updateStatus(const BinaryNinja::FunctionViewType& current); - static QString shortNameForILType(BNFunctionGraphType type); - static QString longNameForILType(BNFunctionGraphType type); + static QString shortNameForILType(const BinaryNinja::FunctionViewType& type); + static QString longNameForILType(const BinaryNinja::FunctionViewType& type); protected: virtual void showMenu() override; diff --git a/ui/linearview.h b/ui/linearview.h index 8dc49041..1c470cb6 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -125,12 +125,14 @@ class StickyHeader: public QWidget uint64_t m_gutterWidthChars; LinearViewLine m_line; + BinaryNinja::FunctionViewType m_viewType; QProgressIndicator* m_updateIndicator; public: StickyHeader(BinaryViewRef data, LinearView* parent); void updateLine(const LinearViewLine& line); + void updateViewType(const BinaryNinja::FunctionViewType& viewType); void updateFonts(); virtual void paintEvent(QPaintEvent* event) override; @@ -209,7 +211,7 @@ class BINARYNINJAUIAPI LinearView : public QAbstractScrollArea, public View, pub SettingsRef m_settings; DisassemblySettingsRef m_options; - BNFunctionGraphType m_ilViewType, m_prevILViewType = InvalidILViewType; + BinaryNinja::FunctionViewType m_ilViewType, m_prevILViewType = InvalidILViewType; HexEditorHighlightState m_highlightState; bool m_singleFunctionView = false; @@ -476,8 +478,8 @@ public: virtual HighlightTokenState getHighlightTokenState() override { return m_highlight; } void setHighlightTokenState(const HighlightTokenState& hts); - virtual BNFunctionGraphType getILViewType() override { return m_ilViewType; }; - virtual void setILViewType(BNFunctionGraphType ilViewType) override; + virtual BinaryNinja::FunctionViewType getILViewType() override { return m_ilViewType; }; + virtual void setILViewType(const BinaryNinja::FunctionViewType& ilViewType) override; void setHighlightMode(HexEditorHighlightMode mode); void setColorMode(HexEditorColorMode mode); @@ -35,7 +35,7 @@ PlatformRef BINARYNINJAUIAPI getOrAskForPlatform(QWidget* parent, BinaryViewRef PlatformRef BINARYNINJAUIAPI getOrAskForPlatform(QWidget* parent, PlatformRef defaultValue); std::optional<std::string> BINARYNINJAUIAPI getStringForGraphType(BNFunctionGraphType type); -std::optional<BNFunctionGraphType> BINARYNINJAUIAPI getGraphTypeForString(const std::string& type); +std::optional<BinaryNinja::FunctionViewType> BINARYNINJAUIAPI getGraphTypeForString(const std::string& type); namespace fmt { diff --git a/ui/variablelist.h b/ui/variablelist.h index 2b7ed8e7..e10d40eb 100644 --- a/ui/variablelist.h +++ b/ui/variablelist.h @@ -101,7 +101,7 @@ class BINARYNINJAUIAPI VariableListModel : public QAbstractListModel ViewFrame* m_view; BinaryViewRef m_data; FunctionRef m_func; - BNFunctionGraphType m_funcType; + BinaryNinja::FunctionViewType m_funcType; bool m_funcExceedsComplexity = false; BinaryNinja::AdvancedFunctionAnalysisDataRequestor m_analysisRequestor; std::vector<VariableListItem> m_items; @@ -123,13 +123,13 @@ class BINARYNINJAUIAPI VariableListModel : public QAbstractListModel FunctionRef function() const; //! Get the current function type. - BNFunctionGraphType functionType() const; + const BinaryNinja::FunctionViewType& functionType() const; //! Whether or not the function exceeds the set complexity threshold bool functionExceedsComplexity() const { return m_funcExceedsComplexity; } //! Set the focused function and update the content of the list. - void setFunction(FunctionRef func, BNFunctionGraphType il, const HighlightTokenState& hts); + void setFunction(FunctionRef func, const BinaryNinja::FunctionViewType& il, const HighlightTokenState& hts); //! Set the selection model, should correspond to the parent widget's. void setSelectionModel(QItemSelectionModel* model); diff --git a/ui/viewframe.h b/ui/viewframe.h index 260939f0..234e01c9 100644 --- a/ui/viewframe.h +++ b/ui/viewframe.h @@ -150,21 +150,21 @@ class BINARYNINJAUIAPI View virtual bool findNextData(uint64_t start, uint64_t end, const BinaryNinja::DataBuffer& data, uint64_t& addr, BNFindFlag flags, const std::function<bool(size_t current, size_t total)>& cb); virtual bool findNextText(uint64_t start, uint64_t end, const std::string& text, uint64_t& addr, - DisassemblySettingsRef settings, BNFindFlag flags, BNFunctionGraphType graph, + DisassemblySettingsRef settings, BNFindFlag flags, const BinaryNinja::FunctionViewType& graph, const std::function<bool(size_t current, size_t total)>& cb); virtual bool findNextConstant(uint64_t start, uint64_t end, uint64_t constant, uint64_t& addr, - DisassemblySettingsRef settings, BNFunctionGraphType graph, + DisassemblySettingsRef settings, const BinaryNinja::FunctionViewType& graph, const std::function<bool(size_t current, size_t total)>& cb); virtual bool findAllData(uint64_t start, uint64_t end, const BinaryNinja::DataBuffer& data, BNFindFlag flags, const std::function<bool(size_t current, size_t total)>& cb, const std::function<bool(uint64_t addr, const BinaryNinja::DataBuffer& match)>& matchCallback); virtual bool findAllText(uint64_t start, uint64_t end, const std::string& data, DisassemblySettingsRef settings, - BNFindFlag flags, BNFunctionGraphType graph, const std::function<bool(size_t current, size_t total)>& cb, + BNFindFlag flags, const BinaryNinja::FunctionViewType& graph, const std::function<bool(size_t current, size_t total)>& cb, const std::function<bool( uint64_t addr, const std::string& match, const BinaryNinja::LinearDisassemblyLine& line)>& matchCallback); virtual bool findAllConstant(uint64_t start, uint64_t end, uint64_t constant, DisassemblySettingsRef settings, - BNFunctionGraphType graph, const std::function<bool(size_t current, size_t total)>& cb, + const BinaryNinja::FunctionViewType& graph, const std::function<bool(size_t current, size_t total)>& cb, const std::function<bool(uint64_t addr, const BinaryNinja::LinearDisassemblyLine& line)>& matchCallback); virtual BinaryViewRef getData() = 0; @@ -228,8 +228,8 @@ class BINARYNINJAUIAPI View virtual LowLevelILFunctionRef getCurrentLowLevelILFunction() { return nullptr; } virtual MediumLevelILFunctionRef getCurrentMediumLevelILFunction() { return nullptr; } virtual HighLevelILFunctionRef getCurrentHighLevelILFunction() { return nullptr; } - virtual BNFunctionGraphType getILViewType() { return InvalidILViewType; } - virtual void setILViewType(BNFunctionGraphType ilViewType) {} + virtual BinaryNinja::FunctionViewType getILViewType() { return InvalidILViewType; } + virtual void setILViewType(const BinaryNinja::FunctionViewType& ilViewType) {} virtual size_t getCurrentILInstructionIndex() { return BN_INVALID_EXPR; } virtual size_t getSelectionStartILInstructionIndex() { return BN_INVALID_EXPR; } virtual BNILIndexRange getILIndexRange() { return {BN_INVALID_EXPR, BN_INVALID_EXPR}; } @@ -290,25 +290,25 @@ class BINARYNINJAUIAPI ViewLocation QString m_viewType; FunctionRef m_function = nullptr; uint64_t m_offset = 0; - BNFunctionGraphType m_ilViewType = InvalidILViewType; + BinaryNinja::FunctionViewType m_ilViewType = InvalidILViewType; size_t m_instrIndex = BN_INVALID_EXPR; public: ViewLocation() {} ViewLocation(const QString& viewType, uint64_t offset) : m_valid(true), m_viewType(viewType), m_offset(offset) {} - ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType) : + ViewLocation(const QString& viewType, uint64_t offset, const BinaryNinja::FunctionViewType& ilViewType) : m_valid(true), m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType) {} - ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) : + ViewLocation(const QString& viewType, uint64_t offset, const BinaryNinja::FunctionViewType& ilViewType, size_t instrIndex) : m_valid(true), m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) {} - ViewLocation(const QString& viewType, FunctionRef function, uint64_t offset, BNFunctionGraphType ilViewType, + ViewLocation(const QString& viewType, FunctionRef function, uint64_t offset, const BinaryNinja::FunctionViewType& ilViewType, size_t instrIndex) : m_valid(true), m_viewType(viewType), m_function(function), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) {} ViewLocation( - FunctionRef function, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex = BN_INVALID_EXPR) : + FunctionRef function, uint64_t offset, const BinaryNinja::FunctionViewType& ilViewType, size_t instrIndex = BN_INVALID_EXPR) : m_valid(true), m_function(function), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) {} @@ -316,13 +316,13 @@ class BINARYNINJAUIAPI ViewLocation bool isValid() const { return m_valid; } QString getViewType() const { return m_viewType; } uint64_t getOffset() const { return m_offset; } - BNFunctionGraphType getILViewType() const { return m_ilViewType; } + const BinaryNinja::FunctionViewType& getILViewType() const { return m_ilViewType; } size_t getInstrIndex() const { return m_instrIndex; } FunctionRef getFunction() const { return m_function; } void setViewType(const QString& viewType) { m_viewType = viewType; } void setOffset(uint64_t offset) { m_offset = offset; } - void setILViewType(BNFunctionGraphType ilViewType) { m_ilViewType = ilViewType; } + void setILViewType(const BinaryNinja::FunctionViewType& ilViewType) { m_ilViewType = ilViewType; } void setInstrIndex(uint64_t index) { m_instrIndex = index; } void setFunction(FunctionRef function) { m_function = function; } diff --git a/ui/xreflist.h b/ui/xreflist.h index eb4edc7e..e9df2df8 100644 --- a/ui/xreflist.h +++ b/ui/xreflist.h @@ -304,7 +304,7 @@ class BINARYNINJAUIAPI CrossReferenceTreeModel : public QAbstractItemModel ViewFrame* m_view; std::vector<XrefItem> m_refs; size_t m_maxUIItems; - std::optional<BNFunctionGraphType> m_graphType; + std::optional<BinaryNinja::FunctionViewType> m_graphType; SelectionInfoForXref m_curRef; QTimer* m_updateTimer; @@ -328,7 +328,7 @@ class BINARYNINJAUIAPI CrossReferenceTreeModel : public QAbstractItemModel ViewFrame* getView() const { return m_view; } virtual void updateMaxUIItems(size_t value) { m_maxUIItems = value; } size_t getMaxUIItems() const { return m_maxUIItems; } - void setGraphType(BNFunctionGraphType type); + void setGraphType(const BinaryNinja::FunctionViewType& type); void requestAdvancedAnalysis(); Q_SIGNALS: @@ -352,7 +352,7 @@ class BINARYNINJAUIAPI CrossReferenceTableModel : public QAbstractTableModel ViewFrame* m_view; std::vector<XrefItem> m_refs; size_t m_maxUIItems; - std::optional<BNFunctionGraphType> m_graphType; + std::optional<BinaryNinja::FunctionViewType> m_graphType; SelectionInfoForXref m_curRef; QTimer* m_updateTimer; @@ -393,7 +393,7 @@ class BINARYNINJAUIAPI CrossReferenceTableModel : public QAbstractTableModel ViewFrame* getView() const { return m_view; } virtual void updateMaxUIItems(size_t value) { m_maxUIItems = value; } size_t getMaxUIItems() const { return m_maxUIItems; } - void setGraphType(BNFunctionGraphType type); + void setGraphType(const BinaryNinja::FunctionViewType& type); void requestAdvancedAnalysis(); Q_SIGNALS: void needRepaint(); @@ -530,7 +530,7 @@ public: virtual int filteredCount() const override; void updateTextFilter(const QString& filterText); virtual void updateMaxUIItems(size_t count) override; - void setGraphType(BNFunctionGraphType type) { m_tree->setGraphType(type); } + void setGraphType(const BinaryNinja::FunctionViewType& type) { m_tree->setGraphType(type); } virtual void OnAnalysisFunctionUpdated(BinaryNinja::BinaryView* view, BinaryNinja::Function* func) override; Q_SIGNALS: @@ -574,7 +574,7 @@ class BINARYNINJAUIAPI CrossReferenceTable : public QTableView, public CrossRefe virtual int leafCount() const override; virtual int filteredCount() const override; virtual void updateMaxUIItems(size_t count) override; - void setGraphType(BNFunctionGraphType type) { m_table->setGraphType(type); } + void setGraphType(const BinaryNinja::FunctionViewType& type) { m_table->setGraphType(type); } virtual void OnAnalysisFunctionUpdated(BinaryNinja::BinaryView* view, BinaryNinja::Function* func) override; public Q_SLOTS: @@ -609,7 +609,7 @@ class BINARYNINJAUIAPI CrossReferenceWidget : public SidebarWidget, public UICon CrossReferenceContainer* m_container; bool m_useTableView; Qt::Orientation m_primaryOrientation; - std::optional<BNFunctionGraphType> m_graphType; + std::optional<BinaryNinja::FunctionViewType> m_graphType; QTimer* m_hoverTimer; QPoint m_hoverPos; @@ -656,7 +656,7 @@ class BINARYNINJAUIAPI CrossReferenceWidget : public SidebarWidget, public UICon bool tableView() const { return m_useTableView; } bool uiMaxItemsExceeded() const { return m_uiMaxItemsExceeded; } void setUIMaxItemsExceeded(bool value) { m_uiMaxItemsExceeded = value; } - void setGraphType(BNFunctionGraphType type); + void setGraphType(const BinaryNinja::FunctionViewType& type); virtual void focus() override; |
