1 /*******************************************************************************
2 * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.lttng2
.ust
.core
.analysis
.debuginfo
;
12 import org
.eclipse
.jdt
.annotation
.Nullable
;
15 * Wrapper class to reference to a particular binary, which can be an
16 * executable or library. It contains both the complete file path (at the
17 * time the trace was taken) and the build ID of the binary.
19 public class UstDebugInfoBinaryFile
implements Comparable
<UstDebugInfoBinaryFile
> {
21 private final String fFilePath
;
22 private final String fBuildId
;
23 private final String fToString
;
29 * The binary's path on the filesystem
31 * The binary's unique buildID (in base16 form).
33 public UstDebugInfoBinaryFile(String filePath
, String buildId
) {
36 fToString
= filePath
+ " (" + buildId
+ ')'; //$NON-NLS-1$
40 * Get the file's path, as was referenced to in the trace.
42 * @return The file path
44 public String
getFilePath() {
49 * Get the build ID of the binary. It should be a unique identifier.
51 * On Unix systems, you can use <pre>eu-readelf -n [binary]</pre> to get
54 * @return The file's build ID.
56 public String
getBuildId() {
61 public String
toString() {
66 public boolean equals(@Nullable Object obj
) {
67 if (obj
== null || !(obj
instanceof UstDebugInfoBinaryFile
)) {
70 UstDebugInfoBinaryFile other
= (UstDebugInfoBinaryFile
) obj
;
71 return (fFilePath
== other
.fFilePath
&&
72 fBuildId
== other
.fBuildId
);
76 public int hashCode() {
79 result
= prime
* result
+ fBuildId
.hashCode();
80 result
= prime
* result
+ fFilePath
.hashCode();
85 * Used for sorting. Sorts by using alphabetical order of the file
89 public int compareTo(@Nullable UstDebugInfoBinaryFile o
) {
93 return fFilePath
.compareTo(o
.fFilePath
);