ust.core: making some classes final
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.ust.core / src / org / eclipse / tracecompass / lttng2 / ust / core / analysis / debuginfo / UstDebugInfoFunctionAspect.java
CommitLineData
3335f36e
AM
1/*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10package org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo;
11
12import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
13
14import org.eclipse.jdt.annotation.Nullable;
15import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
16import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
17
18/**
19 * Aspect for the function location obtained with the UST debug info.
20 *
21 * @author Alexandre Montplaisir
22 * @since 2.0
23 */
ac52feb8 24public final class UstDebugInfoFunctionAspect implements ITmfEventAspect<FunctionLocation> {
3335f36e
AM
25
26 /** Singleton instance */
27 public static final UstDebugInfoFunctionAspect INSTANCE = new UstDebugInfoFunctionAspect();
28
29 private UstDebugInfoFunctionAspect() {}
30
31 @Override
32 public String getName() {
33 return nullToEmptyString(Messages.UstDebugInfoAnalysis_FunctionAspectName);
34 }
35
36 @Override
37 public String getHelpText() {
38 return nullToEmptyString(Messages.UstDebugInfoAnalysis_FunctionAspectHelpText);
39 }
40
41 @Override
42 public @Nullable FunctionLocation resolve(ITmfEvent event) {
43 SourceCallsite sc = UstDebugInfoSourceAspect.INSTANCE.resolve(event);
44 if (sc == null) {
45 return null;
46 }
47
48 String functionName = sc.getFunctionName();
49 if (functionName == null) {
50 return null;
51 }
52
53 /* We do not track the offset in the function at this time */
54 return new FunctionLocation(functionName, null);
55 }
56
57}
This page took 0.030207 seconds and 5 git commands to generate.