diff --git a/debuggers/common/midebugger.h b/debuggers/common/midebugger.h --- a/debuggers/common/midebugger.h +++ b/debuggers/common/midebugger.h @@ -118,10 +118,13 @@ void userCommandOutput(const QString& s); /** Reports output of a command issued internally - by KDevelop. At the moment, stderr output from - debugger and the 'log' MI channel will be also routed here. */ + by KDevelop. */ void internalCommandOutput(const QString& s); + /** Reports debugger interal output, including stderr output from debugger + and the 'log' MI channel */ + void debuggerInternalOutput(const QString& s); + protected Q_SLOTS: void readyReadStandardOutput(); void readyReadStandardError(); diff --git a/debuggers/common/midebugger.cpp b/debuggers/common/midebugger.cpp --- a/debuggers/common/midebugger.cpp +++ b/debuggers/common/midebugger.cpp @@ -139,7 +139,7 @@ void MIDebugger::readyReadStandardError() { process_->setReadChannel(QProcess::StandardError); - emit internalCommandOutput(QString::fromUtf8(process_->readAll())); + emit debuggerInternalOutput(QString::fromUtf8(process_->readAll())); } void MIDebugger::processLine(const QByteArray& line) @@ -266,17 +266,16 @@ if (s.subkind == MI::StreamRecord::Target) { emit applicationOutput(s.message); - } else { + } else if (s.subkind == MI::StreamRecord::Console) { if (currentCmd_ && currentCmd_->isUserCommand()) emit userCommandOutput(s.message); - else if (s.subkind == MI::StreamRecord::Console) { - emit applicationOutput(s.message); - } else { + else emit internalCommandOutput(s.message); - } if (currentCmd_) currentCmd_->newOutput(s.message); + } else { + emit debuggerInternalOutput(s.message); } emit streamRecord(s); diff --git a/debuggers/common/midebugjobs.cpp b/debuggers/common/midebugjobs.cpp --- a/debuggers/common/midebugjobs.cpp +++ b/debuggers/common/midebugjobs.cpp @@ -43,6 +43,7 @@ #include #include +#include using namespace KDevMI; using namespace KDevelop; @@ -58,6 +59,11 @@ m_session = p->createSession(); connect(m_session, &MIDebugSession::inferiorStdoutLines, this, &MIDebugJob::stderrReceived); connect(m_session, &MIDebugSession::inferiorStderrLines, this, &MIDebugJob::stdoutReceived); + connect(m_session, &MIDebugSession::debuggerInternalCommandOutput, + this, [this](const QString &output){ + this->stdoutReceived(output.split(QRegularExpression("[\r\n]"), QString::SkipEmptyParts)); + }); + connect(m_session, &MIDebugSession::finished, this, &MIDebugJob::done); if (launchcfg->project()) { diff --git a/debuggers/common/midebugsession.h b/debuggers/common/midebugsession.h --- a/debuggers/common/midebugsession.h +++ b/debuggers/common/midebugsession.h @@ -87,6 +87,11 @@ void debuggerInternalCommandOutput(const QString &output); /** + * Emits when received internal output from debugger + */ + void debuggerInternalOutput(const QString &output); + + /** * Emits when received standard output from inferior's tty */ void inferiorTtyStdout(const QByteArray &output); diff --git a/debuggers/common/midebugsession.cpp b/debuggers/common/midebugsession.cpp --- a/debuggers/common/midebugsession.cpp +++ b/debuggers/common/midebugsession.cpp @@ -163,6 +163,7 @@ }); connect(m_debugger, &MIDebugger::userCommandOutput, this, &MIDebugSession::debuggerUserCommandOutput); connect(m_debugger, &MIDebugger::internalCommandOutput, this, &MIDebugSession::debuggerInternalCommandOutput); + connect(m_debugger, &MIDebugger::debuggerInternalOutput, this, &MIDebugSession::debuggerInternalOutput); // state signals connect(m_debugger, &MIDebugger::programStopped, this, &MIDebugSession::inferiorStopped); diff --git a/debuggers/gdb/gdboutputwidget.cpp b/debuggers/gdb/gdboutputwidget.cpp --- a/debuggers/gdb/gdboutputwidget.cpp +++ b/debuggers/gdb/gdboutputwidget.cpp @@ -136,6 +136,9 @@ this, &GDBOutputWidget::slotInternalCommandStdout); connect(session, &DebugSession::debuggerUserCommandOutput, this, &GDBOutputWidget::slotUserCommandStdout); + // debugger internal output, treat it as an internal command output + connect(session, &DebugSession::debuggerInternalOutput, + this, &GDBOutputWidget::slotInternalCommandStdout); connect(session, &DebugSession::debuggerStateChanged, this, &GDBOutputWidget::slotStateChanged);