Debugger: Make LLDB startup failures more verbose

Fixes: QTCREATORBUG-19612
Change-Id: I7c8ebe3ec734265c8df8a684ccd6bb8991ea8390
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2018-11-09 16:19:12 +01:00
parent f635af8908
commit d4e79230d8
3 changed files with 22 additions and 9 deletions

View File

@@ -2275,3 +2275,10 @@ def __lldb_init_module(debugger, internal_dict):
if not __name__ == 'qt': if not __name__ == 'qt':
# Make available under global 'qt' name for consistency # Make available under global 'qt' name for consistency
internal_dict['qt'] = internal_dict[__name__] internal_dict['qt'] = internal_dict[__name__]
if __name__ == "lldbbridge":
try:
theDumper = Dumper()
except Exception as error:
print('@\nstate="enginesetupfailed",error="{}"@\n'.format(error))

View File

@@ -191,6 +191,11 @@ void LldbEngine::abortDebuggerProcess()
notifyEngineShutdownFinished(); notifyEngineShutdownFinished();
} }
static QString adapterStartFailed()
{
return LldbEngine::tr("Adapter start failed.");
}
void LldbEngine::setupEngine() void LldbEngine::setupEngine()
{ {
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
@@ -211,7 +216,7 @@ void LldbEngine::setupEngine()
notifyEngineSetupFailed(); notifyEngineSetupFailed();
showMessage("ADAPTER START FAILED"); showMessage("ADAPTER START FAILED");
if (!msg.isEmpty()) if (!msg.isEmpty())
ICore::showWarningWithOptions(tr("Adapter start failed."), msg); ICore::showWarningWithOptions(adapterStartFailed(), msg);
return; return;
} }
m_lldbProc.waitForReadyRead(1000); m_lldbProc.waitForReadyRead(1000);
@@ -222,9 +227,8 @@ void LldbEngine::setupEngine()
ICore::resourcePath().toLocal8Bit() + "/debugger/"; ICore::resourcePath().toLocal8Bit() + "/debugger/";
m_lldbProc.write("script sys.path.insert(1, '" + dumperSourcePath + "')\n"); m_lldbProc.write("script sys.path.insert(1, '" + dumperSourcePath + "')\n");
// This triggers reportState("enginesetupok") or "enginesetupfailed":
m_lldbProc.write("script from lldbbridge import *\n"); m_lldbProc.write("script from lldbbridge import *\n");
m_lldbProc.write("script print(dir())\n");
m_lldbProc.write("script theDumper = Dumper()\n"); // This triggers reportState("enginesetupok")
QString commands = nativeStartupCommands(); QString commands = nativeStartupCommands();
if (!commands.isEmpty()) if (!commands.isEmpty())
@@ -384,7 +388,7 @@ void LldbEngine::handleResponse(const QString &response)
cmd.callback(response); cmd.callback(response);
} }
} else if (name == "state") } else if (name == "state")
handleStateNotification(item); handleStateNotification(all);
else if (name == "location") else if (name == "location")
handleLocationNotification(item); handleLocationNotification(item);
else if (name == "output") else if (name == "output")
@@ -830,9 +834,9 @@ void LldbEngine::readLldbStandardOutput()
} }
} }
void LldbEngine::handleStateNotification(const GdbMi &reportedState) void LldbEngine::handleStateNotification(const GdbMi &item)
{ {
QString newState = reportedState.data(); const QString newState = item["state"].data();
if (newState == "running") if (newState == "running")
notifyInferiorRunOk(); notifyInferiorRunOk();
else if (newState == "inferiorrunfailed") else if (newState == "inferiorrunfailed")
@@ -867,9 +871,11 @@ void LldbEngine::handleStateNotification(const GdbMi &reportedState)
notifyInferiorIll(); notifyInferiorIll();
else if (newState == "enginesetupok") else if (newState == "enginesetupok")
notifyEngineSetupOk(); notifyEngineSetupOk();
else if (newState == "enginesetupfailed") else if (newState == "enginesetupfailed") {
Core::AsynchronousMessageBox::critical(adapterStartFailed(),
item["error"].data());
notifyEngineSetupFailed(); notifyEngineSetupFailed();
else if (newState == "enginerunfailed") } else if (newState == "enginerunfailed")
notifyEngineRunFailed(); notifyEngineRunFailed();
else if (newState == "enginerunandinferiorrunok") { else if (newState == "enginerunandinferiorrunok") {
if (runParameters().continueAfterAttach) if (runParameters().continueAfterAttach)

View File

@@ -117,7 +117,7 @@ private:
void readLldbStandardOutput(); void readLldbStandardOutput();
void readLldbStandardError(); void readLldbStandardError();
void handleStateNotification(const GdbMi &state); void handleStateNotification(const GdbMi &item);
void handleLocationNotification(const GdbMi &location); void handleLocationNotification(const GdbMi &location);
void handleOutputNotification(const GdbMi &output); void handleOutputNotification(const GdbMi &output);