mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge 2980b60439
into 7f86b4a76c
This commit is contained in:
commit
5c6d2b29a0
2 changed files with 17 additions and 3 deletions
|
@ -151,6 +151,9 @@ public interface ICBuildConfiguration extends IAdaptable, IScannerInfoProvider {
|
||||||
* @param env
|
* @param env
|
||||||
* build environment
|
* build environment
|
||||||
* @since 6.1
|
* @since 6.1
|
||||||
|
* @implNote Ensure you pass a new non-empty map containing the base environment
|
||||||
|
* as this method modifies the passed in map adding the ICBuildConfiguration specific
|
||||||
|
* overrides, such as applying the project's build environment.
|
||||||
*/
|
*/
|
||||||
default void setBuildEnvironment(Map<String, String> env) {
|
default void setBuildEnvironment(Map<String, String> env) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.cdt.dsf.gdb.launching.ServicesLaunchSequence;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||||
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
|
||||||
|
import org.eclipse.cdt.utils.spawner.EnvironmentReader;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -76,10 +77,20 @@ public class CoreBuildLocalDebugLaunchDelegate extends CoreBuildLaunchConfigDele
|
||||||
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
|
ILaunchTarget target = ((ITargetedLaunch) launch).getLaunchTarget();
|
||||||
ICBuildConfiguration buildConfig = getBuildConfiguration(configuration, mode, target, monitor);
|
ICBuildConfiguration buildConfig = getBuildConfiguration(configuration, mode, target, monitor);
|
||||||
|
|
||||||
Map<String, String> buildEnv = new HashMap<>();
|
Map<String, String> systemEnv = new HashMap<>();
|
||||||
buildConfig.setBuildEnvironment(buildEnv);
|
Properties environmentVariables = EnvironmentReader.getEnvVars();
|
||||||
|
for (String key : environmentVariables.stringPropertyNames()) {
|
||||||
|
String value = environmentVariables.getProperty(key);
|
||||||
|
systemEnv.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
var before = new HashMap<>(systemEnv);
|
||||||
|
buildConfig.setBuildEnvironment(systemEnv);
|
||||||
|
|
||||||
|
before.forEach((k, v) -> systemEnv.remove(k, v));
|
||||||
|
|
||||||
Properties envProps = new Properties();
|
Properties envProps = new Properties();
|
||||||
envProps.putAll(buildEnv);
|
envProps.putAll(systemEnv);
|
||||||
gdbLaunch.setInitialEnvironment(envProps);
|
gdbLaunch.setInitialEnvironment(envProps);
|
||||||
|
|
||||||
String debugger = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
String debugger = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
||||||
|
|
Loading…
Add table
Reference in a new issue