Debugger: Simplify "debug last command"

Let the engine decide what to do. Less magic parsing, less code,
and survives cleaning the log view.

Change-Id: Ic94f27899d7986fb5ce3d24bb2edce8e6faf899c
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hjk
2014-01-04 01:34:51 +01:00
parent 63c2656d55
commit 32aeb579bb
7 changed files with 28 additions and 27 deletions

View File

@@ -433,27 +433,22 @@ LogWindow::LogWindow(QWidget *parent)
void LogWindow::executeLine()
{
m_ignoreNextInputEcho = true;
debuggerCore()->executeDebuggerCommand(m_inputText->textCursor().block().text(),
CppLanguage);
debuggerCore()->currentEngine()->
executeDebuggerCommand(m_inputText->textCursor().block().text(), 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;
}
}
debuggerCore()->currentEngine()->debugLastCommand();
}
void LogWindow::sendCommand()
{
debuggerCore()->executeDebuggerCommand(m_commandEdit->text(), CppLanguage);
DebuggerEngine *engine = debuggerCore()->currentEngine();
if (engine->acceptsDebuggerCommands())
engine->executeDebuggerCommand(m_commandEdit->text(), CppLanguage);
else
showOutput(LogError, tr("User commands are not accepted in the current state."));
}
void LogWindow::showOutput(int channel, const QString &output)