forked from qt-creator/qt-creator
docker: Fix run environment setup
When starting a debug session the systemEnvironment() was used as the basis for the debugger process. If the docker device did not have the same shell installed as the host, this would break gdb as the SHELL= env variable might point to a non-existing shell binary. Change-Id: I7253ad3c4995eed857279146f1b258febe1ca710 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -3854,6 +3854,7 @@ void GdbEngine::setupEngine()
|
||||
if (!debuggerSettings()->loadGdbInit.value())
|
||||
gdbCommand.addArg("-n");
|
||||
|
||||
// This is filled in DebuggerKitAspect::runnable
|
||||
Environment gdbEnv = rp.debugger.environment;
|
||||
gdbEnv.setupEnglishOutput();
|
||||
if (rp.runAsRoot)
|
||||
@@ -4046,9 +4047,9 @@ void GdbEngine::setEnvironmentVariables()
|
||||
&& str.compare("path", Qt::CaseInsensitive) == 0;
|
||||
};
|
||||
|
||||
Environment sysEnv = Environment::systemEnvironment();
|
||||
Environment baseEnv = runParameters().debugger.environment;
|
||||
Environment runEnv = runParameters().inferior.environment;
|
||||
const NameValueItems items = sysEnv.diff(runEnv);
|
||||
const NameValueItems items = baseEnv.diff(runEnv);
|
||||
for (const EnvironmentItem &item : items) {
|
||||
// imitate the weird windows gdb behavior of setting the case of the path environment
|
||||
// variable name to an all uppercase PATH
|
||||
|
@@ -47,6 +47,8 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
@@ -486,8 +488,10 @@ void BuildConfiguration::setBuildDirectorySettingsKey(const QString &key)
|
||||
Environment BuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
Environment result;
|
||||
if (useSystemEnvironment())
|
||||
result = Environment::systemEnvironment();
|
||||
if (useSystemEnvironment()) {
|
||||
ProjectExplorer::IDevice::ConstPtr devicePtr = BuildDeviceKitAspect::device(kit());
|
||||
result = devicePtr ? devicePtr->systemEnvironment() : Environment::systemEnvironment();
|
||||
}
|
||||
addToEnvironment(result);
|
||||
kit()->addToBuildEnvironment(result);
|
||||
result.modify(project()->additionalEnvironment());
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "kit.h"
|
||||
|
||||
#include "devicesupport/idevice.h"
|
||||
#include "devicesupport/idevicefactory.h"
|
||||
#include "kitinformation.h"
|
||||
#include "kitmanager.h"
|
||||
@@ -575,14 +576,16 @@ void Kit::addToRunEnvironment(Environment &env) const
|
||||
|
||||
Environment Kit::buildEnvironment() const
|
||||
{
|
||||
Environment env = Environment::systemEnvironment(); // FIXME: Use build device
|
||||
IDevice::ConstPtr device = BuildDeviceKitAspect::device(this);
|
||||
Environment env = device ? device->systemEnvironment() : Environment::systemEnvironment();
|
||||
addToBuildEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
Environment Kit::runEnvironment() const
|
||||
{
|
||||
Environment env = Environment::systemEnvironment(); // FIXME: Use run device
|
||||
IDevice::ConstPtr device = DeviceKitAspect::device(this);
|
||||
Environment env = device ? device->systemEnvironment() : Environment::systemEnvironment();
|
||||
addToRunEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
Reference in New Issue
Block a user