diff --git a/src/SeerBreakpointsBrowserWidget.cpp b/src/SeerBreakpointsBrowserWidget.cpp index 923f77a..93c25e6 100644 --- a/src/SeerBreakpointsBrowserWidget.cpp +++ b/src/SeerBreakpointsBrowserWidget.cpp @@ -4,6 +4,8 @@ #include #include #include +#include +#include #include #include @@ -44,6 +46,9 @@ SeerBreakpointsBrowserWidget::SeerBreakpointsBrowserWidget (QWidget* parent) : Q QObject::connect(deleteBreakpointsToolButton, &QToolButton::clicked, this, &SeerBreakpointsBrowserWidget::handleDeleteToolButton); QObject::connect(enableBreakpointsToolButton, &QToolButton::clicked, this, &SeerBreakpointsBrowserWidget::handleEnableToolButton); QObject::connect(disableBreakpointsToolButton, &QToolButton::clicked, this, &SeerBreakpointsBrowserWidget::handleDisableToolButton); + QObject::connect(conditionBreakpointToolButton, &QToolButton::clicked, this, &SeerBreakpointsBrowserWidget::handleConditionToolButton); + QObject::connect(ignoreBreakpointToolButton, &QToolButton::clicked, this, &SeerBreakpointsBrowserWidget::handleIgnoreToolButton); + QObject::connect(commandsBreakpointToolButton, &QToolButton::clicked, this, &SeerBreakpointsBrowserWidget::handleCommandsToolButton); } SeerBreakpointsBrowserWidget::~SeerBreakpointsBrowserWidget () { @@ -302,6 +307,93 @@ void SeerBreakpointsBrowserWidget::handleDisableToolButton () { emit disableBreakpoints(breakpoints); } +void SeerBreakpointsBrowserWidget::handleConditionToolButton () { + + // Get selected tree items. Only allow one. + QList items = breakpointsTreeWidget->selectedItems(); + + if (items.count() == 0) { + return; + } + + if (items.count() > 1) { + QMessageBox::warning(this, "Seer", "Select only one breakpoint when adding a condition.", QMessageBox::Ok); + return; + } + + // Get the condition text. + bool ok; + QString condition = QInputDialog::getText(this, "Seer", "Enter the condition for this breakpoint.\nA blank condition will remove an existing one.", QLineEdit::Normal, QString(), &ok); + + if (ok == false) { + return; + } + + // Get the selected breakpoint number. + QString breakpoint = items.front()->text(0); + + // Send the signal. + emit addBreakpointCondition(breakpoint, condition); +} + +void SeerBreakpointsBrowserWidget::handleIgnoreToolButton () { + + // Get selected tree items. Only allow one. + QList items = breakpointsTreeWidget->selectedItems(); + + if (items.count() == 0) { + return; + } + + if (items.count() > 1) { + QMessageBox::warning(this, "Seer", "Select only one breakpoint when adding an ignore count.", QMessageBox::Ok); + return; + } + + // Get the ignore text. + bool ok; + int count = QInputDialog::getInt(this, "Seer", "Enter the ignore count for this breakpoint.\nA count of 0 will remove an existing one.", 0, 0, 2147483647, 1, &ok); + + if (ok == false) { + return; + } + + // Get the selected breakpoint number. + QString breakpoint = items.front()->text(0); + + // Send the signal. + emit addBreakpointIgnore(breakpoint, QString::number(count)); +} + +void SeerBreakpointsBrowserWidget::handleCommandsToolButton () { + + // Get selected tree items. Only allow one. + QList items = breakpointsTreeWidget->selectedItems(); + + if (items.count() == 0) { + return; + } + + if (items.count() > 1) { + QMessageBox::warning(this, "Seer", "Select only one breakpoint when adding commands.", QMessageBox::Ok); + return; + } + + // Get the ignore text. + bool ok; + QString commands = QInputDialog::getMultiLineText(this, "Seer", "Enter the commands to execute for this breakpoint.\nA blank list will remove existing ones.", QString(), &ok); + + if (ok == false) { + return; + } + + // Get the selected breakpoint number. + QString breakpoint = items.front()->text(0); + + // Send the signal. + emit addBreakpointCommands(breakpoint, commands.split('\n', Qt::SkipEmptyParts)); +} + void SeerBreakpointsBrowserWidget::showEvent (QShowEvent* event) { QWidget::showEvent(event); diff --git a/src/SeerBreakpointsBrowserWidget.h b/src/SeerBreakpointsBrowserWidget.h index f0c2b52..4c2fd97 100644 --- a/src/SeerBreakpointsBrowserWidget.h +++ b/src/SeerBreakpointsBrowserWidget.h @@ -26,12 +26,18 @@ class SeerBreakpointsBrowserWidget : public QWidget, protected Ui::SeerBreakpoin void handleDeleteToolButton (); void handleEnableToolButton (); void handleDisableToolButton (); + void handleConditionToolButton (); + void handleIgnoreToolButton (); + void handleCommandsToolButton (); signals: void refreshBreakpointsList (); void deleteBreakpoints (QString breakpoints); void enableBreakpoints (QString breakpoints); void disableBreakpoints (QString breakpoints); + void addBreakpointCondition (QString breakpoint, QString condition); + void addBreakpointIgnore (QString breakpoint, QString count); + void addBreakpointCommands (QString breakpoint, QStringList commands); void insertBreakpoint (QString breakpoint); void selectedFile (QString file, QString fullname, int lineno); void selectedAddress (QString address); diff --git a/src/SeerBreakpointsBrowserWidget.ui b/src/SeerBreakpointsBrowserWidget.ui index 1fc7818..cd35648 100644 --- a/src/SeerBreakpointsBrowserWidget.ui +++ b/src/SeerBreakpointsBrowserWidget.ui @@ -6,7 +6,7 @@ 0 0 - 794 + 896 528 @@ -92,22 +92,8 @@ - - - - - Refresh the list of breakpoints. - - - - - - - :/seer/resources/RelaxLightIcons/view-refresh.svg:/seer/resources/RelaxLightIcons/view-refresh.svg - - - - + + Add a new breakpoint. @@ -121,21 +107,21 @@ - - + + - Delete selected breakpoints. + Refresh the list of breakpoints. - ... + - :/seer/resources/RelaxLightIcons/edit-delete.svg:/seer/resources/RelaxLightIcons/edit-delete.svg + :/seer/resources/RelaxLightIcons/view-refresh.svg:/seer/resources/RelaxLightIcons/view-refresh.svg - + Enable selected breakpoints. @@ -149,7 +135,7 @@ - + Disable selected breakpoints. @@ -163,8 +149,69 @@ - - + + + + Add condition to selected breakpoint. + + + ? + + + + + + + Add ignore count to selected breakpoint. + + + 5 + + + + + + + Add commands to selected breakpoint. + + + ... + + + + :/seer/resources/RelaxLightIcons/go-next.svg:/seer/resources/RelaxLightIcons/go-next.svg + + + + + + + Delete selected breakpoints. + + + ... + + + + :/seer/resources/RelaxLightIcons/edit-delete.svg:/seer/resources/RelaxLightIcons/edit-delete.svg + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + Qt::Vertical diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 9c9612b..1d0b3c2 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -80,8 +80,11 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) { _watchpointsBrowserWidget = new SeerWatchpointsBrowserWidget(this); _catchpointsBrowserWidget = new SeerCatchpointsBrowserWidget(this); _printpointsBrowserWidget = new SeerPrintpointsBrowserWidget(this); + _gdbOutputLog = new SeerGdbLogWidget(this); _seerOutputLog = new SeerSeerLogWidget(this); + _gdbOutputLog->setPlaceholderText("[gdb output]"); + _seerOutputLog->setPlaceholderText("[seer output]"); logsTabWidget->addTab(_breakpointsBrowserWidget, "Breakpoints"); logsTabWidget->addTab(_watchpointsBrowserWidget, "Watchpoints"); @@ -275,6 +278,9 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) { QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::enableBreakpoints, this, &SeerGdbWidget::handleGdbBreakpointEnable); QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::disableBreakpoints, this, &SeerGdbWidget::handleGdbBreakpointDisable); QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::insertBreakpoint, this, &SeerGdbWidget::handleGdbBreakpointInsert); + QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::addBreakpointCondition, this, &SeerGdbWidget::handleGdbBreakpointCondition); + QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::addBreakpointIgnore, this, &SeerGdbWidget::handleGdbBreakpointIgnore); + QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::addBreakpointCommands, this, &SeerGdbWidget::handleGdbBreakpointCommands); QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::selectedFile, editorManagerWidget, &SeerEditorManagerWidget::handleOpenFile); QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::selectedAddress, editorManagerWidget, &SeerEditorManagerWidget::handleOpenAddress); @@ -1861,6 +1867,46 @@ void SeerGdbWidget::handleGdbBreakpointInsert (QString breakpoint) { handleGdbGenericpointList(); } +void SeerGdbWidget::handleGdbBreakpointCondition (QString breakpoint, QString condition) { + + if (executableLaunchMode() == "") { + return; + } + + handleGdbCommand("-break-condition " + breakpoint + " " + condition); + handleGdbGenericpointList(); +} + +void SeerGdbWidget::handleGdbBreakpointIgnore (QString breakpoint, QString count) { + + if (executableLaunchMode() == "") { + return; + } + + handleGdbCommand("-break-after " + breakpoint + " " + count); + handleGdbGenericpointList(); +} + +void SeerGdbWidget::handleGdbBreakpointCommands (QString breakpoint, QStringList commands) { + + if (executableLaunchMode() == "") { + return; + } + + QString commandstext; + + for (int i=0; iverticalScrollBar()->setValue(textEdit->verticalScrollBar()->maximum()); } +void SeerLogWidget::setPlaceholderText (const QString& text) { + + textEdit->setPlaceholderText(text); +} + void SeerLogWidget::handleText (const QString& text) { // Don't do anything if we're not enabled. diff --git a/src/SeerLogWidget.h b/src/SeerLogWidget.h index eb6442b..642934c 100644 --- a/src/SeerLogWidget.h +++ b/src/SeerLogWidget.h @@ -17,6 +17,7 @@ class SeerLogWidget : public QWidget, protected Ui::SeerLogWidgetForm { bool isLogEnabled () const; void setLogEnabled (bool flag); void moveToEnd (); + void setPlaceholderText (const QString& text); signals: void logEnabledChanged (bool flag); diff --git a/src/SeerLogWidget.ui b/src/SeerLogWidget.ui index 30a8207..42478f0 100644 --- a/src/SeerLogWidget.ui +++ b/src/SeerLogWidget.ui @@ -14,7 +14,7 @@ Seer Log - + @@ -34,94 +34,102 @@ - - - Clear the log output. - - - - - - - - - - :/seer/resources/RelaxLightIcons/edit-clear.svg:/seer/resources/RelaxLightIcons/edit-clear.svg - - - - - - - Print the log output. - - - - - - - - - - :/seer/resources/RelaxLightIcons/document-print.svg:/seer/resources/RelaxLightIcons/document-print.svg - - - - - - - Save the log output to a file. - - - - - - - - - - :/seer/resources/RelaxLightIcons/document-save-as.svg:/seer/resources/RelaxLightIcons/document-save-as.svg - - - - - - - Wrap long lines to the next line. - - - - - - Wrap Text - - - - - - - Enable/Disable output to this log. - - - Enable - - - true - - - - - - - Qt::Vertical - - - - 20 - 266 - - - + + + + + + + Clear the log output. + + + + + + + + + + :/seer/resources/RelaxLightIcons/edit-clear.svg:/seer/resources/RelaxLightIcons/edit-clear.svg + + + + + + + Print the log output. + + + + + + + + + + :/seer/resources/RelaxLightIcons/document-print.svg:/seer/resources/RelaxLightIcons/document-print.svg + + + + + + + Save the log output to a file. + + + + + + + + + + :/seer/resources/RelaxLightIcons/document-save-as.svg:/seer/resources/RelaxLightIcons/document-save-as.svg + + + + + + + + + Wrap long lines to the next line. + + + + + + Wrap Text + + + + + + + Enable/Disable output to this log. + + + Enable + + + true + + + + + + + Qt::Vertical + + + + 28 + 168 + + + + +