import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
import org.eclipse.tracecompass.tmf.core.event.lookup.TmfCallsite;
-import com.google.common.collect.Iterables;
-
/**
* Event aspect of UST traces to generate a {@link TmfCallsite} using the debug
* info analysis and the IP (instruction pointer) context.
*
* @author Alexandre Montplaisir
- * @since 2.0
+ * @since 3.0
*/
-public class UstDebugInfoSourceAspect implements ITmfEventAspect<SourceCallsite> {
+public class UstDebugInfoSourceAspect implements ITmfEventAspect<TmfCallsite> {
/** Singleton instance */
public static final UstDebugInfoSourceAspect INSTANCE = new UstDebugInfoSourceAspect();
return nullToEmptyString(Messages.UstDebugInfoAnalysis_SourceAspectHelpText);
}
+ /**
+ * @since 2.1
+ */
@Override
- public @Nullable SourceCallsite resolve(ITmfEvent event) {
+ public @Nullable TmfCallsite resolve(ITmfEvent event) {
/* This aspect only supports UST traces */
if (!(event.getTrace() instanceof LttngUstTrace)) {
return null;
return null;
}
- return getSourceCallsite(trace, bc);
- }
-
- /**
- * Get the source callsite (the full {@link TmfCallsite} information) from a
- * binary callsite.
- *
- * @param trace
- * The trace, which may contain trace-specific configuration
- * @param bc
- * The binary callsite
- * @return The source callsite, which sould include file name, function name
- * and line number
- */
- public static @Nullable SourceCallsite getSourceCallsite(LttngUstTrace trace, BinaryCallsite bc) {
- Iterable<SourceCallsite> callsites = FileOffsetMapper.getCallsiteFromOffset(
+ TmfCallsite callsite = FileOffsetMapper.getCallsiteFromOffset(
new File(bc.getBinaryFilePath()),
bc.getBuildId(),
bc.getOffset());
-
- if (callsites == null || Iterables.isEmpty(callsites)) {
+ if (callsite == null) {
return null;
}
- /*
- * TMF only supports the notion of one callsite per event at the moment.
- * We will take the "deepest" one in the stack, which should refer to
- * the initial, non-inlined location.
- */
- SourceCallsite callsite = Iterables.getLast(callsites);
/*
* Apply the path prefix again, this time on the path given from
}
String fullFileName = (pathPrefix + callsite.getFileName());
- return new SourceCallsite(fullFileName, callsite.getFunctionName(), callsite.getLineNumber());
+ return new TmfCallsite(fullFileName, callsite.getLineNo());
}
}