LLVM 19.0.0git
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
25#include "llvm/Support/Format.h"
28
29#include <limits>
30
31namespace llvm {
32class StringRef;
33
34namespace dwarf {
35
36//===----------------------------------------------------------------------===//
37// DWARF constants as gleaned from the DWARF Debugging Information Format V.5
38// reference manual http://www.dwarfstd.org/.
39//
40
41// Do not mix the following two enumerations sets. DW_TAG_invalid changes the
42// enumeration base type.
43
45 /// LLVM mock tags (see also llvm/BinaryFormat/Dwarf.def).
46 /// \{
47 DW_TAG_invalid = ~0U, ///< Tag for invalid results.
48 DW_VIRTUALITY_invalid = ~0U, ///< Virtuality for invalid results.
49 DW_MACINFO_invalid = ~0U, ///< Macinfo type for invalid results.
50 /// \}
51
52 /// Special values for an initial length field.
53 /// \{
54 DW_LENGTH_lo_reserved = 0xfffffff0, ///< Lower bound of the reserved range.
55 DW_LENGTH_DWARF64 = 0xffffffff, ///< Indicator of 64-bit DWARF format.
56 DW_LENGTH_hi_reserved = 0xffffffff, ///< Upper bound of the reserved range.
57 /// \}
58
59 /// Other constants.
60 /// \{
61 DWARF_VERSION = 4, ///< Default dwarf version we output.
62 DW_PUBTYPES_VERSION = 2, ///< Section version number for .debug_pubtypes.
63 DW_PUBNAMES_VERSION = 2, ///< Section version number for .debug_pubnames.
64 DW_ARANGES_VERSION = 2, ///< Section version number for .debug_aranges.
65 /// \}
66
67 /// Identifiers we use to distinguish vendor extensions.
68 /// \{
69 DWARF_VENDOR_DWARF = 0, ///< Defined in v2 or later of the DWARF standard.
87 ///\}
88};
89
90/// Constants that define the DWARF format as 32 or 64 bit.
91enum DwarfFormat : uint8_t { DWARF32, DWARF64 };
92
93/// Special ID values that distinguish a CIE from a FDE in DWARF CFI.
94/// Not inside an enum because a 64-bit value is needed.
95/// @{
96const uint32_t DW_CIE_ID = UINT32_MAX;
98/// @}
99
100/// Identifier of an invalid DIE offset in the .debug_info section.
101const uint32_t DW_INVALID_OFFSET = UINT32_MAX;
102
103enum Tag : uint16_t {
104#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND) DW_TAG_##NAME = ID,
105#include "llvm/BinaryFormat/Dwarf.def"
108 DW_TAG_user_base = 0x1000 ///< Recommended base for user tags.
110
111inline bool isType(Tag T) {
112 switch (T) {
113 default:
114 return false;
115#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND) \
116 case DW_TAG_##NAME: \
117 return (KIND == DW_KIND_TYPE);
118#include "llvm/BinaryFormat/Dwarf.def"
119 }
120}
121
122/// Attributes.
124#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) DW_AT_##NAME = ID,
125#include "llvm/BinaryFormat/Dwarf.def"
128};
129
131#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) DW_FORM_##NAME = ID,
132#include "llvm/BinaryFormat/Dwarf.def"
133 DW_FORM_lo_user = 0x1f00, ///< Not specified by DWARF.
134};
135
137#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) DW_OP_##NAME = ID,
138#include "llvm/BinaryFormat/Dwarf.def"
141 DW_OP_LLVM_fragment = 0x1000, ///< Only used in LLVM metadata.
142 DW_OP_LLVM_convert = 0x1001, ///< Only used in LLVM metadata.
143 DW_OP_LLVM_tag_offset = 0x1002, ///< Only used in LLVM metadata.
144 DW_OP_LLVM_entry_value = 0x1003, ///< Only used in LLVM metadata.
145 DW_OP_LLVM_implicit_pointer = 0x1004, ///< Only used in LLVM metadata.
146 DW_OP_LLVM_arg = 0x1005, ///< Only used in LLVM metadata.
147};
148
150#define HANDLE_DW_OP_LLVM_USEROP(ID, NAME) DW_OP_LLVM_##NAME = ID,
151#include "llvm/BinaryFormat/Dwarf.def"
152};
153
154enum TypeKind : uint8_t {
155#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) DW_ATE_##NAME = ID,
156#include "llvm/BinaryFormat/Dwarf.def"
158 DW_ATE_hi_user = 0xff
160
162 // Decimal sign attribute values
169
171 // Endianity attribute values
172#define HANDLE_DW_END(ID, NAME) DW_END_##NAME = ID,
173#include "llvm/BinaryFormat/Dwarf.def"
175 DW_END_hi_user = 0xff
177
179 // Accessibility codes
182 DW_ACCESS_private = 0x03
184
186 // Visibility codes
189 DW_VIS_qualified = 0x03
191
193#define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
194#include "llvm/BinaryFormat/Dwarf.def"
195 DW_VIRTUALITY_max = 0x02
197
199#define HANDLE_DW_DEFAULTED(ID, NAME) DW_DEFAULTED_##NAME = ID,
200#include "llvm/BinaryFormat/Dwarf.def"
201 DW_DEFAULTED_max = 0x02
203
205#define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
206 DW_LANG_##NAME = ID,
207#include "llvm/BinaryFormat/Dwarf.def"
209 DW_LANG_hi_user = 0xffff
211
213#define HANDLE_DW_LNAME(ID, NAME, DESC, LOWER_BOUND) DW_LNAME_##NAME = ID,
214#include "llvm/BinaryFormat/Dwarf.def"
215};
216
217/// Convert a DWARF 6 pair of language name and version to a DWARF 5 DW_LANG.
218/// If the version number doesn't exactly match a known version it is
219/// rounded up to the next-highest known version number.
220inline std::optional<SourceLanguage> toDW_LANG(SourceLanguageName name,
221 uint32_t version) {
222 switch (name) {
223 case DW_LNAME_Ada: // YYYY
224 if (version <= 1983)
225 return DW_LANG_Ada83;
226 if (version <= 1995)
227 return DW_LANG_Ada95;
228 if (version <= 2005)
229 return DW_LANG_Ada2005;
230 if (version <= 2012)
231 return DW_LANG_Ada2012;
232 return {};
233 case DW_LNAME_BLISS:
234 return DW_LANG_BLISS;
235 case DW_LNAME_C: // YYYYMM, K&R 000000
236 if (version == 0)
237 return DW_LANG_C;
238 if (version <= 198912)
239 return DW_LANG_C89;
240 if (version <= 199901)
241 return DW_LANG_C99;
242 if (version <= 201112)
243 return DW_LANG_C11;
244 if (version <= 201710)
245 return DW_LANG_C17;
246 return {};
247 case DW_LNAME_C_plus_plus: // YYYYMM
248 if (version == 0)
249 return DW_LANG_C_plus_plus;
250 if (version <= 199711)
251 return DW_LANG_C_plus_plus;
252 if (version <= 200310)
253 return DW_LANG_C_plus_plus_03;
254 if (version <= 201103)
255 return DW_LANG_C_plus_plus_11;
256 if (version <= 201402)
257 return DW_LANG_C_plus_plus_14;
258 if (version <= 201703)
259 return DW_LANG_C_plus_plus_17;
260 if (version <= 202002)
261 return DW_LANG_C_plus_plus_20;
262 return {};
263 case DW_LNAME_Cobol: // YYYY
264 if (version <= 1974)
265 return DW_LANG_Cobol74;
266 if (version <= 1985)
267 return DW_LANG_Cobol85;
268 return {};
269 case DW_LNAME_Crystal:
270 return DW_LANG_Crystal;
271 case DW_LNAME_D:
272 return DW_LANG_D;
273 case DW_LNAME_Dylan:
274 return DW_LANG_Dylan;
275 case DW_LNAME_Fortran: // YYYY
276 if (version <= 1977)
277 return DW_LANG_Fortran77;
278 if (version <= 1990)
279 return DW_LANG_Fortran90;
280 if (version <= 1995)
281 return DW_LANG_Fortran95;
282 if (version <= 2003)
283 return DW_LANG_Fortran03;
284 if (version <= 2008)
285 return DW_LANG_Fortran08;
286 if (version <= 2018)
287 return DW_LANG_Fortran18;
288 return {};
289 case DW_LNAME_Go:
290 return DW_LANG_Go;
291 case DW_LNAME_Haskell:
292 return DW_LANG_Haskell;
293 // case DW_LNAME_HIP:
294 // return DW_LANG_HIP;
295 case DW_LNAME_Java:
296 return DW_LANG_Java;
297 case DW_LNAME_Julia:
298 return DW_LANG_Julia;
299 case DW_LNAME_Kotlin:
300 return DW_LANG_Kotlin;
301 case DW_LNAME_Modula2:
302 return DW_LANG_Modula2;
303 case DW_LNAME_Modula3:
304 return DW_LANG_Modula3;
305 case DW_LNAME_ObjC:
306 return DW_LANG_ObjC;
307 case DW_LNAME_ObjC_plus_plus:
308 return DW_LANG_ObjC_plus_plus;
309 case DW_LNAME_OCaml:
310 return DW_LANG_OCaml;
311 case DW_LNAME_OpenCL_C:
312 return DW_LANG_OpenCL;
313 case DW_LNAME_Pascal:
314 return DW_LANG_Pascal83;
315 case DW_LNAME_PLI:
316 return DW_LANG_PLI;
317 case DW_LNAME_Python:
318 return DW_LANG_Python;
319 case DW_LNAME_RenderScript:
320 return DW_LANG_RenderScript;
321 case DW_LNAME_Rust:
322 return DW_LANG_Rust;
323 case DW_LNAME_Swift:
324 return DW_LANG_Swift;
325 case DW_LNAME_UPC:
326 return DW_LANG_UPC;
327 case DW_LNAME_Zig:
328 return DW_LANG_Zig;
329 case DW_LNAME_Assembly:
330 return DW_LANG_Assembly;
331 case DW_LNAME_C_sharp:
332 return DW_LANG_C_sharp;
333 case DW_LNAME_Mojo:
334 return DW_LANG_Mojo;
335 case DW_LNAME_GLSL:
336 return DW_LANG_GLSL;
337 case DW_LNAME_GLSL_ES:
338 return DW_LANG_GLSL_ES;
339 case DW_LNAME_HLSL:
340 return DW_LANG_HLSL;
341 case DW_LNAME_OpenCL_CPP:
342 return DW_LANG_OpenCL_CPP;
343 case DW_LNAME_CPP_for_OpenCL:
344 return {};
345 case DW_LNAME_SYCL:
346 return DW_LANG_SYCL;
347 case DW_LNAME_Ruby:
348 return DW_LANG_Ruby;
349 case DW_LNAME_Move:
350 return DW_LANG_Move;
351 case DW_LNAME_Hylo:
352 return DW_LANG_Hylo;
353 }
354 return {};
355}
356
357/// Convert a DWARF 5 DW_LANG to a DWARF 6 pair of language name and version.
358inline std::optional<std::pair<SourceLanguageName, uint32_t>>
360 switch (language) {
361 case DW_LANG_Ada83:
362 return {{DW_LNAME_Ada, 1983}};
363 case DW_LANG_Ada95:
364 return {{DW_LNAME_Ada, 1995}};
365 case DW_LANG_Ada2005:
366 return {{DW_LNAME_Ada, 2005}};
367 case DW_LANG_Ada2012:
368 return {{DW_LNAME_Ada, 2012}};
369 case DW_LANG_BLISS:
370 return {{DW_LNAME_BLISS, 0}};
371 case DW_LANG_C:
372 return {{DW_LNAME_C, 0}};
373 case DW_LANG_C89:
374 return {{DW_LNAME_C, 198912}};
375 case DW_LANG_C99:
376 return {{DW_LNAME_C, 199901}};
377 case DW_LANG_C11:
378 return {{DW_LNAME_C, 201112}};
379 case DW_LANG_C17:
380 return {{DW_LNAME_C, 201712}};
381 case DW_LANG_C_plus_plus:
382 return {{DW_LNAME_C_plus_plus, 0}};
383 case DW_LANG_C_plus_plus_03:
384 return {{DW_LNAME_C_plus_plus, 200310}};
385 case DW_LANG_C_plus_plus_11:
386 return {{DW_LNAME_C_plus_plus, 201103}};
387 case DW_LANG_C_plus_plus_14:
388 return {{DW_LNAME_C_plus_plus, 201402}};
389 case DW_LANG_C_plus_plus_17:
390 return {{DW_LNAME_C_plus_plus, 201703}};
391 case DW_LANG_C_plus_plus_20:
392 return {{DW_LNAME_C_plus_plus, 202002}};
393 case DW_LANG_Cobol74:
394 return {{DW_LNAME_Cobol, 1974}};
395 case DW_LANG_Cobol85:
396 return {{DW_LNAME_Cobol, 1985}};
397 case DW_LANG_Crystal:
398 return {{DW_LNAME_Crystal, 0}};
399 case DW_LANG_D:
400 return {{DW_LNAME_D, 0}};
401 case DW_LANG_Dylan:
402 return {{DW_LNAME_Dylan, 0}};
403 case DW_LANG_Fortran77:
404 return {{DW_LNAME_Fortran, 1977}};
405 case DW_LANG_Fortran90:
406 return {{DW_LNAME_Fortran, 1990}};
407 case DW_LANG_Fortran95:
408 return {{DW_LNAME_Fortran, 1995}};
409 case DW_LANG_Fortran03:
410 return {{DW_LNAME_Fortran, 2003}};
411 case DW_LANG_Fortran08:
412 return {{DW_LNAME_Fortran, 2008}};
413 case DW_LANG_Fortran18:
414 return {{DW_LNAME_Fortran, 2018}};
415 case DW_LANG_Go:
416 return {{DW_LNAME_Go, 0}};
417 case DW_LANG_Haskell:
418 return {{DW_LNAME_Haskell, 0}};
419 case DW_LANG_HIP:
420 return {}; // return {{DW_LNAME_HIP, 0}};
421 case DW_LANG_Java:
422 return {{DW_LNAME_Java, 0}};
423 case DW_LANG_Julia:
424 return {{DW_LNAME_Julia, 0}};
425 case DW_LANG_Kotlin:
426 return {{DW_LNAME_Kotlin, 0}};
427 case DW_LANG_Modula2:
428 return {{DW_LNAME_Modula2, 0}};
429 case DW_LANG_Modula3:
430 return {{DW_LNAME_Modula3, 0}};
431 case DW_LANG_ObjC:
432 return {{DW_LNAME_ObjC, 0}};
433 case DW_LANG_ObjC_plus_plus:
434 return {{DW_LNAME_ObjC_plus_plus, 0}};
435 case DW_LANG_OCaml:
436 return {{DW_LNAME_OCaml, 0}};
437 case DW_LANG_OpenCL:
438 return {{DW_LNAME_OpenCL_C, 0}};
439 case DW_LANG_Pascal83:
440 return {{DW_LNAME_Pascal, 1983}};
441 case DW_LANG_PLI:
442 return {{DW_LNAME_PLI, 0}};
443 case DW_LANG_Python:
444 return {{DW_LNAME_Python, 0}};
445 case DW_LANG_RenderScript:
446 case DW_LANG_GOOGLE_RenderScript:
447 return {{DW_LNAME_RenderScript, 0}};
448 case DW_LANG_Rust:
449 return {{DW_LNAME_Rust, 0}};
450 case DW_LANG_Swift:
451 return {{DW_LNAME_Swift, 0}};
452 case DW_LANG_UPC:
453 return {{DW_LNAME_UPC, 0}};
454 case DW_LANG_Zig:
455 return {{DW_LNAME_Zig, 0}};
456 case DW_LANG_Assembly:
457 case DW_LANG_Mips_Assembler:
458 return {{DW_LNAME_Assembly, 0}};
459 case DW_LANG_C_sharp:
460 return {{DW_LNAME_C_sharp, 0}};
461 case DW_LANG_Mojo:
462 return {{DW_LNAME_Mojo, 0}};
463 case DW_LANG_GLSL:
464 return {{DW_LNAME_GLSL, 0}};
465 case DW_LANG_GLSL_ES:
466 return {{DW_LNAME_GLSL_ES, 0}};
467 case DW_LANG_HLSL:
468 return {{DW_LNAME_HLSL, 0}};
469 case DW_LANG_OpenCL_CPP:
470 return {{DW_LNAME_OpenCL_CPP, 0}};
471 case DW_LANG_SYCL:
472 return {{DW_LNAME_SYCL, 0}};
473 case DW_LANG_Ruby:
474 return {{DW_LNAME_Ruby, 0}};
475 case DW_LANG_Move:
476 return {{DW_LNAME_Move, 0}};
477 case DW_LANG_Hylo:
478 return {{DW_LNAME_Hylo, 0}};
479 case DW_LANG_BORLAND_Delphi:
480 case DW_LANG_CPP_for_OpenCL:
481 case DW_LANG_lo_user:
482 case DW_LANG_hi_user:
483 return {};
484 }
485 return {};
486}
487
489
491 bool result = false;
492 // Deliberately enumerate all the language options so we get a warning when
493 // new language options are added (-Wswitch) that'll hopefully help keep this
494 // switch up-to-date when new C++ versions are added.
495 switch (S) {
496 case DW_LANG_C_plus_plus:
497 case DW_LANG_C_plus_plus_03:
498 case DW_LANG_C_plus_plus_11:
499 case DW_LANG_C_plus_plus_14:
500 case DW_LANG_C_plus_plus_17:
501 case DW_LANG_C_plus_plus_20:
502 result = true;
503 break;
504 case DW_LANG_C89:
505 case DW_LANG_C:
506 case DW_LANG_Ada83:
507 case DW_LANG_Cobol74:
508 case DW_LANG_Cobol85:
509 case DW_LANG_Fortran77:
510 case DW_LANG_Fortran90:
511 case DW_LANG_Pascal83:
512 case DW_LANG_Modula2:
513 case DW_LANG_Java:
514 case DW_LANG_C99:
515 case DW_LANG_Ada95:
516 case DW_LANG_Fortran95:
517 case DW_LANG_PLI:
518 case DW_LANG_ObjC:
519 case DW_LANG_ObjC_plus_plus:
520 case DW_LANG_UPC:
521 case DW_LANG_D:
522 case DW_LANG_Python:
523 case DW_LANG_OpenCL:
524 case DW_LANG_Go:
525 case DW_LANG_Modula3:
526 case DW_LANG_Haskell:
527 case DW_LANG_OCaml:
528 case DW_LANG_Rust:
529 case DW_LANG_C11:
530 case DW_LANG_Swift:
531 case DW_LANG_Julia:
532 case DW_LANG_Dylan:
533 case DW_LANG_Fortran03:
534 case DW_LANG_Fortran08:
535 case DW_LANG_RenderScript:
536 case DW_LANG_BLISS:
537 case DW_LANG_Mips_Assembler:
538 case DW_LANG_GOOGLE_RenderScript:
539 case DW_LANG_BORLAND_Delphi:
540 case DW_LANG_lo_user:
541 case DW_LANG_hi_user:
542 case DW_LANG_Kotlin:
543 case DW_LANG_Zig:
544 case DW_LANG_Crystal:
545 case DW_LANG_C17:
546 case DW_LANG_Fortran18:
547 case DW_LANG_Ada2005:
548 case DW_LANG_Ada2012:
549 case DW_LANG_HIP:
550 case DW_LANG_Assembly:
551 case DW_LANG_C_sharp:
552 case DW_LANG_Mojo:
553 case DW_LANG_GLSL:
554 case DW_LANG_GLSL_ES:
555 case DW_LANG_HLSL:
556 case DW_LANG_OpenCL_CPP:
557 case DW_LANG_CPP_for_OpenCL:
558 case DW_LANG_SYCL:
559 case DW_LANG_Ruby:
560 case DW_LANG_Move:
561 case DW_LANG_Hylo:
562 result = false;
563 break;
564 }
565
566 return result;
567}
568
569inline bool isFortran(SourceLanguage S) {
570 bool result = false;
571 // Deliberately enumerate all the language options so we get a warning when
572 // new language options are added (-Wswitch) that'll hopefully help keep this
573 // switch up-to-date when new Fortran versions are added.
574 switch (S) {
575 case DW_LANG_Fortran77:
576 case DW_LANG_Fortran90:
577 case DW_LANG_Fortran95:
578 case DW_LANG_Fortran03:
579 case DW_LANG_Fortran08:
580 case DW_LANG_Fortran18:
581 result = true;
582 break;
583 case DW_LANG_C89:
584 case DW_LANG_C:
585 case DW_LANG_Ada83:
586 case DW_LANG_C_plus_plus:
587 case DW_LANG_Cobol74:
588 case DW_LANG_Cobol85:
589 case DW_LANG_Pascal83:
590 case DW_LANG_Modula2:
591 case DW_LANG_Java:
592 case DW_LANG_C99:
593 case DW_LANG_Ada95:
594 case DW_LANG_PLI:
595 case DW_LANG_ObjC:
596 case DW_LANG_ObjC_plus_plus:
597 case DW_LANG_UPC:
598 case DW_LANG_D:
599 case DW_LANG_Python:
600 case DW_LANG_OpenCL:
601 case DW_LANG_Go:
602 case DW_LANG_Modula3:
603 case DW_LANG_Haskell:
604 case DW_LANG_C_plus_plus_03:
605 case DW_LANG_C_plus_plus_11:
606 case DW_LANG_OCaml:
607 case DW_LANG_Rust:
608 case DW_LANG_C11:
609 case DW_LANG_Swift:
610 case DW_LANG_Julia:
611 case DW_LANG_Dylan:
612 case DW_LANG_C_plus_plus_14:
613 case DW_LANG_RenderScript:
614 case DW_LANG_BLISS:
615 case DW_LANG_Mips_Assembler:
616 case DW_LANG_GOOGLE_RenderScript:
617 case DW_LANG_BORLAND_Delphi:
618 case DW_LANG_lo_user:
619 case DW_LANG_hi_user:
620 case DW_LANG_Kotlin:
621 case DW_LANG_Zig:
622 case DW_LANG_Crystal:
623 case DW_LANG_C_plus_plus_17:
624 case DW_LANG_C_plus_plus_20:
625 case DW_LANG_C17:
626 case DW_LANG_Ada2005:
627 case DW_LANG_Ada2012:
628 case DW_LANG_HIP:
629 case DW_LANG_Assembly:
630 case DW_LANG_C_sharp:
631 case DW_LANG_Mojo:
632 case DW_LANG_GLSL:
633 case DW_LANG_GLSL_ES:
634 case DW_LANG_HLSL:
635 case DW_LANG_OpenCL_CPP:
636 case DW_LANG_CPP_for_OpenCL:
637 case DW_LANG_SYCL:
638 case DW_LANG_Ruby:
639 case DW_LANG_Move:
640 case DW_LANG_Hylo:
641 result = false;
642 break;
643 }
644
645 return result;
646}
647
648inline bool isC(SourceLanguage S) {
649 // Deliberately enumerate all the language options so we get a warning when
650 // new language options are added (-Wswitch) that'll hopefully help keep this
651 // switch up-to-date when new C++ versions are added.
652 switch (S) {
653 case DW_LANG_C11:
654 case DW_LANG_C17:
655 case DW_LANG_C89:
656 case DW_LANG_C99:
657 case DW_LANG_C:
658 case DW_LANG_ObjC:
659 return true;
660 case DW_LANG_C_plus_plus:
661 case DW_LANG_C_plus_plus_03:
662 case DW_LANG_C_plus_plus_11:
663 case DW_LANG_C_plus_plus_14:
664 case DW_LANG_C_plus_plus_17:
665 case DW_LANG_C_plus_plus_20:
666 case DW_LANG_Ada83:
667 case DW_LANG_Cobol74:
668 case DW_LANG_Cobol85:
669 case DW_LANG_Fortran77:
670 case DW_LANG_Fortran90:
671 case DW_LANG_Pascal83:
672 case DW_LANG_Modula2:
673 case DW_LANG_Java:
674 case DW_LANG_Ada95:
675 case DW_LANG_Fortran95:
676 case DW_LANG_PLI:
677 case DW_LANG_ObjC_plus_plus:
678 case DW_LANG_UPC:
679 case DW_LANG_D:
680 case DW_LANG_Python:
681 case DW_LANG_OpenCL:
682 case DW_LANG_Go:
683 case DW_LANG_Modula3:
684 case DW_LANG_Haskell:
685 case DW_LANG_OCaml:
686 case DW_LANG_Rust:
687 case DW_LANG_Swift:
688 case DW_LANG_Julia:
689 case DW_LANG_Dylan:
690 case DW_LANG_Fortran03:
691 case DW_LANG_Fortran08:
692 case DW_LANG_RenderScript:
693 case DW_LANG_BLISS:
694 case DW_LANG_Mips_Assembler:
695 case DW_LANG_GOOGLE_RenderScript:
696 case DW_LANG_BORLAND_Delphi:
697 case DW_LANG_lo_user:
698 case DW_LANG_hi_user:
699 case DW_LANG_Kotlin:
700 case DW_LANG_Zig:
701 case DW_LANG_Crystal:
702 case DW_LANG_Fortran18:
703 case DW_LANG_Ada2005:
704 case DW_LANG_Ada2012:
705 case DW_LANG_HIP:
706 case DW_LANG_Assembly:
707 case DW_LANG_C_sharp:
708 case DW_LANG_Mojo:
709 case DW_LANG_GLSL:
710 case DW_LANG_GLSL_ES:
711 case DW_LANG_HLSL:
712 case DW_LANG_OpenCL_CPP:
713 case DW_LANG_CPP_for_OpenCL:
714 case DW_LANG_SYCL:
715 case DW_LANG_Ruby:
716 case DW_LANG_Move:
717 case DW_LANG_Hylo:
718 return false;
719 }
720 llvm_unreachable("Unknown language kind.");
721}
722
724 return isFortran(S) ? DW_ATE_signed : DW_ATE_unsigned;
725}
726
728 // Identifier case codes
734
736// Calling convention codes
737#define HANDLE_DW_CC(ID, NAME) DW_CC_##NAME = ID,
738#include "llvm/BinaryFormat/Dwarf.def"
740 DW_CC_hi_user = 0xff
742
744 // Inline codes
750
752 // Array ordering
754 DW_ORD_col_major = 0x01
756
758 // Discriminant descriptor values
760 DW_DSC_range = 0x01
762
763/// Line Number Standard Opcode Encodings.
764enum LineNumberOps : uint8_t {
765#define HANDLE_DW_LNS(ID, NAME) DW_LNS_##NAME = ID,
766#include "llvm/BinaryFormat/Dwarf.def"
767};
768
769/// Line Number Extended Opcode Encodings.
771#define HANDLE_DW_LNE(ID, NAME) DW_LNE_##NAME = ID,
772#include "llvm/BinaryFormat/Dwarf.def"
774 DW_LNE_hi_user = 0xff
776
778#define HANDLE_DW_LNCT(ID, NAME) DW_LNCT_##NAME = ID,
779#include "llvm/BinaryFormat/Dwarf.def"
782};
783
785 // Macinfo Type Encodings
792
793/// DWARF v5 macro information entry type encodings.
795#define HANDLE_DW_MACRO(ID, NAME) DW_MACRO_##NAME = ID,
796#include "llvm/BinaryFormat/Dwarf.def"
798 DW_MACRO_hi_user = 0xff
800
801/// GNU .debug_macro macro information entry type encodings.
803#define HANDLE_DW_MACRO_GNU(ID, NAME) DW_MACRO_GNU_##NAME = ID,
804#include "llvm/BinaryFormat/Dwarf.def"
808
809/// DWARF v5 range list entry encoding values.
811#define HANDLE_DW_RLE(ID, NAME) DW_RLE_##NAME = ID,
812#include "llvm/BinaryFormat/Dwarf.def"
813};
814
815/// DWARF v5 loc list entry encoding values.
817#define HANDLE_DW_LLE(ID, NAME) DW_LLE_##NAME = ID,
818#include "llvm/BinaryFormat/Dwarf.def"
819};
820
821/// Call frame instruction encodings.
823#define HANDLE_DW_CFA(ID, NAME) DW_CFA_##NAME = ID,
824#define HANDLE_DW_CFA_PRED(ID, NAME, ARCH) DW_CFA_##NAME = ID,
825#include "llvm/BinaryFormat/Dwarf.def"
827
829 DW_CFA_hi_user = 0x3f
831
833 // Children flag
836
853 DW_EH_PE_indirect = 0x80
855
856/// Constants for the DW_APPLE_PROPERTY_attributes attribute.
857/// Keep this list in sync with clang's DeclObjCCommon.h
858/// ObjCPropertyAttribute::Kind!
860#define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
861#include "llvm/BinaryFormat/Dwarf.def"
862};
863
864/// Constants for unit types in DWARF v5.
865enum UnitType : unsigned char {
866#define HANDLE_DW_UT(ID, NAME) DW_UT_##NAME = ID,
867#include "llvm/BinaryFormat/Dwarf.def"
869 DW_UT_hi_user = 0xff
871
872enum Index {
873#define HANDLE_DW_IDX(ID, NAME) DW_IDX_##NAME = ID,
874#include "llvm/BinaryFormat/Dwarf.def"
876 DW_IDX_hi_user = 0x3fff
878
879inline bool isUnitType(uint8_t UnitType) {
880 switch (UnitType) {
881 case DW_UT_compile:
882 case DW_UT_type:
883 case DW_UT_partial:
884 case DW_UT_skeleton:
885 case DW_UT_split_compile:
886 case DW_UT_split_type:
887 return true;
888 default:
889 return false;
890 }
891}
892
893inline bool isUnitType(dwarf::Tag T) {
894 switch (T) {
895 case DW_TAG_compile_unit:
896 case DW_TAG_type_unit:
897 case DW_TAG_partial_unit:
898 case DW_TAG_skeleton_unit:
899 return true;
900 default:
901 return false;
902 }
903}
904
905// Constants for the DWARF v5 Accelerator Table Proposal
907 // Data layout descriptors.
908 DW_ATOM_null = 0u, /// Marker as the end of a list of atoms.
909 DW_ATOM_die_offset = 1u, // DIE offset in the debug_info section.
910 DW_ATOM_cu_offset = 2u, // Offset of the compile unit header that contains the
911 // item in question.
912 DW_ATOM_die_tag = 3u, // A tag entry.
913 DW_ATOM_type_flags = 4u, // Set of flags for a type.
914
915 DW_ATOM_type_type_flags = 5u, // Dsymutil type extension.
916 DW_ATOM_qual_name_hash = 6u, // Dsymutil qualified hash extension.
917
918 // DW_ATOM_type_flags values.
919
920 // Always set for C++, only set for ObjC if this is the @implementation for a
921 // class.
923
924 // Hash functions.
925
926 // Daniel J. Bernstein hash.
929
930// Return a suggested bucket count for the DWARF v5 Accelerator Table.
932 if (UniqueHashCount > 1024)
933 return UniqueHashCount / 4;
934 if (UniqueHashCount > 16)
935 return UniqueHashCount / 2;
936 return std::max<uint32_t>(UniqueHashCount, 1);
937}
938
939// Constants for the GNU pubnames/pubtypes extensions supporting gdb index.
950
952
953/// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
954///
955/// All these functions map their argument's value back to the
956/// corresponding enumerator name or return an empty StringRef if the value
957/// isn't known.
958///
959/// @{
960StringRef TagString(unsigned Tag);
961StringRef ChildrenString(unsigned Children);
963StringRef FormEncodingString(unsigned Encoding);
964StringRef OperationEncodingString(unsigned Encoding);
965StringRef SubOperationEncodingString(unsigned OpEncoding,
966 unsigned SubOpEncoding);
967StringRef AttributeEncodingString(unsigned Encoding);
968StringRef DecimalSignString(unsigned Sign);
970StringRef AccessibilityString(unsigned Access);
971StringRef DefaultedMemberString(unsigned DefaultedEncodings);
972StringRef VisibilityString(unsigned Visibility);
973StringRef VirtualityString(unsigned Virtuality);
974StringRef LanguageString(unsigned Language);
975StringRef CaseString(unsigned Case);
976StringRef ConventionString(unsigned Convention);
977StringRef InlineCodeString(unsigned Code);
978StringRef ArrayOrderString(unsigned Order);
979StringRef LNStandardString(unsigned Standard);
980StringRef LNExtendedString(unsigned Encoding);
981StringRef MacinfoString(unsigned Encoding);
982StringRef MacroString(unsigned Encoding);
983StringRef GnuMacroString(unsigned Encoding);
984StringRef RangeListEncodingString(unsigned Encoding);
985StringRef LocListEncodingString(unsigned Encoding);
986StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch);
988StringRef UnitTypeString(unsigned);
989StringRef AtomTypeString(unsigned Atom);
992StringRef IndexString(unsigned Idx);
994StringRef FormatString(bool IsDWARF64);
995StringRef RLEString(unsigned RLE);
996/// @}
997
998/// \defgroup DwarfConstantsParsing Dwarf constants parsing functions
999///
1000/// These functions map their strings back to the corresponding enumeration
1001/// value or return 0 if there is none, except for these exceptions:
1002///
1003/// \li \a getTag() returns \a DW_TAG_invalid on invalid input.
1004/// \li \a getVirtuality() returns \a DW_VIRTUALITY_invalid on invalid input.
1005/// \li \a getMacinfo() returns \a DW_MACINFO_invalid on invalid input.
1006///
1007/// @{
1008unsigned getTag(StringRef TagString);
1010unsigned getSubOperationEncoding(unsigned OpEncoding,
1015unsigned getAttributeEncoding(StringRef EncodingString);
1018/// @}
1019
1020/// \defgroup DwarfConstantsVersioning Dwarf version for constants
1021///
1022/// For constants defined by DWARF, returns the DWARF version when the constant
1023/// was first defined. For vendor extensions, if there is a version-related
1024/// policy for when to emit it, returns a version number for that policy.
1025/// Otherwise returns 0.
1026///
1027/// @{
1028unsigned TagVersion(Tag T);
1029unsigned AttributeVersion(Attribute A);
1030unsigned FormVersion(Form F);
1031unsigned OperationVersion(LocationAtom O);
1034/// @}
1035
1036/// \defgroup DwarfConstantsVendor Dwarf "vendor" for constants
1037///
1038/// These functions return an identifier describing "who" defined the constant,
1039/// either the DWARF standard itself or the vendor who defined the extension.
1040///
1041/// @{
1042unsigned TagVendor(Tag T);
1043unsigned AttributeVendor(Attribute A);
1044unsigned FormVendor(Form F);
1045unsigned OperationVendor(LocationAtom O);
1047unsigned LanguageVendor(SourceLanguage L);
1048/// @}
1049
1050std::optional<unsigned> LanguageLowerBound(SourceLanguage L);
1051
1052/// The size of a reference determined by the DWARF 32/64-bit format.
1054 switch (Format) {
1056 return 4;
1058 return 8;
1059 }
1060 llvm_unreachable("Invalid Format value");
1061}
1062
1063/// A helper struct providing information about the byte size of DW_FORM
1064/// values that vary in size depending on the DWARF version, address byte
1065/// size, or DWARF32/DWARF64.
1068 uint8_t AddrSize;
1070 /// True if DWARF v2 output generally uses relocations for references
1071 /// to other .debug_* sections.
1073
1074 /// The definition of the size of form DW_FORM_ref_addr depends on the
1075 /// version. In DWARF v2 it's the size of an address; after that, it's the
1076 /// size of a reference.
1077 uint8_t getRefAddrByteSize() const {
1078 if (Version == 2)
1079 return AddrSize;
1080 return getDwarfOffsetByteSize();
1081 }
1082
1083 /// The size of a reference is determined by the DWARF 32/64-bit format.
1084 uint8_t getDwarfOffsetByteSize() const {
1086 }
1087
1088 explicit operator bool() const { return Version && AddrSize; }
1089};
1090
1091/// Get the byte size of the unit length field depending on the DWARF format.
1093 switch (Format) {
1095 return 4;
1097 return 12;
1098 }
1099 llvm_unreachable("Invalid Format value");
1100}
1101
1102/// Get the fixed byte size for a given form.
1103///
1104/// If the form has a fixed byte size, then an Optional with a value will be
1105/// returned. If the form is always encoded using a variable length storage
1106/// format (ULEB or SLEB numbers or blocks) then std::nullopt will be returned.
1107///
1108/// \param Form DWARF form to get the fixed byte size for.
1109/// \param Params DWARF parameters to help interpret forms.
1110/// \returns std::optional<uint8_t> value with the fixed byte size or
1111/// std::nullopt if \p Form doesn't have a fixed byte size.
1112std::optional<uint8_t> getFixedFormByteSize(dwarf::Form Form,
1113 FormParams Params);
1114
1115/// Tells whether the specified form is defined in the specified version,
1116/// or is an extension if extensions are allowed.
1117bool isValidFormForVersion(Form F, unsigned Version, bool ExtensionsOk = true);
1118
1119/// Returns the symbolic string representing Val when used as a value
1120/// for attribute Attr.
1121StringRef AttributeValueString(uint16_t Attr, unsigned Val);
1122
1123/// Returns the symbolic string representing Val when used as a value
1124/// for atom Atom.
1125StringRef AtomValueString(uint16_t Atom, unsigned Val);
1126
1127/// Describes an entry of the various gnu_pub* debug sections.
1128///
1129/// The gnu_pub* kind looks like:
1130///
1131/// 0-3 reserved
1132/// 4-6 symbol kind
1133/// 7 0 == global, 1 == static
1134///
1135/// A gdb_index descriptor includes the above kind, shifted 24 bits up with the
1136/// offset of the cu within the debug_info section stored in those 24 bits.
1141 : Kind(Kind), Linkage(Linkage) {}
1145 : Kind(
1146 static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >> KIND_OFFSET)),
1147 Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
1148 LINKAGE_OFFSET)) {}
1149 uint8_t toBits() const {
1150 return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET;
1151 }
1152
1153private:
1154 enum {
1155 KIND_OFFSET = 4,
1156 KIND_MASK = 7 << KIND_OFFSET,
1157 LINKAGE_OFFSET = 7,
1158 LINKAGE_MASK = 1 << LINKAGE_OFFSET
1159 };
1160};
1161
1162template <typename Enum> struct EnumTraits : public std::false_type {};
1163
1164template <> struct EnumTraits<Attribute> : public std::true_type {
1165 static constexpr char Type[3] = "AT";
1166 static constexpr StringRef (*StringFn)(unsigned) = &AttributeString;
1167};
1168
1169template <> struct EnumTraits<Form> : public std::true_type {
1170 static constexpr char Type[5] = "FORM";
1171 static constexpr StringRef (*StringFn)(unsigned) = &FormEncodingString;
1172};
1173
1174template <> struct EnumTraits<Index> : public std::true_type {
1175 static constexpr char Type[4] = "IDX";
1176 static constexpr StringRef (*StringFn)(unsigned) = &IndexString;
1177};
1178
1179template <> struct EnumTraits<Tag> : public std::true_type {
1180 static constexpr char Type[4] = "TAG";
1181 static constexpr StringRef (*StringFn)(unsigned) = &TagString;
1182};
1183
1184template <> struct EnumTraits<LineNumberOps> : public std::true_type {
1185 static constexpr char Type[4] = "LNS";
1186 static constexpr StringRef (*StringFn)(unsigned) = &LNStandardString;
1187};
1188
1189template <> struct EnumTraits<LocationAtom> : public std::true_type {
1190 static constexpr char Type[3] = "OP";
1191 static constexpr StringRef (*StringFn)(unsigned) = &OperationEncodingString;
1192};
1193
1194inline uint64_t computeTombstoneAddress(uint8_t AddressByteSize) {
1195 return std::numeric_limits<uint64_t>::max() >> (8 - AddressByteSize) * 8;
1196}
1197
1198} // End of namespace dwarf
1199
1200/// Dwarf constants format_provider
1201///
1202/// Specialization of the format_provider template for dwarf enums. Unlike the
1203/// dumping functions above, these format unknown enumerator values as
1204/// DW_TYPE_unknown_1234 (e.g. DW_TAG_unknown_ffff).
1205template <typename Enum>
1206struct format_provider<Enum, std::enable_if_t<dwarf::EnumTraits<Enum>::value>> {
1207 static void format(const Enum &E, raw_ostream &OS, StringRef Style) {
1209 if (Str.empty()) {
1210 OS << "DW_" << dwarf::EnumTraits<Enum>::Type << "_unknown_"
1211 << llvm::format("%x", E);
1212 } else
1213 OS << Str;
1214 }
1215};
1216} // End of namespace llvm
1217
1218#endif
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
#define F(x, y, z)
Definition: MD5.cpp:55
static const char * name
Definition: SMEABIPass.cpp:49
endianness Endian
raw_pwrite_stream & OS
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
StringRef LNExtendedString(unsigned Encoding)
Definition: Dwarf.cpp:491
StringRef RangeListEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:559
StringRef CaseString(unsigned Case)
Definition: Dwarf.cpp:424
StringRef VisibilityString(unsigned Visibility)
Definition: Dwarf.cpp:330
StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage)
Definition: Dwarf.cpp:674
StringRef AttributeString(unsigned Attribute)
Definition: Dwarf.cpp:72
StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch)
Definition: Dwarf.cpp:581
StringRef FormEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:105
StringRef ArrayOrderString(unsigned Order)
Definition: Dwarf.cpp:470
StringRef MacroString(unsigned Encoding)
Definition: Dwarf.cpp:531
StringRef LocListEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:570
StringRef IndexString(unsigned Idx)
Definition: Dwarf.cpp:728
StringRef RLEString(unsigned RLE)
Definition: Dwarf.cpp:850
StringRef SubOperationEncodingString(unsigned OpEncoding, unsigned SubOpEncoding)
Definition: Dwarf.cpp:196
StringRef LanguageString(unsigned Language)
Definition: Dwarf.cpp:361
StringRef DecimalSignString(unsigned Sign)
Definition: Dwarf.cpp:272
StringRef VirtualityString(unsigned Virtuality)
Definition: Dwarf.cpp:342
StringRef AttributeEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:231
StringRef ChildrenString(unsigned Children)
Definition: Dwarf.cpp:62
StringRef ApplePropertyString(unsigned)
Definition: Dwarf.cpp:610
StringRef AtomTypeString(unsigned Atom)
Definition: Dwarf.cpp:632
StringRef FormatString(DwarfFormat Format)
Definition: Dwarf.cpp:836
StringRef GnuMacroString(unsigned Encoding)
Definition: Dwarf.cpp:542
StringRef EndianityString(unsigned Endian)
Definition: Dwarf.cpp:288
StringRef ConventionString(unsigned Convention)
Definition: Dwarf.cpp:438
StringRef MacinfoString(unsigned Encoding)
Definition: Dwarf.cpp:502
StringRef OperationEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:138
StringRef UnitTypeString(unsigned)
Definition: Dwarf.cpp:621
StringRef InlineCodeString(unsigned Code)
Definition: Dwarf.cpp:456
StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind)
Definition: Dwarf.cpp:651
StringRef TagString(unsigned Tag)
Definition: Dwarf.cpp:21
StringRef LNStandardString(unsigned Standard)
Definition: Dwarf.cpp:480
StringRef AccessibilityString(unsigned Access)
Definition: Dwarf.cpp:304
StringRef DefaultedMemberString(unsigned DefaultedEncodings)
Definition: Dwarf.cpp:317
unsigned getSubOperationEncoding(unsigned OpEncoding, StringRef SubOperationEncodingString)
Definition: Dwarf.cpp:203
unsigned getOperationEncoding(StringRef OperationEncodingString)
Definition: Dwarf.cpp:161
unsigned getAttributeEncoding(StringRef EncodingString)
Definition: Dwarf.cpp:242
unsigned getTag(StringRef TagString)
Definition: Dwarf.cpp:32
unsigned getCallingConvention(StringRef LanguageString)
Definition: Dwarf.cpp:449
unsigned getLanguage(StringRef LanguageString)
Definition: Dwarf.cpp:372
unsigned getVirtuality(StringRef VirtualityString)
Definition: Dwarf.cpp:353
unsigned getMacro(StringRef MacroString)
Definition: Dwarf.cpp:553
unsigned getMacinfo(StringRef MacinfoString)
Definition: Dwarf.cpp:521
unsigned AttributeEncodingVendor(TypeKind E)
Definition: Dwarf.cpp:261
unsigned FormVendor(Form F)
Definition: Dwarf.cpp:127
unsigned AttributeVendor(Attribute A)
Definition: Dwarf.cpp:94
unsigned OperationVendor(LocationAtom O)
Definition: Dwarf.cpp:220
unsigned TagVendor(Tag T)
Definition: Dwarf.cpp:51
unsigned LanguageVendor(SourceLanguage L)
Definition: Dwarf.cpp:391
unsigned OperationVersion(LocationAtom O)
Definition: Dwarf.cpp:209
unsigned AttributeVersion(Attribute A)
Definition: Dwarf.cpp:83
unsigned LanguageVersion(SourceLanguage L)
Definition: Dwarf.cpp:380
unsigned AttributeEncodingVersion(TypeKind E)
Definition: Dwarf.cpp:250
unsigned TagVersion(Tag T)
Definition: Dwarf.cpp:40
unsigned FormVersion(Form F)
Definition: Dwarf.cpp:116
#define UINT64_MAX
Definition: DataTypes.h:77
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
InlineAttribute
Definition: Dwarf.h:743
@ DW_INL_not_inlined
Definition: Dwarf.h:745
@ DW_INL_declared_not_inlined
Definition: Dwarf.h:747
@ DW_INL_inlined
Definition: Dwarf.h:746
@ DW_INL_declared_inlined
Definition: Dwarf.h:748
const uint32_t DW_CIE_ID
Special ID values that distinguish a CIE from a FDE in DWARF CFI.
Definition: Dwarf.h:96
uint8_t getUnitLengthFieldByteSize(DwarfFormat Format)
Get the byte size of the unit length field depending on the DWARF format.
Definition: Dwarf.h:1092
AccessAttribute
Definition: Dwarf.h:178
@ DW_ACCESS_private
Definition: Dwarf.h:182
@ DW_ACCESS_protected
Definition: Dwarf.h:181
@ DW_ACCESS_public
Definition: Dwarf.h:180
MacroEntryType
DWARF v5 macro information entry type encodings.
Definition: Dwarf.h:794
@ DW_MACRO_lo_user
Definition: Dwarf.h:797
@ DW_MACRO_hi_user
Definition: Dwarf.h:798
Attribute
Attributes.
Definition: Dwarf.h:123
@ DW_AT_hi_user
Definition: Dwarf.h:127
@ DW_AT_lo_user
Definition: Dwarf.h:126
std::optional< unsigned > LanguageLowerBound(SourceLanguage L)
Definition: Dwarf.cpp:403
LineNumberEntryFormat
Definition: Dwarf.h:777
@ DW_LNCT_lo_user
Definition: Dwarf.h:780
@ DW_LNCT_hi_user
Definition: Dwarf.h:781
StringRef AtomValueString(uint16_t Atom, unsigned Val)
Returns the symbolic string representing Val when used as a value for atom Atom.
Definition: Dwarf.cpp:717
DefaultedMemberAttribute
Definition: Dwarf.h:198
@ DW_DEFAULTED_max
Definition: Dwarf.h:201
SourceLanguageName
Definition: Dwarf.h:212
const uint64_t DW64_CIE_ID
Definition: Dwarf.h:97
VisibilityAttribute
Definition: Dwarf.h:185
@ DW_VIS_local
Definition: Dwarf.h:187
@ DW_VIS_exported
Definition: Dwarf.h:188
@ DW_VIS_qualified
Definition: Dwarf.h:189
LlvmUserLocationAtom
Definition: Dwarf.h:149
ArrayDimensionOrdering
Definition: Dwarf.h:751
@ DW_ORD_row_major
Definition: Dwarf.h:753
@ DW_ORD_col_major
Definition: Dwarf.h:754
CallingConvention
Definition: Dwarf.h:735
@ DW_CC_lo_user
Definition: Dwarf.h:739
@ DW_CC_hi_user
Definition: Dwarf.h:740
LineNumberOps
Line Number Standard Opcode Encodings.
Definition: Dwarf.h:764
@ DW_ATE_hi_user
Definition: Dwarf.h:158
@ DW_ATE_lo_user
Definition: Dwarf.h:157
ApplePropertyAttributes
Constants for the DW_APPLE_PROPERTY_attributes attribute.
Definition: Dwarf.h:859
LoclistEntries
DWARF v5 loc list entry encoding values.
Definition: Dwarf.h:816
bool isFortran(SourceLanguage S)
Definition: Dwarf.h:569
bool isUnitType(uint8_t UnitType)
Definition: Dwarf.h:879
@ DW_IDX_lo_user
Definition: Dwarf.h:875
@ DW_IDX_hi_user
Definition: Dwarf.h:876
GnuMacroEntryType
GNU .debug_macro macro information entry type encodings.
Definition: Dwarf.h:802
@ DW_MACRO_GNU_lo_user
Definition: Dwarf.h:805
@ DW_MACRO_GNU_hi_user
Definition: Dwarf.h:806
UnitType
Constants for unit types in DWARF v5.
Definition: Dwarf.h:865
@ DW_UT_lo_user
Definition: Dwarf.h:868
@ DW_UT_hi_user
Definition: Dwarf.h:869
@ DW_FORM_lo_user
Not specified by DWARF.
Definition: Dwarf.h:133
EndianityEncoding
Definition: Dwarf.h:170
@ DW_END_lo_user
Definition: Dwarf.h:174
@ DW_END_hi_user
Definition: Dwarf.h:175
bool isType(Tag T)
Definition: Dwarf.h:111
LocationAtom
Definition: Dwarf.h:136
@ DW_OP_LLVM_entry_value
Only used in LLVM metadata.
Definition: Dwarf.h:144
@ DW_OP_LLVM_implicit_pointer
Only used in LLVM metadata.
Definition: Dwarf.h:145
@ DW_OP_lo_user
Definition: Dwarf.h:139
@ DW_OP_hi_user
Definition: Dwarf.h:140
@ DW_OP_LLVM_tag_offset
Only used in LLVM metadata.
Definition: Dwarf.h:143
@ DW_OP_LLVM_fragment
Only used in LLVM metadata.
Definition: Dwarf.h:141
@ DW_OP_LLVM_arg
Only used in LLVM metadata.
Definition: Dwarf.h:146
@ DW_OP_LLVM_convert
Only used in LLVM metadata.
Definition: Dwarf.h:142
SourceLanguage
Definition: Dwarf.h:204
@ DW_LANG_lo_user
Definition: Dwarf.h:208
@ DW_LANG_hi_user
Definition: Dwarf.h:209
CaseSensitivity
Definition: Dwarf.h:727
@ DW_ID_down_case
Definition: Dwarf.h:731
@ DW_ID_case_insensitive
Definition: Dwarf.h:732
@ DW_ID_case_sensitive
Definition: Dwarf.h:729
@ DW_ID_up_case
Definition: Dwarf.h:730
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:91
@ DWARF64
Definition: Dwarf.h:91
@ DWARF32
Definition: Dwarf.h:91
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:827
std::optional< SourceLanguage > toDW_LANG(SourceLanguageName name, uint32_t version)
Convert a DWARF 6 pair of language name and version to a DWARF 5 DW_LANG.
Definition: Dwarf.h:220
MacinfoRecordType
Definition: Dwarf.h:784
@ DW_MACINFO_undef
Definition: Dwarf.h:787
@ DW_MACINFO_start_file
Definition: Dwarf.h:788
@ DW_MACINFO_end_file
Definition: Dwarf.h:789
@ DW_MACINFO_define
Definition: Dwarf.h:786
@ DW_MACINFO_vendor_ext
Definition: Dwarf.h:790
const uint32_t DW_INVALID_OFFSET
Identifier of an invalid DIE offset in the .debug_info section.
Definition: Dwarf.h:101
RnglistEntries
DWARF v5 range list entry encoding values.
Definition: Dwarf.h:810
std::optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
Definition: Dwarf.cpp:739
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
Definition: Dwarf.h:1053
VirtualityAttribute
Definition: Dwarf.h:192
@ DW_VIRTUALITY_max
Definition: Dwarf.h:195
GDBIndexEntryKind
Definition: Dwarf.h:940
@ GIEK_NONE
Definition: Dwarf.h:941
@ GIEK_UNUSED7
Definition: Dwarf.h:948
@ GIEK_TYPE
Definition: Dwarf.h:942
@ GIEK_UNUSED6
Definition: Dwarf.h:947
@ GIEK_OTHER
Definition: Dwarf.h:945
@ GIEK_FUNCTION
Definition: Dwarf.h:944
@ GIEK_UNUSED5
Definition: Dwarf.h:946
@ GIEK_VARIABLE
Definition: Dwarf.h:943
LineNumberExtendedOps
Line Number Extended Opcode Encodings.
Definition: Dwarf.h:770
@ DW_LNE_hi_user
Definition: Dwarf.h:774
@ DW_LNE_lo_user
Definition: Dwarf.h:773
bool isCPlusPlus(SourceLanguage S)
Definition: Dwarf.h:490
@ DW_EH_PE_textrel
Definition: Dwarf.h:849
@ DW_CHILDREN_no
Definition: Dwarf.h:834
@ DW_EH_PE_datarel
Definition: Dwarf.h:850
@ DW_EH_PE_pcrel
Definition: Dwarf.h:848
@ DW_EH_PE_signed
Definition: Dwarf.h:847
@ DW_CHILDREN_yes
Definition: Dwarf.h:835
@ DW_EH_PE_sdata4
Definition: Dwarf.h:845
@ DW_EH_PE_funcrel
Definition: Dwarf.h:851
@ DW_EH_PE_aligned
Definition: Dwarf.h:852
@ DW_EH_PE_udata2
Definition: Dwarf.h:840
@ DW_EH_PE_sdata8
Definition: Dwarf.h:846
@ DW_EH_PE_absptr
Definition: Dwarf.h:837
@ DW_EH_PE_sdata2
Definition: Dwarf.h:844
@ DW_EH_PE_udata4
Definition: Dwarf.h:841
@ DW_EH_PE_udata8
Definition: Dwarf.h:842
@ DW_EH_PE_uleb128
Definition: Dwarf.h:839
@ DW_EH_PE_indirect
Definition: Dwarf.h:853
@ DW_EH_PE_sleb128
Definition: Dwarf.h:843
@ DW_EH_PE_omit
Definition: Dwarf.h:838
TypeKind getArrayIndexTypeEncoding(SourceLanguage S)
Definition: Dwarf.h:723
StringRef AttributeValueString(uint16_t Attr, unsigned Val)
Returns the symbolic string representing Val when used as a value for attribute Attr.
Definition: Dwarf.cpp:684
DiscriminantList
Definition: Dwarf.h:757
@ DW_DSC_range
Definition: Dwarf.h:760
@ DW_DSC_label
Definition: Dwarf.h:759
@ DW_TAG_user_base
Recommended base for user tags.
Definition: Dwarf.h:108
@ DW_TAG_hi_user
Definition: Dwarf.h:107
@ DW_TAG_lo_user
Definition: Dwarf.h:106
CallFrameInfo
Call frame instruction encodings.
Definition: Dwarf.h:822
@ DW_CFA_hi_user
Definition: Dwarf.h:829
@ DW_CFA_extended
Definition: Dwarf.h:826
@ DW_CFA_lo_user
Definition: Dwarf.h:828
DecimalSignEncoding
Definition: Dwarf.h:161
@ DW_DS_leading_separate
Definition: Dwarf.h:166
@ DW_DS_trailing_separate
Definition: Dwarf.h:167
@ DW_DS_trailing_overpunch
Definition: Dwarf.h:165
@ DW_DS_leading_overpunch
Definition: Dwarf.h:164
@ DW_DS_unsigned
Definition: Dwarf.h:163
uint32_t getDebugNamesBucketCount(uint32_t UniqueHashCount)
Definition: Dwarf.h:931
uint64_t computeTombstoneAddress(uint8_t AddressByteSize)
Definition: Dwarf.h:1194
llvm::StringRef LanguageDescription(SourceLanguageName name)
Definition: Dwarf.cpp:414
AcceleratorTable
Definition: Dwarf.h:906
@ DW_ATOM_type_flags
Definition: Dwarf.h:913
@ DW_ATOM_null
Definition: Dwarf.h:908
@ DW_ATOM_die_tag
Definition: Dwarf.h:912
@ DW_FLAG_type_implementation
Definition: Dwarf.h:922
@ DW_ATOM_qual_name_hash
Definition: Dwarf.h:916
@ DW_ATOM_die_offset
Marker as the end of a list of atoms.
Definition: Dwarf.h:909
@ DW_ATOM_type_type_flags
Definition: Dwarf.h:915
@ DW_ATOM_cu_offset
Definition: Dwarf.h:910
@ DW_hash_function_djb
Definition: Dwarf.h:927
bool isC(SourceLanguage S)
Definition: Dwarf.h:648
LLVMConstants
Definition: Dwarf.h:44
@ DWARF_VENDOR_COMPAQ
Definition: Dwarf.h:78
@ DWARF_VENDOR_LLVM
Definition: Dwarf.h:74
@ DWARF_VENDOR_WASM
Definition: Dwarf.h:76
@ DW_ARANGES_VERSION
Section version number for .debug_aranges.
Definition: Dwarf.h:64
@ DW_PUBNAMES_VERSION
Section version number for .debug_pubnames.
Definition: Dwarf.h:63
@ DWARF_VENDOR_APPLE
Definition: Dwarf.h:70
@ DWARF_VERSION
Other constants.
Definition: Dwarf.h:61
@ DWARF_VENDOR_ALTIUM
Definition: Dwarf.h:77
@ DWARF_VENDOR_IBM
Definition: Dwarf.h:82
@ DWARF_VENDOR_GO
Definition: Dwarf.h:80
@ DWARF_VENDOR_SUN
Definition: Dwarf.h:85
@ DW_TAG_invalid
LLVM mock tags (see also llvm/BinaryFormat/Dwarf.def).
Definition: Dwarf.h:47
@ DWARF_VENDOR_PGI
Definition: Dwarf.h:84
@ DWARF_VENDOR_HP
Definition: Dwarf.h:81
@ DWARF_VENDOR_INTEL
Definition: Dwarf.h:83
@ DW_LENGTH_lo_reserved
Special values for an initial length field.
Definition: Dwarf.h:54
@ DW_MACINFO_invalid
Macinfo type for invalid results.
Definition: Dwarf.h:49
@ DWARF_VENDOR_UPC
Definition: Dwarf.h:86
@ DWARF_VENDOR_GNU
Definition: Dwarf.h:72
@ DW_VIRTUALITY_invalid
Virtuality for invalid results.
Definition: Dwarf.h:48
@ DW_LENGTH_hi_reserved
Upper bound of the reserved range.
Definition: Dwarf.h:56
@ DWARF_VENDOR_GOOGLE
Definition: Dwarf.h:73
@ DWARF_VENDOR_BORLAND
Definition: Dwarf.h:71
@ DWARF_VENDOR_GHS
Definition: Dwarf.h:79
@ DWARF_VENDOR_MIPS
Definition: Dwarf.h:75
@ DW_PUBTYPES_VERSION
Section version number for .debug_pubtypes.
Definition: Dwarf.h:62
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
Definition: Dwarf.h:55
@ DWARF_VENDOR_DWARF
Identifiers we use to distinguish vendor extensions.
Definition: Dwarf.h:69
GDBIndexEntryLinkage
Definition: Dwarf.h:951
@ GIEL_EXTERNAL
Definition: Dwarf.h:951
@ GIEL_STATIC
Definition: Dwarf.h:951
std::optional< std::pair< SourceLanguageName, uint32_t > > toDW_LNAME(SourceLanguage language)
Convert a DWARF 5 DW_LANG to a DWARF 6 pair of language name and version.
Definition: Dwarf.h:359
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:125
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
A helper struct providing information about the byte size of DW_FORM values that vary in size dependi...
Definition: Dwarf.h:1066
bool DwarfUsesRelocationsAcrossSections
True if DWARF v2 output generally uses relocations for references to other .debug_* sections.
Definition: Dwarf.h:1072
DwarfFormat Format
Definition: Dwarf.h:1069
uint8_t getDwarfOffsetByteSize() const
The size of a reference is determined by the DWARF 32/64-bit format.
Definition: Dwarf.h:1084
uint8_t getRefAddrByteSize() const
The definition of the size of form DW_FORM_ref_addr depends on the version.
Definition: Dwarf.h:1077
Describes an entry of the various gnu_pub* debug sections.
Definition: Dwarf.h:1137
PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
Definition: Dwarf.h:1140
PubIndexEntryDescriptor(uint8_t Value)
Definition: Dwarf.h:1144
PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
Definition: Dwarf.h:1142
GDBIndexEntryLinkage Linkage
Definition: Dwarf.h:1139
static void format(const Enum &E, raw_ostream &OS, StringRef Style)
Definition: Dwarf.h:1207