mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +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:
parent
0b189114ba
commit
afd9e92342
4 changed files with 92 additions and 1 deletions
|
@ -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
|
2004-06-02 Mikhail Khodjaiants
|
||||||
|
|
||||||
Moved externalized strings to the right property file.
|
Moved externalized strings to the right property file.
|
||||||
|
|
|
@ -16,4 +16,10 @@ public class CygwinCommandFactory extends CommandFactory {
|
||||||
return new CygwinMIEnvironmentDirectory(pathdirs);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -86,7 +86,6 @@ public class CygwinGDBDebugger extends GDBDebugger {
|
||||||
// We ignore this exception, for example
|
// We ignore this exception, for example
|
||||||
// on GNU/Linux the new-console is an error.
|
// on GNU/Linux the new-console is an error.
|
||||||
}
|
}
|
||||||
initializeLibraries(config, session);
|
|
||||||
return session;
|
return session;
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue