Mercurial > hg > Members > tobaru > cbc > CbC_llvm
comparison docs/SourceLevelDebugging.rst @ 83:60c9769439b8
LLVM 3.7
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 18 Feb 2015 14:55:36 +0900 |
parents | 54457678186b |
children | afa8332a0e37 |
comparison
equal
deleted
inserted
replaced
78:af83660cff7b | 83:60c9769439b8 |
---|---|
184 !1 = metadata !{ | 184 !1 = metadata !{ |
185 i32, ;; A tag | 185 i32, ;; A tag |
186 ... | 186 ... |
187 } | 187 } |
188 | 188 |
189 <a name="LLVMDebugVersion">The first field of a descriptor is always an | 189 Most of the string and integer fields in descriptors are packed into a single, |
190 ``i32`` containing a tag value identifying the content of the descriptor. | 190 null-separated ``mdstring``. The first field of the header is always an |
191 The remaining fields are specific to the descriptor. The values of tags are | 191 ``i32`` containing the DWARF tag value identifying the content of the |
192 loosely bound to the tag values of DWARF information entries. However, that | 192 descriptor. |
193 does not restrict the use of the information supplied to DWARF targets. | 193 |
194 For clarity of definition in this document, these header fields are described | |
195 below split inside an imaginary ``DIHeader`` construct. This is invalid | |
196 assembly syntax. In valid IR, these fields are stringified and concatenated, | |
197 separated by ``\00``. | |
194 | 198 |
195 The details of the various descriptors follow. | 199 The details of the various descriptors follow. |
196 | 200 |
197 Compile unit descriptors | 201 Compile unit descriptors |
198 ^^^^^^^^^^^^^^^^^^^^^^^^ | 202 ^^^^^^^^^^^^^^^^^^^^^^^^ |
199 | 203 |
200 .. code-block:: llvm | 204 .. code-block:: llvm |
201 | 205 |
202 !0 = metadata !{ | 206 !0 = metadata !{ |
203 i32, ;; Tag = 17 (DW_TAG_compile_unit) | 207 DIHeader( |
208 i32, ;; Tag = 17 (DW_TAG_compile_unit) | |
209 i32, ;; DWARF language identifier (ex. DW_LANG_C89) | |
210 mdstring, ;; Producer (ex. "4.0.1 LLVM (LLVM research group)") | |
211 i1, ;; True if this is optimized. | |
212 mdstring, ;; Flags | |
213 i32, ;; Runtime version | |
214 mdstring, ;; Split debug filename | |
215 i32 ;; Debug info emission kind (1 = Full Debug Info, 2 = Line Tables Only) | |
216 ), | |
204 metadata, ;; Source directory (including trailing slash) & file pair | 217 metadata, ;; Source directory (including trailing slash) & file pair |
205 i32, ;; DWARF language identifier (ex. DW_LANG_C89) | 218 metadata, ;; List of enums types |
206 metadata ;; Producer (ex. "4.0.1 LLVM (LLVM research group)") | 219 metadata, ;; List of retained types |
207 i1, ;; True if this is optimized. | 220 metadata, ;; List of subprograms |
208 metadata, ;; Flags | 221 metadata, ;; List of global variables |
209 i32 ;; Runtime version | |
210 metadata ;; List of enums types | |
211 metadata ;; List of retained types | |
212 metadata ;; List of subprograms | |
213 metadata ;; List of global variables | |
214 metadata ;; List of imported entities | 222 metadata ;; List of imported entities |
215 metadata ;; Split debug filename | |
216 i32 ;; Debug info emission kind (1 = Full Debug Info, 2 = Line Tables Only) | |
217 } | 223 } |
218 | 224 |
219 These descriptors contain a source language ID for the file (we use the DWARF | 225 These descriptors contain a source language ID for the file (we use the DWARF |
220 3.0 ID numbers, such as ``DW_LANG_C89``, ``DW_LANG_C_plus_plus``, | 226 3.0 ID numbers, such as ``DW_LANG_C89``, ``DW_LANG_C_plus_plus``, |
221 ``DW_LANG_Cobol74``, etc), a reference to a metadata node containing a pair of | 227 ``DW_LANG_Cobol74``, etc), a reference to a metadata node containing a pair of |
234 ^^^^^^^^^^^^^^^^ | 240 ^^^^^^^^^^^^^^^^ |
235 | 241 |
236 .. code-block:: llvm | 242 .. code-block:: llvm |
237 | 243 |
238 !0 = metadata !{ | 244 !0 = metadata !{ |
239 i32, ;; Tag = 41 (DW_TAG_file_type) | 245 DIHeader( |
240 metadata, ;; Source directory (including trailing slash) & file pair | 246 i32 ;; Tag = 41 (DW_TAG_file_type) |
247 ), | |
248 metadata ;; Source directory (including trailing slash) & file pair | |
241 } | 249 } |
242 | 250 |
243 These descriptors contain information for a file. Global variables and top | 251 These descriptors contain information for a file. Global variables and top |
244 level functions would be defined using this context. File descriptors also | 252 level functions would be defined using this context. File descriptors also |
245 provide context for source line correspondence. | 253 provide context for source line correspondence. |
253 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 261 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
254 | 262 |
255 .. code-block:: llvm | 263 .. code-block:: llvm |
256 | 264 |
257 !1 = metadata !{ | 265 !1 = metadata !{ |
258 i32, ;; Tag = 52 (DW_TAG_variable) | 266 DIHeader( |
259 i32, ;; Unused field. | 267 i32, ;; Tag = 52 (DW_TAG_variable) |
268 mdstring, ;; Name | |
269 mdstring, ;; Display name (fully qualified C++ name) | |
270 mdstring, ;; MIPS linkage name (for C++) | |
271 i32, ;; Line number where defined | |
272 i1, ;; True if the global is local to compile unit (static) | |
273 i1 ;; True if the global is defined in the compile unit (not extern) | |
274 ), | |
260 metadata, ;; Reference to context descriptor | 275 metadata, ;; Reference to context descriptor |
261 metadata, ;; Name | |
262 metadata, ;; Display name (fully qualified C++ name) | |
263 metadata, ;; MIPS linkage name (for C++) | |
264 metadata, ;; Reference to file where defined | 276 metadata, ;; Reference to file where defined |
265 i32, ;; Line number where defined | |
266 metadata, ;; Reference to type descriptor | 277 metadata, ;; Reference to type descriptor |
267 i1, ;; True if the global is local to compile unit (static) | |
268 i1, ;; True if the global is defined in the compile unit (not extern) | |
269 {}*, ;; Reference to the global variable | 278 {}*, ;; Reference to the global variable |
270 metadata, ;; The static member declaration, if any | 279 metadata, ;; The static member declaration, if any |
271 } | 280 } |
272 | 281 |
273 These descriptors provide debug information about global variables. They | 282 These descriptors provide debug information about global variables. They |
280 ^^^^^^^^^^^^^^^^^^^^^^ | 289 ^^^^^^^^^^^^^^^^^^^^^^ |
281 | 290 |
282 .. code-block:: llvm | 291 .. code-block:: llvm |
283 | 292 |
284 !2 = metadata !{ | 293 !2 = metadata !{ |
285 i32, ;; Tag = 46 (DW_TAG_subprogram) | 294 DIHeader( |
295 i32, ;; Tag = 46 (DW_TAG_subprogram) | |
296 mdstring, ;; Name | |
297 mdstring, ;; Display name (fully qualified C++ name) | |
298 mdstring, ;; MIPS linkage name (for C++) | |
299 i32, ;; Line number where defined | |
300 i1, ;; True if the global is local to compile unit (static) | |
301 i1, ;; True if the global is defined in the compile unit (not extern) | |
302 i32, ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual | |
303 i32, ;; Index into a virtual function | |
304 i32, ;; Flags - Artificial, Private, Protected, Explicit, Prototyped. | |
305 i1, ;; isOptimized | |
306 i32 ;; Line number where the scope of the subprogram begins | |
307 ), | |
286 metadata, ;; Source directory (including trailing slash) & file pair | 308 metadata, ;; Source directory (including trailing slash) & file pair |
287 metadata, ;; Reference to context descriptor | 309 metadata, ;; Reference to context descriptor |
288 metadata, ;; Name | |
289 metadata, ;; Display name (fully qualified C++ name) | |
290 metadata, ;; MIPS linkage name (for C++) | |
291 i32, ;; Line number where defined | |
292 metadata, ;; Reference to type descriptor | 310 metadata, ;; Reference to type descriptor |
293 i1, ;; True if the global is local to compile unit (static) | |
294 i1, ;; True if the global is defined in the compile unit (not extern) | |
295 i32, ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual | |
296 i32, ;; Index into a virtual function | |
297 metadata, ;; indicates which base type contains the vtable pointer for the | 311 metadata, ;; indicates which base type contains the vtable pointer for the |
298 ;; derived class | 312 ;; derived class |
299 i32, ;; Flags - Artificial, Private, Protected, Explicit, Prototyped. | |
300 i1, ;; isOptimized | |
301 {}*, ;; Reference to the LLVM function | 313 {}*, ;; Reference to the LLVM function |
302 metadata, ;; Lists function template parameters | 314 metadata, ;; Lists function template parameters |
303 metadata, ;; Function declaration descriptor | 315 metadata, ;; Function declaration descriptor |
304 metadata, ;; List of function variables | 316 metadata ;; List of function variables |
305 i32 ;; Line number where the scope of the subprogram begins | |
306 } | 317 } |
307 | 318 |
308 These descriptors provide debug information about functions, methods and | 319 These descriptors provide debug information about functions, methods and |
309 subprograms. They provide details such as name, return types and the source | 320 subprograms. They provide details such as name, return types and the source |
310 location where the subprogram is defined. | 321 location where the subprogram is defined. |
313 ^^^^^^^^^^^^^^^^^ | 324 ^^^^^^^^^^^^^^^^^ |
314 | 325 |
315 .. code-block:: llvm | 326 .. code-block:: llvm |
316 | 327 |
317 !3 = metadata !{ | 328 !3 = metadata !{ |
318 i32, ;; Tag = 11 (DW_TAG_lexical_block) | 329 DIHeader( |
330 i32, ;; Tag = 11 (DW_TAG_lexical_block) | |
331 i32, ;; Line number | |
332 i32, ;; Column number | |
333 i32 ;; Unique ID to identify blocks from a template function | |
334 ), | |
319 metadata, ;; Source directory (including trailing slash) & file pair | 335 metadata, ;; Source directory (including trailing slash) & file pair |
320 metadata, ;; Reference to context descriptor | 336 metadata ;; Reference to context descriptor |
321 i32, ;; Line number | |
322 i32, ;; Column number | |
323 i32 ;; Unique ID to identify blocks from a template function | |
324 } | 337 } |
325 | 338 |
326 This descriptor provides debug information about nested blocks within a | 339 This descriptor provides debug information about nested blocks within a |
327 subprogram. The line number and column numbers are used to dinstinguish two | 340 subprogram. The line number and column numbers are used to dinstinguish two |
328 lexical blocks at same depth. | 341 lexical blocks at same depth. |
329 | 342 |
330 .. code-block:: llvm | 343 .. code-block:: llvm |
331 | 344 |
332 !3 = metadata !{ | 345 !3 = metadata !{ |
333 i32, ;; Tag = 11 (DW_TAG_lexical_block) | 346 DIHeader( |
347 i32, ;; Tag = 11 (DW_TAG_lexical_block) | |
348 i32 ;; DWARF path discriminator value | |
349 ), | |
334 metadata, ;; Source directory (including trailing slash) & file pair | 350 metadata, ;; Source directory (including trailing slash) & file pair |
335 metadata ;; Reference to the scope we're annotating with a file change | 351 metadata ;; Reference to the scope we're annotating with a file change |
336 i32, ;; DWARF path discriminator value | |
337 } | 352 } |
338 | 353 |
339 This descriptor provides a wrapper around a lexical scope to handle file | 354 This descriptor provides a wrapper around a lexical scope to handle file |
340 changes in the middle of a lexical block. | 355 changes in the middle of a lexical block. |
341 | 356 |
345 ^^^^^^^^^^^^^^^^^^^^^^ | 360 ^^^^^^^^^^^^^^^^^^^^^^ |
346 | 361 |
347 .. code-block:: llvm | 362 .. code-block:: llvm |
348 | 363 |
349 !4 = metadata !{ | 364 !4 = metadata !{ |
350 i32, ;; Tag = 36 (DW_TAG_base_type) | 365 DIHeader( |
366 i32, ;; Tag = 36 (DW_TAG_base_type) | |
367 mdstring, ;; Name (may be "" for anonymous types) | |
368 i32, ;; Line number where defined (may be 0) | |
369 i64, ;; Size in bits | |
370 i64, ;; Alignment in bits | |
371 i64, ;; Offset in bits | |
372 i32, ;; Flags | |
373 i32 ;; DWARF type encoding | |
374 ), | |
351 metadata, ;; Source directory (including trailing slash) & file pair (may be null) | 375 metadata, ;; Source directory (including trailing slash) & file pair (may be null) |
352 metadata, ;; Reference to context | 376 metadata ;; Reference to context |
353 metadata, ;; Name (may be "" for anonymous types) | |
354 i32, ;; Line number where defined (may be 0) | |
355 i64, ;; Size in bits | |
356 i64, ;; Alignment in bits | |
357 i64, ;; Offset in bits | |
358 i32, ;; Flags | |
359 i32 ;; DWARF type encoding | |
360 } | 377 } |
361 | 378 |
362 These descriptors define primitive types used in the code. Example ``int``, | 379 These descriptors define primitive types used in the code. Example ``int``, |
363 ``bool`` and ``float``. The context provides the scope of the type, which is | 380 ``bool`` and ``float``. The context provides the scope of the type, which is |
364 usually the top level. Since basic types are not usually user defined the | 381 usually the top level. Since basic types are not usually user defined the |
388 ^^^^^^^^^^^^^^^^^^^^^^^^ | 405 ^^^^^^^^^^^^^^^^^^^^^^^^ |
389 | 406 |
390 .. code-block:: llvm | 407 .. code-block:: llvm |
391 | 408 |
392 !5 = metadata !{ | 409 !5 = metadata !{ |
393 i32, ;; Tag (see below) | 410 DIHeader( |
411 i32, ;; Tag (see below) | |
412 mdstring, ;; Name (may be "" for anonymous types) | |
413 i32, ;; Line number where defined (may be 0) | |
414 i64, ;; Size in bits | |
415 i64, ;; Alignment in bits | |
416 i64, ;; Offset in bits | |
417 i32 ;; Flags to encode attributes, e.g. private | |
418 ), | |
394 metadata, ;; Source directory (including trailing slash) & file pair (may be null) | 419 metadata, ;; Source directory (including trailing slash) & file pair (may be null) |
395 metadata, ;; Reference to context | 420 metadata, ;; Reference to context |
396 metadata, ;; Name (may be "" for anonymous types) | |
397 i32, ;; Line number where defined (may be 0) | |
398 i64, ;; Size in bits | |
399 i64, ;; Alignment in bits | |
400 i64, ;; Offset in bits | |
401 i32, ;; Flags to encode attributes, e.g. private | |
402 metadata, ;; Reference to type derived from | 421 metadata, ;; Reference to type derived from |
403 metadata, ;; (optional) Name of the Objective C property associated with | 422 metadata ;; (optional) Objective C property node |
404 ;; Objective-C an ivar, or the type of which this | |
405 ;; pointer-to-member is pointing to members of. | |
406 metadata, ;; (optional) Name of the Objective C property getter selector. | |
407 metadata, ;; (optional) Name of the Objective C property setter selector. | |
408 i32 ;; (optional) Objective C property attributes. | |
409 } | 423 } |
410 | 424 |
411 These descriptors are used to define types derived from other types. The value | 425 These descriptors are used to define types derived from other types. The value |
412 of the tag varies depending on the meaning. The following are possible tag | 426 of the tag varies depending on the meaning. The following are possible tag |
413 values: | 427 values: |
451 ^^^^^^^^^^^^^^^^^^^^^^^^^^ | 465 ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
452 | 466 |
453 .. code-block:: llvm | 467 .. code-block:: llvm |
454 | 468 |
455 !6 = metadata !{ | 469 !6 = metadata !{ |
456 i32, ;; Tag (see below) | 470 DIHeader( |
471 i32, ;; Tag (see below) | |
472 mdstring, ;; Name (may be "" for anonymous types) | |
473 i32, ;; Line number where defined (may be 0) | |
474 i64, ;; Size in bits | |
475 i64, ;; Alignment in bits | |
476 i64, ;; Offset in bits | |
477 i32, ;; Flags | |
478 i32 ;; Runtime languages | |
479 ), | |
457 metadata, ;; Source directory (including trailing slash) & file pair (may be null) | 480 metadata, ;; Source directory (including trailing slash) & file pair (may be null) |
458 metadata, ;; Reference to context | 481 metadata, ;; Reference to context |
459 metadata, ;; Name (may be "" for anonymous types) | |
460 i32, ;; Line number where defined (may be 0) | |
461 i64, ;; Size in bits | |
462 i64, ;; Alignment in bits | |
463 i64, ;; Offset in bits | |
464 i32, ;; Flags | |
465 metadata, ;; Reference to type derived from | 482 metadata, ;; Reference to type derived from |
466 metadata, ;; Reference to array of member descriptors | 483 metadata, ;; Reference to array of member descriptors |
467 i32, ;; Runtime languages | |
468 metadata, ;; Base type containing the vtable pointer for this type | 484 metadata, ;; Base type containing the vtable pointer for this type |
469 metadata, ;; Template parameters | 485 metadata, ;; Template parameters |
470 metadata ;; A unique identifier for type uniquing purpose (may be null) | 486 mdstring ;; A unique identifier for type uniquing purpose (may be null) |
471 } | 487 } |
472 | 488 |
473 These descriptors are used to define types that are composed of 0 or more | 489 These descriptors are used to define types that are composed of 0 or more |
474 elements. The value of the tag varies depending on the meaning. The following | 490 elements. The value of the tag varies depending on the meaning. The following |
475 are possible tag values: | 491 are possible tag values: |
527 ^^^^^^^^^^^^^^^^^^^^ | 543 ^^^^^^^^^^^^^^^^^^^^ |
528 | 544 |
529 .. code-block:: llvm | 545 .. code-block:: llvm |
530 | 546 |
531 !42 = metadata !{ | 547 !42 = metadata !{ |
532 i32, ;; Tag = 33 (DW_TAG_subrange_type) | 548 DIHeader( |
533 i64, ;; Low value | 549 i32, ;; Tag = 33 (DW_TAG_subrange_type) |
534 i64 ;; High value | 550 i64, ;; Low value |
551 i64 ;; High value | |
552 ) | |
535 } | 553 } |
536 | 554 |
537 These descriptors are used to define ranges of array subscripts for an array | 555 These descriptors are used to define ranges of array subscripts for an array |
538 :ref:`composite type <format_composite_type>`. The low value defines the lower | 556 :ref:`composite type <format_composite_type>`. The low value defines the lower |
539 bounds typically zero for C/C++. The high value is the upper bounds. Values | 557 bounds typically zero for C/C++. The high value is the upper bounds. Values |
546 ^^^^^^^^^^^^^^^^^^^^^^ | 564 ^^^^^^^^^^^^^^^^^^^^^^ |
547 | 565 |
548 .. code-block:: llvm | 566 .. code-block:: llvm |
549 | 567 |
550 !6 = metadata !{ | 568 !6 = metadata !{ |
551 i32, ;; Tag = 40 (DW_TAG_enumerator) | 569 DIHeader( |
552 metadata, ;; Name | 570 i32, ;; Tag = 40 (DW_TAG_enumerator) |
553 i64 ;; Value | 571 mdstring, ;; Name |
572 i64 ;; Value | |
573 ) | |
554 } | 574 } |
555 | 575 |
556 These descriptors are used to define members of an enumeration :ref:`composite | 576 These descriptors are used to define members of an enumeration :ref:`composite |
557 type <format_composite_type>`, it associates the name to the value. | 577 type <format_composite_type>`, it associates the name to the value. |
558 | 578 |
560 ^^^^^^^^^^^^^^^ | 580 ^^^^^^^^^^^^^^^ |
561 | 581 |
562 .. code-block:: llvm | 582 .. code-block:: llvm |
563 | 583 |
564 !7 = metadata !{ | 584 !7 = metadata !{ |
565 i32, ;; Tag (see below) | 585 DIHeader( |
586 i32, ;; Tag (see below) | |
587 mdstring, ;; Name | |
588 i32, ;; 24 bit - Line number where defined | |
589 ;; 8 bit - Argument number. 1 indicates 1st argument. | |
590 i32 ;; flags | |
591 ), | |
566 metadata, ;; Context | 592 metadata, ;; Context |
567 metadata, ;; Name | |
568 metadata, ;; Reference to file where defined | 593 metadata, ;; Reference to file where defined |
569 i32, ;; 24 bit - Line number where defined | |
570 ;; 8 bit - Argument number. 1 indicates 1st argument. | |
571 metadata, ;; Reference to the type descriptor | 594 metadata, ;; Reference to the type descriptor |
572 i32, ;; flags | |
573 metadata ;; (optional) Reference to inline location | 595 metadata ;; (optional) Reference to inline location |
574 metadata ;; (optional) Reference to a complex expression (see below) | |
575 } | 596 } |
576 | 597 |
577 These descriptors are used to define variables local to a sub program. The | 598 These descriptors are used to define variables local to a sub program. The |
578 value of the tag depends on the usage of the variable: | 599 value of the tag depends on the usage of the variable: |
579 | 600 |
588 | 609 |
589 The context is either the subprogram or block where the variable is defined. | 610 The context is either the subprogram or block where the variable is defined. |
590 Name the source variable name. Context and line indicate where the variable | 611 Name the source variable name. Context and line indicate where the variable |
591 was defined. Type descriptor defines the declared type of the variable. | 612 was defined. Type descriptor defines the declared type of the variable. |
592 | 613 |
593 The ``OpPiece`` operator is used for (typically larger aggregate) | 614 Complex Expressions |
615 ^^^^^^^^^^^^^^^^^^^ | |
616 .. code-block:: llvm | |
617 | |
618 !8 = metadata !{ | |
619 i32, ;; DW_TAG_expression | |
620 ... | |
621 } | |
622 | |
623 Complex expressions describe variable storage locations in terms of | |
624 prefix-notated DWARF expressions. Currently the only supported | |
625 operators are ``DW_OP_plus``, ``DW_OP_deref``, and ``DW_OP_piece``. | |
626 | |
627 The ``DW_OP_piece`` operator is used for (typically larger aggregate) | |
594 variables that are fragmented across several locations. It takes two | 628 variables that are fragmented across several locations. It takes two |
595 i32 arguments, an offset and a size in bytes to describe which piece | 629 i32 arguments, an offset and a size in bytes to describe which piece |
596 of the variable is at this location. | 630 of the variable is at this location. |
597 | 631 |
598 | 632 |
813 representing programs in the same way that DWARF 3 does), or they could choose | 847 representing programs in the same way that DWARF 3 does), or they could choose |
814 to provide completely different forms if they don't fit into the DWARF model. | 848 to provide completely different forms if they don't fit into the DWARF model. |
815 As support for debugging information gets added to the various LLVM | 849 As support for debugging information gets added to the various LLVM |
816 source-language front-ends, the information used should be documented here. | 850 source-language front-ends, the information used should be documented here. |
817 | 851 |
818 The following sections provide examples of various C/C++ constructs and the | 852 The following sections provide examples of a few C/C++ constructs and the debug |
819 debug information that would best describe those constructs. | 853 information that would best describe those constructs. The canonical |
854 references are the ``DIDescriptor`` classes defined in | |
855 ``include/llvm/IR/DebugInfo.h`` and the implementations of the helper functions | |
856 in ``lib/IR/DIBuilder.cpp``. | |
820 | 857 |
821 C/C++ source file information | 858 C/C++ source file information |
822 ----------------------------- | 859 ----------------------------- |
823 | |
824 Given the source files ``MySource.cpp`` and ``MyHeader.h`` located in the | |
825 directory ``/Users/mine/sources``, the following code: | |
826 | |
827 .. code-block:: c | |
828 | |
829 #include "MyHeader.h" | |
830 | |
831 int main(int argc, char *argv[]) { | |
832 return 0; | |
833 } | |
834 | |
835 a C/C++ front-end would generate the following descriptors: | |
836 | |
837 .. code-block:: llvm | |
838 | |
839 ... | |
840 ;; | |
841 ;; Define the compile unit for the main source file "/Users/mine/sources/MySource.cpp". | |
842 ;; | |
843 !0 = metadata !{ | |
844 i32 786449, ;; Tag | |
845 metadata !1, ;; File/directory name | |
846 i32 4, ;; Language Id | |
847 metadata !"clang version 3.4 ", | |
848 i1 false, ;; Optimized compile unit | |
849 metadata !"", ;; Compiler flags | |
850 i32 0, ;; Runtime version | |
851 metadata !2, ;; Enumeration types | |
852 metadata !2, ;; Retained types | |
853 metadata !3, ;; Subprograms | |
854 metadata !2, ;; Global variables | |
855 metadata !2, ;; Imported entities (declarations and namespaces) | |
856 metadata !"" ;; Split debug filename | |
857 1, ;; Full debug info | |
858 } | |
859 | |
860 ;; | |
861 ;; Define the file for the file "/Users/mine/sources/MySource.cpp". | |
862 ;; | |
863 !1 = metadata !{ | |
864 metadata !"MySource.cpp", | |
865 metadata !"/Users/mine/sources" | |
866 } | |
867 !5 = metadata !{ | |
868 i32 786473, ;; Tag | |
869 metadata !1 | |
870 } | |
871 | |
872 ;; | |
873 ;; Define the file for the file "/Users/mine/sources/Myheader.h" | |
874 ;; | |
875 !14 = metadata !{ | |
876 i32 786473, ;; Tag | |
877 metadata !15 | |
878 } | |
879 !15 = metadata !{ | |
880 metadata !"./MyHeader.h", | |
881 metadata !"/Users/mine/sources", | |
882 } | |
883 | |
884 ... | |
885 | 860 |
886 ``llvm::Instruction`` provides easy access to metadata attached with an | 861 ``llvm::Instruction`` provides easy access to metadata attached with an |
887 instruction. One can extract line number information encoded in LLVM IR using | 862 instruction. One can extract line number information encoded in LLVM IR using |
888 ``Instruction::getMetadata()`` and ``DILocation::getLineNumber()``. | 863 ``Instruction::getMetadata()`` and ``DILocation::getLineNumber()``. |
889 | 864 |
910 .. code-block:: llvm | 885 .. code-block:: llvm |
911 | 886 |
912 ;; | 887 ;; |
913 ;; Define the global itself. | 888 ;; Define the global itself. |
914 ;; | 889 ;; |
915 %MyGlobal = global int 100 | 890 @MyGlobal = global i32 100, align 4 |
916 ... | 891 ... |
917 ;; | 892 ;; |
918 ;; List of debug info of globals | 893 ;; List of debug info of globals |
919 ;; | 894 ;; |
920 !llvm.dbg.cu = !{!0} | 895 !llvm.dbg.cu = !{!0} |
921 | 896 |
922 ;; Define the compile unit. | 897 ;; Define the compile unit. |
923 !0 = metadata !{ | 898 !0 = metadata !{ |
924 i32 786449, ;; Tag | 899 ; Header( |
925 i32 0, ;; Context | 900 ; i32 17, ;; Tag |
926 i32 4, ;; Language | 901 ; i32 0, ;; Context |
927 metadata !"foo.cpp", ;; File | 902 ; i32 4, ;; Language |
928 metadata !"/Volumes/Data/tmp", ;; Directory | 903 ; metadata !"clang version 3.6.0 ", ;; Producer |
929 metadata !"clang version 3.1 ", ;; Producer | 904 ; i1 false, ;; "isOptimized"? |
930 i1 true, ;; Deprecated field | 905 ; metadata !"", ;; Flags |
931 i1 false, ;; "isOptimized"? | 906 ; i32 0, ;; Runtime Version |
932 metadata !"", ;; Flags | 907 ; "", ;; Split debug filename |
933 i32 0, ;; Runtime Version | 908 ; 1 ;; Full debug info |
934 metadata !1, ;; Enum Types | 909 ; ) |
935 metadata !1, ;; Retained Types | 910 metadata !"0x11\0012\00clang version 3.6.0 \000\00\000\00\001", |
936 metadata !1, ;; Subprograms | 911 metadata !1, ;; File |
937 metadata !3, ;; Global Variables | 912 metadata !2, ;; Enum Types |
938 metadata !1, ;; Imported entities | 913 metadata !2, ;; Retained Types |
939 "", ;; Split debug filename | 914 metadata !2, ;; Subprograms |
940 1, ;; Full debug info | 915 metadata !3, ;; Global Variables |
916 metadata !2 ;; Imported entities | |
941 } ; [ DW_TAG_compile_unit ] | 917 } ; [ DW_TAG_compile_unit ] |
918 | |
919 ;; The file/directory pair. | |
920 !1 = metadata !{ | |
921 metadata !"foo.c", ;; Filename | |
922 metadata !"/Users/dexonsmith/data/llvm/debug-info" ;; Directory | |
923 } | |
924 | |
925 ;; An empty array. | |
926 !2 = metadata !{} | |
942 | 927 |
943 ;; The Array of Global Variables | 928 ;; The Array of Global Variables |
944 !3 = metadata !{ | 929 !3 = metadata !{ |
945 metadata !4 | 930 metadata !4 |
946 } | 931 } |
947 | 932 |
948 ;; | 933 ;; |
949 ;; Define the global variable itself. | 934 ;; Define the global variable itself. |
950 ;; | 935 ;; |
951 !4 = metadata !{ | 936 !4 = metadata !{ |
952 i32 786484, ;; Tag | 937 ; Header( |
953 i32 0, ;; Unused | 938 ; i32 52, ;; Tag |
939 ; metadata !"MyGlobal", ;; Name | |
940 ; metadata !"MyGlobal", ;; Display Name | |
941 ; metadata !"", ;; Linkage Name | |
942 ; i32 1, ;; Line | |
943 ; i32 0, ;; IsLocalToUnit | |
944 ; i32 1 ;; IsDefinition | |
945 ; ) | |
946 metadata !"0x34\00MyGlobal\00MyGlobal\00\001\000\001", | |
954 null, ;; Unused | 947 null, ;; Unused |
955 metadata !"MyGlobal", ;; Name | 948 metadata !5, ;; File |
956 metadata !"MyGlobal", ;; Display Name | 949 metadata !6, ;; Type |
957 metadata !"", ;; Linkage Name | |
958 metadata !6, ;; File | |
959 i32 1, ;; Line | |
960 metadata !7, ;; Type | |
961 i32 0, ;; IsLocalToUnit | |
962 i32 1, ;; IsDefinition | |
963 i32* @MyGlobal, ;; LLVM-IR Value | 950 i32* @MyGlobal, ;; LLVM-IR Value |
964 null ;; Static member declaration | 951 null ;; Static member declaration |
965 } ; [ DW_TAG_variable ] | 952 } ; [ DW_TAG_variable ] |
966 | 953 |
967 ;; | 954 ;; |
968 ;; Define the file | 955 ;; Define the file |
969 ;; | 956 ;; |
970 !5 = metadata !{ | 957 !5 = metadata !{ |
971 metadata !"foo.cpp", ;; File | 958 ; Header( |
972 metadata !"/Volumes/Data/tmp", ;; Directory | 959 ; i32 41 ;; Tag |
973 } | 960 ; ) |
974 !6 = metadata !{ | 961 metadata !"0x29", |
975 i32 786473, ;; Tag | 962 metadata !1 ;; File/directory pair |
976 metadata !5 ;; Unused | |
977 } ; [ DW_TAG_file_type ] | 963 } ; [ DW_TAG_file_type ] |
978 | 964 |
979 ;; | 965 ;; |
980 ;; Define the type | 966 ;; Define the type |
981 ;; | 967 ;; |
982 !7 = metadata !{ | 968 !6 = metadata !{ |
983 i32 786468, ;; Tag | 969 ; Header( |
984 null, ;; Unused | 970 ; i32 36, ;; Tag |
985 null, ;; Unused | 971 ; metadata !"int", ;; Name |
986 metadata !"int", ;; Name | 972 ; i32 0, ;; Line |
987 i32 0, ;; Line | 973 ; i64 32, ;; Size in Bits |
988 i64 32, ;; Size in Bits | 974 ; i64 32, ;; Align in Bits |
989 i64 32, ;; Align in Bits | 975 ; i64 0, ;; Offset |
990 i64 0, ;; Offset | 976 ; i32 0, ;; Flags |
991 i32 0, ;; Flags | 977 ; i32 5 ;; Encoding |
992 i32 5 ;; Encoding | 978 ; ) |
979 metadata !"0x24\00int\000\0032\0032\000\000\005", | |
980 null, ;; Unused | |
981 null ;; Unused | |
993 } ; [ DW_TAG_base_type ] | 982 } ; [ DW_TAG_base_type ] |
994 | 983 |
995 C/C++ function information | 984 C/C++ function information |
996 -------------------------- | 985 -------------------------- |
997 | 986 |
1009 | 998 |
1010 ;; | 999 ;; |
1011 ;; Define the anchor for subprograms. | 1000 ;; Define the anchor for subprograms. |
1012 ;; | 1001 ;; |
1013 !6 = metadata !{ | 1002 !6 = metadata !{ |
1014 i32 786484, ;; Tag | 1003 ; Header( |
1015 metadata !1, ;; File | 1004 ; i32 46, ;; Tag |
1016 metadata !1, ;; Context | 1005 ; metadata !"main", ;; Name |
1017 metadata !"main", ;; Name | 1006 ; metadata !"main", ;; Display name |
1018 metadata !"main", ;; Display name | 1007 ; metadata !"", ;; Linkage name |
1019 metadata !"main", ;; Linkage name | 1008 ; i32 1, ;; Line number |
1020 i32 1, ;; Line number | 1009 ; i1 false, ;; Is local |
1021 metadata !4, ;; Type | 1010 ; i1 true, ;; Is definition |
1022 i1 false, ;; Is local | 1011 ; i32 0, ;; Virtuality attribute, e.g. pure virtual function |
1023 i1 true, ;; Is definition | 1012 ; i32 0, ;; Index into virtual table for C++ methods |
1024 i32 0, ;; Virtuality attribute, e.g. pure virtual function | 1013 ; i32 256, ;; Flags |
1025 i32 0, ;; Index into virtual table for C++ methods | 1014 ; i1 0, ;; True if this function is optimized |
1026 i32 0, ;; Type that holds virtual table. | 1015 ; 1 ;; Line number of the opening '{' of the function |
1027 i32 0, ;; Flags | 1016 ; ) |
1028 i1 false, ;; True if this function is optimized | 1017 metadata !"0x2e\00main\00main\00\001\000\001\000\000\00256\000\001", |
1029 Function *, ;; Pointer to llvm::Function | 1018 metadata !1, ;; File |
1030 null, ;; Function template parameters | 1019 metadata !5, ;; Context |
1031 null, ;; List of function variables (emitted when optimizing) | 1020 metadata !6, ;; Type |
1032 1 ;; Line number of the opening '{' of the function | 1021 null, ;; Containing type |
1033 } | 1022 i32 (i32, i8**)* @main, ;; Pointer to llvm::Function |
1023 null, ;; Function template parameters | |
1024 null, ;; Function declaration | |
1025 metadata !2 ;; List of function variables (emitted when optimizing) | |
1026 } | |
1027 | |
1034 ;; | 1028 ;; |
1035 ;; Define the subprogram itself. | 1029 ;; Define the subprogram itself. |
1036 ;; | 1030 ;; |
1037 define i32 @main(i32 %argc, i8** %argv) { | 1031 define i32 @main(i32 %argc, i8** %argv) { |
1038 ... | 1032 ... |
1039 } | 1033 } |
1040 | |
1041 C/C++ basic types | |
1042 ----------------- | |
1043 | |
1044 The following are the basic type descriptors for C/C++ core types: | |
1045 | |
1046 bool | |
1047 ^^^^ | |
1048 | |
1049 .. code-block:: llvm | |
1050 | |
1051 !2 = metadata !{ | |
1052 i32 786468, ;; Tag | |
1053 null, ;; File | |
1054 null, ;; Context | |
1055 metadata !"bool", ;; Name | |
1056 i32 0, ;; Line number | |
1057 i64 8, ;; Size in Bits | |
1058 i64 8, ;; Align in Bits | |
1059 i64 0, ;; Offset in Bits | |
1060 i32 0, ;; Flags | |
1061 i32 2 ;; Encoding | |
1062 } | |
1063 | |
1064 char | |
1065 ^^^^ | |
1066 | |
1067 .. code-block:: llvm | |
1068 | |
1069 !2 = metadata !{ | |
1070 i32 786468, ;; Tag | |
1071 null, ;; File | |
1072 null, ;; Context | |
1073 metadata !"char", ;; Name | |
1074 i32 0, ;; Line number | |
1075 i64 8, ;; Size in Bits | |
1076 i64 8, ;; Align in Bits | |
1077 i64 0, ;; Offset in Bits | |
1078 i32 0, ;; Flags | |
1079 i32 6 ;; Encoding | |
1080 } | |
1081 | |
1082 unsigned char | |
1083 ^^^^^^^^^^^^^ | |
1084 | |
1085 .. code-block:: llvm | |
1086 | |
1087 !2 = metadata !{ | |
1088 i32 786468, ;; Tag | |
1089 null, ;; File | |
1090 null, ;; Context | |
1091 metadata !"unsigned char", | |
1092 i32 0, ;; Line number | |
1093 i64 8, ;; Size in Bits | |
1094 i64 8, ;; Align in Bits | |
1095 i64 0, ;; Offset in Bits | |
1096 i32 0, ;; Flags | |
1097 i32 8 ;; Encoding | |
1098 } | |
1099 | |
1100 short | |
1101 ^^^^^ | |
1102 | |
1103 .. code-block:: llvm | |
1104 | |
1105 !2 = metadata !{ | |
1106 i32 786468, ;; Tag | |
1107 null, ;; File | |
1108 null, ;; Context | |
1109 metadata !"short int", | |
1110 i32 0, ;; Line number | |
1111 i64 16, ;; Size in Bits | |
1112 i64 16, ;; Align in Bits | |
1113 i64 0, ;; Offset in Bits | |
1114 i32 0, ;; Flags | |
1115 i32 5 ;; Encoding | |
1116 } | |
1117 | |
1118 unsigned short | |
1119 ^^^^^^^^^^^^^^ | |
1120 | |
1121 .. code-block:: llvm | |
1122 | |
1123 !2 = metadata !{ | |
1124 i32 786468, ;; Tag | |
1125 null, ;; File | |
1126 null, ;; Context | |
1127 metadata !"short unsigned int", | |
1128 i32 0, ;; Line number | |
1129 i64 16, ;; Size in Bits | |
1130 i64 16, ;; Align in Bits | |
1131 i64 0, ;; Offset in Bits | |
1132 i32 0, ;; Flags | |
1133 i32 7 ;; Encoding | |
1134 } | |
1135 | |
1136 int | |
1137 ^^^ | |
1138 | |
1139 .. code-block:: llvm | |
1140 | |
1141 !2 = metadata !{ | |
1142 i32 786468, ;; Tag | |
1143 null, ;; File | |
1144 null, ;; Context | |
1145 metadata !"int", ;; Name | |
1146 i32 0, ;; Line number | |
1147 i64 32, ;; Size in Bits | |
1148 i64 32, ;; Align in Bits | |
1149 i64 0, ;; Offset in Bits | |
1150 i32 0, ;; Flags | |
1151 i32 5 ;; Encoding | |
1152 } | |
1153 | |
1154 unsigned int | |
1155 ^^^^^^^^^^^^ | |
1156 | |
1157 .. code-block:: llvm | |
1158 | |
1159 !2 = metadata !{ | |
1160 i32 786468, ;; Tag | |
1161 null, ;; File | |
1162 null, ;; Context | |
1163 metadata !"unsigned int", | |
1164 i32 0, ;; Line number | |
1165 i64 32, ;; Size in Bits | |
1166 i64 32, ;; Align in Bits | |
1167 i64 0, ;; Offset in Bits | |
1168 i32 0, ;; Flags | |
1169 i32 7 ;; Encoding | |
1170 } | |
1171 | |
1172 long long | |
1173 ^^^^^^^^^ | |
1174 | |
1175 .. code-block:: llvm | |
1176 | |
1177 !2 = metadata !{ | |
1178 i32 786468, ;; Tag | |
1179 null, ;; File | |
1180 null, ;; Context | |
1181 metadata !"long long int", | |
1182 i32 0, ;; Line number | |
1183 i64 64, ;; Size in Bits | |
1184 i64 64, ;; Align in Bits | |
1185 i64 0, ;; Offset in Bits | |
1186 i32 0, ;; Flags | |
1187 i32 5 ;; Encoding | |
1188 } | |
1189 | |
1190 unsigned long long | |
1191 ^^^^^^^^^^^^^^^^^^ | |
1192 | |
1193 .. code-block:: llvm | |
1194 | |
1195 !2 = metadata !{ | |
1196 i32 786468, ;; Tag | |
1197 null, ;; File | |
1198 null, ;; Context | |
1199 metadata !"long long unsigned int", | |
1200 i32 0, ;; Line number | |
1201 i64 64, ;; Size in Bits | |
1202 i64 64, ;; Align in Bits | |
1203 i64 0, ;; Offset in Bits | |
1204 i32 0, ;; Flags | |
1205 i32 7 ;; Encoding | |
1206 } | |
1207 | |
1208 float | |
1209 ^^^^^ | |
1210 | |
1211 .. code-block:: llvm | |
1212 | |
1213 !2 = metadata !{ | |
1214 i32 786468, ;; Tag | |
1215 null, ;; File | |
1216 null, ;; Context | |
1217 metadata !"float", | |
1218 i32 0, ;; Line number | |
1219 i64 32, ;; Size in Bits | |
1220 i64 32, ;; Align in Bits | |
1221 i64 0, ;; Offset in Bits | |
1222 i32 0, ;; Flags | |
1223 i32 4 ;; Encoding | |
1224 } | |
1225 | |
1226 double | |
1227 ^^^^^^ | |
1228 | |
1229 .. code-block:: llvm | |
1230 | |
1231 !2 = metadata !{ | |
1232 i32 786468, ;; Tag | |
1233 null, ;; File | |
1234 null, ;; Context | |
1235 metadata !"double",;; Name | |
1236 i32 0, ;; Line number | |
1237 i64 64, ;; Size in Bits | |
1238 i64 64, ;; Align in Bits | |
1239 i64 0, ;; Offset in Bits | |
1240 i32 0, ;; Flags | |
1241 i32 4 ;; Encoding | |
1242 } | |
1243 | |
1244 C/C++ derived types | |
1245 ------------------- | |
1246 | |
1247 Given the following as an example of C/C++ derived type: | |
1248 | |
1249 .. code-block:: c | |
1250 | |
1251 typedef const int *IntPtr; | |
1252 | |
1253 a C/C++ front-end would generate the following descriptors: | |
1254 | |
1255 .. code-block:: llvm | |
1256 | |
1257 ;; | |
1258 ;; Define the typedef "IntPtr". | |
1259 ;; | |
1260 !2 = metadata !{ | |
1261 i32 786454, ;; Tag | |
1262 metadata !3, ;; File | |
1263 metadata !1, ;; Context | |
1264 metadata !"IntPtr", ;; Name | |
1265 i32 0, ;; Line number | |
1266 i64 0, ;; Size in bits | |
1267 i64 0, ;; Align in bits | |
1268 i64 0, ;; Offset in bits | |
1269 i32 0, ;; Flags | |
1270 metadata !4 ;; Derived From type | |
1271 } | |
1272 ;; | |
1273 ;; Define the pointer type. | |
1274 ;; | |
1275 !4 = metadata !{ | |
1276 i32 786447, ;; Tag | |
1277 null, ;; File | |
1278 null, ;; Context | |
1279 metadata !"", ;; Name | |
1280 i32 0, ;; Line number | |
1281 i64 64, ;; Size in bits | |
1282 i64 64, ;; Align in bits | |
1283 i64 0, ;; Offset in bits | |
1284 i32 0, ;; Flags | |
1285 metadata !5 ;; Derived From type | |
1286 } | |
1287 ;; | |
1288 ;; Define the const type. | |
1289 ;; | |
1290 !5 = metadata !{ | |
1291 i32 786470, ;; Tag | |
1292 null, ;; File | |
1293 null, ;; Context | |
1294 metadata !"", ;; Name | |
1295 i32 0, ;; Line number | |
1296 i64 0, ;; Size in bits | |
1297 i64 0, ;; Align in bits | |
1298 i64 0, ;; Offset in bits | |
1299 i32 0, ;; Flags | |
1300 metadata !6 ;; Derived From type | |
1301 } | |
1302 ;; | |
1303 ;; Define the int type. | |
1304 ;; | |
1305 !6 = metadata !{ | |
1306 i32 786468, ;; Tag | |
1307 null, ;; File | |
1308 null, ;; Context | |
1309 metadata !"int", ;; Name | |
1310 i32 0, ;; Line number | |
1311 i64 32, ;; Size in bits | |
1312 i64 32, ;; Align in bits | |
1313 i64 0, ;; Offset in bits | |
1314 i32 0, ;; Flags | |
1315 i32 5 ;; Encoding | |
1316 } | |
1317 | |
1318 C/C++ struct/union types | |
1319 ------------------------ | |
1320 | |
1321 Given the following as an example of C/C++ struct type: | |
1322 | |
1323 .. code-block:: c | |
1324 | |
1325 struct Color { | |
1326 unsigned Red; | |
1327 unsigned Green; | |
1328 unsigned Blue; | |
1329 }; | |
1330 | |
1331 a C/C++ front-end would generate the following descriptors: | |
1332 | |
1333 .. code-block:: llvm | |
1334 | |
1335 ;; | |
1336 ;; Define basic type for unsigned int. | |
1337 ;; | |
1338 !5 = metadata !{ | |
1339 i32 786468, ;; Tag | |
1340 null, ;; File | |
1341 null, ;; Context | |
1342 metadata !"unsigned int", | |
1343 i32 0, ;; Line number | |
1344 i64 32, ;; Size in Bits | |
1345 i64 32, ;; Align in Bits | |
1346 i64 0, ;; Offset in Bits | |
1347 i32 0, ;; Flags | |
1348 i32 7 ;; Encoding | |
1349 } | |
1350 ;; | |
1351 ;; Define composite type for struct Color. | |
1352 ;; | |
1353 !2 = metadata !{ | |
1354 i32 786451, ;; Tag | |
1355 metadata !1, ;; Compile unit | |
1356 null, ;; Context | |
1357 metadata !"Color", ;; Name | |
1358 i32 1, ;; Line number | |
1359 i64 96, ;; Size in bits | |
1360 i64 32, ;; Align in bits | |
1361 i64 0, ;; Offset in bits | |
1362 i32 0, ;; Flags | |
1363 null, ;; Derived From | |
1364 metadata !3, ;; Elements | |
1365 i32 0, ;; Runtime Language | |
1366 null, ;; Base type containing the vtable pointer for this type | |
1367 null ;; Template parameters | |
1368 } | |
1369 | |
1370 ;; | |
1371 ;; Define the Red field. | |
1372 ;; | |
1373 !4 = metadata !{ | |
1374 i32 786445, ;; Tag | |
1375 metadata !1, ;; File | |
1376 metadata !1, ;; Context | |
1377 metadata !"Red", ;; Name | |
1378 i32 2, ;; Line number | |
1379 i64 32, ;; Size in bits | |
1380 i64 32, ;; Align in bits | |
1381 i64 0, ;; Offset in bits | |
1382 i32 0, ;; Flags | |
1383 metadata !5 ;; Derived From type | |
1384 } | |
1385 | |
1386 ;; | |
1387 ;; Define the Green field. | |
1388 ;; | |
1389 !6 = metadata !{ | |
1390 i32 786445, ;; Tag | |
1391 metadata !1, ;; File | |
1392 metadata !1, ;; Context | |
1393 metadata !"Green", ;; Name | |
1394 i32 3, ;; Line number | |
1395 i64 32, ;; Size in bits | |
1396 i64 32, ;; Align in bits | |
1397 i64 32, ;; Offset in bits | |
1398 i32 0, ;; Flags | |
1399 metadata !5 ;; Derived From type | |
1400 } | |
1401 | |
1402 ;; | |
1403 ;; Define the Blue field. | |
1404 ;; | |
1405 !7 = metadata !{ | |
1406 i32 786445, ;; Tag | |
1407 metadata !1, ;; File | |
1408 metadata !1, ;; Context | |
1409 metadata !"Blue", ;; Name | |
1410 i32 4, ;; Line number | |
1411 i64 32, ;; Size in bits | |
1412 i64 32, ;; Align in bits | |
1413 i64 64, ;; Offset in bits | |
1414 i32 0, ;; Flags | |
1415 metadata !5 ;; Derived From type | |
1416 } | |
1417 | |
1418 ;; | |
1419 ;; Define the array of fields used by the composite type Color. | |
1420 ;; | |
1421 !3 = metadata !{metadata !4, metadata !6, metadata !7} | |
1422 | |
1423 C/C++ enumeration types | |
1424 ----------------------- | |
1425 | |
1426 Given the following as an example of C/C++ enumeration type: | |
1427 | |
1428 .. code-block:: c | |
1429 | |
1430 enum Trees { | |
1431 Spruce = 100, | |
1432 Oak = 200, | |
1433 Maple = 300 | |
1434 }; | |
1435 | |
1436 a C/C++ front-end would generate the following descriptors: | |
1437 | |
1438 .. code-block:: llvm | |
1439 | |
1440 ;; | |
1441 ;; Define composite type for enum Trees | |
1442 ;; | |
1443 !2 = metadata !{ | |
1444 i32 786436, ;; Tag | |
1445 metadata !1, ;; File | |
1446 metadata !1, ;; Context | |
1447 metadata !"Trees", ;; Name | |
1448 i32 1, ;; Line number | |
1449 i64 32, ;; Size in bits | |
1450 i64 32, ;; Align in bits | |
1451 i64 0, ;; Offset in bits | |
1452 i32 0, ;; Flags | |
1453 null, ;; Derived From type | |
1454 metadata !3, ;; Elements | |
1455 i32 0 ;; Runtime language | |
1456 } | |
1457 | |
1458 ;; | |
1459 ;; Define the array of enumerators used by composite type Trees. | |
1460 ;; | |
1461 !3 = metadata !{metadata !4, metadata !5, metadata !6} | |
1462 | |
1463 ;; | |
1464 ;; Define Spruce enumerator. | |
1465 ;; | |
1466 !4 = metadata !{i32 786472, metadata !"Spruce", i64 100} | |
1467 | |
1468 ;; | |
1469 ;; Define Oak enumerator. | |
1470 ;; | |
1471 !5 = metadata !{i32 786472, metadata !"Oak", i64 200} | |
1472 | |
1473 ;; | |
1474 ;; Define Maple enumerator. | |
1475 ;; | |
1476 !6 = metadata !{i32 786472, metadata !"Maple", i64 300} | |
1477 | 1034 |
1478 Debugging information format | 1035 Debugging information format |
1479 ============================ | 1036 ============================ |
1480 | 1037 |
1481 Debugging Information Extension for Objective C Properties | 1038 Debugging Information Extension for Objective C Properties |
1655 +--------------------------------+--------+-----------+ | 1212 +--------------------------------+--------+-----------+ |
1656 | 1213 |
1657 New DWARF Constants | 1214 New DWARF Constants |
1658 ^^^^^^^^^^^^^^^^^^^ | 1215 ^^^^^^^^^^^^^^^^^^^ |
1659 | 1216 |
1660 +--------------------------------+-------+ | 1217 +--------------------------------------+-------+ |
1661 | Name | Value | | 1218 | Name | Value | |
1662 +================================+=======+ | 1219 +======================================+=======+ |
1663 | DW_AT_APPLE_PROPERTY_readonly | 0x1 | | 1220 | DW_APPLE_PROPERTY_readonly | 0x01 | |
1664 +--------------------------------+-------+ | 1221 +--------------------------------------+-------+ |
1665 | DW_AT_APPLE_PROPERTY_readwrite | 0x2 | | 1222 | DW_APPLE_PROPERTY_getter | 0x02 | |
1666 +--------------------------------+-------+ | 1223 +--------------------------------------+-------+ |
1667 | DW_AT_APPLE_PROPERTY_assign | 0x4 | | 1224 | DW_APPLE_PROPERTY_assign | 0x04 | |
1668 +--------------------------------+-------+ | 1225 +--------------------------------------+-------+ |
1669 | DW_AT_APPLE_PROPERTY_retain | 0x8 | | 1226 | DW_APPLE_PROPERTY_readwrite | 0x08 | |
1670 +--------------------------------+-------+ | 1227 +--------------------------------------+-------+ |
1671 | DW_AT_APPLE_PROPERTY_copy | 0x10 | | 1228 | DW_APPLE_PROPERTY_retain | 0x10 | |
1672 +--------------------------------+-------+ | 1229 +--------------------------------------+-------+ |
1673 | DW_AT_APPLE_PROPERTY_nonatomic | 0x20 | | 1230 | DW_APPLE_PROPERTY_copy | 0x20 | |
1674 +--------------------------------+-------+ | 1231 +--------------------------------------+-------+ |
1232 | DW_APPLE_PROPERTY_nonatomic | 0x40 | | |
1233 +--------------------------------------+-------+ | |
1234 | DW_APPLE_PROPERTY_setter | 0x80 | | |
1235 +--------------------------------------+-------+ | |
1236 | DW_APPLE_PROPERTY_atomic | 0x100 | | |
1237 +--------------------------------------+-------+ | |
1238 | DW_APPLE_PROPERTY_weak | 0x200 | | |
1239 +--------------------------------------+-------+ | |
1240 | DW_APPLE_PROPERTY_strong | 0x400 | | |
1241 +--------------------------------------+-------+ | |
1242 | DW_APPLE_PROPERTY_unsafe_unretained | 0x800 | | |
1243 +--------------------------------+-----+-------+ | |
1675 | 1244 |
1676 Name Accelerator Tables | 1245 Name Accelerator Tables |
1677 ----------------------- | 1246 ----------------------- |
1678 | 1247 |
1679 Introduction | 1248 Introduction |
2236 * DW_TAG_ptr_to_member_type | 1805 * DW_TAG_ptr_to_member_type |
2237 * DW_TAG_set_type | 1806 * DW_TAG_set_type |
2238 * DW_TAG_subrange_type | 1807 * DW_TAG_subrange_type |
2239 * DW_TAG_base_type | 1808 * DW_TAG_base_type |
2240 * DW_TAG_const_type | 1809 * DW_TAG_const_type |
2241 * DW_TAG_constant | |
2242 * DW_TAG_file_type | 1810 * DW_TAG_file_type |
2243 * DW_TAG_namelist | 1811 * DW_TAG_namelist |
2244 * DW_TAG_packed_type | 1812 * DW_TAG_packed_type |
2245 * DW_TAG_volatile_type | 1813 * DW_TAG_volatile_type |
2246 * DW_TAG_restrict_type | 1814 * DW_TAG_restrict_type |