1 //===- InlineInfo.h ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_GSYM_INLINEINFO_H
11 #define LLVM_DEBUGINFO_GSYM_INLINEINFO_H
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/DebugInfo/GSYM/Range.h"
24 /// Inline information stores the name of the inline function along with
25 /// an array of address ranges. It also stores the call file and call line
26 /// that called this inline function. This allows us to unwind inline call
27 /// stacks back to the inline or concrete function that called this
28 /// function. Inlined functions contained in this function are stored in the
29 /// "Children" variable. All address ranges must be sorted and all address
30 /// ranges of all children must be contained in the ranges of this function.
31 /// Any clients that encode information will need to ensure the ranges are
32 /// all contined correctly or lookups could fail. Add ranges in these objects
33 /// must be contained in the top level FunctionInfo address ranges as well.
36 uint32_t Name; ///< String table offset in the string table.
37 uint32_t CallFile; ///< 1 based file index in the file table.
38 uint32_t CallLine; ///< Source line number.
40 std::vector<InlineInfo> Children;
41 InlineInfo() : Name(0), CallFile(0), CallLine(0) {}
49 bool isValid() const { return !Ranges.empty(); }
51 using InlineArray = std::vector<const InlineInfo *>;
53 /// Lookup an address in the InlineInfo object
55 /// This function is used to symbolicate an inline call stack and can
56 /// turn one address in the program into one or more inline call stacks
57 /// and have the stack trace show the original call site from
60 /// \param Addr the address to lookup
62 /// \returns optional vector of InlineInfo objects that describe the
63 /// inline call stack for a given address, false otherwise.
64 llvm::Optional<InlineArray> getInlineStack(uint64_t Addr) const;
67 inline bool operator==(const InlineInfo &LHS, const InlineInfo &RHS) {
68 return LHS.Name == RHS.Name && LHS.CallFile == RHS.CallFile &&
69 LHS.CallLine == RHS.CallLine && LHS.Ranges == RHS.Ranges &&
70 LHS.Children == RHS.Children;
73 raw_ostream &operator<<(raw_ostream &OS, const InlineInfo &FI);
78 #endif // #ifndef LLVM_DEBUGINFO_GSYM_INLINEINFO_H