diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2025-07-31 14:27:00 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2025-08-01 14:35:05 -0400 |
| commit | afccc4b8e0a698b9e9ae39865162c671380e876a (patch) | |
| tree | 8cfee48a476f6503437f3f3e1dbabda497c85143 /ui | |
| parent | 8df034ed6b3a1a52bd268ed43e783c35b687408f (diff) | |
Add log message dialog for showing stack traces
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/logmessagedialog.h | 38 | ||||
| -rw-r--r-- | ui/logview.h | 2 | ||||
| -rw-r--r-- | ui/uitypes.h | 2 |
3 files changed, 41 insertions, 1 deletions
diff --git a/ui/logmessagedialog.h b/ui/logmessagedialog.h new file mode 100644 index 00000000..c63a3838 --- /dev/null +++ b/ui/logmessagedialog.h @@ -0,0 +1,38 @@ +#pragma once + +#include <QtWidgets/QDialog> +#include "binaryninjaapi.h" +#include "uitypes.h" +#include "clickablelabel.h" + +/*! + + \defgroup logmessagedialog LogMessageDialog + \ingroup uiapi +*/ + +/*! + \ingroup logmessagedialog +*/ +class BINARYNINJAUIAPI LogMessageDialog : public QDialog +{ + Q_OBJECT + + QString m_stackTrace; + ClickableLabel* m_showStackTraceLabel = nullptr; + QVBoxLayout* m_stackTraceLayout = nullptr; + bool m_stackTraceVisible = false; + + static constexpr int MAX_WIDTH = 720; + static constexpr int STACK_TRACE_HEIGHT = 300; + + void init(BNLogLevel level, const QString& stackTrace, const QString& message); + +public: + LogMessageDialog(QWidget* parent, BNLogLevel level, const std::optional<std::string>& stackTrace, + const std::string& message); + LogMessageDialog(QWidget* parent, BNLogLevel level, const QString& stackTrace, const QString& message); + +public Q_SLOTS: + void requestStackTrace(); +}; diff --git a/ui/logview.h b/ui/logview.h index b1ce57a1..36016ff8 100644 --- a/ui/logview.h +++ b/ui/logview.h @@ -49,6 +49,7 @@ struct BINARYNINJAUIAPI LogListItem size_t sessionId; BNLogLevel level; QString text; + QString stackTrace; LogTokenList tokens; bool selected; QString logger; @@ -122,6 +123,7 @@ class BINARYNINJAUIAPI LogListModel : public QAbstractItemModel, BinaryNinja::Lo static constexpr int Session = Qt::UserRole + 5; static constexpr int FormattedMessage = Qt::UserRole + 6; static constexpr int Tokens = Qt::UserRole + 7; + static constexpr int StackTrace = Qt::UserRole + 8; LogListModel(QWidget* parent); ~LogListModel(); diff --git a/ui/uitypes.h b/ui/uitypes.h index 89d2bdcd..b0197adc 100644 --- a/ui/uitypes.h +++ b/ui/uitypes.h @@ -6,7 +6,7 @@ // there are changes to the API that affect linking, including new functions, // new types, modifications to existing functions or types, or new versions // of the Qt libraries. -#define BN_CURRENT_UI_ABI_VERSION 9 +#define BN_CURRENT_UI_ABI_VERSION 10 // Minimum ABI version that is supported for loading of plugins. Plugins that // are linked to an ABI version less than this will not be able to load and |
