LLVM 18.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
101 /// Parse a macro[.dwo] or macinfo[.dwo] section.
102 std::unique_ptr<DWARFDebugMacro>
104
105 };
106 friend class DWARFContextState;
107
108private:
109 /// All important state for a DWARFContext that needs to be threadsafe needs
110 /// to go into DWARFContextState.
111 std::unique_ptr<DWARFContextState> State;
112
113 /// The maximum DWARF version of all units.
114 unsigned MaxVersion = 0;
115
116 std::function<void(Error)> RecoverableErrorHandler =
118 std::function<void(Error)> WarningHandler = WithColor::defaultWarningHandler;
119
120 /// Read compile units from the debug_info.dwo section (if necessary)
121 /// and type units from the debug_types.dwo section (if necessary)
122 /// and store them in DWOUnits.
123 /// If \p Lazy is true, set up to parse but don't actually parse them.
124 enum { EagerParse = false, LazyParse = true };
125 DWARFUnitVector &getDWOUnits(bool Lazy = false);
126
127 std::unique_ptr<const DWARFObject> DObj;
128
129 // When set parses debug_info.dwo/debug_abbrev.dwo manually and populates CU
130 // Index, and TU Index for DWARF5.
131 bool ParseCUTUIndexManually = false;
132
133public:
134 DWARFContext(std::unique_ptr<const DWARFObject> DObj,
135 std::string DWPName = "",
136 std::function<void(Error)> RecoverableErrorHandler =
138 std::function<void(Error)> WarningHandler =
140 bool ThreadSafe = false);
141 ~DWARFContext() override;
142
145
146 const DWARFObject &getDWARFObj() const { return *DObj; }
147
148 static bool classof(const DIContext *DICtx) {
149 return DICtx->getKind() == CK_DWARF;
150 }
151
152 /// Dump a textual representation to \p OS. If any \p DumpOffsets are present,
153 /// dump only the record at the specified offset.
154 void dump(raw_ostream &OS, DIDumpOptions DumpOpts,
155 std::array<std::optional<uint64_t>, DIDT_ID_Count> DumpOffsets);
156
157 void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override {
158 std::array<std::optional<uint64_t>, DIDT_ID_Count> DumpOffsets;
159 dump(OS, DumpOpts, DumpOffsets);
160 }
161
162 bool verify(raw_ostream &OS, DIDumpOptions DumpOpts = {}) override;
163
166
167 /// Get units from .debug_info in this context.
169 DWARFUnitVector &NormalUnits = State->getNormalUnits();
170 return unit_iterator_range(NormalUnits.begin(),
171 NormalUnits.begin() +
172 NormalUnits.getNumInfoUnits());
173 }
174
176 return State->getNormalUnits();
177 }
178
179 /// Get units from .debug_types in this context.
181 DWARFUnitVector &NormalUnits = State->getNormalUnits();
182 return unit_iterator_range(
183 NormalUnits.begin() + NormalUnits.getNumInfoUnits(), NormalUnits.end());
184 }
185
186 /// Get compile units in this context.
189 }
190
191 // If you want type_units(), it'll need to be a concat iterator of a filter of
192 // TUs in info_section + all the (all type) units in types_section
193
194 /// Get all normal compile/type units in this context.
196 DWARFUnitVector &NormalUnits = State->getNormalUnits();
197 return unit_iterator_range(NormalUnits.begin(), NormalUnits.end());
198 }
199
200 /// Get units from .debug_info..dwo in the DWO context.
202 DWARFUnitVector &DWOUnits = State->getDWOUnits();
203 return unit_iterator_range(DWOUnits.begin(),
204 DWOUnits.begin() + DWOUnits.getNumInfoUnits());
205 }
206
208 return State->getDWOUnits();
209 }
210
211 /// Get units from .debug_types.dwo in the DWO context.
213 DWARFUnitVector &DWOUnits = State->getDWOUnits();
214 return unit_iterator_range(DWOUnits.begin() + DWOUnits.getNumInfoUnits(),
215 DWOUnits.end());
216 }
217
218 /// Get compile units in the DWO context.
221 }
222
223 // If you want dwo_type_units(), it'll need to be a concat iterator of a
224 // filter of TUs in dwo_info_section + all the (all type) units in
225 // dwo_types_section.
226
227 /// Get all units in the DWO context.
229 DWARFUnitVector &DWOUnits = State->getDWOUnits();
230 return unit_iterator_range(DWOUnits.begin(), DWOUnits.end());
231 }
232
233 /// Get the number of compile units in this context.
235 return State->getNormalUnits().getNumInfoUnits();
236 }
237
238 /// Get the number of type units in this context.
239 unsigned getNumTypeUnits() {
240 return State->getNormalUnits().getNumTypesUnits();
241 }
242
243 /// Get the number of compile units in the DWO context.
245 return State->getDWOUnits().getNumInfoUnits();
246 }
247
248 /// Get the number of type units in the DWO context.
250 return State->getDWOUnits().getNumTypesUnits();
251 }
252
253 /// Get the unit at the specified index.
254 DWARFUnit *getUnitAtIndex(unsigned index) {
255 return State->getNormalUnits()[index].get();
256 }
257
258 /// Get the unit at the specified index for the DWO units.
259 DWARFUnit *getDWOUnitAtIndex(unsigned index) {
260 return State->getDWOUnits()[index].get();
261 }
262
264 DWARFTypeUnit *getTypeUnitForHash(uint16_t Version, uint64_t Hash, bool IsDWO);
265
266 /// Return the compile unit that includes an offset (relative to .debug_info).
268
269 /// Get a DIE given an exact offset.
271
272 unsigned getMaxVersion() {
273 // Ensure info units have been parsed to discover MaxVersion
275 return MaxVersion;
276 }
277
278 unsigned getMaxDWOVersion() {
279 // Ensure DWO info units have been parsed to discover MaxVersion
281 return MaxVersion;
282 }
283
284 void setMaxVersionIfGreater(unsigned Version) {
285 if (Version > MaxVersion)
286 MaxVersion = Version;
287 }
288
289 const DWARFUnitIndex &getCUIndex();
291 const DWARFUnitIndex &getTUIndex();
292
293 /// Get a pointer to the parsed DebugAbbrev object.
295
296 /// Get a pointer to the parsed DebugLoc object.
297 const DWARFDebugLoc *getDebugLoc();
298
299 /// Get a pointer to the parsed dwo abbreviations object.
301
302 /// Get a pointer to the parsed DebugAranges object.
304
305 /// Get a pointer to the parsed frame information object.
307
308 /// Get a pointer to the parsed eh frame information object.
310
311 /// Get a pointer to the parsed DebugMacinfo information object.
313
314 /// Get a pointer to the parsed DebugMacinfoDWO information object.
316
317 /// Get a pointer to the parsed DebugMacro information object.
319
320 /// Get a pointer to the parsed DebugMacroDWO information object.
322
323 /// Get a reference to the parsed accelerator table object.
325
326 /// Get a reference to the parsed accelerator table object.
328
329 /// Get a reference to the parsed accelerator table object.
331
332 /// Get a reference to the parsed accelerator table object.
334
335 /// Get a reference to the parsed accelerator table object.
337
338 /// Get a pointer to a parsed line table corresponding to a compile unit.
339 /// Report any parsing issues as warnings on stderr.
341
342 /// Get a pointer to a parsed line table corresponding to a compile unit.
343 /// Report any recoverable parsing problems using the handler.
346 function_ref<void(Error)> RecoverableErrorHandler);
347
348 // Clear the line table object corresponding to a compile unit for memory
349 // management purpose. When it's referred to again, it'll be re-populated.
351
353 return DataExtractor(DObj->getStrSection(), false, 0);
354 }
356 return DataExtractor(DObj->getStrDWOSection(), false, 0);
357 }
359 return DataExtractor(DObj->getLineStrSection(), false, 0);
360 }
361
362 /// Wraps the returned DIEs for a given address.
367 explicit operator bool() const { return CompileUnit != nullptr; }
368 };
369
370 /// Get the compilation unit, the function DIE and lexical block DIE for the
371 /// given address where applicable.
372 /// TODO: change input parameter from "uint64_t Address"
373 /// into "SectionedAddress Address"
374 DIEsForAddress getDIEsForAddress(uint64_t Address);
375
378 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
383 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
386 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
387
388 std::vector<DILocal>
390
391 bool isLittleEndian() const { return DObj->isLittleEndian(); }
392 static unsigned getMaxSupportedVersion() { return 5; }
393 static bool isSupportedVersion(unsigned version) {
394 return version >= 2 && version <= getMaxSupportedVersion();
395 }
396
398 return {2, 4, 8};
399 }
400 static bool isAddressSizeSupported(unsigned AddressSize) {
401 return llvm::is_contained(getSupportedAddressSizes(), AddressSize);
402 }
403 template <typename... Ts>
404 static Error checkAddressSizeSupported(unsigned AddressSize,
405 std::error_code EC, char const *Fmt,
406 const Ts &...Vals) {
407 if (isAddressSizeSupported(AddressSize))
408 return Error::success();
409 std::string Buffer;
410 raw_string_ostream Stream(Buffer);
411 Stream << format(Fmt, Vals...)
412 << " has unsupported address size: " << AddressSize
413 << " (supported are ";
414 ListSeparator LS;
416 Stream << LS << Size;
417 Stream << ')';
418 return make_error<StringError>(Stream.str(), EC);
419 }
420
421 std::shared_ptr<DWARFContext> getDWOContext(StringRef AbsolutePath);
422
424 return RecoverableErrorHandler;
425 }
426
427 function_ref<void(Error)> getWarningHandler() { return WarningHandler; }
428
430
431 static std::unique_ptr<DWARFContext>
432 create(const object::ObjectFile &Obj,
434 const LoadedObjectInfo *L = nullptr, std::string DWPName = "",
435 std::function<void(Error)> RecoverableErrorHandler =
437 std::function<void(Error)> WarningHandler =
439 bool ThreadSafe = false);
440
441 static std::unique_ptr<DWARFContext>
442 create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
443 uint8_t AddrSize, bool isLittleEndian = sys::IsLittleEndianHost,
444 std::function<void(Error)> RecoverableErrorHandler =
446 std::function<void(Error)> WarningHandler =
448 bool ThreadSafe = false);
449
450 /// Get address size from CUs.
451 /// TODO: refactor compile_units() to make this const.
452 uint8_t getCUAddrSize();
453
455 return getDWARFObj().getFile()->getArch();
456 }
457
458 /// Return the compile unit which contains instruction with provided
459 /// address.
460 /// TODO: change input parameter from "uint64_t Address"
461 /// into "SectionedAddress Address"
463
464 /// Return the compile unit which contains data with the provided address.
465 /// Note: This is more expensive than `getCompileUnitForAddress`, as if
466 /// `Address` isn't found in the CU ranges (which is cheap), then it falls
467 /// back to an expensive O(n) walk of all CU's looking for data that spans the
468 /// address.
469 /// TODO: change input parameter from "uint64_t Address" into
470 /// "SectionedAddress Address"
472
473 /// Returns whether CU/TU should be populated manually. TU Index populated
474 /// manually only for DWARF5.
475 bool getParseCUTUIndexManually() const { return ParseCUTUIndexManually; }
476
477 /// Sets whether CU/TU should be populated manually. TU Index populated
478 /// manually only for DWARF5.
479 void setParseCUTUIndexManually(bool PCUTU) { ParseCUTUIndexManually = PCUTU; }
480
481private:
482 void addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram, DWARFDie Die,
483 std::vector<DILocal> &Result);
484};
485
486} // end namespace llvm
487
488#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...
Stores all information relating to a compile unit, be it in its original instance in the object file ...
DIContextKind getKind() const
Definition: DIContext.h:240
A format-neutral container for inlined code description.
Definition: DIContext.h:92
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 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:393
Triple::ArchType getArch() const
Definition: DWARFContext.h:454
function_ref< void(Error)> getRecoverableErrorHandler()
Definition: DWARFContext.h:423
DWARFGdbIndex & getGdbIndex()
unsigned getNumCompileUnits()
Get the number of compile units in this context.
Definition: DWARFContext.h:234
~DWARFContext() override
DWARFUnitVector::compile_unit_range compile_unit_range
Definition: DWARFContext.h:165
static SmallVector< uint8_t, 3 > getSupportedAddressSizes()
Definition: DWARFContext.h:397
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:239
DIEsForAddress getDIEsForAddress(uint64_t Address)
Get the compilation unit, the function DIE and lexical block DIE for the given address where applicab...
DWARFUnitVector::iterator_range unit_iterator_range
Definition: DWARFContext.h:164
static bool classof(const DIContext *DICtx)
Definition: DWARFContext.h:148
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:187
const AppleAcceleratorTable & getAppleObjC()
Get a reference to the parsed accelerator table object.
const DWARFUnitIndex & getTUIndex()
unsigned getMaxVersion()
Definition: DWARFContext.h:272
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:259
std::vector< DILocal > getLocalsForAddress(object::SectionedAddress Address) override
DataExtractor getStringExtractor() const
Definition: DWARFContext.h:352
void setParseCUTUIndexManually(bool PCUTU)
Sets whether CU/TU should be populated manually.
Definition: DWARFContext.h:479
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:249
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:404
function_ref< void(Error)> getWarningHandler()
Definition: DWARFContext.h:427
bool isLittleEndian() const
Definition: DWARFContext.h:391
DWARFUnit * getUnitAtIndex(unsigned index)
Get the unit at the specified index.
Definition: DWARFContext.h:254
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:284
compile_unit_range dwo_compile_units()
Get compile units in the DWO context.
Definition: DWARFContext.h:219
const DWARFUnitVector & getNormalUnitsVector()
Definition: DWARFContext.h:175
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:212
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:195
static unsigned getMaxSupportedVersion()
Definition: DWARFContext.h:392
unit_iterator_range types_section_units()
Get units from .debug_types in this context.
Definition: DWARFContext.h:180
std::shared_ptr< DWARFContext > getDWOContext(StringRef AbsolutePath)
DWARFCompileUnit * getDWOCompileUnitForHash(uint64_t Hash)
void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override
Definition: DWARFContext.h:157
unsigned getNumDWOCompileUnits()
Get the number of compile units in the DWO context.
Definition: DWARFContext.h:244
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.
DataExtractor getLineStringExtractor() const
Definition: DWARFContext.h:358
unit_iterator_range info_section_units()
Get units from .debug_info in this context.
Definition: DWARFContext.h:168
DWARFTypeUnit * getTypeUnitForHash(uint16_t Version, uint64_t Hash, bool IsDWO)
bool getParseCUTUIndexManually() const
Returns whether CU/TU should be populated manually.
Definition: DWARFContext.h:475
unit_iterator_range dwo_info_section_units()
Get units from .debug_info..dwo in the DWO context.
Definition: DWARFContext.h:201
DataExtractor getStringDWOExtractor() const
Definition: DWARFContext.h:355
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:400
const DWARFUnitVector & getDWOUnitsVector()
Definition: DWARFContext.h:207
unit_iterator_range dwo_units()
Get all units in the DWO context.
Definition: DWARFContext.h:228
const DWARFObject & getDWARFObj() const
Definition: DWARFContext.h:146
unsigned getMaxDWOVersion()
Definition: DWARFContext.h:278
.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:126
unsigned getNumInfoUnits() const
Returns number of units from all .debug_info[.dwo] sections.
Definition: DWARFUnit.h:165
llvm::iterator_range< typename UnitVector::iterator > iterator_range
Definition: DWARFUnit.h:136
decltype(make_filter_range(std::declval< iterator_range >(), isCompileUnit)) compile_unit_range
Definition: DWARFUnit.h:139
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:334
Tagged union holding either a T or a Error.
Definition: Error.h:474
An inferface for inquiring the load address of a loaded object file to be used by the DIContext imple...
Definition: DIContext.h:271
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1200
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:112
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
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:642
std::string & str()
Returns the string's reference.
Definition: raw_ostream.h:660
static const bool IsLittleEndianHost
Definition: SwapByteOrder.h:57
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:440
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:582
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:1884
@ DIDT_ID_Count
Definition: DIContext.h:176
bool isCompileUnit(const std::unique_ptr< DWARFUnit > &U)
Definition: DWARFUnit.h:593
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:193
Controls which fields of DILineInfo container should be filled with data.
Definition: DIContext.h:144
A format-neutral container for source line information.
Definition: DIContext.h:32
Wraps the returned DIEs for a given address.
Definition: DWARFContext.h:363