Skip to content

Commit

Permalink
Core Build local debug use launch environment attributes.
Browse files Browse the repository at this point in the history
The Core Build local debug session uses the environment variables from
the environment tab that was added in eclipse-cdt#901.
  • Loading branch information
ewaterlander committed Nov 19, 2024
1 parent 2093a0b commit 691ae8c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.launchbar.core.target.ILaunchTarget;
import org.eclipse.launchbar.core.target.launch.ITargetedLaunch;

Expand Down Expand Up @@ -81,6 +82,14 @@ public void launch(ILaunchConfiguration configuration, String mode, ILaunch laun
envProps.putAll(buildEnv);
gdbLaunch.setInitialEnvironment(envProps);

// Override initial environment by launch configuration attributes.
Map<String, String> launchEnvironment = configuration.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
new HashMap<>());
if (!configuration.getAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true)) {
envProps.clear();
}
envProps.putAll(launchEnvironment);

IToolChain toolChain = buildConfig.getToolChain();
Path gdbPath = toolChain.getCommandPath(Paths.get("gdb")); //$NON-NLS-1$
gdbLaunch.setGDBPath(gdbPath != null ? gdbPath.toString() : "gdb"); //$NON-NLS-1$
Expand Down

0 comments on commit 691ae8c

Please sign in to comment.