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.NonNull; | |
13 | import org.eclipse.jdt.annotation.Nullable; | |
14 | import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.BinaryCallsite; | |
15 | import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule; | |
16 | import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryAspect; | |
17 | import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoSourceAspect; | |
18 | import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace; | |
19 | import org.eclipse.tracecompass.tmf.core.event.lookup.TmfCallsite; | |
20 | import org.eclipse.tracecompass.tmf.ui.symbols.DefaultSymbolProvider; | |
21 | import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProviderPreferencePage; | |
22 | ||
23 | /** | |
24 | * Symbol provider for UST traces with debug information. | |
25 | * | |
26 | * @author Alexandre Montplaisir | |
27 | * @see UstDebugInfoAnalysisModule | |
28 | */ | |
29 | public class UstDebugInfoSymbolProvider extends DefaultSymbolProvider { | |
30 | ||
31 | /** | |
32 | * Create a new {@link UstDebugInfoSymbolProvider} for the given trace | |
33 | * | |
34 | * @param trace | |
35 | * A non-null trace | |
36 | */ | |
37 | public UstDebugInfoSymbolProvider(LttngUstTrace trace) { | |
38 | super(trace); | |
39 | } | |
40 | ||
41 | /** | |
42 | * Sets the configured path prefix. Usually called from the preferences | |
43 | * page. | |
44 | * | |
45 | * @param newPathPrefix | |
46 | * The new path prefix to use | |
47 | */ | |
48 | void setConfiguredPathPrefix(LttngUstTrace.SymbolProviderConfig newConfig) { | |
49 | getTrace().setSymbolProviderConfig(newConfig); | |
50 | } | |
51 | ||
52 | @Override | |
53 | public @NonNull LttngUstTrace getTrace() { | |
54 | /* Type enforced at constructor */ | |
55 | return (LttngUstTrace) super.getTrace(); | |
56 | } | |
57 | ||
58 | @Override | |
59 | public @Nullable String getSymbolText(int pid, long timestamp, long address) { | |
48599f10 AM |
60 | BinaryCallsite bc = UstDebugInfoBinaryAspect.getBinaryCallsite(getTrace(), pid, timestamp, address); |
61 | if (bc == null) { | |
62 | return null; | |
63 | } | |
64 | ||
65 | TmfCallsite callsite = UstDebugInfoSourceAspect.getSourceCallsite(getTrace(), bc); | |
cb2b5e56 AM |
66 | return (callsite == null ? null : callsite.getFunctionName()); |
67 | } | |
68 | ||
48599f10 | 69 | @Deprecated |
cb2b5e56 AM |
70 | @Override |
71 | public @Nullable TmfCallsite getSymbolInfo(int pid, long timestamp, long address) { | |
72 | BinaryCallsite bc = UstDebugInfoBinaryAspect.getBinaryCallsite(getTrace(), pid, timestamp, address); | |
73 | if (bc == null) { | |
74 | return null; | |
75 | } | |
76 | ||
77 | return UstDebugInfoSourceAspect.getSourceCallsite(getTrace(), bc); | |
78 | } | |
79 | ||
80 | @Override | |
81 | public @NonNull ISymbolProviderPreferencePage createPreferencePage() { | |
82 | return new UstDebugInfoSymbolProviderPreferencePage(this); | |
83 | } | |
84 | ||
85 | } |