forked from qt-creator/qt-creator
Debugger: Also look for "/ndk/" path segment in LldbEngine::setupEngine
And pull the env-modifying code into a function which we might want to use in other places where lldb gets executed. Change-Id: Ic9caaf8c29896c54d67c969d2812b4da627a5fc0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -204,6 +204,18 @@ static QString adapterStartFailed()
|
|||||||
return LldbEngine::tr("Adapter start failed.");
|
return LldbEngine::tr("Adapter start failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void addAndroidPythonDir(const FilePath &lldbCmd, Environment &env)
|
||||||
|
{
|
||||||
|
if (!lldbCmd.path().contains("/ndk/") && !lldbCmd.path().contains("/ndk-bundle/"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
FilePath androidPythonDir = lldbCmd.parentDir().parentDir().pathAppended("python3");
|
||||||
|
if (HostOsInfo::isAnyUnixHost())
|
||||||
|
androidPythonDir = androidPythonDir.pathAppended("bin");
|
||||||
|
if (androidPythonDir.exists())
|
||||||
|
env.prependOrSetPath(androidPythonDir.path());
|
||||||
|
}
|
||||||
|
|
||||||
void LldbEngine::setupEngine()
|
void LldbEngine::setupEngine()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||||
@@ -213,13 +225,7 @@ void LldbEngine::setupEngine()
|
|||||||
showMessage("STARTING LLDB: " + lldbCmd.toUserOutput());
|
showMessage("STARTING LLDB: " + lldbCmd.toUserOutput());
|
||||||
Environment environment = runParameters().debugger.environment;
|
Environment environment = runParameters().debugger.environment;
|
||||||
environment.appendOrSet("PYTHONUNBUFFERED", "1"); // avoid flushing problem on macOS
|
environment.appendOrSet("PYTHONUNBUFFERED", "1"); // avoid flushing problem on macOS
|
||||||
if (lldbCmd.path().contains("/ndk-bundle/")) {
|
addAndroidPythonDir(lldbCmd, environment);
|
||||||
FilePath androidPythonDir = lldbCmd.parentDir().parentDir().pathAppended("python3");
|
|
||||||
if (HostOsInfo::isAnyUnixHost())
|
|
||||||
androidPythonDir = androidPythonDir.pathAppended("bin");
|
|
||||||
if (androidPythonDir.exists())
|
|
||||||
environment.prependOrSetPath(androidPythonDir.path());
|
|
||||||
}
|
|
||||||
m_lldbProc.setEnvironment(environment);
|
m_lldbProc.setEnvironment(environment);
|
||||||
|
|
||||||
if (runParameters().debugger.workingDirectory.isDir())
|
if (runParameters().debugger.workingDirectory.isDir())
|
||||||
|
|||||||
Reference in New Issue
Block a user