Search in sources :

Example 1 with LttngUstEvent

use of org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstEvent 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

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 LttngUstEvent (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstEvent)1 LttngUstTrace (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace)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 Test (org.junit.Test)1