forked from qt-creator/qt-creator
Debugger: Make CDB DebuggerCommand handling more similar to LLDB
Change-Id: Ib0ea7e95e2744f521cf369bd03d3d88ee2578cb2 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -340,8 +340,8 @@ void CdbEngine::syncOperateByInstruction(bool operateByInstruction)
|
|||||||
return;
|
return;
|
||||||
QTC_ASSERT(m_accessible, return);
|
QTC_ASSERT(m_accessible, return);
|
||||||
m_operateByInstruction = operateByInstruction;
|
m_operateByInstruction = operateByInstruction;
|
||||||
postCommand(DebuggerCommand(m_operateByInstruction ? QByteArray("l-t") : QByteArray("l+t")));
|
runCommand(DebuggerCommand(m_operateByInstruction ? QByteArray("l-t") : QByteArray("l+t")));
|
||||||
postCommand(DebuggerCommand(m_operateByInstruction ? QByteArray("l-s") : QByteArray("l+s")));
|
runCommand(DebuggerCommand(m_operateByInstruction ? QByteArray("l-s") : QByteArray("l+s")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::syncVerboseLog(bool verboseLog)
|
void CdbEngine::syncVerboseLog(bool verboseLog)
|
||||||
@@ -350,7 +350,7 @@ void CdbEngine::syncVerboseLog(bool verboseLog)
|
|||||||
return;
|
return;
|
||||||
QTC_ASSERT(m_accessible, return);
|
QTC_ASSERT(m_accessible, return);
|
||||||
m_verboseLog = verboseLog;
|
m_verboseLog = verboseLog;
|
||||||
postCommand(DebuggerCommand(m_verboseLog ? QByteArray("!sym noisy") : QByteArray("!sym quiet")));
|
runCommand(DebuggerCommand(m_verboseLog ? QByteArray("!sym noisy") : QByteArray("!sym quiet")));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CdbEngine::canHandleToolTip(const DebuggerToolTipContext &context) const
|
bool CdbEngine::canHandleToolTip(const DebuggerToolTipContext &context) const
|
||||||
@@ -474,12 +474,11 @@ void CdbEngine::consoleStubExited()
|
|||||||
|
|
||||||
void CdbEngine::createFullBacktrace()
|
void CdbEngine::createFullBacktrace()
|
||||||
{
|
{
|
||||||
postCommand(DebuggerCommand("~*kp", BuiltinCommand, CB(handleCreateFullBackTrace)));
|
DebuggerCommand cmd("~*kp");
|
||||||
}
|
cmd.callback = [this](const DebuggerResponse &response) {
|
||||||
|
|
||||||
void CdbEngine::handleCreateFullBackTrace(const DebuggerResponse &response)
|
|
||||||
{
|
|
||||||
Internal::openTextEditor(QLatin1String("Backtrace $"), response.data.toLatin1());
|
Internal::openTextEditor(QLatin1String("Backtrace $"), response.data.toLatin1());
|
||||||
|
};
|
||||||
|
runCommand(cmd, BuiltinCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::setupEngine()
|
void CdbEngine::setupEngine()
|
||||||
@@ -647,7 +646,7 @@ bool CdbEngine::launchCDB(const DebuggerRunParameters &sp, QString *errorMessage
|
|||||||
m_hasDebuggee = true;
|
m_hasDebuggee = true;
|
||||||
if (isRemote) { // We do not get an 'idle' in a remote session, but are accessible
|
if (isRemote) { // We do not get an 'idle' in a remote session, but are accessible
|
||||||
m_accessible = true;
|
m_accessible = true;
|
||||||
postCommand(DebuggerCommand(".load " + extensionFileName.toLocal8Bit()));
|
runCommand(DebuggerCommand(".load " + extensionFileName.toLocal8Bit()));
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupOk")
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupOk")
|
||||||
notifyEngineSetupOk();
|
notifyEngineSetupOk();
|
||||||
}
|
}
|
||||||
@@ -660,26 +659,41 @@ void CdbEngine::setupInferior()
|
|||||||
qDebug("setupInferior");
|
qDebug("setupInferior");
|
||||||
const DebuggerRunParameters &rp = runParameters();
|
const DebuggerRunParameters &rp = runParameters();
|
||||||
if (!rp.commandsAfterConnect.isEmpty())
|
if (!rp.commandsAfterConnect.isEmpty())
|
||||||
postCommand(DebuggerCommand(rp.commandsAfterConnect));
|
runCommand(DebuggerCommand(rp.commandsAfterConnect));
|
||||||
// QmlCppEngine expects the QML engine to be connected before any breakpoints are hit
|
// QmlCppEngine expects the QML engine to be connected before any breakpoints are hit
|
||||||
// (attemptBreakpointSynchronization() will be directly called then)
|
// (attemptBreakpointSynchronization() will be directly called then)
|
||||||
attemptBreakpointSynchronization();
|
attemptBreakpointSynchronization();
|
||||||
if (rp.breakOnMain) {
|
if (rp.breakOnMain) {
|
||||||
const BreakpointParameters bp(BreakpointAtMain);
|
const BreakpointParameters bp(BreakpointAtMain);
|
||||||
BreakpointModelId id(quint16(-1));
|
BreakpointModelId id(quint16(-1));
|
||||||
postCommand(DebuggerCommand(
|
DebuggerCommand cmd(cdbAddBreakpointCommand(bp, m_sourcePathMappings, id, true));
|
||||||
cdbAddBreakpointCommand(bp, m_sourcePathMappings, id, true),
|
cmd.callback = [this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); };
|
||||||
BuiltinCommand,
|
runCommand(cmd, BuiltinCommand);
|
||||||
[this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); }));
|
|
||||||
}
|
}
|
||||||
postCommand(DebuggerCommand("sxn 0x4000001f")); // Do not break on WowX86 exceptions.
|
runCommand(DebuggerCommand("sxn 0x4000001f")); // Do not break on WowX86 exceptions.
|
||||||
postCommand(DebuggerCommand("sxn ibp")); // Do not break on initial breakpoints.
|
runCommand(DebuggerCommand("sxn ibp")); // Do not break on initial breakpoints.
|
||||||
postCommand(DebuggerCommand(".asm source_line")); // Source line in assembly
|
runCommand(DebuggerCommand(".asm source_line")); // Source line in assembly
|
||||||
postCommand(DebuggerCommand(m_extensionCommandPrefixBA + "setparameter maxStringLength="
|
runCommand(DebuggerCommand(m_extensionCommandPrefixBA + "setparameter maxStringLength="
|
||||||
+ action(MaximalStringLength)->value().toByteArray()
|
+ action(MaximalStringLength)->value().toByteArray()
|
||||||
+ " maxStackDepth="
|
+ " maxStackDepth="
|
||||||
+ action(MaximalStackDepth)->value().toByteArray()));
|
+ action(MaximalStackDepth)->value().toByteArray()));
|
||||||
postCommand(DebuggerCommand("pid", ExtensionCommand, CB(handlePid)));
|
|
||||||
|
DebuggerCommand cmd("pid");
|
||||||
|
cmd.callback = [this](const DebuggerResponse &response) {
|
||||||
|
// Fails for core dumps.
|
||||||
|
if (response.resultClass == ResultDone)
|
||||||
|
notifyInferiorPid(response.data.data().toULongLong());
|
||||||
|
if (response.resultClass == ResultDone || runParameters().startMode == AttachCore) {
|
||||||
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupOk")
|
||||||
|
notifyInferiorSetupOk();
|
||||||
|
} else {
|
||||||
|
showMessage(QString::fromLatin1("Failed to determine inferior pid: %1").
|
||||||
|
arg(response.data["msg"].toLatin1()), LogError);
|
||||||
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupFailed")
|
||||||
|
notifyInferiorSetupFailed();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QByteArray msvcRunTime(const Abi::OSFlavor flavour)
|
static QByteArray msvcRunTime(const Abi::OSFlavor flavour)
|
||||||
@@ -722,37 +736,35 @@ void CdbEngine::runEngine()
|
|||||||
|
|
||||||
const QStringList breakEvents = stringListSetting(CdbBreakEvents);
|
const QStringList breakEvents = stringListSetting(CdbBreakEvents);
|
||||||
foreach (const QString &breakEvent, breakEvents)
|
foreach (const QString &breakEvent, breakEvents)
|
||||||
postCommand(DebuggerCommand(QByteArray("sxe ") + breakEvent.toLatin1()));
|
runCommand(DebuggerCommand(QByteArray("sxe ") + breakEvent.toLatin1()));
|
||||||
// Break functions: each function must be fully qualified,
|
// Break functions: each function must be fully qualified,
|
||||||
// else the debugger will slow down considerably.
|
// else the debugger will slow down considerably.
|
||||||
|
DebuggerCommand cmd;
|
||||||
|
cmd.callback = [this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); };
|
||||||
if (boolSetting(CdbBreakOnCrtDbgReport)) {
|
if (boolSetting(CdbBreakOnCrtDbgReport)) {
|
||||||
const QByteArray module = msvcRunTime(runParameters().toolChainAbi.osFlavor());
|
const QByteArray module = msvcRunTime(runParameters().toolChainAbi.osFlavor());
|
||||||
const QByteArray debugModule = module + 'D';
|
const QByteArray debugModule = module + 'D';
|
||||||
const QByteArray wideFunc = QByteArray(CdbOptionsPage::crtDbgReport).append('W');
|
const QByteArray wideFunc = QByteArray(CdbOptionsPage::crtDbgReport).append('W');
|
||||||
postCommand(DebuggerCommand(
|
cmd.function = breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, module);
|
||||||
breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, module), BuiltinCommand,
|
runCommand(cmd, BuiltinCommand);
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
cmd.function = breakAtFunctionCommand(wideFunc, module);
|
||||||
postCommand(DebuggerCommand(
|
runCommand(cmd, BuiltinCommand);
|
||||||
breakAtFunctionCommand(wideFunc, module), BuiltinCommand,
|
cmd.function = breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, debugModule);
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
runCommand(cmd, BuiltinCommand);
|
||||||
postCommand(DebuggerCommand(
|
cmd.function = breakAtFunctionCommand(wideFunc, debugModule);
|
||||||
breakAtFunctionCommand(CdbOptionsPage::crtDbgReport, debugModule), BuiltinCommand,
|
runCommand(cmd, BuiltinCommand);
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
|
||||||
postCommand(DebuggerCommand(
|
|
||||||
breakAtFunctionCommand(wideFunc, debugModule), BuiltinCommand,
|
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
|
||||||
}
|
}
|
||||||
if (boolSetting(BreakOnWarning)) {
|
if (boolSetting(BreakOnWarning)) {
|
||||||
postCommand(DebuggerCommand( "bm /( QtCored4!qWarning", BuiltinCommand, // 'bm': All overloads.
|
cmd.function = "bm /( QtCored4!qWarning"; // 'bm': All overloads.
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
runCommand(cmd, BuiltinCommand);
|
||||||
postCommand(DebuggerCommand( "bm /( Qt5Cored!QMessageLogger::warning", BuiltinCommand,
|
cmd.function = "bm /( Qt5Cored!QMessageLogger::warning";
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
runCommand(cmd, BuiltinCommand);
|
||||||
}
|
}
|
||||||
if (boolSetting(BreakOnFatal)) {
|
if (boolSetting(BreakOnFatal)) {
|
||||||
postCommand(DebuggerCommand("bm /( QtCored4!qFatal", BuiltinCommand, // 'bm': All overloads.
|
cmd.function = "bm /( QtCored4!qFatal"; // 'bm': All overloads.
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
runCommand(cmd, BuiltinCommand);
|
||||||
postCommand(DebuggerCommand("bm /( Qt5Cored!QMessageLogger::fatal", BuiltinCommand,
|
cmd.function = "bm /( Qt5Cored!QMessageLogger::fatal";
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
runCommand(cmd, BuiltinCommand);
|
||||||
}
|
}
|
||||||
if (runParameters().startMode == AttachCore) {
|
if (runParameters().startMode == AttachCore) {
|
||||||
QTC_ASSERT(!m_coreStopReason.isNull(), return; );
|
QTC_ASSERT(!m_coreStopReason.isNull(), return; );
|
||||||
@@ -836,10 +848,10 @@ void CdbEngine::shutdownEngine()
|
|||||||
detachDebugger();
|
detachDebugger();
|
||||||
// Remote requires a bit more force to quit.
|
// Remote requires a bit more force to quit.
|
||||||
if (m_effectiveStartMode == AttachToRemoteServer) {
|
if (m_effectiveStartMode == AttachToRemoteServer) {
|
||||||
postCommand(DebuggerCommand(m_extensionCommandPrefixBA + "shutdownex"));
|
runCommand(DebuggerCommand(m_extensionCommandPrefixBA + "shutdownex"));
|
||||||
postCommand(DebuggerCommand("qq"));
|
runCommand(DebuggerCommand("qq"));
|
||||||
} else {
|
} else {
|
||||||
postCommand(DebuggerCommand("q"));
|
runCommand(DebuggerCommand("q"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Remote process. No can do, currently
|
// Remote process. No can do, currently
|
||||||
@@ -873,7 +885,7 @@ void CdbEngine::processFinished()
|
|||||||
|
|
||||||
void CdbEngine::detachDebugger()
|
void CdbEngine::detachDebugger()
|
||||||
{
|
{
|
||||||
postCommand(DebuggerCommand(".detach"));
|
runCommand(DebuggerCommand(".detach"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool isWatchIName(const QByteArray &iname)
|
static inline bool isWatchIName(const QByteArray &iname)
|
||||||
@@ -901,21 +913,21 @@ void CdbEngine::executeStep()
|
|||||||
{
|
{
|
||||||
if (!m_operateByInstruction)
|
if (!m_operateByInstruction)
|
||||||
m_sourceStepInto = true; // See explanation at handleStackTrace().
|
m_sourceStepInto = true; // See explanation at handleStackTrace().
|
||||||
postCommand(DebuggerCommand(QByteArray("t"))); // Step into-> t (trace)
|
runCommand(DebuggerCommand(QByteArray("t"))); // Step into-> t (trace)
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::executeStepOut()
|
void CdbEngine::executeStepOut()
|
||||||
{
|
{
|
||||||
postCommand(DebuggerCommand(QByteArray("gu"))); // Step out-> gu (go up)
|
runCommand(DebuggerCommand(QByteArray("gu"))); // Step out-> gu (go up)
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::executeNext()
|
void CdbEngine::executeNext()
|
||||||
{
|
{
|
||||||
postCommand(DebuggerCommand(QByteArray("p"))); // Step over -> p
|
runCommand(DebuggerCommand(QByteArray("p"))); // Step over -> p
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
|
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorRunRequested")
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
}
|
}
|
||||||
@@ -939,7 +951,7 @@ void CdbEngine::continueInferior()
|
|||||||
|
|
||||||
void CdbEngine::doContinueInferior()
|
void CdbEngine::doContinueInferior()
|
||||||
{
|
{
|
||||||
postCommand(DebuggerCommand(QByteArray("g")));
|
runCommand(DebuggerCommand(QByteArray("g")));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CdbEngine::canInterruptInferior() const
|
bool CdbEngine::canInterruptInferior() const
|
||||||
@@ -1012,10 +1024,10 @@ void CdbEngine::executeRunToLine(const ContextData &data)
|
|||||||
bp.fileName = data.fileName;
|
bp.fileName = data.fileName;
|
||||||
bp.lineNumber = data.lineNumber;
|
bp.lineNumber = data.lineNumber;
|
||||||
}
|
}
|
||||||
postCommand(DebuggerCommand(
|
|
||||||
cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true),
|
DebuggerCommand cmd(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true));
|
||||||
BuiltinCommand,
|
cmd.callback = [this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); };
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
runCommand(cmd, BuiltinCommand);
|
||||||
continueInferior();
|
continueInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1025,10 +1037,9 @@ void CdbEngine::executeRunToFunction(const QString &functionName)
|
|||||||
BreakpointParameters bp(BreakpointByFunction);
|
BreakpointParameters bp(BreakpointByFunction);
|
||||||
bp.functionName = functionName;
|
bp.functionName = functionName;
|
||||||
|
|
||||||
postCommand(DebuggerCommand(
|
DebuggerCommand cmd(cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true));
|
||||||
cdbAddBreakpointCommand(bp, m_sourcePathMappings, BreakpointModelId(), true),
|
cmd.callback = [this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); };
|
||||||
BuiltinCommand,
|
runCommand(cmd, BuiltinCommand);
|
||||||
[this](const DebuggerResponse &r) { handleBreakInsert(r, BreakpointModelId()); }));
|
|
||||||
continueInferior();
|
continueInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1038,7 +1049,7 @@ void CdbEngine::setRegisterValue(const QByteArray &name, const QString &value)
|
|||||||
QByteArray cmd;
|
QByteArray cmd;
|
||||||
ByteArrayInputStream str(cmd);
|
ByteArrayInputStream str(cmd);
|
||||||
str << "r " << name << '=' << value;
|
str << "r " << name << '=' << value;
|
||||||
postCommand(DebuggerCommand(cmd));
|
runCommand(DebuggerCommand(cmd));
|
||||||
reloadRegisters();
|
reloadRegisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,11 +1061,11 @@ void CdbEngine::executeJumpToLine(const ContextData &data)
|
|||||||
gotoLocation(Location(data.address));
|
gotoLocation(Location(data.address));
|
||||||
} else {
|
} else {
|
||||||
// Jump to source line: Resolve source line address and go to that location
|
// Jump to source line: Resolve source line address and go to that location
|
||||||
QByteArray cmd;
|
DebuggerCommand cmd;
|
||||||
ByteArrayInputStream str(cmd);
|
ByteArrayInputStream str(cmd.function);
|
||||||
str << "? `" << QDir::toNativeSeparators(data.fileName) << ':' << data.lineNumber << '`';
|
str << "? `" << QDir::toNativeSeparators(data.fileName) << ':' << data.lineNumber << '`';
|
||||||
postCommand(DebuggerCommand(cmd, BuiltinCommand,
|
cmd.callback = [this, data](const DebuggerResponse &r) { handleJumpToLineAddressResolution(r, data); };
|
||||||
[this, data](const DebuggerResponse &r) { handleJumpToLineAddressResolution(r, data); }));
|
runCommand(cmd, BuiltinCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1068,7 +1079,7 @@ void CdbEngine::jumpToAddress(quint64 address)
|
|||||||
str.setHexPrefix(true);
|
str.setHexPrefix(true);
|
||||||
str.setIntegerBase(16);
|
str.setIntegerBase(16);
|
||||||
str << address;
|
str << address;
|
||||||
postCommand(DebuggerCommand(registerCmd));
|
runCommand(DebuggerCommand(registerCmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::handleJumpToLineAddressResolution(const DebuggerResponse &response, const ContextData &context)
|
void CdbEngine::handleJumpToLineAddressResolution(const DebuggerResponse &response, const ContextData &context)
|
||||||
@@ -1133,7 +1144,7 @@ void CdbEngine::assignValueInDebugger(WatchItem *w, const QString &expr, const Q
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
postCommand(DebuggerCommand(cmd));
|
runCommand(DebuggerCommand(cmd));
|
||||||
// Update all locals in case we change a union or something pointed to
|
// Update all locals in case we change a union or something pointed to
|
||||||
// that affects other variables, too.
|
// that affects other variables, too.
|
||||||
updateLocals();
|
updateLocals();
|
||||||
@@ -1157,11 +1168,11 @@ void CdbEngine::handleThreads(const DebuggerResponse &response)
|
|||||||
void CdbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
|
void CdbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
|
||||||
{
|
{
|
||||||
if (languages & CppLanguage)
|
if (languages & CppLanguage)
|
||||||
postCommand(DebuggerCommand(command.toLocal8Bit()));
|
runCommand(DebuggerCommand(command.toLocal8Bit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post command to the cdb process
|
// Post command to the cdb process
|
||||||
void CdbEngine::postCommand(const DebuggerCommand &dbgCmd)
|
void CdbEngine::runCommand(const DebuggerCommand &dbgCmd, int flags)
|
||||||
{
|
{
|
||||||
QByteArray cmd = dbgCmd.function + dbgCmd.arguments();
|
QByteArray cmd = dbgCmd.function + dbgCmd.arguments();
|
||||||
if (!m_accessible) {
|
if (!m_accessible) {
|
||||||
@@ -1173,7 +1184,7 @@ void CdbEngine::postCommand(const DebuggerCommand &dbgCmd)
|
|||||||
|
|
||||||
QByteArray fullCmd;
|
QByteArray fullCmd;
|
||||||
ByteArrayInputStream str(fullCmd);
|
ByteArrayInputStream str(fullCmd);
|
||||||
if (dbgCmd.flags & BuiltinCommand) {
|
if (flags & BuiltinCommand) {
|
||||||
// Post a built-in-command producing free-format output with a callback.
|
// Post a built-in-command producing free-format output with a callback.
|
||||||
// In order to catch the output, it is enclosed in 'echo' commands
|
// In order to catch the output, it is enclosed in 'echo' commands
|
||||||
// printing a specially formatted token to be identifiable in the output.
|
// printing a specially formatted token to be identifiable in the output.
|
||||||
@@ -1181,7 +1192,7 @@ void CdbEngine::postCommand(const DebuggerCommand &dbgCmd)
|
|||||||
str << ".echo \"" << m_tokenPrefix << token << "<\"\n"
|
str << ".echo \"" << m_tokenPrefix << token << "<\"\n"
|
||||||
<< cmd << "\n.echo \"" << m_tokenPrefix << token << ">\"";
|
<< cmd << "\n.echo \"" << m_tokenPrefix << token << ">\"";
|
||||||
m_commandForToken.insert(token, dbgCmd);
|
m_commandForToken.insert(token, dbgCmd);
|
||||||
} else if (dbgCmd.flags & ExtensionCommand) {
|
} else if (flags & ExtensionCommand) {
|
||||||
// Post an extension command producing one-line output with a callback,
|
// Post an extension command producing one-line output with a callback,
|
||||||
// pass along token for identification in hash.
|
// pass along token for identification in hash.
|
||||||
const int token = m_nextCommandToken++;
|
const int token = m_nextCommandToken++;
|
||||||
@@ -1320,8 +1331,10 @@ void CdbEngine::doUpdateLocals(const UpdateParameters &updateParameters)
|
|||||||
if (partialUpdate)
|
if (partialUpdate)
|
||||||
str << blankSeparator << updateParameters.partialVariable;
|
str << blankSeparator << updateParameters.partialVariable;
|
||||||
|
|
||||||
postCommand(DebuggerCommand("locals", arguments.constData(), ExtensionCommand,
|
DebuggerCommand cmd("locals");
|
||||||
[this, partialUpdate](const DebuggerResponse &r) { handleLocals(r, partialUpdate); }));
|
cmd.args = arguments;
|
||||||
|
cmd.callback = [this, partialUpdate](const DebuggerResponse &r) { handleLocals(r, partialUpdate); };
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::updateAll()
|
void CdbEngine::updateAll()
|
||||||
@@ -1336,10 +1349,9 @@ void CdbEngine::selectThread(ThreadId threadId)
|
|||||||
|
|
||||||
threadsHandler()->setCurrentThread(threadId);
|
threadsHandler()->setCurrentThread(threadId);
|
||||||
|
|
||||||
const QByteArray cmd = '~' + QByteArray::number(threadId.raw()) + " s";
|
DebuggerCommand cmd('~' + QByteArray::number(threadId.raw()) + " s");
|
||||||
postCommand(DebuggerCommand(cmd, BuiltinCommand, [this](const DebuggerResponse &) {
|
cmd.callback = [this](const DebuggerResponse &) { reloadFullStack(); };
|
||||||
reloadFullStack();
|
runCommand(cmd, BuiltinCommand);
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default address range for showing disassembly.
|
// Default address range for showing disassembly.
|
||||||
@@ -1382,11 +1394,14 @@ void CdbEngine::postDisassemblerCommand(quint64 address, DisassemblerAgent *agen
|
|||||||
void CdbEngine::postDisassemblerCommand(quint64 address, quint64 endAddress,
|
void CdbEngine::postDisassemblerCommand(quint64 address, quint64 endAddress,
|
||||||
DisassemblerAgent *agent)
|
DisassemblerAgent *agent)
|
||||||
{
|
{
|
||||||
QByteArray cmd;
|
DebuggerCommand cmd;
|
||||||
ByteArrayInputStream str(cmd);
|
ByteArrayInputStream str(cmd.function);
|
||||||
str << "u " << hex <<hexPrefixOn << address << ' ' << endAddress;
|
str << "u " << hex <<hexPrefixOn << address << ' ' << endAddress;
|
||||||
postCommand(DebuggerCommand(cmd, BuiltinCommand,
|
cmd.callback = [this, agent](const DebuggerResponse &response) {
|
||||||
[this, agent](const DebuggerResponse &r) { handleDisassembler(r, agent); }));
|
// Parse: "00000000`77606060 cc int 3"
|
||||||
|
agent->setContents(parseCdbDisassembler(response.data.data()));
|
||||||
|
};
|
||||||
|
runCommand(cmd, BuiltinCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::postResolveSymbol(const QString &module, const QString &function,
|
void CdbEngine::postResolveSymbol(const QString &module, const QString &function,
|
||||||
@@ -1398,10 +1413,11 @@ void CdbEngine::postResolveSymbol(const QString &module, const QString &function
|
|||||||
const QList<quint64> addresses = m_symbolAddressCache.values(symbol);
|
const QList<quint64> addresses = m_symbolAddressCache.values(symbol);
|
||||||
if (addresses.isEmpty()) {
|
if (addresses.isEmpty()) {
|
||||||
showMessage(QLatin1String("Resolving symbol: ") + symbol + QLatin1String("..."), LogMisc);
|
showMessage(QLatin1String("Resolving symbol: ") + symbol + QLatin1String("..."), LogMisc);
|
||||||
postCommand(DebuggerCommand(QByteArray("x ") + symbol.toLatin1(), BuiltinCommand,
|
DebuggerCommand cmd(QByteArray("x ") + symbol.toLatin1());
|
||||||
[this, symbol, agent](const DebuggerResponse &r) {
|
cmd.callback = [this, symbol, agent](const DebuggerResponse &r) {
|
||||||
handleResolveSymbol(r, symbol, agent);
|
handleResolveSymbol(r, symbol, agent);
|
||||||
}));
|
};
|
||||||
|
runCommand(cmd, BuiltinCommand);
|
||||||
} else {
|
} else {
|
||||||
showMessage(QString::fromLatin1("Using cached addresses for %1.").
|
showMessage(QString::fromLatin1("Using cached addresses for %1.").
|
||||||
arg(symbol), LogMisc);
|
arg(symbol), LogMisc);
|
||||||
@@ -1527,12 +1543,6 @@ void CdbEngine::handleResolveSymbolHelper(const QList<quint64> &addresses, Disas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse: "00000000`77606060 cc int 3"
|
|
||||||
void CdbEngine::handleDisassembler(const DebuggerResponse &response, DisassemblerAgent *agent)
|
|
||||||
{
|
|
||||||
agent->setContents(parseCdbDisassembler(response.data.data()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbEngine::fetchMemory(MemoryAgent *agent, QObject *editor, quint64 addr, quint64 length)
|
void CdbEngine::fetchMemory(MemoryAgent *agent, QObject *editor, quint64 addr, quint64 length)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@@ -1546,11 +1556,19 @@ void CdbEngine::fetchMemory(MemoryAgent *agent, QObject *editor, quint64 addr, q
|
|||||||
|
|
||||||
void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie)
|
void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie)
|
||||||
{
|
{
|
||||||
QByteArray args;
|
DebuggerCommand cmd("memory");
|
||||||
ByteArrayInputStream str(args);
|
ByteArrayInputStream str(cmd.args);
|
||||||
str << cookie.address << ' ' << cookie.length;
|
str << cookie.address << ' ' << cookie.length;
|
||||||
postCommand(DebuggerCommand("memory", args, ExtensionCommand,
|
cmd.callback = [this, cookie](const DebuggerResponse &response) {
|
||||||
[this, cookie](const DebuggerResponse &r) { handleMemory(r, cookie); }));
|
if (response.resultClass == ResultDone && cookie.agent) {
|
||||||
|
const QByteArray data = QByteArray::fromBase64(response.data.data());
|
||||||
|
if (unsigned(data.size()) == cookie.length)
|
||||||
|
cookie.agent->addLazyData(cookie.editorToken, cookie.address, data);
|
||||||
|
} else {
|
||||||
|
showMessage(response.data["msg"].toLatin1(), LogWarning);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, const QByteArray &data)
|
void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, const QByteArray &data)
|
||||||
@@ -1560,25 +1578,15 @@ void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, c
|
|||||||
const MemoryChangeCookie cookie(addr, data);
|
const MemoryChangeCookie cookie(addr, data);
|
||||||
doInterruptInferiorCustomSpecialStop(qVariantFromValue(cookie));
|
doInterruptInferiorCustomSpecialStop(qVariantFromValue(cookie));
|
||||||
} else {
|
} else {
|
||||||
postCommand(DebuggerCommand(cdbWriteMemoryCommand(addr, data)));
|
runCommand(DebuggerCommand(cdbWriteMemoryCommand(addr, data)));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CdbEngine::handleMemory(const DebuggerResponse &response, const MemoryViewCookie &memViewCookie)
|
|
||||||
{
|
|
||||||
if (response.resultClass == ResultDone && memViewCookie.agent) {
|
|
||||||
const QByteArray data = QByteArray::fromBase64(response.data.data());
|
|
||||||
if (unsigned(data.size()) == memViewCookie.length)
|
|
||||||
memViewCookie.agent->addLazyData(memViewCookie.editorToken,
|
|
||||||
memViewCookie.address, data);
|
|
||||||
} else {
|
|
||||||
showMessage(response.data["msg"].toLatin1(), LogWarning);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::reloadModules()
|
void CdbEngine::reloadModules()
|
||||||
{
|
{
|
||||||
postCommand(DebuggerCommand("modules", ExtensionCommand, CB(handleModules)));
|
DebuggerCommand cmd("modules");
|
||||||
|
cmd.callback = CB(handleModules);
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::loadSymbols(const QString & /* moduleName */)
|
void CdbEngine::loadSymbols(const QString & /* moduleName */)
|
||||||
@@ -1597,7 +1605,9 @@ void CdbEngine::requestModuleSymbols(const QString &moduleName)
|
|||||||
void CdbEngine::reloadRegisters()
|
void CdbEngine::reloadRegisters()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(threadsHandler()->currentThreadIndex() >= 0, return);
|
QTC_ASSERT(threadsHandler()->currentThreadIndex() >= 0, return);
|
||||||
postCommand(DebuggerCommand("registers", ExtensionCommand, CB(handleRegistersExt)));
|
DebuggerCommand cmd("registers");
|
||||||
|
cmd.callback = CB(handleRegistersExt);
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::reloadSourceFiles()
|
void CdbEngine::reloadSourceFiles()
|
||||||
@@ -1608,28 +1618,18 @@ void CdbEngine::reloadFullStack()
|
|||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug("%s", Q_FUNC_INFO);
|
qDebug("%s", Q_FUNC_INFO);
|
||||||
postCommand(DebuggerCommand("stack", "unlimited", ExtensionCommand, CB(handleStackTrace)));
|
DebuggerCommand cmd("stack");
|
||||||
|
cmd.args = "unlimited";
|
||||||
|
cmd.callback = CB(handleStackTrace);
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::listBreakpoints()
|
void CdbEngine::listBreakpoints()
|
||||||
{
|
{
|
||||||
postCommand(DebuggerCommand("breakpoints", "-v", ExtensionCommand, CB(handleBreakPoints)));
|
DebuggerCommand cmd("breakpoints");
|
||||||
}
|
cmd.args = "-v";
|
||||||
|
cmd.callback = CB(handleBreakPoints);
|
||||||
void CdbEngine::handlePid(const DebuggerResponse &response)
|
runCommand(cmd, ExtensionCommand);
|
||||||
{
|
|
||||||
// Fails for core dumps.
|
|
||||||
if (response.resultClass == ResultDone)
|
|
||||||
notifyInferiorPid(response.data.data().toULongLong());
|
|
||||||
if (response.resultClass == ResultDone || runParameters().startMode == AttachCore) {
|
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupOk")
|
|
||||||
notifyInferiorSetupOk();
|
|
||||||
} else {
|
|
||||||
showMessage(QString::fromLatin1("Failed to determine inferior pid: %1").
|
|
||||||
arg(response.data["msg"].toLatin1()), LogError);
|
|
||||||
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorSetupFailed")
|
|
||||||
notifyInferiorSetupFailed();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::handleModules(const DebuggerResponse &response)
|
void CdbEngine::handleModules(const DebuggerResponse &response)
|
||||||
@@ -1844,13 +1844,16 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
|
|||||||
*message = msgCheckingConditionalBreakPoint(id, number, parameters.condition,
|
*message = msgCheckingConditionalBreakPoint(id, number, parameters.condition,
|
||||||
QString::number(threadId));
|
QString::number(threadId));
|
||||||
|
|
||||||
QByteArray exp = parameters.condition;
|
DebuggerCommand cmd("expression");
|
||||||
if (exp.contains(' ') && !exp.startsWith('"')) {
|
cmd.args = parameters.condition;
|
||||||
exp.prepend('"');
|
if (cmd.args.contains(' ') && !cmd.args.startsWith('"')) {
|
||||||
exp.append('"');
|
cmd.args.prepend('"');
|
||||||
|
cmd.args.append('"');
|
||||||
}
|
}
|
||||||
postCommand(DebuggerCommand("expression", exp, ExtensionCommand,
|
cmd.callback = [this, id, stopReason](const DebuggerResponse &response) {
|
||||||
[this, id, stopReason](const DebuggerResponse &r) { handleExpression(r, id, stopReason); }));
|
handleExpression(response, id, stopReason);
|
||||||
|
};
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
|
|
||||||
return StopReportLog;
|
return StopReportLog;
|
||||||
}
|
}
|
||||||
@@ -1998,7 +2001,7 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
|
|||||||
// Start sequence to get all relevant data.
|
// Start sequence to get all relevant data.
|
||||||
if (stopFlags & StopInArtificialThread) {
|
if (stopFlags & StopInArtificialThread) {
|
||||||
showMessage(tr("Switching to main thread..."), LogMisc);
|
showMessage(tr("Switching to main thread..."), LogMisc);
|
||||||
postCommand(DebuggerCommand("~0 s"));
|
runCommand(DebuggerCommand("~0 s"));
|
||||||
forcedThreadId = ThreadId(0);
|
forcedThreadId = ThreadId(0);
|
||||||
// Re-fetch stack again.
|
// Re-fetch stack again.
|
||||||
reloadFullStack();
|
reloadFullStack();
|
||||||
@@ -2013,8 +2016,9 @@ void CdbEngine::processStop(const GdbMi &stopReason, bool conditionalBreakPointT
|
|||||||
executeStepOut();
|
executeStepOut();
|
||||||
return;
|
return;
|
||||||
case ParseStackWow64:
|
case ParseStackWow64:
|
||||||
postCommand(DebuggerCommand("lm m wow64", BuiltinCommand,
|
DebuggerCommand cmd("lm m wow64");
|
||||||
[this, stack](const DebuggerResponse &r) { handleCheckWow64(r, stack); }));
|
cmd.callback = [this, stack](const DebuggerResponse &r) { handleCheckWow64(r, stack); };
|
||||||
|
runCommand(cmd, BuiltinCommand);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2105,8 +2109,9 @@ void CdbEngine::handleCheckWow64(const DebuggerResponse &response, const GdbMi &
|
|||||||
// start end module name
|
// start end module name
|
||||||
// 00000000`77490000 00000000`774d5000 wow64 (deferred)
|
// 00000000`77490000 00000000`774d5000 wow64 (deferred)
|
||||||
if (response.data.data().contains("wow64")) {
|
if (response.data.data().contains("wow64")) {
|
||||||
postCommand(DebuggerCommand("k", BuiltinCommand,
|
DebuggerCommand cmd("k");
|
||||||
[this, stack](const DebuggerResponse &r) { ensureUsing32BitStackInWow64(r, stack); }));
|
cmd.callback = [this, stack](const DebuggerResponse &r) { ensureUsing32BitStackInWow64(r, stack); };
|
||||||
|
runCommand(cmd, BuiltinCommand);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_wow64State = noWow64Stack;
|
m_wow64State = noWow64Stack;
|
||||||
@@ -2126,7 +2131,9 @@ void CdbEngine::ensureUsing32BitStackInWow64(const DebuggerResponse &response, c
|
|||||||
return;
|
return;
|
||||||
} else if (line.startsWith("Child-SP")) {
|
} else if (line.startsWith("Child-SP")) {
|
||||||
m_wow64State = wow64Stack64Bit;
|
m_wow64State = wow64Stack64Bit;
|
||||||
postCommand(DebuggerCommand("!wow64exts.sw", BuiltinCommand, CB(handleSwitchWow64Stack)));
|
DebuggerCommand cmd("!wow64exts.sw");
|
||||||
|
cmd.callback = CB(handleSwitchWow64Stack);
|
||||||
|
runCommand(cmd, BuiltinCommand);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2143,7 +2150,9 @@ void CdbEngine::handleSwitchWow64Stack(const DebuggerResponse &response)
|
|||||||
else
|
else
|
||||||
m_wow64State = noWow64Stack;
|
m_wow64State = noWow64Stack;
|
||||||
// reload threads and the stack after switching the mode
|
// reload threads and the stack after switching the mode
|
||||||
postCommand(DebuggerCommand("threads", ExtensionCommand, CB(handleThreads)));
|
DebuggerCommand cmd("threads");
|
||||||
|
cmd.callback = CB(handleThreads);
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::handleSessionAccessible(unsigned long cdbExState)
|
void CdbEngine::handleSessionAccessible(unsigned long cdbExState)
|
||||||
@@ -2675,18 +2684,16 @@ void CdbEngine::attemptBreakpointSynchronization()
|
|||||||
lineCorrection.reset(new BreakpointCorrectionContext(Internal::cppCodeModelSnapshot(),
|
lineCorrection.reset(new BreakpointCorrectionContext(Internal::cppCodeModelSnapshot(),
|
||||||
CppTools::CppModelManager::instance()->workingCopy()));
|
CppTools::CppModelManager::instance()->workingCopy()));
|
||||||
response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber);
|
response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber);
|
||||||
postCommand(DebuggerCommand(
|
DebuggerCommand cmd(cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false));
|
||||||
cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false),
|
cmd.callback = [this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); };
|
||||||
BuiltinCommand,
|
runCommand(cmd, BuiltinCommand);
|
||||||
[this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); }));
|
|
||||||
} else {
|
} else {
|
||||||
postCommand(DebuggerCommand(
|
DebuggerCommand cmd(cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false));
|
||||||
cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false),
|
cmd.callback = [this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); };
|
||||||
BuiltinCommand,
|
runCommand(cmd, BuiltinCommand);
|
||||||
[this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); }));
|
|
||||||
}
|
}
|
||||||
if (!parameters.enabled)
|
if (!parameters.enabled)
|
||||||
postCommand(DebuggerCommand("bd " + QByteArray::number(breakPointIdToCdbId(id))));
|
runCommand(DebuggerCommand("bd " + QByteArray::number(breakPointIdToCdbId(id))));
|
||||||
bp.notifyBreakpointInsertProceeding();
|
bp.notifyBreakpointInsertProceeding();
|
||||||
bp.notifyBreakpointInsertOk();
|
bp.notifyBreakpointInsertOk();
|
||||||
m_pendingBreakpointMap.insert(id, response);
|
m_pendingBreakpointMap.insert(id, response);
|
||||||
@@ -2705,7 +2712,7 @@ void CdbEngine::attemptBreakpointSynchronization()
|
|||||||
qPrintable(parameters.toString()));
|
qPrintable(parameters.toString()));
|
||||||
if (parameters.enabled != bp.response().enabled) {
|
if (parameters.enabled != bp.response().enabled) {
|
||||||
// Change enabled/disabled breakpoints without triggering update.
|
// Change enabled/disabled breakpoints without triggering update.
|
||||||
postCommand(DebuggerCommand((parameters.enabled ? "be " : "bd ")
|
runCommand(DebuggerCommand((parameters.enabled ? "be " : "bd ")
|
||||||
+ QByteArray::number(breakPointIdToCdbId(id))));
|
+ QByteArray::number(breakPointIdToCdbId(id))));
|
||||||
response.pending = false;
|
response.pending = false;
|
||||||
response.enabled = parameters.enabled;
|
response.enabled = parameters.enabled;
|
||||||
@@ -2713,17 +2720,16 @@ void CdbEngine::attemptBreakpointSynchronization()
|
|||||||
} else {
|
} else {
|
||||||
// Delete and re-add, triggering update
|
// Delete and re-add, triggering update
|
||||||
addedChanged = true;
|
addedChanged = true;
|
||||||
postCommand(DebuggerCommand(cdbClearBreakpointCommand(id)));
|
runCommand(DebuggerCommand(cdbClearBreakpointCommand(id)));
|
||||||
postCommand(DebuggerCommand(
|
DebuggerCommand cmd(cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false));
|
||||||
cdbAddBreakpointCommand(parameters, m_sourcePathMappings, id, false),
|
cmd.callback = [this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); };
|
||||||
BuiltinCommand,
|
runCommand(cmd, BuiltinCommand);
|
||||||
[this, id](const DebuggerResponse &r) { handleBreakInsert(r, id); }));
|
|
||||||
m_pendingBreakpointMap.insert(id, response);
|
m_pendingBreakpointMap.insert(id, response);
|
||||||
}
|
}
|
||||||
bp.notifyBreakpointChangeOk();
|
bp.notifyBreakpointChangeOk();
|
||||||
break;
|
break;
|
||||||
case BreakpointRemoveRequested:
|
case BreakpointRemoveRequested:
|
||||||
postCommand(DebuggerCommand(cdbClearBreakpointCommand(id)));
|
runCommand(DebuggerCommand(cdbClearBreakpointCommand(id)));
|
||||||
bp.notifyBreakpointRemoveProceeding();
|
bp.notifyBreakpointRemoveProceeding();
|
||||||
bp.notifyBreakpointRemoveOk();
|
bp.notifyBreakpointRemoveOk();
|
||||||
m_pendingBreakpointMap.remove(id);
|
m_pendingBreakpointMap.remove(id);
|
||||||
@@ -2735,7 +2741,7 @@ void CdbEngine::attemptBreakpointSynchronization()
|
|||||||
foreach (BreakpointModelId id, m_insertSubBreakpointMap.keys()) {
|
foreach (BreakpointModelId id, m_insertSubBreakpointMap.keys()) {
|
||||||
addedChanged = true;
|
addedChanged = true;
|
||||||
const BreakpointResponse &response = m_insertSubBreakpointMap.value(id);
|
const BreakpointResponse &response = m_insertSubBreakpointMap.value(id);
|
||||||
postCommand(DebuggerCommand(cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false)));
|
runCommand(DebuggerCommand(cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false)));
|
||||||
m_insertSubBreakpointMap.remove(id);
|
m_insertSubBreakpointMap.remove(id);
|
||||||
m_pendingSubBreakpointMap.insert(id, response);
|
m_pendingSubBreakpointMap.insert(id, response);
|
||||||
}
|
}
|
||||||
@@ -2862,7 +2868,9 @@ unsigned CdbEngine::parseStackTrace(const GdbMi &data, bool sourceStepInto)
|
|||||||
|
|
||||||
void CdbEngine::loadAdditionalQmlStack()
|
void CdbEngine::loadAdditionalQmlStack()
|
||||||
{
|
{
|
||||||
postCommand(DebuggerCommand("qmlstack", ExtensionCommand, CB(handleAdditionalQmlStack)));
|
DebuggerCommand cmd("qmlstack");
|
||||||
|
cmd.callback = CB(handleAdditionalQmlStack);
|
||||||
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::handleAdditionalQmlStack(const DebuggerResponse &response)
|
void CdbEngine::handleAdditionalQmlStack(const DebuggerResponse &response)
|
||||||
@@ -2907,8 +2915,9 @@ void CdbEngine::handleStackTrace(const DebuggerResponse &response)
|
|||||||
GdbMi stack = response.data;
|
GdbMi stack = response.data;
|
||||||
if (response.resultClass == ResultDone) {
|
if (response.resultClass == ResultDone) {
|
||||||
if (parseStackTrace(stack, false) == ParseStackWow64) {
|
if (parseStackTrace(stack, false) == ParseStackWow64) {
|
||||||
postCommand(DebuggerCommand("lm m wow64", BuiltinCommand,
|
DebuggerCommand cmd("lm m wow64");
|
||||||
[this, stack](const DebuggerResponse &r) { handleCheckWow64(r, stack); }));
|
cmd.callback = [this, stack](const DebuggerResponse &r) { handleCheckWow64(r, stack); };
|
||||||
|
runCommand(cmd, BuiltinCommand);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showMessage(stack["msg"].toLatin1(), LogError);
|
showMessage(stack["msg"].toLatin1(), LogError);
|
||||||
@@ -3082,17 +3091,17 @@ void CdbEngine::watchPoint(const QPoint &p)
|
|||||||
|
|
||||||
void CdbEngine::postWidgetAtCommand()
|
void CdbEngine::postWidgetAtCommand()
|
||||||
{
|
{
|
||||||
QByteArray arguments = QByteArray::number(m_watchPointX);
|
DebuggerCommand cmd("widgetat");
|
||||||
arguments.append(' ');
|
cmd.args = QByteArray::number(m_watchPointX) + ' ' + QByteArray::number(m_watchPointY);
|
||||||
arguments.append(QByteArray::number(m_watchPointY));
|
cmd.callback = CB(handleWidgetAt);
|
||||||
postCommand(DebuggerCommand("widgetat", arguments.constData(), ExtensionCommand, CB(handleWidgetAt)));
|
runCommand(cmd, ExtensionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CdbEngine::handleCustomSpecialStop(const QVariant &v)
|
void CdbEngine::handleCustomSpecialStop(const QVariant &v)
|
||||||
{
|
{
|
||||||
if (v.canConvert<MemoryChangeCookie>()) {
|
if (v.canConvert<MemoryChangeCookie>()) {
|
||||||
const MemoryChangeCookie changeData = qvariant_cast<MemoryChangeCookie>(v);
|
const MemoryChangeCookie changeData = qvariant_cast<MemoryChangeCookie>(v);
|
||||||
postCommand(DebuggerCommand(cdbWriteMemoryCommand(changeData.address, changeData.data)));
|
runCommand(DebuggerCommand(cdbWriteMemoryCommand(changeData.address, changeData.data)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (v.canConvert<MemoryViewCookie>()) {
|
if (v.canConvert<MemoryViewCookie>()) {
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ private slots:
|
|||||||
void readyReadStandardError();
|
void readyReadStandardError();
|
||||||
void processError();
|
void processError();
|
||||||
void processFinished();
|
void processFinished();
|
||||||
void postCommand(const DebuggerCommand &cmd);
|
void runCommand(const DebuggerCommand &cmd, int flags = 0);
|
||||||
void operateByInstructionTriggered(bool);
|
void operateByInstructionTriggered(bool);
|
||||||
void verboseLogTriggered(bool);
|
void verboseLogTriggered(bool);
|
||||||
|
|
||||||
@@ -201,7 +201,6 @@ private:
|
|||||||
// Builtin commands
|
// Builtin commands
|
||||||
void handleStackTrace(const DebuggerResponse &);
|
void handleStackTrace(const DebuggerResponse &);
|
||||||
void handleRegisters(const DebuggerResponse &);
|
void handleRegisters(const DebuggerResponse &);
|
||||||
void handleDisassembler(const DebuggerResponse &, DisassemblerAgent *agent);
|
|
||||||
void handleJumpToLineAddressResolution(const DebuggerResponse &response, const ContextData &context);
|
void handleJumpToLineAddressResolution(const DebuggerResponse &response, const ContextData &context);
|
||||||
void handleExpression(const DebuggerResponse &command, BreakpointModelId id, const GdbMi &stopReason);
|
void handleExpression(const DebuggerResponse &command, BreakpointModelId id, const GdbMi &stopReason);
|
||||||
void handleResolveSymbol(const DebuggerResponse &command, const QString &symbol, DisassemblerAgent *agent);
|
void handleResolveSymbol(const DebuggerResponse &command, const QString &symbol, DisassemblerAgent *agent);
|
||||||
@@ -211,16 +210,13 @@ private:
|
|||||||
void ensureUsing32BitStackInWow64(const DebuggerResponse &response, const GdbMi &stack);
|
void ensureUsing32BitStackInWow64(const DebuggerResponse &response, const GdbMi &stack);
|
||||||
void handleSwitchWow64Stack(const DebuggerResponse &response);
|
void handleSwitchWow64Stack(const DebuggerResponse &response);
|
||||||
void jumpToAddress(quint64 address);
|
void jumpToAddress(quint64 address);
|
||||||
void handleCreateFullBackTrace(const DebuggerResponse &response);
|
|
||||||
|
|
||||||
// Extension commands
|
// Extension commands
|
||||||
void handleThreads(const DebuggerResponse &response);
|
void handleThreads(const DebuggerResponse &response);
|
||||||
void handlePid(const DebuggerResponse &response);
|
|
||||||
void handleLocals(const DebuggerResponse &response, bool partialUpdate);
|
void handleLocals(const DebuggerResponse &response, bool partialUpdate);
|
||||||
void handleExpandLocals(const DebuggerResponse &response);
|
void handleExpandLocals(const DebuggerResponse &response);
|
||||||
void handleRegistersExt(const DebuggerResponse &response);
|
void handleRegistersExt(const DebuggerResponse &response);
|
||||||
void handleModules(const DebuggerResponse &response);
|
void handleModules(const DebuggerResponse &response);
|
||||||
void handleMemory(const DebuggerResponse &response, const MemoryViewCookie &memViewCookie);
|
|
||||||
void handleWidgetAt(const DebuggerResponse &response);
|
void handleWidgetAt(const DebuggerResponse &response);
|
||||||
void handleBreakPoints(const DebuggerResponse &response);
|
void handleBreakPoints(const DebuggerResponse &response);
|
||||||
void handleAdditionalQmlStack(const DebuggerResponse &response);
|
void handleAdditionalQmlStack(const DebuggerResponse &response);
|
||||||
|
|||||||
Reference in New Issue
Block a user