1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 196154: "Run to Line" command fails with native windows paths

This commit is contained in:
John Cortell 2010-09-27 16:21:33 +00:00
parent 8ff177d648
commit f38c9abf74
2 changed files with 15 additions and 8 deletions

View file

@ -1514,18 +1514,21 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
} }
} }
/** /**
* See bug232415 * See bug 232415
* *
* @param path the absolute path to the source file * @param path
* @return * the absolute path to the source file
*/ * @return the simple filename if running on Windows and [path] is not an
private String adjustDebuggerPath(String path) { * absolute UNIX one. Otherwise, [path] is returned
*/
static String adjustDebuggerPath(String path) {
String result = path; String result = path;
// Make it MinGW-specific // Make it MinGW-specific
if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$ if (Platform.getOS().startsWith("win")) { //$NON-NLS-1$
if (!path.startsWith("/")) { //$NON-NLS-1$ if (!path.startsWith("/")) { //$NON-NLS-1$
result = path.substring(path.lastIndexOf('\\') + 1); path = path.replace('\\', '/');
result = path.substring(path.lastIndexOf('/') + 1);
} }
} }
return result; return result;

View file

@ -1119,6 +1119,10 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
*/ */
public void runToLine(IExecutionDMContext context, String sourceFile, public void runToLine(IExecutionDMContext context, String sourceFile,
int lineNumber, boolean skipBreakpoints, RequestMonitor rm) { int lineNumber, boolean skipBreakpoints, RequestMonitor rm) {
// Hack around a MinGW bug; see 196154
sourceFile = MIBreakpointsManager.adjustDebuggerPath(sourceFile);
runToLocation(context, sourceFile + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$ runToLocation(context, sourceFile + ":" + Integer.toString(lineNumber), skipBreakpoints, rm); //$NON-NLS-1$
} }