diff options
author | hjk <hjk121@nokiamail.com> | 2013-07-12 13:23:51 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2013-07-12 14:44:08 +0200 |
commit | 2c7daecd26602e2dbf9a7eb2b0ceff0f671dcba3 (patch) | |
tree | 26f7148b722e6dd71167559142dc0ae313fddcc3 | |
parent | 108085008fd0565d55fff6ebb30a7c0b9678e4db (diff) | |
download | qt-creator-2c7daecd26602e2dbf9a7eb2b0ceff0f671dcba3.tar.gz |
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>
-rw-r--r-- | src/plugins/debugger/logwindow.cpp | 28 | ||||
-rw-r--r-- | 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 f54f1c5611..0b62cc0f60 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 cabc729c8c..e303c3b1b9 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; }; |