lttng.ust: Do not skip unknown lines in addr2line output
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Tue, 19 Jul 2016 19:13:49 +0000 (15:13 -0400)
committerAlexandre Montplaisir <alexmonthy@efficios.com>
Thu, 1 Sep 2016 16:25:53 +0000 (12:25 -0400)
addr2line will use "??" to indicate unknown function names or
source files. In these cases we should still report the other
information that may be available, instead of skipping the whole
callsite.

Change-Id: I2cd055b68950c8a6b5c21fd984cd82f2e3544245
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/77327
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/FileOffsetMapper.java

index 7717955aef228758a21cc671fc288788b5ab01af..d6700046d216c57145fa101fa2138b8ee10141d5 100644 (file)
@@ -163,6 +163,12 @@ public final class FileOffsetMapper {
     // Utility methods making use of 'addr2line'
     // ------------------------------------------------------------------------
 
+    /**
+     * Value used in addr2line output to represent unknown function names or
+     * source files.
+     */
+    private static final String UNKNOWN_VALUE = "??"; //$NON-NLS-1$
+
     /**
      * Cache of all calls to 'addr2line', so that we can avoid recalling the
      * external process repeatedly.
@@ -252,25 +258,26 @@ public final class FileOffsetMapper {
 
             if (oddLine) {
                 /* This is a line indicating the function name */
-                currentFunctionName = outputLine;
+                if (outputLine.equals(UNKNOWN_VALUE)) {
+                    currentFunctionName = null;
+                } else {
+                    currentFunctionName = outputLine;
+                }
             } else {
                 /* This is a line indicating a call site */
                 String[] elems = outputLine.split(":"); //$NON-NLS-1$
                 String fileName = elems[0];
-                if (fileName.equals("??")) { //$NON-NLS-1$
-                    continue;
+                if (fileName.equals(UNKNOWN_VALUE)) {
+                    fileName = null;
                 }
+                Long lineNumber;
                 try {
-                    long lineNumber = Long.parseLong(elems[1]);
-                    callsites.add(new Addr2lineInfo(fileName, currentFunctionName, lineNumber));
-
+                    lineNumber = Long.valueOf(elems[1]);
                 } catch (NumberFormatException e) {
-                    /*
-                     * Probably a '?' output, meaning unknown line number.
-                     * Ignore this entry.
-                     */
-                    continue;
+                    /* Probably a '?' output, meaning unknown line number. */
+                    lineNumber = null;
                 }
+                callsites.add(new Addr2lineInfo(fileName, currentFunctionName, lineNumber));
             }
         }
 
This page took 0.025795 seconds and 5 git commands to generate.