ce13611afa3aaa3ab304d383c9a73f7d4189f3eb
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.ust.core / src / org / eclipse / tracecompass / lttng2 / ust / core / analysis / debuginfo / FunctionLocation.java
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
10 package org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo;
11
12 import org.eclipse.jdt.annotation.Nullable;
13
14 /**
15 * Compound object representing a binary location inside a function/symbol
16 * inside a binary.
17 *
18 * It consists of the function/symbol name, and offset within this function. The
19 * offset may or may not be available.
20 *
21 * @author Alexandre Montplaisir
22 * @since 2.0
23 */
24 public class FunctionLocation {
25
26 private final String fFunctionName;
27 private final @Nullable Long fOffset;
28
29 /**
30 * Constructor
31 *
32 * @param functionName
33 * Name of the function
34 * @param offsetInFunction
35 * Offset *within this function*. May be null to mean unknown.
36 */
37 public FunctionLocation(String functionName, @Nullable Long offsetInFunction) {
38 fFunctionName = functionName;
39 fOffset = offsetInFunction;
40 }
41
42 @Override
43 public String toString() {
44 Long offset = fOffset;
45
46 if (offset == null) {
47 return fFunctionName;
48 }
49 return (fFunctionName + "+0x" + Long.toHexString(offset.longValue())); //$NON-NLS-1$
50
51 }
52 }
This page took 0.049177 seconds and 4 git commands to generate.