View | Details | Raw Unified | Return to bug 53323
Collapse All | Expand All

(-)Addr2line.java (-6 / +21 lines)
Lines 14-36 Link Here
14
import org.eclipse.cdt.utils.spawner.ProcessFactory;
14
import org.eclipse.cdt.utils.spawner.ProcessFactory;
15
15
16
public class Addr2line {
16
public class Addr2line {
17
	private String[] args;
17
	private Process addr2line;
18
	private Process addr2line;
18
	private BufferedReader stdout;
19
	private BufferedReader stdout;
19
	private BufferedWriter stdin;
20
	private BufferedWriter stdin;
20
	private String lastaddr, lastsymbol, lastline;
21
	private String lastaddr, lastsymbol, lastline;
21
22
22
	public Addr2line(String command, String file) throws IOException {
23
	public Addr2line(String command, String[] params, String file) throws IOException {
23
		String[] args = {command, "-C", "-f", "-e", file}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
24
		init(command, params, file);
24
		addr2line = ProcessFactory.getFactory().exec(args);
25
		stdin = new BufferedWriter(new OutputStreamWriter(addr2line.getOutputStream()));
26
		stdout = new BufferedReader(new InputStreamReader(addr2line.getInputStream()));			
27
	}
25
	}
28
26
27
	public Addr2line(String command, String file) throws IOException {
28
		this(command, new String[0], file);
29
	}
30
	
29
	public Addr2line(String file) throws IOException {
31
	public Addr2line(String file) throws IOException {
30
		this("addr2line", file); //$NON-NLS-1$
32
		this("addr2line", file); //$NON-NLS-1$
31
	}
33
	}
32
34
33
	private void getOutput(String address) throws IOException {
35
	protected void init(String command, String[] params, String file) throws IOException {
36
		if (params == null || params.length == 0) {
37
			args = new String[] {command, "-C", "-f", "-e", file}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
38
		} else {
39
			args = new String[params.length + 1];
40
			args[0] = command;
41
			System.arraycopy(params, 0, args, 1, params.length);
42
		}
43
		addr2line = ProcessFactory.getFactory().exec(args);
44
		stdin = new BufferedWriter(new OutputStreamWriter(addr2line.getOutputStream()));
45
		stdout = new BufferedReader(new InputStreamReader(addr2line.getInputStream()));			
46
	}
47
	
48
	protected void getOutput(String address) throws IOException {
34
		if ( address.equals(lastaddr) == false ) {
49
		if ( address.equals(lastaddr) == false ) {
35
				stdin.write(address + "\n"); //$NON-NLS-1$
50
				stdin.write(address + "\n"); //$NON-NLS-1$
36
				stdin.flush();
51
				stdin.flush();
(-)CPPFilt.java (-7 / +21 lines)
Lines 14-33 Link Here
14
import org.eclipse.cdt.utils.spawner.ProcessFactory;
14
import org.eclipse.cdt.utils.spawner.ProcessFactory;
15
15
16
public class CPPFilt {
16
public class CPPFilt {
17
	private String[] args;
17
	private Process cppfilt;
18
	private Process cppfilt;
18
	private BufferedReader stdout;
19
	private BufferedReader stdout;
19
	private BufferedWriter stdin;
20
	private BufferedWriter stdin;
20
21
21
	public CPPFilt(String command) throws IOException {		
22
	public CPPFilt(String command, String[] params) throws IOException {
22
		String[] args = {command};
23
		init(command, params);
23
		cppfilt = ProcessFactory.getFactory().exec(args);
24
		//cppfilt = new Spawner(args);
25
		stdin = new BufferedWriter(new OutputStreamWriter(cppfilt.getOutputStream()));
26
		stdout = new BufferedReader(new InputStreamReader(cppfilt.getInputStream()));
27
	}
24
	}
28
25
	
26
	public CPPFilt(String command) throws IOException {
27
		this(command, new String[0]);
28
	}
29
	
29
	public CPPFilt() throws IOException {
30
	public CPPFilt() throws IOException {
30
		this("c++filt"); //$NON-NLS-1$
31
		this("c++filt"); //$NON-NLS-1$
32
	}
33
34
	protected void init(String command, String[] params) throws IOException {
35
		if (params == null || params.length == 0) {
36
			args = new String[] {command};
37
		} else {
38
			args = new String[params.length + 1];
39
			args[0] = command;
40
			System.arraycopy(params, 0, args, 1, params.length);
41
		}
42
		cppfilt = ProcessFactory.getFactory().exec(args);
43
		stdin = new BufferedWriter(new OutputStreamWriter(cppfilt.getOutputStream()));
44
		stdout = new BufferedReader(new InputStreamReader(cppfilt.getInputStream()));			
31
	}
45
	}
32
46
33
	public String getFunction(String symbol) throws IOException {
47
	public String getFunction(String symbol) throws IOException {
(-)Objdump.java (-1 / +1 lines)
Lines 50-56 Link Here
50
		this("objdump", new String[0], file); //$NON-NLS-1$
50
		this("objdump", new String[0], file); //$NON-NLS-1$
51
	}
51
	}
52
52
53
	void init(String command, String[] params, String file) throws IOException {
53
	protected void init(String command, String[] params, String file) throws IOException {
54
		if (params == null || params.length == 0) {
54
		if (params == null || params.length == 0) {
55
			args = new String[] { command, "-C", "-x", "-S", file }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
55
			args = new String[] { command, "-C", "-x", "-S", file }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
56
		} else {
56
		} else {

Return to bug 53323