LLVM 20.0.0git
DWARFContext.h
Go to the documentation of this file.
1//===- DWARFContext.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_DWARF_DWARFCONTEXT_H
10#define LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
11
14#include "llvm/ADT/StringMap.h"
15#include "llvm/ADT/StringRef.h"
21#include "llvm/Object/Binary.h"
24#include "llvm/Support/Error.h"
26#include <cstdint>
27#include <memory>
28#include <mutex>
29
30namespace llvm {
31
32class MemoryBuffer;
33class AppleAcceleratorTable;
34class DWARFCompileUnit;
35class DWARFDebugAbbrev;
36class DWARFDebugAranges;
37class DWARFDebugFrame;
38class DWARFDebugLoc;
39class DWARFDebugMacro;
40class DWARFDebugNames;
41class DWARFGdbIndex;
42class DWARFTypeUnit;
43class DWARFUnitIndex;
44
45/// DWARFContext
46/// This data structure is the top level entity that deals with dwarf debug
47/// information parsing. The actual data is supplied through DWARFObj.
48class DWARFContext : public DIContext {
49public:
50 /// DWARFContextState
51 /// This structure contains all member variables for DWARFContext that need
52 /// to be protected in multi-threaded environments. Threading support can be
53 /// enabled by setting the ThreadSafe to true when constructing a
54 /// DWARFContext to allow DWARRContext to be able to be used in a
55 /// multi-threaded environment, or not enabled to allow for maximum
56 /// performance in single threaded environments.
58 protected:
59 /// Helper enum to distinguish between macro[.dwo] and macinfo[.dwo]
60 /// section.
66 };
67
69 public:
71 virtual ~DWARFContextState() = default;
73 virtual DWARFUnitVector &getDWOUnits(bool Lazy = false) = 0;
74 virtual const DWARFDebugAbbrev *getDebugAbbrevDWO() = 0;
75 virtual const DWARFUnitIndex &getCUIndex() = 0;
76 virtual const DWARFUnitIndex &getTUIndex() = 0;
77 virtual DWARFGdbIndex &getGdbIndex() = 0;
78 virtual const DWARFDebugAbbrev *getDebugAbbrev() = 0;
79 virtual const DWARFDebugLoc *getDebugLoc() = 0;
80 virtual const DWARFDebugAranges *getDebugAranges() = 0;
83 function_ref<void(Error)> RecoverableErrHandler) = 0;
84 virtual void clearLineTableForUnit(DWARFUnit *U) = 0;
87 virtual const DWARFDebugMacro *getDebugMacinfo() = 0;
88 virtual const DWARFDebugMacro *getDebugMacinfoDWO() = 0;
89 virtual const DWARFDebugMacro *getDebugMacro() = 0;
90 virtual const DWARFDebugMacro *getDebugMacroDWO() = 0;
91 virtual const DWARFDebugNames &getDebugNames() = 0;
95 virtual const AppleAcceleratorTable &getAppleObjC() = 0;
96 virtual std::shared_ptr<DWARFContext>
97 getDWOContext(StringRef AbsolutePath) = 0;
99 getTypeUnitMap(bool IsDWO) = 0;
100 virtual bool isThreadSafe() const = 0;
101
102 /// Parse a macro[.dwo] or macinfo[.dwo] section.
103 std::unique_ptr<DWARFDebugMacro>
105
106 };
107 friend class DWARFContextState;
108
109private:
110 /// All important state for a DWARFContext that needs to be threadsafe needs
111 /// to go into DWARFContextState.
112 std::unique_ptr<DWARFContextState> State;
113
114 /// The maximum DWARF version of all units.
115 unsigned MaxVersion = 0;
116
117 std::function<void(Error)> RecoverableErrorHandler =
119 std::function<void(Error)> WarningHandler = WithColor::defaultWarningHandler;
120
121 /// Read compile units from the debug_info.dwo section (if necessary)
122 /// and type units from the debug_types.dwo section (if necessary)
123 /// and store them in DWOUnits.
124 /// If \p Lazy is true, set up to parse but don't actually parse them.
125 enum { EagerParse = false, LazyParse = true };
126 DWARFUnitVector &getDWOUnits(bool Lazy = false);
127
128 std::unique_ptr<const DWARFObject> DObj;
129
130 // When set parses debug_info.dwo/debug_abbrev.dwo manually and populates CU
131 // Index, and TU Index for DWARF5.
132 bool ParseCUTUIndexManually = false;
133
134public:
135 DWARFContext(std::unique_ptr<const DWARFObject> DObj,
136 std::string DWPName = "",
137 std::function<void(Error)> RecoverableErrorHandler =
139 std::function<void(Error)> WarningHandler =
141 bool ThreadSafe = false);
142 ~DWARFContext() override;
143
146
147 const DWARFObject &getDWARFObj() const { return *DObj; }
148
149 static bool classof(const DIContext *DICtx) {
150 return DICtx->getKind() == CK_DWARF;
151 }
152
153 /// Dump a textual representation to \p OS. If any \p DumpOffsets are present,
154 /// dump only the record at the specified offset.
155 void dump(raw_ostream &OS, DIDumpOptions DumpOpts,
156 std::array<std::optional<uint64_t>, DIDT_ID_Count> DumpOffsets);
157
158 void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override {
159 std::array<std::optional<uint64_t>, DIDT_ID_Count> DumpOffsets;
160 dump(OS, DumpOpts, DumpOffsets);
161 }
162
163 bool verify(raw_ostream &OS, DIDumpOptions DumpOpts = {}) override;
164
167
168 /// Get units from .debug_info in this context.
170 DWARFUnitVector &NormalUnits = State->getNormalUnits();
171 return unit_iterator_range(NormalUnits.begin(),
172 NormalUnits.begin() +
173 NormalUnits.getNumInfoUnits());
174 }
175
177 return State->getNormalUnits();
178 }
179
180 /// Get units from .debug_types in this context.
182 DWARFUnitVector &NormalUnits = State->getNormalUnits();
183 return unit_iterator_range(
184 NormalUnits.begin() + NormalUnits.getNumInfoUnits(), NormalUnits.end());
185 }
186
187 /// Get compile units in this context.
190 }
191
192 // If you want type_units(), it'll need to be a concat iterator of a filter of
193 // TUs in info_section + all the (all type) units in types_section
194
195 /// Get all normal compile/type units in this context.
197 DWARFUnitVector &NormalUnits = State->getNormalUnits();
198 return unit_iterator_range(NormalUnits.begin(), NormalUnits.end());
199 }
200
201 /// Get units from .debug_info..dwo in the DWO context.
203 DWARFUnitVector &DWOUnits = State->getDWOUnits();
204 return unit_iterator_range(DWOUnits.begin(),
205 DWOUnits.begin() + DWOUnits.getNumInfoUnits());
206 }
207
209 return State->getDWOUnits();
210 }
211
212 /// Get units from .debug_types.dwo in the DWO context.
214 DWARFUnitVector &DWOUnits = State->getDWOUnits();
215 return unit_iterator_range(DWOUnits.begin() + DWOUnits.getNumInfoUnits(),
216 DWOUnits.end());
217 }
218
219 /// Get compile units in the DWO context.
222 }
223
224 // If you want dwo_type_units(), it'll need to be a concat iterator of a
225 // filter of TUs in dwo_info_section + all the (all type) units in
226 // dwo_types_section.
227
228 /// Get all units in the DWO context.
230 DWARFUnitVector &DWOUnits = State->getDWOUnits();
231 return unit_iterator_range(DWOUnits.begin(), DWOUnits.end());
232 }
233
234 /// Get the number of compile units in this context.
236 return State->getNormalUnits().getNumInfoUnits();
237 }
238
239 /// Get the number of type units in this context.
240 unsigned getNumTypeUnits() {
241 return State->getNormalUnits().getNumTypesUnits();
242 }
243
244 /// Get the number of compile units in the DWO context.
246 return State->getDWOUnits().getNumInfoUnits();
247 }
248
249 /// Get the number of type units in the DWO context.
251 return State->getDWOUnits().getNumTypesUnits();
252 }
253
254 /// Get the unit at the specified index.
255 DWARFUnit *getUnitAtIndex(unsigned index) {
256 return State->getNormalUnits()[index].get();
257 }
258
259 /// Get the unit at the specified index for the DWO units.
260 DWARFUnit *getDWOUnitAtIndex(unsigned index) {
261 return State->getDWOUnits()[index].get();
262 }
263
266
267 /// Return the DWARF unit that includes an offset (relative to .debug_info).
269
270 /// Return the compile unit that includes an offset (relative to .debug_info).
272
273 /// Get a DIE given an exact offset.
275
276 unsigned getMaxVersion() {
277 // Ensure info units have been parsed to discover MaxVersion
279 return MaxVersion;
280 }
281
282 unsigned getMaxDWOVersion() {
283 // Ensure DWO info units have been parsed to discover MaxVersion
285 return MaxVersion;
286 }
287
289 if (Version > MaxVersion)
290 MaxVersion = Version;
291 }
292
293 const DWARFUnitIndex &getCUIndex();
295 const DWARFUnitIndex &getTUIndex();
296
297 /// Get a pointer to the parsed DebugAbbrev object.
299
300 /// Get a pointer to the parsed DebugLoc object.
301 const DWARFDebugLoc *getDebugLoc();
302
303 /// Get a pointer to the parsed dwo abbreviations object.
305
306 /// Get a pointer to the parsed DebugAranges object.
308
309 /// Get a pointer to the parsed frame information object.
311
312 /// Get a pointer to the parsed eh frame information object.
314
315 /// Get a pointer to the parsed DebugMacinfo information object.
317
318 /// Get a pointer to the parsed DebugMacinfoDWO information object.
320
321 /// Get a pointer to the parsed DebugMacro information object.
323
324 /// Get a pointer to the parsed DebugMacroDWO information object.
326
327 /// Get a reference to the parsed accelerator table object.
329
330 /// Get a reference to the parsed accelerator table object.
332
333 /// Get a reference to the parsed accelerator table object.
335
336 /// Get a reference to the parsed accelerator table object.
338
339 /// Get a reference to the parsed accelerator table object.
341
342 /// Get a pointer to a parsed line table corresponding to a compile unit.
343 /// Report any parsing issues as warnings on stderr.
345
346 /// Get a pointer to a parsed line table corresponding to a compile unit.
347 /// Report any recoverable parsing problems using the handler.
350 function_ref<void(Error)> RecoverableErrorHandler);
351
352 // Clear the line table object corresponding to a compile unit for memory
353 // management purpose. When it's referred to again, it'll be re-populated.
355
357 return DataExtractor(DObj->getStrSection(), false, 0);
358 }
360 return DataExtractor(DObj->getStrDWOSection(), false, 0);
361 }
363 return DataExtractor(DObj->getLineStrSection(), false, 0);
364 }
365
366 /// Wraps the returned DIEs for a given address.
371 explicit operator bool() const { return CompileUnit != nullptr; }
372 };
373
374 /// Get the compilation unit, the function DIE and lexical block DIE for the
375 /// given address where applicable.
376 /// TODO: change input parameter from "uint64_t Address"
377 /// into "SectionedAddress Address"
378 /// \param[in] CheckDWO If this is false then only search for address matches
379 /// in the current context's DIEs. If this is true, then each
380 /// DWARFUnit that has a DWO file will have the debug info in the
381 /// DWO file searched as well. This allows for lookups to succeed
382 /// by searching the split DWARF debug info when using the main
383 /// executable's debug info.
384 DIEsForAddress getDIEsForAddress(uint64_t Address, bool CheckDWO = false);
385
388 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
393 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
396 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
397
398 std::vector<DILocal>
400
401 bool isLittleEndian() const { return DObj->isLittleEndian(); }
402 static unsigned getMaxSupportedVersion() { return 5; }
403 static bool isSupportedVersion(unsigned version) {
404 return version >= 2 && version <= getMaxSupportedVersion();
405 }
406
408 return {2, 4, 8};
409 }
410 static bool isAddressSizeSupported(unsigned AddressSize) {
411 return llvm::is_contained(getSupportedAddressSizes(), AddressSize);
412 }
413 template <typename... Ts>
414 static Error checkAddressSizeSupported(unsigned AddressSize,
415 std::error_code EC, char const *Fmt,
416 const Ts &...Vals) {
417 if (isAddressSizeSupported(AddressSize))
418 return Error::success();
419 std::string Buffer;
420 raw_string_ostream Stream(Buffer);
421 Stream << format(Fmt, Vals...)
422 << " has unsupported address size: " << AddressSize
423 << " (supported are ";
424 ListSeparator LS;
426 Stream << LS << Size;
427 Stream << ')';
428 return make_error<StringError>(Buffer, EC);
429 }
430
431 std::shared_ptr<DWARFContext> getDWOContext(StringRef AbsolutePath);
432
434 return RecoverableErrorHandler;
435 }
436
437 function_ref<void(Error)> getWarningHandler() { return WarningHandler; }
438
440
441 static std::unique_ptr<DWARFContext>
442 create(const object::ObjectFile &Obj,
444 const LoadedObjectInfo *L = nullptr, std::string DWPName = "",
445 std::function<void(Error)> RecoverableErrorHandler =
447 std::function<void(Error)> WarningHandler =
449 bool ThreadSafe = false);
450
451 static std::unique_ptr<DWARFContext>
452 create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
453 uint8_t AddrSize, bool isLittleEndian = sys::IsLittleEndianHost,
454 std::function<void(Error)> RecoverableErrorHandler =
456 std::function<void(Error)> WarningHandler =
458 bool ThreadSafe = false);
459
460 /// Get address size from CUs.
461 /// TODO: refactor compile_units() to make this const.
462 uint8_t getCUAddrSize();
463
465 return getDWARFObj().getFile()->getArch();
466 }
467
468 /// Return the compile unit which contains instruction with provided
469 /// address.
470 /// TODO: change input parameter from "uint64_t Address"
471 /// into "SectionedAddress Address"
473
474 /// Return the compile unit which contains data with the provided address.
475 /// Note: This is more expensive than `getCompileUnitForAddress`, as if
476 /// `Address` isn't found in the CU ranges (which is cheap), then it falls
477 /// back to an expensive O(n) walk of all CU's looking for data that spans the
478 /// address.
479 /// TODO: change input parameter from "uint64_t Address" into
480 /// "SectionedAddress Address"
482
483 /// Returns whether CU/TU should be populated manually. TU Index populated
484 /// manually only for DWARF5.
485 bool getParseCUTUIndexManually() const { return ParseCUTUIndexManually; }
486
487 /// Sets whether CU/TU should be populated manually. TU Index populated
488 /// manually only for DWARF5.
489 void setParseCUTUIndexManually(bool PCUTU) { ParseCUTUIndexManually = PCUTU; }
490
491private:
492 void addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram, DWARFDie Die,
493 std::vector<DILocal> &Result);
494};
495
496} // end namespace llvm
497
498#endif // LLVM_DEBUGINFO_DWARF_DWARFCONTEXT_H
This file defines the StringMap class.
uint64_t Size
ppc ctr loops verify
raw_pwrite_stream & OS
This file defines the SmallVector class.
This file contains some functions that are useful when dealing with strings.
This implements the Apple accelerator table format, a precursor of the DWARF 5 accelerator table form...
DIContextKind getKind() const
Definition: DIContext.h:246
A format-neutral container for inlined code description.
Definition: DIContext.h:94
DWARFContextState This structure contains all member variables for DWARFContext that need to be prote...
Definition: DWARFContext.h:57
virtual void clearLineTableForUnit(DWARFUnit *U)=0
virtual DWARFGdbIndex & getGdbIndex()=0
virtual Expected< const DWARFDebugFrame * > getEHFrame()=0
virtual const DWARFUnitIndex & getCUIndex()=0
MacroSecType
Helper enum to distinguish between macro[.dwo] and macinfo[.dwo] section.
Definition: DWARFContext.h:61
virtual bool isThreadSafe() const =0
virtual const DWARFUnitIndex & getTUIndex()=0
virtual const DWARFDebugMacro * getDebugMacinfoDWO()=0
virtual const DWARFDebugMacro * getDebugMacroDWO()=0
virtual const DenseMap< uint64_t, DWARFTypeUnit * > & getTypeUnitMap(bool IsDWO)=0
virtual Expected< const DWARFDebugLine::LineTable * > getLineTableForUnit(DWARFUnit *U, function_ref< void(Error)> RecoverableErrHandler)=0
virtual const DWARFDebugAbbrev * getDebugAbbrevDWO()=0
virtual const DWARFDebugMacro * getDebugMacro()=0
virtual const DWARFDebugAranges * getDebugAranges()=0
virtual const AppleAcceleratorTable & getAppleNames()=0
std::unique_ptr< DWARFDebugMacro > parseMacroOrMacinfo(MacroSecType SectionType)
Parse a macro[.dwo] or macinfo[.dwo] section.
virtual Expected< const DWARFDebugFrame * > getDebugFrame()=0
virtual DWARFUnitVector & getDWOUnits(bool Lazy=false)=0
virtual const DWARFDebugLoc * getDebugLoc()=0
virtual DWARFUnitVector & getNormalUnits()=0
virtual const DWARFDebugAbbrev * getDebugAbbrev()=0
virtual const DWARFDebugNames & getDebugNames()=0
virtual const AppleAcceleratorTable & getAppleTypes()=0
virtual const AppleAcceleratorTable & getAppleNamespaces()=0
virtual const DWARFDebugMacro * getDebugMacinfo()=0
virtual const AppleAcceleratorTable & getAppleObjC()=0
virtual std::shared_ptr< DWARFContext > getDWOContext(StringRef AbsolutePath)=0
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition: DWARFContext.h:48
DWARFCompileUnit * getCompileUnitForCodeAddress(uint64_t Address)
Return the compile unit which contains instruction with provided address.
uint8_t getCUAddrSize()
Get address size from CUs.
DIInliningInfo getInliningInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
Expected< const DWARFDebugFrame * > getDebugFrame()
Get a pointer to the parsed frame information object.
static bool isSupportedVersion(unsigned version)
Definition: DWARFContext.h:403
Triple::ArchType getArch() const
Definition: DWARFContext.h:464
function_ref< void(Error)> getRecoverableErrorHandler()
Definition: DWARFContext.h:433
DWARFGdbIndex & getGdbIndex()
unsigned getNumCompileUnits()
Get the number of compile units in this context.
Definition: DWARFContext.h:235
~DWARFContext() override
DWARFUnitVector::compile_unit_range compile_unit_range
Definition: DWARFContext.h:166
static SmallVector< uint8_t, 3 > getSupportedAddressSizes()
Definition: DWARFContext.h:407
DWARFDie getDIEForOffset(uint64_t Offset)
Get a DIE given an exact offset.
unsigned getNumTypeUnits()
Get the number of type units in this context.
Definition: DWARFContext.h:240
DWARFUnitVector::iterator_range unit_iterator_range
Definition: DWARFContext.h:165
static bool classof(const DIContext *DICtx)
Definition: DWARFContext.h:149
DILineInfo getLineInfoForAddress(object::SectionedAddress Address, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
const DWARFDebugAbbrev * getDebugAbbrevDWO()
Get a pointer to the parsed dwo abbreviations object.
compile_unit_range compile_units()
Get compile units in this context.
Definition: DWARFContext.h:188
const AppleAcceleratorTable & getAppleObjC()
Get a reference to the parsed accelerator table object.
const DWARFUnitIndex & getTUIndex()
unsigned getMaxVersion()
Definition: DWARFContext.h:276
DWARFCompileUnit * getCompileUnitForDataAddress(uint64_t Address)
Return the compile unit which contains data with the provided address.
const DWARFDebugAbbrev * getDebugAbbrev()
Get a pointer to the parsed DebugAbbrev object.
DWARFUnit * getDWOUnitAtIndex(unsigned index)
Get the unit at the specified index for the DWO units.
Definition: DWARFContext.h:260
std::vector< DILocal > getLocalsForAddress(object::SectionedAddress Address) override
DataExtractor getStringExtractor() const
Definition: DWARFContext.h:356
void setParseCUTUIndexManually(bool PCUTU)
Sets whether CU/TU should be populated manually.
Definition: DWARFContext.h:489
DWARFCompileUnit * getCompileUnitForOffset(uint64_t Offset)
Return the compile unit that includes an offset (relative to .debug_info).
const DWARFDebugNames & getDebugNames()
Get a reference to the parsed accelerator table object.
unsigned getNumDWOTypeUnits()
Get the number of type units in the DWO context.
Definition: DWARFContext.h:250
const DWARFDebugMacro * getDebugMacroDWO()
Get a pointer to the parsed DebugMacroDWO information object.
DILineInfoTable getLineInfoForAddressRange(object::SectionedAddress Address, uint64_t Size, DILineInfoSpecifier Specifier=DILineInfoSpecifier()) override
static Error checkAddressSizeSupported(unsigned AddressSize, std::error_code EC, char const *Fmt, const Ts &...Vals)
Definition: DWARFContext.h:414
function_ref< void(Error)> getWarningHandler()
Definition: DWARFContext.h:437
bool isLittleEndian() const
Definition: DWARFContext.h:401
DWARFUnit * getUnitAtIndex(unsigned index)
Get the unit at the specified index.
Definition: DWARFContext.h:255
const DWARFDebugLine::LineTable * getLineTableForUnit(DWARFUnit *U)
Get a pointer to a parsed line table corresponding to a compile unit.
DWARFContext & operator=(DWARFContext &)=delete
void clearLineTableForUnit(DWARFUnit *U)
const AppleAcceleratorTable & getAppleTypes()
Get a reference to the parsed accelerator table object.
const AppleAcceleratorTable & getAppleNames()
Get a reference to the parsed accelerator table object.
void setMaxVersionIfGreater(unsigned Version)
Definition: DWARFContext.h:288
DWARFUnit * getUnitForOffset(uint64_t Offset)
Return the DWARF unit that includes an offset (relative to .debug_info).
compile_unit_range dwo_compile_units()
Get compile units in the DWO context.
Definition: DWARFContext.h:220
const DWARFUnitVector & getNormalUnitsVector()
Definition: DWARFContext.h:176
const DWARFDebugLoc * getDebugLoc()
Get a pointer to the parsed DebugLoc object.
const DWARFDebugMacro * getDebugMacinfoDWO()
Get a pointer to the parsed DebugMacinfoDWO information object.
unit_iterator_range dwo_types_section_units()
Get units from .debug_types.dwo in the DWO context.
Definition: DWARFContext.h:213
void dump(raw_ostream &OS, DIDumpOptions DumpOpts, std::array< std::optional< uint64_t >, DIDT_ID_Count > DumpOffsets)
Dump a textual representation to OS.
unit_iterator_range normal_units()
Get all normal compile/type units in this context.
Definition: DWARFContext.h:196
static unsigned getMaxSupportedVersion()
Definition: DWARFContext.h:402
unit_iterator_range types_section_units()
Get units from .debug_types in this context.
Definition: DWARFContext.h:181
std::shared_ptr< DWARFContext > getDWOContext(StringRef AbsolutePath)
DWARFCompileUnit * getDWOCompileUnitForHash(uint64_t Hash)
void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override
Definition: DWARFContext.h:158
unsigned getNumDWOCompileUnits()
Get the number of compile units in the DWO context.
Definition: DWARFContext.h:245
DWARFContext(DWARFContext &)=delete
DILineInfo getLineInfoForDataAddress(object::SectionedAddress Address) override
const DWARFDebugAranges * getDebugAranges()
Get a pointer to the parsed DebugAranges object.
const DWARFUnitIndex & getCUIndex()
Expected< const DWARFDebugFrame * > getEHFrame()
Get a pointer to the parsed eh frame information object.
DIEsForAddress getDIEsForAddress(uint64_t Address, bool CheckDWO=false)
Get the compilation unit, the function DIE and lexical block DIE for the given address where applicab...
DataExtractor getLineStringExtractor() const
Definition: DWARFContext.h:362
unit_iterator_range info_section_units()
Get units from .debug_info in this context.
Definition: DWARFContext.h:169
DWARFTypeUnit * getTypeUnitForHash(uint16_t Version, uint64_t Hash, bool IsDWO)
bool getParseCUTUIndexManually() const
Returns whether CU/TU should be populated manually.
Definition: DWARFContext.h:485
unit_iterator_range dwo_info_section_units()
Get units from .debug_info..dwo in the DWO context.
Definition: DWARFContext.h:202
DataExtractor getStringDWOExtractor() const
Definition: DWARFContext.h:359
const AppleAcceleratorTable & getAppleNamespaces()
Get a reference to the parsed accelerator table object.
const DWARFDebugMacro * getDebugMacro()
Get a pointer to the parsed DebugMacro information object.
static std::unique_ptr< DWARFContext > create(const object::ObjectFile &Obj, ProcessDebugRelocations RelocAction=ProcessDebugRelocations::Process, const LoadedObjectInfo *L=nullptr, std::string DWPName="", std::function< void(Error)> RecoverableErrorHandler=WithColor::defaultErrorHandler, std::function< void(Error)> WarningHandler=WithColor::defaultWarningHandler, bool ThreadSafe=false)
const DWARFDebugMacro * getDebugMacinfo()
Get a pointer to the parsed DebugMacinfo information object.
static bool isAddressSizeSupported(unsigned AddressSize)
Definition: DWARFContext.h:410
const DWARFUnitVector & getDWOUnitsVector()
Definition: DWARFContext.h:208
unit_iterator_range dwo_units()
Get all units in the DWO context.
Definition: DWARFContext.h:229
const DWARFObject & getDWARFObj() const
Definition: DWARFContext.h:147
unsigned getMaxDWOVersion()
Definition: DWARFContext.h:282
.debug_names section consists of one or more units.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Definition: DWARFDie.h:42
virtual const object::ObjectFile * getFile() const
Definition: DWARFObject.h:32
Describe a collection of units.
Definition: DWARFUnit.h:128
unsigned getNumInfoUnits() const
Returns number of units from all .debug_info[.dwo] sections.
Definition: DWARFUnit.h:167
llvm::iterator_range< typename UnitVector::iterator > iterator_range
Definition: DWARFUnit.h:138
decltype(make_filter_range(std::declval< iterator_range >(), isCompileUnit)) compile_unit_range
Definition: DWARFUnit.h:141
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:337
Tagged union holding either a T or a Error.
Definition: Error.h:481
An inferface for inquiring the load address of a loaded object file to be used by the DIContext imple...
Definition: DIContext.h:277
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:128
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
static void defaultWarningHandler(Error Warning)
Implement default handling for Warning.
Definition: WithColor.cpp:164
static void defaultErrorHandler(Error Err)
Implement default handling for Error.
Definition: WithColor.cpp:158
Stores all information relating to a compile unit, be it in its original instance in the object file ...
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This class is the base class for all object file types.
Definition: ObjectFile.h:229
virtual Triple::ArchType getArch() const =0
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:661
static const bool IsLittleEndianHost
Definition: SwapByteOrder.h:29
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
Definition: STLExtras.h:572
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:125
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1886
@ DIDT_ID_Count
Definition: DIContext.h:179
bool isCompileUnit(const std::unique_ptr< DWARFUnit > &U)
Definition: DWARFUnit.h:595
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:196
Controls which fields of DILineInfo container should be filled with data.
Definition: DIContext.h:146
A format-neutral container for source line information.
Definition: DIContext.h:32
Wraps the returned DIEs for a given address.
Definition: DWARFContext.h:367