|
34 | 34 | import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
35 | 35 | import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
36 | 36 | import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
| 37 | +import org.eclipse.cdt.utils.spawner.EnvironmentReader; |
37 | 38 | import org.eclipse.core.runtime.CoreException;
|
38 | 39 | import org.eclipse.core.runtime.IProgressMonitor;
|
39 | 40 | import org.eclipse.core.runtime.IStatus;
|
@@ -76,10 +77,20 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun
|
76 | 77 | ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
|
77 | 78 | ICBuildConfiguration buildConfig = getBuildConfiguration(configuration, mode, target, monitor);
|
78 | 79 |
|
79 |
| - Map<String, String> buildEnv = new HashMap<>(); |
80 |
| - buildConfig.setBuildEnvironment(buildEnv); |
| 80 | + Map<String, String> systemEnv = new HashMap<>(); |
| 81 | + Properties environmentVariables = EnvironmentReader.getEnvVars(); |
| 82 | + for (String key : environmentVariables.stringPropertyNames()) { |
| 83 | + String value = environmentVariables.getProperty(key); |
| 84 | + systemEnv.put(key, value); |
| 85 | + } |
| 86 | + |
| 87 | + var before = new HashMap<>(systemEnv); |
| 88 | + buildConfig.setBuildEnvironment(systemEnv); |
| 89 | + |
| 90 | + before.forEach((k, v) -> systemEnv.remove(k, v)); |
| 91 | + |
81 | 92 | Properties envProps = new Properties();
|
82 |
| - envProps.putAll(buildEnv); |
| 93 | + envProps.putAll(systemEnv); |
83 | 94 | gdbLaunch.setInitialEnvironment(envProps);
|
84 | 95 |
|
85 | 96 | String debugger = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
|
0 commit comments