lttng: Make use of "is_pic" event field in debug info analysis
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.ust.core / src / org / eclipse / tracecompass / lttng2 / ust / core / analysis / debuginfo / UstDebugInfoBinaryAspect.java
index 00f8aedb2f33313614d08a9c064489c7b6deba77..3cb29f28512a3f6f3b0bb52c3f21bdafdff7c628 100644 (file)
@@ -107,10 +107,9 @@ public final class UstDebugInfoBinaryAspect implements ITmfEventAspect<BinaryCal
 
         /* Apply the path prefix defined by the trace, if any */
         String fullPath = (trace.getSymbolProviderConfig().getActualRootDirPath() + file.getFilePath());
-        boolean isPIC = isPIC(fullPath);
 
         long offset;
-        if (isPIC) {
+        if (file.isPic()) {
             offset = (ip - file.getBaseAddress());
         } else {
             /*
@@ -121,21 +120,7 @@ public final class UstDebugInfoBinaryAspect implements ITmfEventAspect<BinaryCal
             offset = ip;
         }
 
-        return new BinaryCallsite(fullPath, file.getBuildId(), offset, isPIC);
-    }
-
-    /**
-     * Return if the given file (binary or library) is Position-Independent Code
-     * or not. This indicates if addr2line considers the addresses as absolute
-     * addresses or as offsets.
-     */
-    private static boolean isPIC(String filePath) {
-        /*
-         * Ghetto binary/library identification for now. It would be possible to
-         * parse the ELF binary to check if it is position-independent
-         * (-fPIC/-fPIE) or not.
-         */
-        return (filePath.endsWith(".so") || filePath.contains(".so.")); //$NON-NLS-1$ //$NON-NLS-2$
+        return new BinaryCallsite(fullPath, file.getBuildId(), offset, file.isPic());
     }
 
 }
This page took 0.025944 seconds and 5 git commands to generate.