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