LLVM  11.0.0git
LookupResult.h
Go to the documentation of this file.
1 //===- LookupResult.h -------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_GSYM_LOOKUPRESULT_H
10 #define LLVM_DEBUGINFO_GSYM_LOOKUPRESULT_H
11 
13 #include "llvm/ADT/StringRef.h"
14 #include <inttypes.h>
15 #include <vector>
16 
17 namespace llvm {
18 class raw_ostream;
19 namespace gsym {
20 struct FileEntry;
21 
23  StringRef Name; ///< Function or symbol name.
24  StringRef Dir; ///< Line entry source file directory path.
25  StringRef Base; ///< Line entry source file basename.
26  uint32_t Line = 0; ///< Source file line number.
27  uint32_t Offset = 0; ///< Byte size offset within the named function.
28 };
29 
30 inline bool operator==(const SourceLocation &LHS, const SourceLocation &RHS) {
31  return LHS.Name == RHS.Name && LHS.Dir == RHS.Dir &&
32  LHS.Base == RHS.Base && LHS.Line == RHS.Line &&
33  LHS.Offset == RHS.Offset;
34 }
35 
37 
38 using SourceLocations = std::vector<SourceLocation>;
39 
40 
41 struct LookupResult {
42  uint64_t LookupAddr = 0; ///< The address that this lookup pertains to.
43  AddressRange FuncRange; ///< The concrete function address range.
44  StringRef FuncName; ///< The concrete function name that contains LookupAddr.
45  /// The source locations that match this address. This information will only
46  /// be filled in if the FunctionInfo contains a line table. If an address is
47  /// for a concrete function with no inlined functions, this array will have
48  /// one entry. If an address points to an inline function, there will be one
49  /// SourceLocation for each inlined function with the last entry pointing to
50  /// the concrete function itself. This allows one address to generate
51  /// multiple locations and allows unwinding of inline call stacks. The
52  /// deepest inline function will appear at index zero in the source locations
53  /// array, and the concrete function will appear at the end of the array.
55  std::string getSourceFile(uint32_t Index) const;
56 };
57 
59 
60 } // namespace gsym
61 } // namespace llvm
62 
63 #endif // #ifndef LLVM_DEBUGINFO_GSYM_LOOKUPRESULT_H
StringRef Base
Line entry source file basename.
Definition: LookupResult.h:25
StringRef FuncName
The concrete function name that contains LookupAddr.
Definition: LookupResult.h:44
This class represents lattice values for constants.
Definition: AllocatorList.h:23
StringRef Dir
Line entry source file directory path.
Definition: LookupResult.h:24
uint32_t Line
Source file line number.
Definition: LookupResult.h:26
SourceLocations Locations
The source locations that match this address.
Definition: LookupResult.h:54
StringRef Name
Function or symbol name.
Definition: LookupResult.h:23
A class that represents an address range.
Definition: Range.h:33
bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS)
Definition: FunctionInfo.h:187
uint32_t Offset
Byte size offset within the named function.
Definition: LookupResult.h:27
std::vector< SourceLocation > SourceLocations
Definition: LookupResult.h:38
AddressRange FuncRange
The concrete function address range.
Definition: LookupResult.h:43
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
raw_ostream & operator<<(raw_ostream &OS, const FunctionInfo &R)