forked from qt-creator/qt-creator
Debugger: use QtcProcess output buffer
Change-Id: I03326879bbcf2411a1feab8b6826ddd4c0981286 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -204,10 +204,8 @@ CdbEngine::CdbEngine() :
|
|||||||
this, &CdbEngine::createFullBacktrace);
|
this, &CdbEngine::createFullBacktrace);
|
||||||
connect(&m_process, &QtcProcess::started, this, &CdbEngine::processStarted);
|
connect(&m_process, &QtcProcess::started, this, &CdbEngine::processStarted);
|
||||||
connect(&m_process, &QtcProcess::done, this, &CdbEngine::processDone);
|
connect(&m_process, &QtcProcess::done, this, &CdbEngine::processDone);
|
||||||
connect(&m_process, &QtcProcess::readyReadStandardOutput,
|
m_process.setStdOutLineCallback([this](const QString &line) { parseOutputLine(line); });
|
||||||
this, &CdbEngine::readyReadStandardOut);
|
m_process.setStdErrLineCallback([this](const QString &line) { parseOutputLine(line); });
|
||||||
connect(&m_process, &QtcProcess::readyReadStandardError,
|
|
||||||
this, &CdbEngine::readyReadStandardOut);
|
|
||||||
connect(&s->useDebuggingHelpers, &BaseAspect::changed,
|
connect(&s->useDebuggingHelpers, &BaseAspect::changed,
|
||||||
this, &CdbEngine::updateLocals);
|
this, &CdbEngine::updateLocals);
|
||||||
|
|
||||||
@@ -230,7 +228,6 @@ void CdbEngine::init()
|
|||||||
m_autoBreakPointCorrection = false;
|
m_autoBreakPointCorrection = false;
|
||||||
m_wow64State = wow64Uninitialized;
|
m_wow64State = wow64Uninitialized;
|
||||||
|
|
||||||
m_outputBuffer.clear();
|
|
||||||
m_commandForToken.clear();
|
m_commandForToken.clear();
|
||||||
m_currentBuiltinResponse.clear();
|
m_currentBuiltinResponse.clear();
|
||||||
m_extensionMessageBuffer.clear();
|
m_extensionMessageBuffer.clear();
|
||||||
@@ -434,7 +431,6 @@ void CdbEngine::setupEngine()
|
|||||||
QLocale::system().toString(extensionFi.lastModified(), QLocale::ShortFormat));
|
QLocale::system().toString(extensionFi.lastModified(), QLocale::ShortFormat));
|
||||||
showMessage(msg, LogMisc);
|
showMessage(msg, LogMisc);
|
||||||
|
|
||||||
m_outputBuffer.clear();
|
|
||||||
m_autoBreakPointCorrection = false;
|
m_autoBreakPointCorrection = false;
|
||||||
|
|
||||||
Environment inferiorEnvironment = sp.inferior.environment.isValid()
|
Environment inferiorEnvironment = sp.inferior.environment.isValid()
|
||||||
@@ -2282,6 +2278,8 @@ void CdbEngine::parseOutputLine(QString line)
|
|||||||
// it should happen only in initial and exit stages. Note however that
|
// it should happen only in initial and exit stages. Note however that
|
||||||
// if the output is not hooked, sequences of prompts are possible which
|
// if the output is not hooked, sequences of prompts are possible which
|
||||||
// can mix things up.
|
// can mix things up.
|
||||||
|
if (line.endsWith('\n'))
|
||||||
|
line.chop(1);
|
||||||
while (isCdbPrompt(line))
|
while (isCdbPrompt(line))
|
||||||
line.remove(0, CdbPromptLength);
|
line.remove(0, CdbPromptLength);
|
||||||
// An extension notification (potentially consisting of several chunks)
|
// An extension notification (potentially consisting of several chunks)
|
||||||
@@ -2394,32 +2392,6 @@ void CdbEngine::parseOutputLine(QString line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::readyReadStandardOut()
|
|
||||||
{
|
|
||||||
if (m_ignoreCdbOutput)
|
|
||||||
return;
|
|
||||||
m_outputBuffer += m_process.readAllStandardOutput();
|
|
||||||
// Split into lines and parse line by line.
|
|
||||||
while (true) {
|
|
||||||
const int endOfLinePos = m_outputBuffer.indexOf('\n');
|
|
||||||
if (endOfLinePos == -1) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
// Check for '\r\n'
|
|
||||||
QByteArray line = m_outputBuffer.left(endOfLinePos);
|
|
||||||
if (!line.isEmpty() && line.at(line.size() - 1) == '\r')
|
|
||||||
line.truncate(line.size() - 1);
|
|
||||||
parseOutputLine(QString::fromLocal8Bit(line));
|
|
||||||
m_outputBuffer.remove(0, endOfLinePos + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbEngine::readyReadStandardError()
|
|
||||||
{
|
|
||||||
showMessage(QString::fromLocal8Bit(m_process.readAllStandardError()), LogError);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Join breakpoint ids for a multi-breakpoint id commands like 'bc', 'be', 'bd'
|
// Join breakpoint ids for a multi-breakpoint id commands like 'bc', 'be', 'bd'
|
||||||
static QByteArray multiBreakpointCommand(const char *cmdC, const Breakpoints &bps)
|
static QByteArray multiBreakpointCommand(const char *cmdC, const Breakpoints &bps)
|
||||||
|
|||||||
@@ -101,8 +101,6 @@ public:
|
|||||||
static QString extensionLibraryName(bool is64Bit, bool isArm = false);
|
static QString extensionLibraryName(bool is64Bit, bool isArm = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void readyReadStandardOut();
|
|
||||||
void readyReadStandardError();
|
|
||||||
void processStarted();
|
void processStarted();
|
||||||
void processDone();
|
void processDone();
|
||||||
void runCommand(const DebuggerCommand &cmd) override;
|
void runCommand(const DebuggerCommand &cmd) override;
|
||||||
@@ -198,7 +196,6 @@ private:
|
|||||||
|
|
||||||
Utils::QtcProcess m_process;
|
Utils::QtcProcess m_process;
|
||||||
DebuggerStartMode m_effectiveStartMode = NoStartMode;
|
DebuggerStartMode m_effectiveStartMode = NoStartMode;
|
||||||
QByteArray m_outputBuffer;
|
|
||||||
//! Debugger accessible (expecting commands)
|
//! Debugger accessible (expecting commands)
|
||||||
bool m_accessible = false;
|
bool m_accessible = false;
|
||||||
StopMode m_stopMode = NoStopRequested;
|
StopMode m_stopMode = NoStopRequested;
|
||||||
|
|||||||
Reference in New Issue
Block a user