mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Bug 427401 - Failure to Parse addr2line binutil output
Fixed Addr2line.java Change-Id: I9b42e8925c86e238ce6dc610d9e0617b11981f42 Signed-off-by: Brad Chiu <brad@andestech.com> Reviewed-on: https://git.eclipse.org/r/24935 Tested-by: Hudson CI Reviewed-by: Jonathan Williams <jonwilliams@qnx.com> Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
This commit is contained in:
parent
0a1d2637ac
commit
84974e6725
1 changed files with 12 additions and 0 deletions
|
@ -15,6 +15,8 @@ import java.io.BufferedWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
||||||
|
@ -25,6 +27,7 @@ public class Addr2line {
|
||||||
private BufferedReader stdout;
|
private BufferedReader stdout;
|
||||||
private BufferedWriter stdin;
|
private BufferedWriter stdin;
|
||||||
private String lastaddr, lastsymbol, lastline;
|
private String lastaddr, lastsymbol, lastline;
|
||||||
|
private static final Pattern OUTPUT_PATTERN = Pattern.compile("(.*)( \\(discriminator.*\\))"); //$NON-NLS-1$
|
||||||
//private boolean isDisposed = false;
|
//private boolean isDisposed = false;
|
||||||
|
|
||||||
public Addr2line(String command, String[] params, String file) throws IOException {
|
public Addr2line(String command, String[] params, String file) throws IOException {
|
||||||
|
@ -113,6 +116,7 @@ public class Addr2line {
|
||||||
//IPF_TODO: check
|
//IPF_TODO: check
|
||||||
for (int i = 0; i <= 20; i += 4, address = address.add(i)) {
|
for (int i = 0; i <= 20; i += 4, address = address.add(i)) {
|
||||||
String line = getLine(address);
|
String line = getLine(address);
|
||||||
|
line = parserOutput(line);
|
||||||
if (line != null) {
|
if (line != null) {
|
||||||
int colon = line.lastIndexOf(':');
|
int colon = line.lastIndexOf(':');
|
||||||
String number = line.substring(colon + 1);
|
String number = line.substring(colon + 1);
|
||||||
|
@ -138,6 +142,14 @@ public class Addr2line {
|
||||||
addr2line.destroy();
|
addr2line.destroy();
|
||||||
//isDisposed = true;
|
//isDisposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String parserOutput(String line) {
|
||||||
|
Matcher matcher = OUTPUT_PATTERN.matcher(line);
|
||||||
|
if (matcher.matches() && matcher.groupCount() > 1) {
|
||||||
|
line = matcher.group(1);
|
||||||
|
}
|
||||||
|
return line;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue