From 2c7daecd26602e2dbf9a7eb2b0ceff0f671dcba3 Mon Sep 17 00:00:00 2001 From: hjk <hjk121@nokiamail.com> Date: Fri, 12 Jul 2013 13:23:51 +0200 Subject: [PATCH] Debugger: Add button to debug python dumpers This searches the last 'bb' command and triggers a re-run with the 'pe' option added. Change-Id: Icbe251c9f8980f3bcd0ba10171ec39f0fb02c2f4 Reviewed-by: hjk <hjk121@nokiamail.com> --- src/plugins/debugger/logwindow.cpp | 28 ++++++++++++++++++++++++++-- src/plugins/debugger/logwindow.h | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index f54f1c5611d..0b62cc0f60f 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -41,7 +41,9 @@ #include <QMenu> #include <QSyntaxHighlighter> #include <QPlainTextEdit> +#include <QPushButton> #include <QFileDialog> +#include <QToolButton> #include <aggregation/aggregate.h> #include <coreplugin/findplaceholder.h> @@ -360,12 +362,18 @@ LogWindow::LogWindow(QWidget *parent) m_inputText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - m_commandLabel = new QLabel(tr("Command:"), this); m_commandEdit = new Utils::FancyLineEdit(this); m_commandEdit->setFrame(false); m_commandEdit->setHistoryCompleter(QLatin1String("DebuggerInput")); + + QToolButton *repeatButton = new QToolButton(this); + repeatButton->setIcon(QIcon(QLatin1String(":/debugger/images/debugger_stepover_small.png"))); + repeatButton->setIconSize(QSize(12, 12)); + repeatButton->setToolTip(tr("Repeat last command for debug reasons")); + QHBoxLayout *commandBox = new QHBoxLayout; - commandBox->addWidget(m_commandLabel); + commandBox->addWidget(repeatButton); + commandBox->addWidget(new QLabel(tr("Command:"), this)); commandBox->addWidget(m_commandEdit); commandBox->setMargin(2); commandBox->setSpacing(6); @@ -407,6 +415,8 @@ LogWindow::LogWindow(QWidget *parent) SLOT(sendCommand())); connect(m_inputText, SIGNAL(executeLineRequested()), SLOT(executeLine())); + connect(repeatButton, SIGNAL(clicked()), + SLOT(repeatLastCommand())); connect(&m_outputTimer, SIGNAL(timeout()), SLOT(doOutput())); @@ -420,6 +430,20 @@ void LogWindow::executeLine() CppLanguage); } +void LogWindow::repeatLastCommand() +{ + QTextCursor tc = m_inputText->textCursor(); + QRegExp re = QRegExp(QLatin1String("^\\d+(bb options:)(.*)$")); + for (QTextBlock block = tc.block(); block.isValid(); block = block.previous()) { + QString line = block.text(); + if (re.exactMatch(line)) { + QString cmd = re.cap(1) + QLatin1String("pe,") + re.cap(2); + debuggerCore()->executeDebuggerCommand(cmd, CppLanguage); + return; + } + } +} + void LogWindow::sendCommand() { debuggerCore()->executeDebuggerCommand(m_commandEdit->text(), CppLanguage); diff --git a/src/plugins/debugger/logwindow.h b/src/plugins/debugger/logwindow.h index cabc729c8c3..e303c3b1b99 100644 --- a/src/plugins/debugger/logwindow.h +++ b/src/plugins/debugger/logwindow.h @@ -75,6 +75,7 @@ public slots: void showOutput(int channel, const QString &output); void showInput(int channel, const QString &input); void doOutput(); + void repeatLastCommand(); signals: void showPage(); @@ -86,7 +87,6 @@ private: QTimer m_outputTimer; QString m_queuedOutput; Utils::FancyLineEdit *m_commandEdit; - QLabel *m_commandLabel; bool m_ignoreNextInputEcho; }; -- GitLab