mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 18:35:32 +02:00
New Cygpath class for the ICygwinToolsProvider
IToolsProvider to find addr2line and c++filt
This commit is contained in:
parent
8c64ff43dd
commit
8989c875b7
3 changed files with 95 additions and 0 deletions
|
@ -0,0 +1,53 @@
|
||||||
|
package org.eclipse.cdt.utils;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
||||||
|
|
||||||
|
public class CygPath {
|
||||||
|
private Process cygpath;
|
||||||
|
private BufferedReader stdout;
|
||||||
|
private BufferedWriter stdin;
|
||||||
|
|
||||||
|
public CygPath(String command) throws IOException {
|
||||||
|
String[] args = {command, "--windows", "--file", "-"};
|
||||||
|
cygpath = ProcessFactory.getFactory().exec(args);
|
||||||
|
//cppfilt = new Spawner(args);
|
||||||
|
stdin = new BufferedWriter(new OutputStreamWriter(cygpath.getOutputStream()));
|
||||||
|
stdout = new BufferedReader(new InputStreamReader(cygpath.getInputStream()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CygPath() throws IOException {
|
||||||
|
this("cygpath");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileName(String name) throws IOException {
|
||||||
|
stdin.write(name + "\n");
|
||||||
|
stdin.flush();
|
||||||
|
String str = stdout.readLine();
|
||||||
|
if ( str != null ) {
|
||||||
|
return str.trim();
|
||||||
|
}
|
||||||
|
throw new IOException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
try {
|
||||||
|
stdout.close();
|
||||||
|
stdin.close();
|
||||||
|
cygpath.getErrorStream().close();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
}
|
||||||
|
cygpath.destroy();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2002,2003 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.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public interface ICygwinToolsProvider extends IToolsProvider {
|
||||||
|
|
||||||
|
CygPath getCygPath();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2002,2003 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.utils;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public interface IToolsProvider {
|
||||||
|
|
||||||
|
Addr2line getAddr2Line(IPath path);
|
||||||
|
|
||||||
|
CPPFilt getCPPFilt();
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue