1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Fix for PR 65077

* mi/org/eclipse/cdt/debug/mi/core/command/CygwinCommandFactory.java
	* mi/org/eclipse/cdt/debug/mi/core/command/CygwinMIEnvironmentCD.jav
	* src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java
This commit is contained in:
Alain Magloire 2004-06-08 21:40:21 +00:00
parent 0b189114ba
commit afd9e92342
4 changed files with 92 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2004-06-08 Alain Magloire
Fix for PR 65077
* mi/org/eclipse/cdt/debug/mi/core/command/CygwinCommandFactory.java
* mi/org/eclipse/cdt/debug/mi/core/command/CygwinMIEnvironmentCD.jav
* src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java
2004-06-02 Mikhail Khodjaiants
Moved externalized strings to the right property file.

View file

@ -16,4 +16,10 @@ public class CygwinCommandFactory extends CommandFactory {
return new CygwinMIEnvironmentDirectory(pathdirs);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createMIEnvironmentCD(java.lang.String)
*/
public MIEnvironmentCD createMIEnvironmentCD(String pathdir) {
return new CygwinMIEnvironmentCD(pathdir);
}
}

View file

@ -0,0 +1,78 @@
/**********************************************************************
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.mi.core.command;
import java.io.ByteArrayOutputStream;
import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.core.runtime.Path;
/**
* CygwinMIEnvironmentCD
*/
public class CygwinMIEnvironmentCD extends MIEnvironmentCD {
/**
* @param path
*/
public CygwinMIEnvironmentCD(String path) {
super(path);
// Use the cygpath utility to convert the path
CommandLauncher launcher = new CommandLauncher();
ByteArrayOutputStream output = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
String newPath = null;
launcher.execute(
new Path("cygpath"), //$NON-NLS-1$
new String[] { "-u", path }, //$NON-NLS-1$
new String[0],
new Path(".")); //$NON-NLS-1$
if (launcher.waitAndRead(output, err) == CommandLauncher.OK) {
newPath = output.toString().trim();
if (newPath != null && newPath.length() > 0) {
path = newPath;
}
}
setParameters(new String[]{newPath});
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.mi.core.command.MICommand#parametersToString()
*/
protected String parametersToString() {
if (parameters != null && parameters.length == 1) {
StringBuffer sb = new StringBuffer();
// We need to escape the double quotes and the backslash.
String param = parameters[0];
for (int j = 0; j < param.length(); j++) {
char c = param.charAt(j);
if (c == '"' || c == '\\') {
sb.append('\\');
}
sb.append(c);
}
// If the string contains spaces instead of escaping
// surround the parameter with double quotes.
if (containsWhitespace(param)) {
sb.insert(0, '"');
sb.append('"');
}
return sb.toString().trim();
}
return super.parametersToString();
}
}

View file

@ -86,7 +86,6 @@ public class CygwinGDBDebugger extends GDBDebugger {
// We ignore this exception, for example
// on GNU/Linux the new-console is an error.
}
initializeLibraries(config, session);
return session;
} catch (CDIException e) {
failed = true;