LLVM  10.0.0svn
Dwarf.h
Go to the documentation of this file.
1 //===-- llvm/BinaryFormat/Dwarf.h ---Dwarf Constants-------------*- 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 /// \file
10 /// This file contains constants used for implementing Dwarf
11 /// debug support.
12 ///
13 /// For details on the Dwarf specfication see the latest DWARF Debugging
14 /// Information Format standard document on http://www.dwarfstd.org. This
15 /// file often includes support for non-released standard features.
16 //
17 //===----------------------------------------------------------------------===//
18 
19 #ifndef LLVM_BINARYFORMAT_DWARF_H
20 #define LLVM_BINARYFORMAT_DWARF_H
21 
22 #include "llvm/ADT/Optional.h"
23 #include "llvm/Support/Compiler.h"
24 #include "llvm/Support/DataTypes.h"
26 #include "llvm/Support/Format.h"
28 #include "llvm/ADT/Triple.h"
29 
30 namespace llvm {
31 class StringRef;
32 
33 namespace dwarf {
34 
35 //===----------------------------------------------------------------------===//
36 // DWARF constants as gleaned from the DWARF Debugging Information Format V.5
37 // reference manual http://www.dwarfstd.org/.
38 //
39 
40 // Do not mix the following two enumerations sets. DW_TAG_invalid changes the
41 // enumeration base type.
42 
44  // LLVM mock tags (see also llvm/BinaryFormat/Dwarf.def).
45  DW_TAG_invalid = ~0U, // Tag for invalid results.
46  DW_VIRTUALITY_invalid = ~0U, // Virtuality for invalid results.
47  DW_MACINFO_invalid = ~0U, // Macinfo type for invalid results.
48 
49  // Special values for an initial length field.
50  DW_LENGTH_lo_reserved = 0xfffffff0, // Lower bound of the reserved range.
51  DW_LENGTH_DWARF64 = 0xffffffff, // Indicator of 64-bit DWARF format.
52  DW_LENGTH_hi_reserved = 0xffffffff, // Upper bound of the reserved range.
53 
54  // Other constants.
55  DWARF_VERSION = 4, // Default dwarf version we output.
56  DW_PUBTYPES_VERSION = 2, // Section version number for .debug_pubtypes.
57  DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
58  DW_ARANGES_VERSION = 2, // Section version number for .debug_aranges.
59  // Identifiers we use to distinguish vendor extensions.
60  DWARF_VENDOR_DWARF = 0, // Defined in v2 or later of the DWARF standard.
67 };
68 
69 /// Constants that define the DWARF format as 32 or 64 bit.
70 enum DwarfFormat : uint8_t { DWARF32, DWARF64 };
71 
72 /// Special ID values that distinguish a CIE from a FDE in DWARF CFI.
73 /// Not inside an enum because a 64-bit value is needed.
74 /// @{
75 const uint32_t DW_CIE_ID = UINT32_MAX;
76 const uint64_t DW64_CIE_ID = UINT64_MAX;
77 /// @}
78 
79 /// Identifier of an invalid DIE offset in the .debug_info section.
80 const uint32_t DW_INVALID_OFFSET = UINT32_MAX;
81 
82 enum Tag : uint16_t {
83 #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND) DW_TAG_##NAME = ID,
84 #include "llvm/BinaryFormat/Dwarf.def"
85  DW_TAG_lo_user = 0x4080,
86  DW_TAG_hi_user = 0xffff,
87  DW_TAG_user_base = 0x1000 ///< Recommended base for user tags.
88 };
89 
90 inline bool isType(Tag T) {
91  switch (T) {
92  default:
93  return false;
94 #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND) \
95  case DW_TAG_##NAME: \
96  return (KIND == DW_KIND_TYPE);
97 #include "llvm/BinaryFormat/Dwarf.def"
98  }
99 }
100 
101 /// Attributes.
102 enum Attribute : uint16_t {
103 #define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) DW_AT_##NAME = ID,
104 #include "llvm/BinaryFormat/Dwarf.def"
105  DW_AT_lo_user = 0x2000,
106  DW_AT_hi_user = 0x3fff,
107 };
108 
109 enum Form : uint16_t {
110 #define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) DW_FORM_##NAME = ID,
111 #include "llvm/BinaryFormat/Dwarf.def"
112  DW_FORM_lo_user = 0x1f00, ///< Not specified by DWARF.
113 };
114 
116 #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) DW_OP_##NAME = ID,
117 #include "llvm/BinaryFormat/Dwarf.def"
120  DW_OP_LLVM_fragment = 0x1000, ///< Only used in LLVM metadata.
121  DW_OP_LLVM_convert = 0x1001, ///< Only used in LLVM metadata.
122  DW_OP_LLVM_tag_offset = 0x1002, ///< Only used in LLVM metadata.
123  DW_OP_LLVM_entry_value = 0x1003, ///< Only used in LLVM metadata.
124 };
125 
126 enum TypeKind : uint8_t {
127 #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) DW_ATE_##NAME = ID,
128 #include "llvm/BinaryFormat/Dwarf.def"
131 };
132 
134  // Decimal sign attribute values
140 };
141 
143  // Endianity attribute values
144 #define HANDLE_DW_END(ID, NAME) DW_END_##NAME = ID,
145 #include "llvm/BinaryFormat/Dwarf.def"
148 };
149 
151  // Accessibility codes
155 };
156 
158  // Visibility codes
159  DW_VIS_local = 0x01,
162 };
163 
165 #define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
166 #include "llvm/BinaryFormat/Dwarf.def"
168 };
169 
171 #define HANDLE_DW_DEFAULTED(ID, NAME) DW_DEFAULTED_##NAME = ID,
172 #include "llvm/BinaryFormat/Dwarf.def"
174 };
175 
177 #define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
178  DW_LANG_##NAME = ID,
179 #include "llvm/BinaryFormat/Dwarf.def"
180  DW_LANG_lo_user = 0x8000,
182 };
183 
184 inline bool isCPlusPlus(SourceLanguage S) {
185  // Deliberately enumerate all the language options so we get a warning when
186  // new language options are added (-Wswitch) that'll hopefully help keep this
187  // switch up-to-date when new C++ versions are added.
188  switch (S) {
189  case DW_LANG_C_plus_plus:
190  case DW_LANG_C_plus_plus_03:
191  case DW_LANG_C_plus_plus_11:
192  case DW_LANG_C_plus_plus_14:
193  return true;
194  case DW_LANG_C89:
195  case DW_LANG_C:
196  case DW_LANG_Ada83:
197  case DW_LANG_Cobol74:
198  case DW_LANG_Cobol85:
199  case DW_LANG_Fortran77:
200  case DW_LANG_Fortran90:
201  case DW_LANG_Pascal83:
202  case DW_LANG_Modula2:
203  case DW_LANG_Java:
204  case DW_LANG_C99:
205  case DW_LANG_Ada95:
206  case DW_LANG_Fortran95:
207  case DW_LANG_PLI:
208  case DW_LANG_ObjC:
209  case DW_LANG_ObjC_plus_plus:
210  case DW_LANG_UPC:
211  case DW_LANG_D:
212  case DW_LANG_Python:
213  case DW_LANG_OpenCL:
214  case DW_LANG_Go:
215  case DW_LANG_Modula3:
216  case DW_LANG_Haskell:
217  case DW_LANG_OCaml:
218  case DW_LANG_Rust:
219  case DW_LANG_C11:
220  case DW_LANG_Swift:
221  case DW_LANG_Julia:
222  case DW_LANG_Dylan:
223  case DW_LANG_Fortran03:
224  case DW_LANG_Fortran08:
225  case DW_LANG_RenderScript:
226  case DW_LANG_BLISS:
227  case DW_LANG_Mips_Assembler:
228  case DW_LANG_GOOGLE_RenderScript:
229  case DW_LANG_BORLAND_Delphi:
230  case DW_LANG_lo_user:
231  case DW_LANG_hi_user:
232  return false;
233  }
234  llvm_unreachable("Invalid source language");
235 }
236 
238  // Identifier case codes
243 };
244 
246 // Calling convention codes
247 #define HANDLE_DW_CC(ID, NAME) DW_CC_##NAME = ID,
248 #include "llvm/BinaryFormat/Dwarf.def"
251 };
252 
254  // Inline codes
259 };
260 
262  // Array ordering
265 };
266 
268  // Discriminant descriptor values
269  DW_DSC_label = 0x00,
271 };
272 
273 /// Line Number Standard Opcode Encodings.
274 enum LineNumberOps : uint8_t {
275 #define HANDLE_DW_LNS(ID, NAME) DW_LNS_##NAME = ID,
276 #include "llvm/BinaryFormat/Dwarf.def"
277 };
278 
279 /// Line Number Extended Opcode Encodings.
281 #define HANDLE_DW_LNE(ID, NAME) DW_LNE_##NAME = ID,
282 #include "llvm/BinaryFormat/Dwarf.def"
285 };
286 
288 #define HANDLE_DW_LNCT(ID, NAME) DW_LNCT_##NAME = ID,
289 #include "llvm/BinaryFormat/Dwarf.def"
290  DW_LNCT_lo_user = 0x2000,
291  DW_LNCT_hi_user = 0x3fff,
292 };
293 
295  // Macinfo Type Encodings
301 };
302 
303 /// DWARF v5 macro information entry type encodings.
305 #define HANDLE_DW_MACRO(ID, NAME) DW_MACRO_##NAME = ID,
306 #include "llvm/BinaryFormat/Dwarf.def"
309 };
310 
311 /// DWARF v5 range list entry encoding values.
313 #define HANDLE_DW_RLE(ID, NAME) DW_RLE_##NAME = ID,
314 #include "llvm/BinaryFormat/Dwarf.def"
315 };
316 
317 /// DWARF v5 loc list entry encoding values.
319 #define HANDLE_DW_LLE(ID, NAME) DW_LLE_##NAME = ID,
320 #include "llvm/BinaryFormat/Dwarf.def"
321 };
322 
323 /// Call frame instruction encodings.
325 #define HANDLE_DW_CFA(ID, NAME) DW_CFA_##NAME = ID,
326 #define HANDLE_DW_CFA_PRED(ID, NAME, ARCH) DW_CFA_##NAME = ID,
327 #include "llvm/BinaryFormat/Dwarf.def"
329 
332 };
333 
334 enum Constants {
335  // Children flag
338 
356 };
357 
358 /// Constants for the DW_APPLE_PROPERTY_attributes attribute.
359 /// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
361 #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
362 #include "llvm/BinaryFormat/Dwarf.def"
363 };
364 
365 /// Constants for unit types in DWARF v5.
366 enum UnitType : unsigned char {
367 #define HANDLE_DW_UT(ID, NAME) DW_UT_##NAME = ID,
368 #include "llvm/BinaryFormat/Dwarf.def"
371 };
372 
373 enum Index {
374 #define HANDLE_DW_IDX(ID, NAME) DW_IDX_##NAME = ID,
375 #include "llvm/BinaryFormat/Dwarf.def"
376  DW_IDX_lo_user = 0x2000,
377  DW_IDX_hi_user = 0x3fff
378 };
379 
380 inline bool isUnitType(uint8_t UnitType) {
381  switch (UnitType) {
382  case DW_UT_compile:
383  case DW_UT_type:
384  case DW_UT_partial:
385  case DW_UT_skeleton:
386  case DW_UT_split_compile:
387  case DW_UT_split_type:
388  return true;
389  default:
390  return false;
391  }
392 }
393 
394 inline bool isUnitType(dwarf::Tag T) {
395  switch (T) {
396  case DW_TAG_compile_unit:
397  case DW_TAG_type_unit:
398  case DW_TAG_partial_unit:
399  case DW_TAG_skeleton_unit:
400  return true;
401  default:
402  return false;
403  }
404 }
405 
406 // Constants for the DWARF v5 Accelerator Table Proposal
408  // Data layout descriptors.
409  DW_ATOM_null = 0u, /// Marker as the end of a list of atoms.
410  DW_ATOM_die_offset = 1u, // DIE offset in the debug_info section.
411  DW_ATOM_cu_offset = 2u, // Offset of the compile unit header that contains the
412  // item in question.
413  DW_ATOM_die_tag = 3u, // A tag entry.
414  DW_ATOM_type_flags = 4u, // Set of flags for a type.
415 
416  DW_ATOM_type_type_flags = 5u, // Dsymutil type extension.
417  DW_ATOM_qual_name_hash = 6u, // Dsymutil qualified hash extension.
418 
419  // DW_ATOM_type_flags values.
420 
421  // Always set for C++, only set for ObjC if this is the @implementation for a
422  // class.
424 
425  // Hash functions.
426 
427  // Daniel J. Bernstein hash.
429 };
430 
431 // Constants for the GNU pubnames/pubtypes extensions supporting gdb index.
441 };
442 
444 
445 /// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
446 ///
447 /// All these functions map their argument's value back to the
448 /// corresponding enumerator name or return an empty StringRef if the value
449 /// isn't known.
450 ///
451 /// @{
452 StringRef TagString(unsigned Tag);
453 StringRef ChildrenString(unsigned Children);
455 StringRef FormEncodingString(unsigned Encoding);
456 StringRef OperationEncodingString(unsigned Encoding);
457 StringRef AttributeEncodingString(unsigned Encoding);
458 StringRef DecimalSignString(unsigned Sign);
459 StringRef EndianityString(unsigned Endian);
460 StringRef AccessibilityString(unsigned Access);
461 StringRef VisibilityString(unsigned Visibility);
462 StringRef VirtualityString(unsigned Virtuality);
464 StringRef CaseString(unsigned Case);
465 StringRef ConventionString(unsigned Convention);
466 StringRef InlineCodeString(unsigned Code);
467 StringRef ArrayOrderString(unsigned Order);
468 StringRef LNStandardString(unsigned Standard);
469 StringRef LNExtendedString(unsigned Encoding);
470 StringRef MacinfoString(unsigned Encoding);
471 StringRef RangeListEncodingString(unsigned Encoding);
472 StringRef LocListEncodingString(unsigned Encoding);
473 StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch);
475 StringRef UnitTypeString(unsigned);
476 StringRef AtomTypeString(unsigned Atom);
479 StringRef IndexString(unsigned Idx);
480 /// @}
481 
482 /// \defgroup DwarfConstantsParsing Dwarf constants parsing functions
483 ///
484 /// These functions map their strings back to the corresponding enumeration
485 /// value or return 0 if there is none, except for these exceptions:
486 ///
487 /// \li \a getTag() returns \a DW_TAG_invalid on invalid input.
488 /// \li \a getVirtuality() returns \a DW_VIRTUALITY_invalid on invalid input.
489 /// \li \a getMacinfo() returns \a DW_MACINFO_invalid on invalid input.
490 ///
491 /// @{
492 unsigned getTag(StringRef TagString);
493 unsigned getOperationEncoding(StringRef OperationEncodingString);
494 unsigned getVirtuality(StringRef VirtualityString);
495 unsigned getLanguage(StringRef LanguageString);
496 unsigned getCallingConvention(StringRef LanguageString);
497 unsigned getAttributeEncoding(StringRef EncodingString);
498 unsigned getMacinfo(StringRef MacinfoString);
499 /// @}
500 
501 /// \defgroup DwarfConstantsVersioning Dwarf version for constants
502 ///
503 /// For constants defined by DWARF, returns the DWARF version when the constant
504 /// was first defined. For vendor extensions, if there is a version-related
505 /// policy for when to emit it, returns a version number for that policy.
506 /// Otherwise returns 0.
507 ///
508 /// @{
509 unsigned TagVersion(Tag T);
510 unsigned AttributeVersion(Attribute A);
511 unsigned FormVersion(Form F);
514 unsigned LanguageVersion(SourceLanguage L);
515 /// @}
516 
517 /// \defgroup DwarfConstantsVendor Dwarf "vendor" for constants
518 ///
519 /// These functions return an identifier describing "who" defined the constant,
520 /// either the DWARF standard itself or the vendor who defined the extension.
521 ///
522 /// @{
523 unsigned TagVendor(Tag T);
524 unsigned AttributeVendor(Attribute A);
525 unsigned FormVendor(Form F);
526 unsigned OperationVendor(LocationAtom O);
528 unsigned LanguageVendor(SourceLanguage L);
529 /// @}
530 
532 
533 /// A helper struct providing information about the byte size of DW_FORM
534 /// values that vary in size depending on the DWARF version, address byte
535 /// size, or DWARF32/DWARF64.
536 struct FormParams {
537  uint16_t Version;
538  uint8_t AddrSize;
540 
541  /// The definition of the size of form DW_FORM_ref_addr depends on the
542  /// version. In DWARF v2 it's the size of an address; after that, it's the
543  /// size of a reference.
544  uint8_t getRefAddrByteSize() const {
545  if (Version == 2)
546  return AddrSize;
547  return getDwarfOffsetByteSize();
548  }
549 
550  /// The size of a reference is determined by the DWARF 32/64-bit format.
551  uint8_t getDwarfOffsetByteSize() const {
552  switch (Format) {
554  return 4;
556  return 8;
557  }
558  llvm_unreachable("Invalid Format value");
559  }
560 
561  explicit operator bool() const { return Version && AddrSize; }
562 };
563 
564 /// Get the byte size of the unit length field depending on the DWARF format.
566  switch (Format) {
568  return 4;
570  return 12;
571  }
572  llvm_unreachable("Invalid Format value");
573 }
574 
575 /// Get the fixed byte size for a given form.
576 ///
577 /// If the form has a fixed byte size, then an Optional with a value will be
578 /// returned. If the form is always encoded using a variable length storage
579 /// format (ULEB or SLEB numbers or blocks) then None will be returned.
580 ///
581 /// \param Form DWARF form to get the fixed byte size for.
582 /// \param Params DWARF parameters to help interpret forms.
583 /// \returns Optional<uint8_t> value with the fixed byte size or None if
584 /// \p Form doesn't have a fixed byte size.
586 
587 /// Tells whether the specified form is defined in the specified version,
588 /// or is an extension if extensions are allowed.
589 bool isValidFormForVersion(Form F, unsigned Version, bool ExtensionsOk = true);
590 
591 /// Returns the symbolic string representing Val when used as a value
592 /// for attribute Attr.
593 StringRef AttributeValueString(uint16_t Attr, unsigned Val);
594 
595 /// Returns the symbolic string representing Val when used as a value
596 /// for atom Atom.
597 StringRef AtomValueString(uint16_t Atom, unsigned Val);
598 
599 /// Describes an entry of the various gnu_pub* debug sections.
600 ///
601 /// The gnu_pub* kind looks like:
602 ///
603 /// 0-3 reserved
604 /// 4-6 symbol kind
605 /// 7 0 == global, 1 == static
606 ///
607 /// A gdb_index descriptor includes the above kind, shifted 24 bits up with the
608 /// offset of the cu within the debug_info section stored in those 24 bits.
613  : Kind(Kind), Linkage(Linkage) {}
615  : Kind(Kind), Linkage(GIEL_EXTERNAL) {}
616  explicit PubIndexEntryDescriptor(uint8_t Value)
617  : Kind(
618  static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >> KIND_OFFSET)),
619  Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
620  LINKAGE_OFFSET)) {}
621  uint8_t toBits() const {
622  return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET;
623  }
624 
625 private:
626  enum {
627  KIND_OFFSET = 4,
628  KIND_MASK = 7 << KIND_OFFSET,
629  LINKAGE_OFFSET = 7,
630  LINKAGE_MASK = 1 << LINKAGE_OFFSET
631  };
632 };
633 
634 template <typename Enum> struct EnumTraits : public std::false_type {};
635 
636 template <> struct EnumTraits<Attribute> : public std::true_type {
637  static constexpr char Type[3] = "AT";
638  static constexpr StringRef (*StringFn)(unsigned) = &AttributeString;
639 };
640 
641 template <> struct EnumTraits<Form> : public std::true_type {
642  static constexpr char Type[5] = "FORM";
643  static constexpr StringRef (*StringFn)(unsigned) = &FormEncodingString;
644 };
645 
646 template <> struct EnumTraits<Index> : public std::true_type {
647  static constexpr char Type[4] = "IDX";
648  static constexpr StringRef (*StringFn)(unsigned) = &IndexString;
649 };
650 
651 template <> struct EnumTraits<Tag> : public std::true_type {
652  static constexpr char Type[4] = "TAG";
653  static constexpr StringRef (*StringFn)(unsigned) = &TagString;
654 };
655 } // End of namespace dwarf
656 
657 /// Dwarf constants format_provider
658 ///
659 /// Specialization of the format_provider template for dwarf enums. Unlike the
660 /// dumping functions above, these format unknown enumerator values as
661 /// DW_TYPE_unknown_1234 (e.g. DW_TAG_unknown_ffff).
662 template <typename Enum>
664  Enum, typename std::enable_if<dwarf::EnumTraits<Enum>::value>::type> {
665  static void format(const Enum &E, raw_ostream &OS, StringRef Style) {
667  if (Str.empty()) {
668  OS << "DW_" << dwarf::EnumTraits<Enum>::Type << "_unknown_"
669  << llvm::format("%x", E);
670  } else
671  OS << Str;
672  }
673 };
674 } // End of namespace llvm
675 
676 #endif
DecimalSignEncoding
Definition: Dwarf.h:133
MacinfoRecordType
Definition: Dwarf.h:294
LocationAtom
Definition: Dwarf.h:115
unsigned FormVersion(Form F)
Definition: Dwarf.cpp:116
StringRef ApplePropertyString(unsigned)
Definition: Dwarf.cpp:518
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:536
PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
Definition: Dwarf.h:614
StringRef IndexString(unsigned Idx)
Definition: Dwarf.cpp:634
LineNumberOps
Line Number Standard Opcode Encodings.
Definition: Dwarf.h:274
Not specified by DWARF.
Definition: Dwarf.h:112
This class represents lattice values for constants.
Definition: AllocatorList.h:23
StringRef AtomTypeString(unsigned Atom)
Definition: Dwarf.cpp:540
unsigned FormVendor(Form F)
Definition: Dwarf.cpp:127
LoclistEntries
DWARF v5 loc list entry encoding values.
Definition: Dwarf.h:318
bool isUnitType(uint8_t UnitType)
Definition: Dwarf.h:380
Attribute
Attributes.
Definition: Dwarf.h:102
StringRef LNExtendedString(unsigned Encoding)
Definition: Dwarf.cpp:427
StringRef LNStandardString(unsigned Standard)
Definition: Dwarf.cpp:416
unsigned TagVendor(Tag T)
Definition: Dwarf.cpp:51
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
uint8_t getRefAddrByteSize() const
The definition of the size of form DW_FORM_ref_addr depends on the version.
Definition: Dwarf.h:544
Only used in LLVM metadata.
Definition: Dwarf.h:121
GDBIndexEntryKind
Definition: Dwarf.h:432
F(f)
ArrayDimensionOrdering
Definition: Dwarf.h:261
Optional< unsigned > LanguageLowerBound(SourceLanguage L)
Definition: Dwarf.cpp:349
unsigned getVirtuality(StringRef VirtualityString)
Definition: Dwarf.cpp:300
constexpr char Language[]
Key for Kernel::Metadata::mLanguage.
StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch)
Definition: Dwarf.cpp:489
InlineAttribute
Definition: Dwarf.h:253
CallFrameInfo
Call frame instruction encodings.
Definition: Dwarf.h:324
Definition: BitVector.h:937
EndianityEncoding
Definition: Dwarf.h:142
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:70
LLVMConstants
Definition: Dwarf.h:43
unsigned TagVersion(Tag T)
Definition: Dwarf.cpp:40
unsigned AttributeVendor(Attribute A)
Definition: Dwarf.cpp:94
StringRef FormEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:105
Only used in LLVM metadata.
Definition: Dwarf.h:120
PubIndexEntryDescriptor(uint8_t Value)
Definition: Dwarf.h:616
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:140
unsigned LanguageVendor(SourceLanguage L)
Definition: Dwarf.cpp:338
Describes an entry of the various gnu_pub* debug sections.
Definition: Dwarf.h:609
#define UINT64_MAX
Definition: DataTypes.h:83
MacroEntryType
DWARF v5 macro information entry type encodings.
Definition: Dwarf.h:304
StringRef AttributeString(unsigned Attribute)
Definition: Dwarf.cpp:72
StringRef LanguageString(unsigned Language)
Definition: Dwarf.cpp:308
AccessAttribute
Definition: Dwarf.h:150
StringRef DecimalSignString(unsigned Sign)
Definition: Dwarf.cpp:232
uint8_t getUnitLengthFieldByteSize(DwarfFormat Format)
Get the byte size of the unit length field depending on the DWARF format.
Definition: Dwarf.h:565
StringRef AttributeValueString(uint16_t Attr, unsigned Val)
Returns the symbolic string representing Val when used as a value for attribute Attr.
Definition: Dwarf.cpp:592
unsigned LanguageVersion(SourceLanguage L)
Definition: Dwarf.cpp:327
StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind)
Definition: Dwarf.cpp:559
StringRef AccessibilityString(unsigned Access)
Definition: Dwarf.cpp:264
const uint32_t DW_INVALID_OFFSET
Identifier of an invalid DIE offset in the .debug_info section.
Definition: Dwarf.h:80
StringRef EndianityString(unsigned Endian)
Definition: Dwarf.cpp:248
StringRef AttributeEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:191
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
unsigned OperationVendor(LocationAtom O)
Definition: Dwarf.cpp:180
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
unsigned getCallingConvention(StringRef LanguageString)
Definition: Dwarf.cpp:385
Only used in LLVM metadata.
Definition: Dwarf.h:122
SourceLanguage
Definition: Dwarf.h:176
unsigned getOperationEncoding(StringRef OperationEncodingString)
Definition: Dwarf.cpp:157
StringRef ArrayOrderString(unsigned Order)
Definition: Dwarf.cpp:406
Recommended base for user tags.
Definition: Dwarf.h:87
unsigned OperationVersion(LocationAtom O)
Definition: Dwarf.cpp:169
RnglistEntries
DWARF v5 range list entry encoding values.
Definition: Dwarf.h:312
Only used in LLVM metadata.
Definition: Dwarf.h:123
StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage)
Definition: Dwarf.cpp:582
GDBIndexEntryLinkage Linkage
Definition: Dwarf.h:611
unsigned getLanguage(StringRef LanguageString)
Definition: Dwarf.cpp:319
StringRef RangeListEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:467
VisibilityAttribute
Definition: Dwarf.h:157
LineNumberExtendedOps
Line Number Extended Opcode Encodings.
Definition: Dwarf.h:280
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
StringRef VirtualityString(unsigned Virtuality)
Definition: Dwarf.cpp:289
StringRef OperationEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:138
const uint32_t DW_CIE_ID
Special ID values that distinguish a CIE from a FDE in DWARF CFI.
Definition: Dwarf.h:75
unsigned getTag(StringRef TagString)
Definition: Dwarf.cpp:32
UnitType
Constants for unit types in DWARF v5.
Definition: Dwarf.h:366
StringRef CaseString(unsigned Case)
Definition: Dwarf.cpp:360
ApplePropertyAttributes
Constants for the DW_APPLE_PROPERTY_attributes attribute.
Definition: Dwarf.h:360
unsigned AttributeVersion(Attribute A)
Definition: Dwarf.cpp:83
static void format(const Enum &E, raw_ostream &OS, StringRef Style)
Definition: Dwarf.h:665
AcceleratorTable
Definition: Dwarf.h:407
bool isType(Tag T)
Definition: Dwarf.h:90
PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
Definition: Dwarf.h:612
unsigned AttributeEncodingVersion(TypeKind E)
Definition: Dwarf.cpp:210
StringRef VisibilityString(unsigned Visibility)
Definition: Dwarf.cpp:277
StringRef UnitTypeString(unsigned)
Definition: Dwarf.cpp:529
StringRef AtomValueString(uint16_t Atom, unsigned Val)
Returns the symbolic string representing Val when used as a value for atom Atom.
Definition: Dwarf.cpp:623
Optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
Definition: Dwarf.cpp:645
StringRef TagString(unsigned Tag)
Definition: Dwarf.cpp:21
unsigned AttributeEncodingVendor(TypeKind E)
Definition: Dwarf.cpp:221
StringRef InlineCodeString(unsigned Code)
Definition: Dwarf.cpp:392
StringRef ConventionString(unsigned Convention)
Definition: Dwarf.cpp:374
unsigned getMacinfo(StringRef MacinfoString)
Definition: Dwarf.cpp:457
StringRef ChildrenString(unsigned Children)
Definition: Dwarf.cpp:62
bool isValidFormForVersion(Form F, unsigned Version, bool ExtensionsOk=true)
Tells whether the specified form is defined in the specified version, or is an extension if extension...
Definition: Dwarf.cpp:732
CallingConvention
Definition: Dwarf.h:245
StringRef LocListEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:478
DwarfFormat Format
Definition: Dwarf.h:539
VirtualityAttribute
Definition: Dwarf.h:164
LLVM Value Representation.
Definition: Value.h:74
unsigned getAttributeEncoding(StringRef EncodingString)
Definition: Dwarf.cpp:202
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
GDBIndexEntryLinkage
Definition: Dwarf.h:443
DiscriminantList
Definition: Dwarf.h:267
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
StringRef MacinfoString(unsigned Encoding)
Definition: Dwarf.cpp:438
Marker as the end of a list of atoms.
Definition: Dwarf.h:410
LineNumberEntryFormat
Definition: Dwarf.h:287
CaseSensitivity
Definition: Dwarf.h:237
uint8_t getDwarfOffsetByteSize() const
The size of a reference is determined by the DWARF 32/64-bit format.
Definition: Dwarf.h:551
bool isCPlusPlus(SourceLanguage S)
Definition: Dwarf.h:184
DefaultedMemberAttribute
Definition: Dwarf.h:170
const uint64_t DW64_CIE_ID
Definition: Dwarf.h:76