forked from qt-creator/qt-creator
Debugger: Do not pass inferior output unncessarily through MI parser
Change-Id: I809c6bf9cd1b97a728af341819b3f009335ffa36 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -150,11 +150,12 @@ static QString parsePlainConsoleStream(const DebuggerResponse &response)
|
|||||||
return out.mid(pos + 3);
|
return out.mid(pos + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isMostlyHarmlessMessage(const QString &msg)
|
static bool isMostlyHarmlessMessage(const QStringRef &msg)
|
||||||
{
|
{
|
||||||
return msg == "warning: GDB: Failed to set controlling terminal: "
|
return msg == "warning: GDB: Failed to set controlling terminal: "
|
||||||
"Inappropriate ioctl for device\\n"
|
"Inappropriate ioctl for device\\n"
|
||||||
|| msg == "warning: GDB: Failed to set controlling terminal: Invalid argument\\n";
|
|| msg == "warning: GDB: Failed to set controlling terminal: "
|
||||||
|
"Invalid argument\\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
@@ -222,7 +223,8 @@ GdbEngine::GdbEngine(const DebuggerRunParameters &startParameters)
|
|||||||
m_sourcesListUpdating = false;
|
m_sourcesListUpdating = false;
|
||||||
m_oldestAcceptableToken = -1;
|
m_oldestAcceptableToken = -1;
|
||||||
m_nonDiscardableCount = 0;
|
m_nonDiscardableCount = 0;
|
||||||
m_outputCodec = QTextCodec::codecForLocale();
|
m_gdbOutputCodec = QTextCodec::codecForLocale();
|
||||||
|
m_inferiorOutputCodec = QTextCodec::codecForLocale();
|
||||||
m_pendingBreakpointRequests = 0;
|
m_pendingBreakpointRequests = 0;
|
||||||
m_commandsDoneCallback = 0;
|
m_commandsDoneCallback = 0;
|
||||||
m_stackNeeded = false;
|
m_stackNeeded = false;
|
||||||
@@ -496,7 +498,6 @@ void GdbEngine::handleResponse(const QString &buff)
|
|||||||
case '@': {
|
case '@': {
|
||||||
QString data = GdbMi::parseCString(from, to);
|
QString data = GdbMi::parseCString(from, to);
|
||||||
QString msg = data.mid(2, data.size() - 4);
|
QString msg = data.mid(2, data.size() - 4);
|
||||||
if (!isMostlyHarmlessMessage(msg))
|
|
||||||
showMessage(msg, AppOutput);
|
showMessage(msg, AppOutput);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -505,13 +506,8 @@ void GdbEngine::handleResponse(const QString &buff)
|
|||||||
QString data = GdbMi::parseCString(from, to);
|
QString data = GdbMi::parseCString(from, to);
|
||||||
// On Windows, the contents seem to depend on the debugger
|
// On Windows, the contents seem to depend on the debugger
|
||||||
// version and/or OS version used.
|
// version and/or OS version used.
|
||||||
if (data.startsWith("warning:")) {
|
if (data.startsWith("warning:"))
|
||||||
if (isMostlyHarmlessMessage(data)) {
|
|
||||||
showMessage("Mostly harmless terminal warning suppressed.", LogWarning);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
showMessage(data.mid(9), AppStuff); // Cut "warning: "
|
showMessage(data.mid(9), AppStuff); // Cut "warning: "
|
||||||
}
|
|
||||||
|
|
||||||
m_pendingLogStreamOutput += data;
|
m_pendingLogStreamOutput += data;
|
||||||
|
|
||||||
@@ -581,8 +577,6 @@ void GdbEngine::handleResponse(const QString &buff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//qDebug() << "\nLOG STREAM:" + m_pendingLogStreamOutput;
|
|
||||||
//qDebug() << "\nCONSOLE STREAM:" + m_pendingConsoleStreamOutput;
|
|
||||||
response.logStreamOutput = m_pendingLogStreamOutput;
|
response.logStreamOutput = m_pendingLogStreamOutput;
|
||||||
response.consoleStreamOutput = m_pendingConsoleStreamOutput;
|
response.consoleStreamOutput = m_pendingConsoleStreamOutput;
|
||||||
m_pendingLogStreamOutput.clear();
|
m_pendingLogStreamOutput.clear();
|
||||||
@@ -796,8 +790,13 @@ void GdbEngine::readGdbStandardError()
|
|||||||
|
|
||||||
void GdbEngine::readDebuggeeOutput(const QByteArray &ba)
|
void GdbEngine::readDebuggeeOutput(const QByteArray &ba)
|
||||||
{
|
{
|
||||||
QString msg = m_outputCodec->toUnicode(ba.constData(), ba.size(), &m_outputCodecState);
|
const QString msg = m_inferiorOutputCodec->toUnicode(ba.constData(), ba.size(),
|
||||||
handleResponse(msg);
|
&m_inferiorOutputCodecState);
|
||||||
|
|
||||||
|
if (msg.startsWith("&\"") && isMostlyHarmlessMessage(msg.midRef(2, msg.size() - 4)))
|
||||||
|
showMessage("Mostly harmless terminal warning suppressed.", LogWarning);
|
||||||
|
else
|
||||||
|
showMessage(msg, AppStuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::readGdbStandardOutput()
|
void GdbEngine::readGdbStandardOutput()
|
||||||
@@ -832,8 +831,8 @@ void GdbEngine::readGdbStandardOutput()
|
|||||||
}
|
}
|
||||||
m_busy = true;
|
m_busy = true;
|
||||||
|
|
||||||
QString msg = m_outputCodec->toUnicode(m_inbuffer.constData() + start, end - start,
|
QString msg = m_gdbOutputCodec->toUnicode(m_inbuffer.constData() + start, end - start,
|
||||||
&m_outputCodecState);
|
&m_gdbOutputCodecState);
|
||||||
|
|
||||||
handleResponse(msg);
|
handleResponse(msg);
|
||||||
m_busy = false;
|
m_busy = false;
|
||||||
|
|||||||
@@ -133,8 +133,10 @@ private slots:
|
|||||||
void readDebuggeeOutput(const QByteArray &ba);
|
void readDebuggeeOutput(const QByteArray &ba);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTextCodec *m_outputCodec;
|
QTextCodec *m_gdbOutputCodec;
|
||||||
QTextCodec::ConverterState m_outputCodecState;
|
QTextCodec::ConverterState m_gdbOutputCodecState;
|
||||||
|
QTextCodec *m_inferiorOutputCodec;
|
||||||
|
QTextCodec::ConverterState m_inferiorOutputCodecState;
|
||||||
|
|
||||||
QByteArray m_inbuffer;
|
QByteArray m_inbuffer;
|
||||||
bool m_busy;
|
bool m_busy;
|
||||||
|
|||||||
Reference in New Issue
Block a user