diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java new file mode 100644 index 00000000000..f2612ad4406 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/command/MIGDBSetEnvironment.java @@ -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(); + } + +}