1 /*******************************************************************************
2 * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.lttng2
.ust
.core
.analysis
.debuginfo
;
13 * Object carrying the information about the "binary callsite" corresponding to
14 * an instruction pointer. This consists in:
17 * <li>Binary file</li>
18 * <li>Symbol name</li>
19 * <li>Offset (within the binary)</li>
22 * @author Alexandre Montplaisir
25 public class BinaryCallsite
{
27 private final String fBinaryFilePath
;
28 private final String fSymbolName
;
29 private final long fOffset
;
34 * @param binaryFilePath
35 * The path to the binary file on disk, as specified in the trace
36 * (may or may not be present on the system opening the trace).
38 * The name of the symbol in the path. Should not be null, but
39 * can be an empty string if not available.
41 * The offset *within the binary* of the call site. This should
42 * be ready to be passed as-is to tools like addr2line.
44 public BinaryCallsite(String binaryFilePath
, String symbolName
, long offset
) {
46 throw new IllegalArgumentException("Address offset cannot be negative"); //$NON-NLS-1$
49 fBinaryFilePath
= binaryFilePath
;
50 fSymbolName
= symbolName
;
55 * Get the binary file's path
57 * @return The binary file path
59 public String
getBinaryFilePath() {
60 return fBinaryFilePath
;
64 * Get the name of the symbol this instruction pointer is from, if it is
67 * @return The symbol name, or an empty string if not available
69 public String
getSymbolName() {
74 * Get the address offset within the binary file corresponding to the
75 * instruction pointer.
77 * @return The address offset
79 public long getOffset() {
84 public String
toString() {
85 StringBuilder sb
= new StringBuilder();
86 sb
.append(fBinaryFilePath
);
87 if (!fSymbolName
.equals("")) { //$NON-NLS-1$
88 sb
.append(", "); //$NON-NLS-1$
89 sb
.append(Messages
.UstDebugInfoAnalysis_Symbol
);
91 sb
.append(fSymbolName
);
93 sb
.append(", "); //$NON-NLS-1$
94 sb
.append(Messages
.UstDebugInfoAnalysis_Offset
);