Debugger: Fix soft assert when loading core file

Task-number: QTCREATORBUG-14048
Change-Id: I20d4d8269df3bfb42259ad459b92d5cd738332f5
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-02-26 15:04:02 +01:00
parent aee35662a2
commit 01cb4ee21d
2 changed files with 21 additions and 27 deletions

View File

@@ -223,27 +223,29 @@ void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
QString core = coreFileName(); QString core = coreFileName();
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {
showMessage(tr("Symbols found."), StatusBar); showMessage(tr("Symbols found."), StatusBar);
postCommand("target core " + core.toLocal8Bit(), NoFlags, handleInferiorPrepared();
CB(handleTargetCore)); } else {
return; QString msg = tr("No symbols found in core file <i>%1</i>.").arg(core)
} + _(" ") + tr("This can be caused by a path length limitation "
QString msg = tr("No symbols found in core file <i>%1</i>.") "in the core file.")
.arg(core); + _(" ") + tr("Try to specify the binary using the "
msg += _(" ");
msg += tr("This can be caused by a path length limitation in the "
"core file.");
msg += _(" ");
msg += tr("Try to specify the binary using the "
"<i>Debug->Start Debugging->Attach to Core</i> dialog."); "<i>Debug->Start Debugging->Attach to Core</i> dialog.");
notifyInferiorSetupFailed(msg); notifyInferiorSetupFailed(msg);
} }
}
void GdbCoreEngine::runEngine()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
postCommand("target core " + coreFileName().toLocal8Bit(), NoFlags, CB(handleTargetCore));
}
void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response) void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response)
{ {
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
notifyInferiorUnrunnable();
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {
showMessage(tr("Attached to core."), StatusBar); showMessage(tr("Attached to core."), StatusBar);
handleInferiorPrepared();
// Due to the auto-solib-add off setting, we don't have any // Due to the auto-solib-add off setting, we don't have any
// symbols yet. Load them in order of importance. // symbols yet. Load them in order of importance.
reloadStack(); reloadStack();
@@ -251,27 +253,19 @@ void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response)
postCommand("p 5", NoFlags, CB(handleRoundTrip)); postCommand("p 5", NoFlags, CB(handleRoundTrip));
return; return;
} }
QString msg = tr("Attach to core \"%1\" failed:") showStatusMessage(tr("Attach to core \"%1\" failed:").arg(startParameters().coreFile)
.arg(startParameters().coreFile) + QLatin1Char('\n') + QString::fromLocal8Bit(response.data["msg"].data()));
+ QLatin1Char('\n') notifyEngineIll();
+ QString::fromLocal8Bit(response.data["msg"].data());
notifyInferiorSetupFailed(msg);
} }
void GdbCoreEngine::handleRoundTrip(const DebuggerResponse &response) void GdbCoreEngine::handleRoundTrip(const DebuggerResponse &response)
{ {
Q_UNUSED(response); Q_UNUSED(response);
loadSymbolsForStack(); loadSymbolsForStack();
handleStop2();
QTimer::singleShot(1000, this, SLOT(loadAllSymbols())); QTimer::singleShot(1000, this, SLOT(loadAllSymbols()));
} }
void GdbCoreEngine::runEngine()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
notifyInferiorUnrunnable();
updateAll();
}
void GdbCoreEngine::interruptInferior() void GdbCoreEngine::interruptInferior()
{ {
// A core never runs, so this cannot be called. // A core never runs, so this cannot be called.

View File

@@ -1230,7 +1230,7 @@ void GdbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages
flushCommand(cmd); flushCommand(cmd);
} }
// This is called from CoreAdapter and AttachAdapter. // This is triggered when switching snapshots.
void GdbEngine::updateAll() void GdbEngine::updateAll()
{ {
//PENDING_DEBUG("UPDATING ALL\n"); //PENDING_DEBUG("UPDATING ALL\n");