Commit 01cb4ee2 authored by hjk's avatar hjk
Browse files

Debugger: Fix soft assert when loading core file



Task-number: QTCREATORBUG-14048
Change-Id: I20d4d8269df3bfb42259ad459b92d5cd738332f5
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent aee35662
...@@ -223,27 +223,29 @@ void GdbCoreEngine::handleFileExecAndSymbols(const DebuggerResponse &response) ...@@ -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 "
"in the core file.")
+ _(" ") + tr("Try to specify the binary using the "
"<i>Debug->Start Debugging->Attach to Core</i> dialog.");
notifyInferiorSetupFailed(msg);
} }
QString msg = tr("No symbols found in core file <i>%1</i>.") }
.arg(core);
msg += _(" "); void GdbCoreEngine::runEngine()
msg += tr("This can be caused by a path length limitation in the " {
"core file."); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
msg += _(" "); postCommand("target core " + coreFileName().toLocal8Bit(), NoFlags, CB(handleTargetCore));
msg += tr("Try to specify the binary using the "
"<i>Debug->Start Debugging->Attach to Core</i> dialog.");
notifyInferiorSetupFailed(msg);
} }
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) ...@@ -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.
......
...@@ -1230,7 +1230,7 @@ void GdbEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages ...@@ -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");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment