1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

PR 53323 fix

This commit is contained in:
Alain Magloire 2004-03-01 15:19:49 +00:00
parent a5e59ef207
commit 183e1ab403
4 changed files with 52 additions and 14 deletions

View file

@ -1,3 +1,12 @@
2004-03-01 Alain Magloire
Patch from Uwe Stieber
PR #53323 extending the implementation of Addr2line/CPPFilt and Objdump.
* utils/org/eclipse/cdt/utils/Addr2line.java
* utils/org/eclipse/cdt/utils/CPPFil.java
* utils/org/eclipse/cdt/utils/Objdump.java
2004-02-29 Alain Magloire
Performance improvements in the Deltaprocessing

View file

@ -14,23 +14,38 @@ import java.io.OutputStreamWriter;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
public class Addr2line {
private String[] args;
private Process addr2line;
private BufferedReader stdout;
private BufferedWriter stdin;
private String lastaddr, lastsymbol, lastline;
public Addr2line(String command, String file) throws IOException {
String[] args = {command, "-C", "-f", "-e", file}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addr2line = ProcessFactory.getFactory().exec(args);
stdin = new BufferedWriter(new OutputStreamWriter(addr2line.getOutputStream()));
stdout = new BufferedReader(new InputStreamReader(addr2line.getInputStream()));
public Addr2line(String command, String[] params, String file) throws IOException {
init(command, params, file);
}
public Addr2line(String command, String file) throws IOException {
this(command, new String[0], file);
}
public Addr2line(String file) throws IOException {
this("addr2line", file); //$NON-NLS-1$
}
private void getOutput(String address) throws IOException {
protected void init(String command, String[] params, String file) throws IOException {
if (params == null || params.length == 0) {
args = new String[] {command, "-C", "-f", "-e", file}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
args = new String[params.length + 1];
args[0] = command;
System.arraycopy(params, 0, args, 1, params.length);
}
addr2line = ProcessFactory.getFactory().exec(args);
stdin = new BufferedWriter(new OutputStreamWriter(addr2line.getOutputStream()));
stdout = new BufferedReader(new InputStreamReader(addr2line.getInputStream()));
}
protected void getOutput(String address) throws IOException {
if ( address.equals(lastaddr) == false ) {
stdin.write(address + "\n"); //$NON-NLS-1$
stdin.flush();

View file

@ -14,22 +14,36 @@ import java.io.OutputStreamWriter;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
public class CPPFilt {
private String[] args;
private Process cppfilt;
private BufferedReader stdout;
private BufferedWriter stdin;
public CPPFilt(String command) throws IOException {
String[] args = {command};
cppfilt = ProcessFactory.getFactory().exec(args);
//cppfilt = new Spawner(args);
stdin = new BufferedWriter(new OutputStreamWriter(cppfilt.getOutputStream()));
stdout = new BufferedReader(new InputStreamReader(cppfilt.getInputStream()));
public CPPFilt(String command, String[] params) throws IOException {
init(command, params);
}
public CPPFilt(String command) throws IOException {
this(command, new String[0]);
}
public CPPFilt() throws IOException {
this("c++filt"); //$NON-NLS-1$
}
protected void init(String command, String[] params) throws IOException {
if (params == null || params.length == 0) {
args = new String[] {command};
} else {
args = new String[params.length + 1];
args[0] = command;
System.arraycopy(params, 0, args, 1, params.length);
}
cppfilt = ProcessFactory.getFactory().exec(args);
stdin = new BufferedWriter(new OutputStreamWriter(cppfilt.getOutputStream()));
stdout = new BufferedReader(new InputStreamReader(cppfilt.getInputStream()));
}
public String getFunction(String symbol) throws IOException {
stdin.write(symbol + "\n"); //$NON-NLS-1$
stdin.flush();

View file

@ -50,7 +50,7 @@ public class Objdump {
this("objdump", new String[0], file); //$NON-NLS-1$
}
void init(String command, String[] params, String file) throws IOException {
protected void init(String command, String[] params, String file) throws IOException {
if (params == null || params.length == 0) {
args = new String[] { command, "-C", "-x", "-S", file }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {