Commit | Line | Data |
---|---|---|
cb2b5e56 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2016 EfficiOS Inc. and others | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | *******************************************************************************/ | |
9 | ||
10 | package org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.debuginfo; | |
11 | ||
12 | import org.eclipse.jdt.annotation.Nullable; | |
13 | import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule; | |
14 | import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace; | |
37c87032 MK |
15 | import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider; |
16 | import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProviderFactory; | |
cb2b5e56 AM |
17 | import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; |
18 | import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; | |
cb2b5e56 AM |
19 | |
20 | /** | |
21 | * Factory to create {@link UstDebugInfoSymbolProvider}. Provided to TMF via | |
22 | * the extension point. Only works with LTTng-UST traces. | |
23 | * | |
24 | * @author Alexandre Montplaisir | |
25 | */ | |
26 | public class UstDebugInfoSymbolProviderFactory implements ISymbolProviderFactory { | |
27 | ||
28 | @Override | |
29 | public @Nullable ISymbolProvider createProvider(ITmfTrace trace) { | |
30 | /* | |
31 | * This applies only to UST traces that fulfill the DebugInfo analysis | |
32 | * requirements. | |
33 | */ | |
34 | UstDebugInfoAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, | |
35 | UstDebugInfoAnalysisModule.class, UstDebugInfoAnalysisModule.ID); | |
36 | ||
37 | if (module != null && trace instanceof LttngUstTrace) { | |
38 | return new UstDebugInfoSymbolProvider((LttngUstTrace) trace); | |
39 | } | |
40 | return null; | |
41 | } | |
42 | ||
43 | } |