Search in sources :

Example 1 with UstDebugInfoAnalysisModule

use of org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule in project tracecompass by tracecompass.

the class UstDebugInfoAnalysisModuleTest method testGetAllBinaries.

/**
 * Test the {@link UstDebugInfoAnalysisModule#getAllBinaries} method.
 */
@Test
public void testGetAllBinaries() {
    LttngUstTrace trace = LttngUstTestTraceUtils.getTrace(REAL_TEST_TRACE);
    executeModule(trace);
    List<UstDebugInfoBinaryFile> actualBinaries = Lists.newArrayList(fModule.getAllBinaries());
    List<UstDebugInfoBinaryFile> expectedBinaries = Lists.newArrayList(new UstDebugInfoBinaryFile("/home/simark/src/babeltrace/tests/debug-info-data/libhello_so", "cdd98cdd87f7fe64c13b6daad553987eafd40cbb", null, true), new UstDebugInfoBinaryFile("/home/simark/src/babeltrace/tests/debug-info-data/test", "0683255d2cf219c33cc0efd6039db09ccc4416d7", null, false), new UstDebugInfoBinaryFile("[linux-vdso.so.1]", null, null, false), new UstDebugInfoBinaryFile("/usr/local/lib/liblttng-ust-dl.so.0.0.0", "39c035014cc02008d6884fcb1be4e020cc820366", null, true), new UstDebugInfoBinaryFile("/usr/lib/libdl-2.23.so", "db3f9be9f4ebe9e2a21e4ae0b4ef7165d40fdfef", null, true), new UstDebugInfoBinaryFile("/usr/lib/libc-2.23.so", "946025a5cad7b5f2dfbaebc6ebd1fcc004349b48", null, true), new UstDebugInfoBinaryFile("/usr/local/lib/liblttng-ust.so.0.0.0", "405b0b15daa73eccb88076247ba30356c00d3b92", null, true), new UstDebugInfoBinaryFile("/usr/local/lib/liblttng-ust-tracepoint.so.0.0.0", "62c028aad38adb5e0910c527d522e8c86a0a3344", null, true), new UstDebugInfoBinaryFile("/usr/lib/librt-2.23.so", "aba676bda7fb6adb71e100159915504e1a0c17e6", null, true), new UstDebugInfoBinaryFile("/usr/lib/liburcu-bp.so.4.0.0", "b9dfadea234107f8453bc636fc160047e0c01b7a", null, true), new UstDebugInfoBinaryFile("/usr/lib/liburcu-cds.so.4.0.0", "420527f6dacc762378d9fa7def54d91c80a6c87e", null, true), new UstDebugInfoBinaryFile("/usr/lib/libpthread-2.23.so", "d91ed99c8425b7ce5da5bb750662a91038e02a78", null, true), new UstDebugInfoBinaryFile("/usr/lib/ld-2.23.so", "524eff0527e923e4adc4be9db1ef7475607b92e8", null, true), new UstDebugInfoBinaryFile("/usr/lib/liburcu-common.so.4.0.0", "f279a6d46a2b846e15e7abd99cfe9fbe8d7f8295", null, true));
    Comparator<UstDebugInfoBinaryFile> comparator = Comparator.comparing(UstDebugInfoBinaryFile::getFilePath);
    actualBinaries.sort(comparator);
    expectedBinaries.sort(comparator);
    /* Highlights failures more easily */
    for (int i = 0; i < expectedBinaries.size(); i++) {
        assertEquals(expectedBinaries.get(i), actualBinaries.get(i));
    }
    assertEquals(actualBinaries, expectedBinaries);
    LttngUstTestTraceUtils.dispose(REAL_TEST_TRACE);
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) UstDebugInfoBinaryFile(org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryFile) Test(org.junit.Test)

Example 2 with UstDebugInfoAnalysisModule

use of org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule in project tracecompass by tracecompass.

the class UstDebugInfoAnalysisModuleTest method testBinaryCallsites.

/**
 * Test that the binary callsite aspect resolves correctly for some
 * user-defined tracepoints in the trace.
 *
 * These should be available even without the binaries with debug symbols
 * being present on the system.
 */
@Test
public void testBinaryCallsites() {
    LttngUstTrace trace = LttngUstTestTraceUtils.getTrace(REAL_TEST_TRACE);
    /*
         * Fake a "trace opened" signal, so that the relevant analyses are
         * started.
         */
    TmfTraceOpenedSignal signal = new TmfTraceOpenedSignal(this, trace, null);
    TmfSignalManager.dispatchSignal(signal);
    UstDebugInfoAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, UstDebugInfoAnalysisModule.class, UstDebugInfoAnalysisModule.ID);
    assertNotNull(module);
    module.waitForCompletion();
    /* Send a request to get the 3 events we are interested in */
    List<@NonNull LttngUstEvent> events = new ArrayList<>();
    TmfEventRequest request = new TmfEventRequest(LttngUstEvent.class, 31, 1, ExecutionType.FOREGROUND) {

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            events.add((LttngUstEvent) event);
        }
    };
    trace.sendRequest(request);
    try {
        request.waitForCompletion();
    } catch (InterruptedException e) {
        fail(e.getMessage());
    }
    /* Tests that the aspects are resolved correctly */
    final UstDebugInfoBinaryAspect aspect = UstDebugInfoBinaryAspect.INSTANCE;
    String actual = checkNotNull(aspect.resolve(events.get(0))).toString();
    String expected = "/home/simark/src/babeltrace/tests/debug-info-data/libhello_so+0x14d4";
    assertEquals(expected, actual);
    LttngUstTestTraceUtils.dispose(REAL_TEST_TRACE);
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) ArrayList(java.util.ArrayList) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) LttngUstEvent(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstEvent) UstDebugInfoBinaryAspect(org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryAspect) UstDebugInfoAnalysisModule(org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) Test(org.junit.Test)

Aggregations

LttngUstTrace (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 UstDebugInfoAnalysisModule (org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule)1 UstDebugInfoBinaryAspect (org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryAspect)1 UstDebugInfoBinaryFile (org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryFile)1 LttngUstEvent (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstEvent)1 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)1 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)1 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)1