Skip to content

Commit

Permalink
Use launch configuration environment attributes in Core Build local d…
Browse files Browse the repository at this point in the history
…ebug.

The Core Build local debug launch uses the environment attributes from
the new environment tab that was added in eclipse-cdt#901.
  • Loading branch information
ewaterlander committed Nov 19, 2024
1 parent 9b6bb07 commit 014e093
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
Bundle-Version: 7.1.300.qualifier
Bundle-Version: 7.1.400.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
Expand Down
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 014e093

Please sign in to comment.