Commit d4206752 authored by hjk's avatar hjk
Browse files

Debugger: Only pass environmental differences to inferior

This amends 0f46ad4a

.
Passing the whole environment is unneeded, and can cause
problems with multi-line variables.

Change-Id: I49a32c550ba52737bb8f797e227bb883be8b1df1
Reviewed-by: default avatarBogDan Vatra <bogdan@kde.org>
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent 7a675e2d
......@@ -4263,9 +4263,13 @@ void GdbEngine::loadInitScript()
void GdbEngine::setEnvironmentVariables()
{
if (runParameters().environment.size()) {
foreach (const QString &env, runParameters().environment.toStringList())
postCommand("-gdb-set environment " + env.toUtf8());
Environment sysEnv = Environment::systemEnvironment();
Environment runEnv = runParameters().environment;
foreach (const EnvironmentItem &item, sysEnv.diff(runEnv)) {
if (item.unset)
postCommand("unset environment " + item.name.toUtf8());
else
postCommand("-gdb-set environment " + item.name.toUtf8() + '=' + item.value.toUtf8());
}
}
......
......@@ -290,9 +290,15 @@ void LldbEngine::startLldbStage2()
void LldbEngine::setupInferior()
{
if (runParameters().environment.size()) {
foreach (const QString &env, runParameters().environment.toStringList())
runCommand("env " + env.toUtf8());
Environment sysEnv = Environment::systemEnvironment();
Environment runEnv = runParameters().environment;
foreach (const EnvironmentItem &item, sysEnv.diff(runEnv)) {
DebuggerCommand cmd("executeDebuggerCommand");
if (item.unset)
cmd.arg("command", "settings remove target.env-vars " + item.name.toUtf8());
else
cmd.arg("command", "settings set target.env-vars " + item.name.toUtf8() + '=' + item.value.toUtf8());
runCommand(cmd);
}
const QString path = stringSetting(ExtraDumperFile);
......
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