Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Chiu2014-04-14 22:29:24 -0400
committerDoug Schaefer2014-04-15 11:36:35 -0400
commit995e0da76c2d84ebaea4f3797c855d6cb10d8969 (patch)
treed0366bc40878c827dfebfd123d9a5c4117b5376d
parent3bfbd4e24345bf6a71f205bb3eb3d2aaf0e9d7be (diff)
downloadorg.eclipse.cdt-995e0da76c2d84ebaea4f3797c855d6cb10d8969.tar.gz
org.eclipse.cdt-995e0da76c2d84ebaea4f3797c855d6cb10d8969.tar.xz
org.eclipse.cdt-995e0da76c2d84ebaea4f3797c855d6cb10d8969.zip
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> (cherry picked from commit 84974e67258414635cd4e5c4b73921e56d3c8833) Reviewed-on: https://git.eclipse.org/r/25066 Tested-by: Doug Schaefer <dschaefer@qnx.com>
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr2line.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr2line.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr2line.java
index 8a370d0a2e3..9f687643912 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr2line.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr2line.java
@@ -15,6 +15,8 @@ import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
@@ -25,6 +27,7 @@ public class Addr2line {
private BufferedReader stdout;
private BufferedWriter stdin;
private String lastaddr, lastsymbol, lastline;
+ private static final Pattern OUTPUT_PATTERN = Pattern.compile("(.*)( \\(discriminator.*\\))"); //$NON-NLS-1$
//private boolean isDisposed = false;
public Addr2line(String command, String[] params, String file) throws IOException {
@@ -113,6 +116,7 @@ public class Addr2line {
//IPF_TODO: check
for (int i = 0; i <= 20; i += 4, address = address.add(i)) {
String line = getLine(address);
+ line = parserOutput(line);
if (line != null) {
int colon = line.lastIndexOf(':');
String number = line.substring(colon + 1);
@@ -138,6 +142,14 @@ public class Addr2line {
addr2line.destroy();
//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;
+ }
}

Back to the top