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