1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-20 06:35:50 +02:00

Bug 495044 - Fix launching for msys2

Not sure how this was working my desktop machine, but in my home
environment, I ran across an issue where the macros weren't resolved
in the ICdtVariables used for the launch. They need to be resolved.

I think took a look at the debug launch because it was also failing.
As I found out, the GdbLaunchDelegate wasn't using the new GDBLaunch
getVersion routine and was using the deprecated method in launch utils.

Change-Id: I63076833fc444c6df7f758e08df67c1c6f9d9f72
This commit is contained in:
Doug Schaefer 2016-06-02 22:56:25 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent c62b5f8ae6
commit b5b78c64d6
3 changed files with 13 additions and 11 deletions

View file

@ -32,6 +32,7 @@ import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.cdtvariables.CdtVariableException; import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
import org.eclipse.cdt.core.cdtvariables.ICdtVariable; import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable; import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
@ -660,19 +661,17 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr
} }
// Add variables from build info // Add variables from build info
ICdtVariable[] buildVars = CCorePlugin.getDefault().getCdtVariableManager().getVariables(cfg); ICdtVariableManager manager = CCorePlugin.getDefault().getCdtVariableManager();
ICdtVariable[] buildVars = manager.getVariables(cfg);
for (ICdtVariable var : buildVars) { for (ICdtVariable var : buildVars) {
try { try {
// The project_classpath variable contributed by JDT is // The project_classpath variable contributed by JDT is
// useless // useless for running C/C++ binaries, but it can be lethal
// for running C/C++ // if it has a very large value that exceeds shell limit. See
// binaries, but it can be lethal if it has a very large
// value
// that exceeds shell
// limit. See
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=408522 // http://bugs.eclipse.org/bugs/show_bug.cgi?id=408522
if (!"project_classpath".equals(var.getName())) {//$NON-NLS-1$ if (!"project_classpath".equals(var.getName())) {//$NON-NLS-1$
envMap.put(var.getName(), var.getStringValue()); String value = manager.resolveValue(var.getStringValue(), "", File.pathSeparator, cfg); //$NON-NLS-1$
envMap.put(var.getName(), value);
} }
} catch (CdtVariableException e) { } catch (CdtVariableException e) {
// Some Eclipse dynamic variables can't be resolved // Some Eclipse dynamic variables can't be resolved

View file

@ -139,7 +139,7 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2
monitor.worked(1); monitor.worked(1);
String gdbVersion = getGDBVersion(config); String gdbVersion = launch.getGDBVersion();
// First make sure non-stop is supported, if the user want to use this mode // First make sure non-stop is supported, if the user want to use this mode
if (LaunchUtils.getIsNonStopMode(config) && !isNonStopSupportedInGdbVersion(gdbVersion)) { if (LaunchUtils.getIsNonStopMode(config) && !isNonStopSupportedInGdbVersion(gdbVersion)) {

View file

@ -25,6 +25,7 @@ import java.util.Map.Entry;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.cdtvariables.CdtVariableException; import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
import org.eclipse.cdt.core.cdtvariables.ICdtVariable; import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable; import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
@ -204,7 +205,8 @@ public class LocalRunLaunchDelegate extends AbstractCLaunchDelegate2 {
} }
// Add variables from build info // Add variables from build info
ICdtVariable[] buildVars = CCorePlugin.getDefault().getCdtVariableManager().getVariables(cfg); ICdtVariableManager manager = CCorePlugin.getDefault().getCdtVariableManager();
ICdtVariable[] buildVars = manager.getVariables(cfg);
for (ICdtVariable var : buildVars) { for (ICdtVariable var : buildVars) {
try { try {
// The project_classpath variable contributed by JDT is // The project_classpath variable contributed by JDT is
@ -213,7 +215,8 @@ public class LocalRunLaunchDelegate extends AbstractCLaunchDelegate2 {
// shell limit. See // shell limit. See
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=408522 // http://bugs.eclipse.org/bugs/show_bug.cgi?id=408522
if (!"project_classpath".equals(var.getName())) {//$NON-NLS-1$ if (!"project_classpath".equals(var.getName())) {//$NON-NLS-1$
envMap.put(var.getName(), var.getStringValue()); String value = manager.resolveValue(var.getStringValue(), "", File.pathSeparator, cfg); //$NON-NLS-1$
envMap.put(var.getName(), value);
} }
} catch (CdtVariableException e) { } catch (CdtVariableException e) {
// Some Eclipse dynamic variables can't be resolved // Some Eclipse dynamic variables can't be resolved