LLVM: include/llvm/DebugInfo/DIContext.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_DEBUGINFO_DICONTEXT_H
15#define LLVM_DEBUGINFO_DICONTEXT_H
16
21#include
22#include
23#include
24#include
25#include
26#include
27#include
28
29namespace llvm {
30
31
33 static constexpr const char *const ApproxString = "(approximate)";
34
35 static constexpr const char *const BadString = "";
36
41
43
44
50
51
53
58
65
67
71 std::tie(RHS.FileName, RHS.FunctionName, RHS.StartFileName, RHS.Line,
72 RHS.Column, RHS.StartLine, RHS.Discriminator);
73 }
74
75 explicit operator bool() const { return *this != DILineInfo(); }
76
78 OS << "Line info: ";
80 OS << "file '" << FileName << "', ";
83 OS << "line " << Line << ", ";
84 OS << "column " << Column << ", ";
87 OS << "start line " << StartLine << '\n';
88 }
89};
90
92
93
96
97public:
99
100
101
103 assert(Index < Frames.size());
104 return Frames[Index];
105 }
106
108 assert(Index < Frames.size());
109 return &Frames[Index];
110 }
111
113
115
116 void resize(unsigned i) { Frames.resize(i); }
117};
118
119
129
136 std::optional<uint64_t> Size;
138};
139
140
141
143
144
145
171
172
174#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \
175 DIDT_ID_##ENUM_NAME,
176#include "llvm/BinaryFormat/Dwarf.def"
177#undef HANDLE_DWARF_SECTION
180};
181static_assert(DIDT_ID_Count <= 32, "section types overflow storage");
182
183
187#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME, OPTION) \
188 DIDT_##ENUM_NAME = 1U << DIDT_ID_##ENUM_NAME,
189#include "llvm/BinaryFormat/Dwarf.def"
190#undef HANDLE_DWARF_SECTION
192};
193
194
195
241
243public:
245
248
250
252
254
255 return true;
256 }
257
258
259
263 virtual std::optional
271
272 virtual std::vector
274
275private:
277};
278
279
280
281
283protected:
286
287public:
289
290
291
292
293
294
295
296
300
301
302
303
304
305
306
307
308
309
310
311
316
317
318
319
320
321 virtual std::unique_ptr clone() const = 0;
322};
323
324template <typename Derived, typename Base = LoadedObjectInfo>
326protected:
329
330public:
331 template <typename... Ts>
333
334 std::unique_ptrllvm::LoadedObjectInfo clone() const override {
335 return std::make_unique(static_cast<const Derived &>(*this));
336 }
337};
338
339}
340
341#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the SmallVector class.
virtual std::vector< DILocal > getLocalsForAddress(object::SectionedAddress Address)=0
virtual DIInliningInfo getInliningInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier())=0
virtual DILineInfoTable getLineInfoForAddressRange(object::SectionedAddress Address, uint64_t Size, DILineInfoSpecifier Specifier=DILineInfoSpecifier())=0
virtual bool verify(raw_ostream &OS, DIDumpOptions DumpOpts={})
Definition DIContext.h:253
virtual ~DIContext()=default
virtual std::optional< DILineInfo > getLineInfoForDataAddress(object::SectionedAddress Address)=0
DIContextKind
Definition DIContext.h:244
@ CK_BTF
Definition DIContext.h:244
@ CK_PDB
Definition DIContext.h:244
@ CK_DWARF
Definition DIContext.h:244
@ CK_GSYM
Definition DIContext.h:244
virtual void dump(raw_ostream &OS, DIDumpOptions DumpOpts)=0
DIContextKind getKind() const
Definition DIContext.h:249
virtual std::optional< DILineInfo > getLineInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier())=0
DIContext(DIContextKind K)
Definition DIContext.h:246
A format-neutral container for inlined code description.
Definition DIContext.h:94
const DILineInfo & getFrame(unsigned Index) const
Returns the frame at Index.
Definition DIContext.h:102
uint32_t getNumberOfFrames() const
Definition DIContext.h:112
void addFrame(const DILineInfo &Frame)
Definition DIContext.h:114
DILineInfo * getMutableFrame(unsigned Index)
Definition DIContext.h:107
void resize(unsigned i)
Definition DIContext.h:116
Lightweight error class with error context and mandatory checking.
virtual std::unique_ptr< LoadedObjectInfo > clone() const =0
Obtain a copy of this LoadedObjectInfo.
LoadedObjectInfo(const LoadedObjectInfo &)=default
virtual bool getLoadedSectionContents(const object::SectionRef &Sec, StringRef &Data) const
If conveniently available, return the content of the given Section.
Definition DIContext.h:312
LoadedObjectInfo()=default
virtual ~LoadedObjectInfo()=default
virtual uint64_t getSectionLoadAddress(const object::SectionRef &Sec) const
Obtain the Load Address of a section by SectionRef.
Definition DIContext.h:297
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
static LLVM_ABI void defaultWarningHandler(Error Warning)
Implement default handling for Warning.
static LLVM_ABI void defaultErrorHandler(Error Err)
Implement default handling for Error.
This is a value type class that represents a single section in the list of sections in the object fil...
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
SmallVector< std::pair< uint64_t, DILineInfo >, 16 > DILineInfoTable
Definition DIContext.h:91
FunctionAddr VTableAddr uintptr_t uintptr_t Data
DINameKind
A DINameKind is passed to name search methods to specify a preference regarding the type of name reso...
Definition DIContext.h:142
@ LinkageName
Definition DIContext.h:142
@ ShortName
Definition DIContext.h:142
DIDumpTypeCounter
This is just a helper to programmatically construct DIDumpType.
Definition DIContext.h:173
@ DIDT_ID_Count
Definition DIContext.h:179
@ DIDT_ID_UUID
Definition DIContext.h:178
DIDumpType
Selects which debug sections get dumped.
Definition DIContext.h:184
@ DIDT_All
Definition DIContext.h:186
@ DIDT_UUID
Definition DIContext.h:191
@ DIDT_Null
Definition DIContext.h:185
Implement std::hash so that hash_code can be used in STL containers.
Container for dump options that control which debug information will be dumped.
Definition DIContext.h:196
std::function< void(Error)> WarningHandler
Definition DIContext.h:239
bool IsEH
Definition DIContext.h:209
bool PrintRegisterOnly
Definition DIContext.h:212
std::function< void(Error)> RecoverableErrorHandler
Definition DIContext.h:237
static DIDumpOptions getForSingleDIE()
Return default option set for printing a single DIE without children.
Definition DIContext.h:220
bool ShowForm
Definition DIContext.h:205
bool ShowChildren
Definition DIContext.h:203
llvm::SmallVector< unsigned, 0 > FilterChildTag
List of DWARF tags to filter children by.
Definition DIContext.h:215
unsigned DumpType
Definition DIContext.h:197
bool ShowAddresses
Definition DIContext.h:202
std::string JsonErrSummaryFile
Definition DIContext.h:213
bool DumpNonSkeleton
Definition DIContext.h:210
bool ShowAggregateErrors
Definition DIContext.h:211
bool SummarizeTypes
Definition DIContext.h:206
uint16_t Version
Definition DIContext.h:200
std::function< llvm::StringRef(uint64_t DwarfRegNum, bool IsEH)> GetNameForDWARFReg
Definition DIContext.h:217
DIDumpOptions noImplicitRecursion() const
Return the options with RecurseDepth set to 0 unless explicitly required.
Definition DIContext.h:228
bool Verbose
Definition DIContext.h:207
unsigned ChildRecurseDepth
Definition DIContext.h:198
uint8_t AddrSize
Definition DIContext.h:201
bool ShowParents
Definition DIContext.h:204
unsigned ParentRecurseDepth
Definition DIContext.h:199
bool DisplayRawContents
Definition DIContext.h:208
uint64_t Size
Definition DIContext.h:123
uint64_t Start
Definition DIContext.h:122
std::string Name
Definition DIContext.h:121
std::string DeclFile
Definition DIContext.h:124
uint64_t DeclLine
Definition DIContext.h:125
DIGlobal()
Definition DIContext.h:127
Controls which fields of DILineInfo container should be filled with data.
Definition DIContext.h:146
bool ApproximateLine
Definition DIContext.h:160
FileLineInfoKind FLIKind
Definition DIContext.h:158
FileLineInfoKind
Definition DIContext.h:147
@ BaseNameOnly
Definition DIContext.h:152
@ RawValue
Definition DIContext.h:151
@ RelativeFilePath
Definition DIContext.h:154
@ None
Definition DIContext.h:148
@ AbsoluteFilePath
Definition DIContext.h:155
DILineInfoSpecifier(FileLineInfoKind FLIKind=FileLineInfoKind::RawValue, FunctionNameKind FNKind=FunctionNameKind::None, bool ApproximateLine=false)
Definition DIContext.h:162
DINameKind FunctionNameKind
Definition DIContext.h:157
bool operator==(const DILineInfoSpecifier &RHS) const
Definition DIContext.h:167
FunctionNameKind FNKind
Definition DIContext.h:159
A format-neutral container for source line information.
Definition DIContext.h:32
static constexpr const char *const BadString
Definition DIContext.h:35
bool IsApproximateLine
Definition DIContext.h:54
void dump(raw_ostream &OS)
Definition DIContext.h:77
std::optional< uint64_t > StartAddress
Definition DIContext.h:49
uint32_t Discriminator
Definition DIContext.h:52
bool operator!=(const DILineInfo &RHS) const
Definition DIContext.h:66
static constexpr const char *const Addr2LineBadString
Definition DIContext.h:37
static constexpr const char *const ApproxString
Definition DIContext.h:33
uint32_t Line
Definition DIContext.h:46
bool operator==(const DILineInfo &RHS) const
Definition DIContext.h:59
std::optional< StringRef > Source
Definition DIContext.h:42
std::string FileName
Definition DIContext.h:38
std::string FunctionName
Definition DIContext.h:39
uint32_t Column
Definition DIContext.h:47
DILineInfo()
Definition DIContext.h:55
uint32_t StartLine
Definition DIContext.h:48
bool operator<(const DILineInfo &RHS) const
Definition DIContext.h:68
std::string StartFileName
Definition DIContext.h:40
std::optional< StringRef > LineSource
Definition DIContext.h:45
Definition DIContext.h:130
std::optional< uint64_t > Size
Definition DIContext.h:136
std::optional< uint64_t > TagOffset
Definition DIContext.h:137
std::string DeclFile
Definition DIContext.h:133
std::optional< int64_t > FrameOffset
Definition DIContext.h:135
uint64_t DeclLine
Definition DIContext.h:134
std::string Name
Definition DIContext.h:132
std::string FunctionName
Definition DIContext.h:131
LoadedObjectInfoHelper()=default
LoadedObjectInfoHelper(const LoadedObjectInfoHelper &)=default
LoadedObjectInfoHelper(Ts &&...Args)
Definition DIContext.h:332
std::unique_ptr< llvm::LoadedObjectInfo > clone() const override
Obtain a copy of this LoadedObjectInfo.
Definition DIContext.h:334