mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
The -gdb-set environment is not describe properly
in the doc ... finally discover at it works by looking at the command line, first attempt to rectify
This commit is contained in:
parent
e8e72e90ad
commit
d9141a8a93
4 changed files with 71 additions and 5 deletions
|
@ -1,3 +1,16 @@
|
|||
2003-12-18 Alain Magloire
|
||||
Set environment variable value to give the program.
|
||||
Arguments are VAR VALUE where VAR is variable name and VALUE is value.
|
||||
VALUES of environment variables are uninterpreted strings.
|
||||
This does not affect the program until the next "run" command.
|
||||
|
||||
So pass the string raw.
|
||||
|
||||
* src/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/cdi/RuntimeOptions.java
|
||||
* src/org/eclipse/cdt/debug/mi/core/CommandFactory.java
|
||||
|
||||
|
||||
2003-12-17 Mikhail Khodjaiants
|
||||
|
||||
Fix for bug 49061: Different values are used as default for the "Load shared library symbols automatically" option.
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.cdt.debug.mi.core.MISession;
|
|||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIExecArguments;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIGDBSetEnvironment;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||
|
||||
/**
|
||||
|
@ -64,12 +64,11 @@ public class RuntimeOptions implements ICDIRuntimeOptions {
|
|||
String value = props.getProperty(key);
|
||||
String params[] = null;
|
||||
if (value == null || value.length() == 0) {
|
||||
params = new String[] {"environment", key};
|
||||
params = new String[] {key};
|
||||
} else {
|
||||
String var = key + "=" + value;
|
||||
params = new String[] {"environment", var};
|
||||
params = new String[] {key, value};
|
||||
}
|
||||
MIGDBSet set = factory.createMIGDBSet(params);
|
||||
MIGDBSetEnvironment set = factory.createMIGDBSetEnvironment(params);
|
||||
try {
|
||||
mi.postCommand(set);
|
||||
MIInfo info = set.getMIInfo();
|
||||
|
|
|
@ -109,6 +109,14 @@ public class CommandFactory {
|
|||
return new MIEnvironmentPWD();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public MIGDBSetEnvironment createMIGDBSetEnvironment(String[] params) {
|
||||
return new MIGDBSetEnvironment(params);
|
||||
}
|
||||
|
||||
public MIExecAbort createMIExecAbort() {
|
||||
return new MIExecAbort();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.eclipse.cdt.debug.mi.core.command;
|
||||
|
||||
/**
|
||||
*
|
||||
* -gdb-set
|
||||
*
|
||||
* Set an internal GDB variable.
|
||||
*
|
||||
*/
|
||||
public class MIGDBSetEnvironment extends MIGDBSet {
|
||||
|
||||
public MIGDBSetEnvironment(String[] paths) {
|
||||
super(paths);
|
||||
// Overload the parameter
|
||||
String[] newPaths = new String[paths.length + 1];
|
||||
newPaths[0] = "environment";
|
||||
System.arraycopy(paths, 0, newPaths, 1, paths.length);
|
||||
setParameters(newPaths);
|
||||
}
|
||||
|
||||
/**
|
||||
* According to the help.:
|
||||
* Set environment variable value to give the program.
|
||||
* Arguments are VAR VALUE where VAR is variable name and VALUE is value.
|
||||
* VALUES of environment variables are uninterpreted strings.
|
||||
* This does not affect the program until the next "run" command.
|
||||
*
|
||||
* So pass the strings raw without interpretation.
|
||||
*/
|
||||
protected String parametersToString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
if (parameters != null) {
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
buffer.append(' ').append(parameters[i]);
|
||||
}
|
||||
}
|
||||
return buffer.toString().trim();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue