llvm.org GIT mirror llvm / cec12a5
Bring debugging information up to date. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26759 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Laskey 13 years ago
1 changed file(s) with 1313 addition(s) and 783 deletion(s). Raw diff Collapse all Expand all
1616
1717
  • Philosophy behind LLVM debugging information
  • 1818
  • Debugging optimized code
  • 19
  • Future work
  • 2019
    21
  • Using the llvm-db tool
  • 22
    23
  • Limitations of llvm-db
  • 24
  • A sample llvm-db session
  • 25
  • Starting the debugger
  • 26
  • Commands recognized by the debugger
  • 27
    28
    29
  • Architecture of the LLVM debugger
  • 30
    31
  • The Debugger and InferiorProcess classes
  • 32
  • The RuntimeInfo, ProgramInfo, and SourceLanguage classes
  • 33
  • The llvm-db tool
  • 34
  • Short-term TODO list
  • 35
    36
    3720
  • Debugging information format
  • 3821
    39
  • Anchors for global objects
  • 40
  • Representing stopping points in the source program
  • 41
  • Object lifetimes and scoping
  • 42
  • Object descriptor formats
  • 22
  • Debug information descriptors
  • 4323
    44
  • Representation of source files
  • 45
  • Representation of program objects
  • 46
  • Program object contexts
  • 24
  • Anchor descriptors
  • 25
  • Compile unit descriptors
  • 26
  • Global variable descriptors
  • 27
  • Subprogram descriptors
  • 28
  • Basic type descriptors
  • 29
  • Derived type descriptors
  • 30
  • Composite type descriptors
  • 31
  • Subrange descriptors
  • 32
  • Enumerator descriptors
  • 4733
    48
  • Debugger intrinsic functions
  • 49
  • Values for debugger tags>
  • 34
  • Debugger intrinsic functions>
  • 35
    36
  • llvm.dbg.stoppoint
  • 37
  • llvm.dbg.func.start
  • 38
  • llvm.dbg.region.start
  • 39
  • llvm.dbg.region.end
  • 40
  • llvm.dbg.declare
  • 41
    42
  • Representing stopping points in the
  • 43 source program
    5044
    5145
  • C/C++ front-end specific debug information
  • 5246
    53
  • Program Scope Entries
  • 54
    55
  • Compilation unit entries
  • 56
  • Module, namespace, and importing entries
  • 57
    58
  • Data objects (program variables)
  • 47
  • C/C++ source file information
  • 48
  • C/C++ global variable information
  • 49
  • C/C++ function information
  • 50
  • C/C++ basic types
  • 51
  • C/C++ derived types
  • 52
  • C/C++ struct/union types
  • 53
  • C/C++ enumeration types
  • 5954
    6055
    6156
    6661
    6762 6863
    69

    Written by Chris Lattner

    64

    Written by Chris Lattner 65 and Jim Laskey

    7066
    7167 7268 7773
    7874 7975

    This document is the central repository for all information pertaining to 80 debug information in LLVM. It describes the user 81 interface for the llvm-db tool, which provides a 82 powerful source-level debugger 83 to users of LLVM-based compilers. It then describes the 84 href="#architecture">various components that make up the debugger and the 85 libraries which future clients may use. Finally, it describes the 86 href="#format">actual format that the LLVM debug information takes, 87 which is useful for those interested in creating front-ends or dealing directly 88 with the information.

    76 debug information in LLVM. It describes the actual format 77 that the LLVM debug information takes, which is useful for those interested 78 in creating front-ends or dealing directly with the information. Further, this 79 document provides specifc examples of what debug information for C/C++.

    8980 9081
    9182 132123 currently uses working draft 7 of the 133124 href="http://www.eagercon.com/dwarf/dwarf3std.htm">Dwarf 3 standard).

    134125 135

    When a program is debugged, the debugger interacts with the user and turns 136 the stored debug information into source-language specific information. As 137 such, the debugger must be aware of the source-language, and is thus tied to a 138 specific language of family of languages. The LLVM 139 debugger is designed to be modular in its support for source-languages.

    140 141
    142 126

    When a program is being debugged, a debugger interacts with the user and 127 turns the stored debug information into source-language specific information. 128 As such, the debugger must be aware of the source-language, and is thus tied to 129 a specific language of family of languages.

    130 131
    143132 144133 145134 196185 197 198 201 202
    203

    There are several important extensions that could be eventually added to the 204 LLVM debugger. The most important extension would be to upgrade the LLVM code 205 generators to support debugging information. This would also allow, for 206 example, the X86 code generator to emit native objects that contain debugging 207 information consumable by traditional source-level debuggers like GDB or 208 DBX.

    209 210

    Additionally, LLVM optimizations can be upgraded to incrementally update the 211 debugging information, new commands can be added to the 212 debugger, and thread support could be added to the debugger.

    213 214

    The "SourceLanguage" modules provided by llvm-db could be 215 substantially improved to provide good support for C++ language features like 216 namespaces and scoping rules.

    217 218

    After working with the debugger for a while, perhaps the nicest improvement 219 would be to add some sort of line editor, such as GNU readline (but one that is 220 compatible with the LLVM license).

    221 222

    For someone so inclined, it should be straight-forward to write different 223 front-ends for the LLVM debugger, as the LLVM debugging engine is cleanly 224 separated from the llvm-db front-end. A new LLVM GUI debugger or IDE 225 would be nice.

    226 227
    228 229 230 233 234 235
    236 237

    The llvm-db tool provides a GDB-like interface for source-level 238 debugging of programs. This tool provides many standard commands for inspecting 239 and modifying the program as it executes, loading new programs, single stepping, 240 placing breakpoints, etc. This section describes how to use the debugger.

    241 242

    llvm-db has been designed to be as similar to GDB in its user 243 interface as possible. This should make it extremely easy to learn 244 llvm-db if you already know GDB. In general, llvm-db 245 provides the subset of GDB commands that are applicable to LLVM debugging users. 246 If there is a command missing that make a reasonable amount of sense within the 247 limitations of llvm-db, please report it as 248 a bug or, better yet, submit a patch to add it.

    249 250
    251 252 253 256 257
    258 259

    llvm-db is designed to be modular and easy to extend. This 260 extensibility was key to getting the debugger up-and-running quickly, because we 261 can start with simple-but-unsophisicated implementations of various components. 262 Because of this, it is currently missing many features, though they should be 263 easy to add over time (patches welcomed!). The biggest inherent limitations of 264 llvm-db are currently due to extremely simple 265 href="#arch_debugger">debugger backend (implemented in 266 "lib/Debugger/UnixLocalInferiorProcess.cpp") which is designed to work without 267 any cooperation from the code generators. Because it is so simple, it suffers 268 from the following inherent limitations:

    269 270
      271 272
    • Running a program in llvm-db is a bit slower than running it with 273 lli (i.e., in the JIT).
    • 274 275
    • Inspection of the target hardware is not supported. This means that you 276 cannot, for example, print the contents of X86 registers.
    • 277 278
    • Inspection of LLVM code is not supported. This means that you cannot print 279 the contents of arbitrary LLVM values, or use commands such as stepi. 280 This also means that you cannot debug code without debug information.
    • 281 282
    • Portions of the debugger run in the same address space as the program being 283 debugged. This means that memory corruption by the program could trample on 284 portions of the debugger.
    • 285 286
    • Attaching to existing processes and core files is not currently 287 supported.
    • 288 289
    290 291

    That said, the debugger is still quite useful, and all of these limitations 292 can be eliminated by integrating support for the debugger into the code 293 generators, and writing a new InferiorProcess 294 subclass to use it. See the future work section for ideas 295 of how to extend the LLVM debugger despite these limitations.

    296 297
    298 299 300 301 304 305
    306 307

    TODO: this is obviously lame, when more is implemented, this can be much 308 better.

    309 310
    
                      
                    
    
                  311
                      $ llvm-db funccall
    
                      
                    
    
                  312
                      llvm-db: The LLVM source-level debugger
    
                      
                    
    
                  313
                      Loading program... successfully loaded 'funccall.bc'!
    
                      
                    
    
                  314
                      (llvm-db) create
    
                      
                    
    
                  315
                      Starting program: funccall.bc
    
                      
                    
    
                  316
                      main at funccall.c:9:2
    
                      
                    
    
                  317
                      9 ->            q = 0;
    
                      
                    
    
                  318
                      (llvm-db) list main
    
                      
                    
    
                  319
                      4       void foo() {
    
                      
                    
    
                  320
                      5               int t = q;
    
                      
                    
    
                  321
                      6               q = t + 1;
    
                      
                    
    
                  322
                      7       }
    
                      
                    
    
                  323
                      8       int main() {
    
                      
                    
    
                  324
                      9 ->            q = 0;
    
                      
                    
    
                  325
                      10              foo();
    
                      
                    
    
                  326
                      11              q = q - 1;
    
                      
                    
    
                  327
                      12
    
                      
                    
    
                  328
                      13              return q;
    
                      
                    
    
                  329
                      (llvm-db) list
    
                      
                    
    
                  330
                      14      }
    
                      
                    
    
                  331
                      (llvm-db) step
    
                      
                    
    
                  332
                      10 ->           foo();
    
                      
                    
    
                  333
                      (llvm-db) s
    
                      
                    
    
                  334
                      foo at funccall.c:5:2
    
                      
                    
    
                  335
                      5 ->            int t = q;
    
                      
                    
    
                  336
                      (llvm-db) bt
    
                      
                    
    
                  337
                      #0 ->   0x85ffba0 in foo at funccall.c:5:2
    
                      
                    
    
                  338
                      #1      0x85ffd98 in main at funccall.c:10:2
    
                      
                    
    
                  339
                      (llvm-db) finish
    
                      
                    
    
                  340
                      main at funccall.c:11:2
    
                      
                    
    
                  341
                      11 ->           q = q - 1;
    
                      
                    
    
                  342
                      (llvm-db) s
    
                      
                    
    
                  343
                      13 ->           return q;
    
                      
                    
    
                  344
                      (llvm-db) s
    
                      
                    
    
                  345
                      The program stopped with exit code 0
    
                      
                    
    
                  346
                      (llvm-db) quit
    
                      
                    
    
                  347
                      $
    
                      
                    
    
                  348
                      
    349 350
    351 352 353 354 355 358 359
    360 361

    There are three ways to start up the llvm-db debugger:

    362 363

    When run with no options, just llvm-db, the debugger starts up 364 without a program loaded at all. You must use the 365 href="#c_file">file command to load a program, and the 366 href="#c_set_args">set args or run 367 commands to specify the arguments for the program.

    368 369

    If you start the debugger with one argument, as llvm-db 370 <program>, the debugger will start up and load in the specified 371 program. You can then optionally specify arguments to the program with the 372 href="#c_set_args">set args or run 373 commands.

    374 375

    The third way to start the program is with the --args option. This 376 option allows you to specify the program to load and the arguments to start out 377 with. Example use: llvm-db --args ls /home

    379 380
    381 382 383 386 387
    388 389

    FIXME: this needs work obviously. See the 390 href="http://sources.redhat.com/gdb/documentation/">GDB documentation for 391 information about what these do, or try 'help [command]' within 392 llvm-db to get information.

    393 394

    395

    General usage:

    396 401 402

    Program inspection and interaction:

    403
      404
    • create (start the program, stopping it ASAP in main)
    • 405
    • kill
    • 406
    • run [args]
    • 407
    • step [num]
    • 408
    • next [num]
    • 409
    • cont
    • 410
    • finish
    • 411 412
    • list [start[, end]]
    • 413
    • info source
    • 414
    • info sources
    • 415
    • info functions
    • 416
    417 418

    Call stack inspection:

    419 425 426 427

    Debugger inspection and interaction:

    428
      429
    • info target
    • 430
    • show prompt
    • 431
    • set prompt
    • 432
    • show listsize
    • 433
    • set listsize
    • 434
    • show language
    • 435
    • set language
    • 436
    • show args
    • 437
    • set args [args]
    • 438
    439 440

    TODO:

    441 456 457
    458 459 460 463 464 465
    466

    The LLVM debugger is built out of three distinct layers of software. These 467 layers provide clients with different interface options depending on what pieces 468 of they want to implement themselves, and it also promotes code modularity and 469 good design. The three layers are the Debugger 470 interface, the "info" interfaces, and the 471 href="#arch_llvm-db">llvm-db tool itself.

    472
    473 474 475 478 479
    480

    The Debugger class (defined in the include/llvm/Debugger/ directory) 481 is a low-level class which is used to maintain information about the loaded 482 program, as well as start and stop the program running as necessary. This class 483 does not provide any high-level analysis or control over the program, only 484 exposing simple interfaces like load/unloadProgram, 485 create/killProgram, step/next/finish/contProgram, and 486 low-level methods for installing breakpoints.

    487 488

    489 The Debugger class is itself a wrapper around the lowest-level InferiorProcess 490 class. This class is used to represent an instance of the program running under 491 debugger control. The InferiorProcess class can be implemented in different 492 ways for different targets and execution scenarios (e.g., remote debugging). 493 The InferiorProcess class exposes a small and simple collection of interfaces 494 which are useful for inspecting the current state of the program (such as 495 collecting stack trace information, reading the memory image of the process, 496 etc). The interfaces in this class are designed to be as low-level and simple 497 as possible, to make it easy to create new instances of the class. 498

    499 500

    501 The Debugger class exposes the currently active instance of InferiorProcess 502 through the Debugger::getRunningProcess method, which returns a 503 const reference to the class. This means that clients of the Debugger 504 class can only inspect the running instance of the program directly. To 505 change the executing process in some way, they must use the interces exposed by 506 the Debugger class. 507

    508
    509 510 511 514 515
    516

    517 The next-highest level of debugger abstraction is provided through the 518 ProgramInfo, RuntimeInfo, SourceLanguage and related classes (also defined in 519 the include/llvm/Debugger/ directory). These classes efficiently 520 decode the debugging information and low-level interfaces exposed by 521 InferiorProcess into a higher-level representation, suitable for analysis by the 522 debugger. 523

    524 525

    526 The ProgramInfo class exposes a variety of different kinds of information about 527 the program objects in the source-level-language. The SourceFileInfo class 528 represents a source-file in the program (e.g. a .cpp or .h file). The 529 SourceFileInfo class captures information such as which SourceLanguage was used 530 to compile the file, where the debugger can get access to the actual file text 531 (which is lazily loaded on demand), etc. The SourceFunctionInfo class 532 represents a... FIXME: finish. The ProgramInfo class provides interfaces 533 to lazily find and decode the information needed to create the Source*Info 534 classes requested by the debugger. 535

    536 537

    538 The RuntimeInfo class exposes information about the currently executed program, 539 by decoding information from the InferiorProcess and ProgramInfo classes. It 540 provides a StackFrame class which provides an easy-to-use interface for 541 inspecting the current and suspended stack frames in the program. 542

    543 544

    545 The SourceLanguage class is an abstract interface used by the debugger to 546 perform all source-language-specific tasks. For example, this interface is used 547 by the ProgramInfo class to decode language-specific types and functions and by 548 the debugger front-end (such as llvm-db to 549 evaluate source-langauge expressions typed into the debugger. This class uses 550 the RuntimeInfo & ProgramInfo classes to get information about the current 551 execution context and the loaded program, respectively. 552

    553 554
    555 556 557 560 561
    562

    563 The llvm-db is designed to be a debugger providing an interface as 564 href="#llvm-db">similar to GDB as reasonable, but no more so than that. 565 Because the Debugger and 566 href="#arch_info">info classes implement all of the heavy lifting and 567 analysis, llvm-db (which lives in llvm/tools/llvm-db) consists 568 mainly of of code to interact with the user and parse commands. The CLIDebugger 569 constructor registers all of the builtin commands for the debugger, and each 570 command is implemented as a CLIDebugger::[name]Command method. 571

    572
    573 574 575 576 579 580
    581 582

    583 FIXME: this section will eventually go away. These are notes to myself of 584 things that should be implemented, but haven't yet. 585

    586 587

    588 Breakpoints: Support is already implemented in the 'InferiorProcess' 589 class, though it hasn't been tested yet. To finish breakpoint support, we need 590 to implement breakCommand (which should reuse the linespec parser from the list 591 command), and handle the fact that 'break foo' or 'break file.c:53' may insert 592 multiple breakpoints. Also, if you say 'break file.c:53' and there is no 593 stoppoint on line 53, the breakpoint should go on the next available line. My 594 idea was to have the Debugger class provide a "Breakpoint" class which 595 encapsulated this messiness, giving the debugger front-end a simple interface. 596 The debugger front-end would have to map the really complex semantics of 597 temporary breakpoints and 'conditional' breakpoints onto this intermediate 598 level. Also, breakpoints should survive as much as possible across program 599 reloads. 600

    601 602

    603 UnixLocalInferiorProcess.cpp speedup: There is no reason for the debugged 604 process to code gen the globals corresponding to debug information. The 605 IntrinsicLowering object could instead change descriptors into constant expr 606 casts of the constant address of the LLVM objects for the descriptors. This 607 would also allow us to eliminate the mapping back and forth between physical 608 addresses that must be done.

    609 610

    611 Process deaths: The InferiorProcessDead exception should be extended to 612 know "how" a process died, i.e., it was killed by a signal. This is easy to 613 collect in the UnixLocalInferiorProcess, we just need to represent it.

    614 615
    616 617186 618187
    619188 Debugging information format 640209 -globaldce pass), the extraneous debug information will automatically 641210 become dead and be removed by the optimizer.

    642211 643

    The debugger is designed to be agnostic about the contents of most of the 644 debugging information. It uses a source-language-specific 645 module to decode the information that represents variables, types, 646 functions, namespaces, etc: this allows for arbitrary source-language semantics 647 and type-systems to be used, as long as there is a module written for the 648 debugger to interpret the information.

    212

    Debug information is designed to be agnostic about the target debugger and 213 debugging information representation (e.g. DWARF/Stabs/etc). It uses a generic 214 machine debug information pass to decode the information that represents 215 variables, types, functions, namespaces, etc: this allows for arbitrary 216 source-language semantics and type-systems to be used, as long as there is a 217 module written for the target debugger to interpret the information. In 218 addition, debug global variables are declared in the "llvm.metadata" 219 section. All values declared in this section are stripped away after target 220 debug information is constructed and before the program object is emitted.

    649221 650222

    To provide basic functionality, the LLVM debugger does have to make some 651223 assumptions about the source-level language being debugged, though it keeps 652224 these to a minimum. The only common features that the LLVM debugger assumes 653 exist are source files, and 654 href="#format_program_objects">program objects. These abstract objects are 225 exist are source files, and 226 href="#format_global_variables">program objects. These abstract objects are 655227 used by the debugger to form stack traces, show information about local 656228 variables, etc.

    657229 663235 664236 665237 668 669 240 241
    242

    In consideration of the complexity and volume of debug information, LLVM 243 provides a specification for well formed debug global variables. The constant 244 value of each of these globals is one of a limited set of structures, known as 245 debug descriptors.

    246 247

    Consumers of LLVM debug information expect the descriptors for program 248 objects to start in a canonical format, but the descriptors can include 249 additional information appended at the end that is source-language specific. 250 All LLVM debugging information is versioned, allowing backwards compatibility in 251 the case that the core structures need to change in some way. Also, all 252 debugging information objects start with a tag to indicate what type of object 253 it is. The source-language is allowed to define its own objects, by using 254 unreserved tag numbers.

    255 256

    The fields of debug descriptors used internally by LLVM (MachineDebugInfo) 257 are restricted to only the simple data types int, uint, 258 bool, float, double, sbyte* and { }* 259 . References to arbitrary values are handled using a { }* and a 260 cast to { }* expression; typically references to other field 261 descriptors, arrays of descriptors or global variables.

    262 263
    
                      
                    
    
                  264
                    
                        %llvm.dbg.object.type = type {
    
                      
                    
    
                  265
                    
                          uint,   ;; A tag
    
                      
                    
    
                  266
                    
                          ...
    
                      
                    
    
                  267
                    
                        }
    
                      
                    
    
                  268
                    
                      
    269 270

    The first field of a descriptor is always an uint containing a tag 271 value identifying the content of the descriptor. The remaining fields are 272 specific to the descriptor. The values of tags are loosely bound to the tag 273 values of Dwarf information entries. However, that does not restrict the use of 274 the information supplied to Dwarf targets.

    275 276

    The details of the various descriptors follow.

    277 278
    279 280 281 284 285
    286 287
    
                      
                    
    
                  288
                    
                        %llvm.dbg.anchor.type = type {
    
                      
                    
    
                  289
                    
                          uint,   ;; Tag = 0
    
                      
                    
    
                  290
                    
                          uint    ;; Tag of descriptors grouped by the anchor
    
                      
                    
    
                  291
                    
                        }
    
                      
                    
    
                  292
                    
                      
    293 670294

    One important aspect of the LLVM debug representation is that it allows the 671295 LLVM debugger to efficiently index all of the global objects without having the 672 scan the program. To do this, all of the global objects use "anchor" globals of 673 type "{}", with designated names. These anchor objects obviously do 674 not contain any content or meaning by themselves, but all of the global objects 675 of a particular type (e.g., source file descriptors) contain a pointer to the 676 anchor. This pointer allows the debugger to use def-use chains to find all 677 global objects of that type.

    678 679

    So far, the following names are recognized as anchors by the LLVM 680 debugger:

    681 682
    
                      
                    
    
                  683
                        %llvm.dbg.translation_units = linkonce global {} {}
    
                      
                    
    
                  684
                        %llvm.dbg.globals         = linkonce global {} {}
    
                      
                    
    
                  685
                      
    686 687

    Using anchors in this way (where the source file descriptor points to the 688 anchors, as opposed to having a list of source file descriptors) allows for the 296 scan the program. To do this, all of the global objects use "anchor" 297 descriptors with designated names. All of the global objects of a particular 298 type (e.g., compile units) contain a pointer to the anchor. This pointer allows 299 the debugger to use def-use chains to find all global objects of that type.

    300 301

    The following names are recognized as anchors by LLVM:

    302 303
    
                      
                    
    
                  304
                    
                        %llvm.dbg.compile_units       = linkonce constant %llvm.dbg.anchor.type  { uint 0, uint 17 } ;; DW_TAG_compile_unit
    
                      
                    
    
                  305
                    
                        %llvm.dbg.global_variables    = linkonce constant %llvm.dbg.anchor.type  { uint 0, uint 52 } ;; DW_TAG_variable
    
                      
                    
    
                  306
                    
                        %llvm.dbg.subprograms         = linkonce constant %llvm.dbg.anchor.type  { uint 0, uint 46 } ;; DW_TAG_subprogram
    
                      
                    
    
                  307
                    
                      
    308 309

    Using anchors in this way (where the compile unit descriptor points to the 310 anchors, as opposed to having a list of compile unit descriptors) allows for the 689311 standard dead global elimination and merging passes to automatically remove 690312 unused debugging information. If the globals were kept track of through lists, 691313 there would always be an object pointing to the descriptors, thus would never be 694316

    695317 696318 319 322 323
    324 325
    
                      
                    
    
                  326
                    
                        %llvm.dbg.compile_unit.type = type {
    
                      
                    
    
                  327
                    
                          uint,   ;; Tag = 17 (DW_TAG_compile_unit)
    
                      
                    
    
                  328
                    
                          {  }*,  ;; Compile unit anchor = cast = (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to {  }*)
    
                      
                    
    
                  329
                    
                          uint,   ;; LLVM debug version number = 1
    
                      
                    
    
                  330
                    
                          uint,   ;; Dwarf language identifier (ex. DW_LANG_C89) 
    
                      
                    
    
                  331
                    
                          sbyte*, ;; Source file name
    
                      
                    
    
                  332
                    
                          sbyte*, ;; Source file directory (includes trailing slash)
    
                      
                    
    
                  333
                    
                          sbyte*  ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
    
                      
                    
    
                  334
                    
                        }
    
                      
                    
    
                  335
                    
                      
    336 337

    These descriptors contain the version number for the debug info (currently 338 1), a source language ID for the file (we use the Dwarf 3.0 ID numbers, such as 339 DW_LANG_C89, DW_LANG_C_plus_plus, DW_LANG_Cobol74, 340 etc), three strings describing the filename, working directory of the compiler, 341 and an identifier string for the compiler that produced it.

    342 343

    Compile unit descriptors provide the root context for objects declared in a 344 specific source file. Global variables and top level functions would be defined 345 using this context. Compile unit descriptors also provide context for source 346 line correspondence.

    347 348
    349 350 351 354 355
    356 357
    
                      
                    
    
                  358
                    
                        %llvm.dbg.global_variable.type = type {
    
                      
                    
    
                  359
                    
                          uint,   ;; Tag = 52 (DW_TAG_variable)
    
                      
                    
    
                  360
                    
                          {  }*,  ;; Global variable anchor = cast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to {  }*),  
    
                      
                    
    
                  361
                    
                          {  }*,  ;; Reference to compile unit
    
                      
                    
    
                  362
                    
                          sbyte*, ;; Name
    
                      
                    
    
                  363
                    
                          {  }*,  ;; Reference to type descriptor
    
                      
                    
    
                  364
                    
                          bool,   ;; True if the global is local to compile unit (static)
    
                      
                    
    
                  365
                    
                          bool,   ;; True if the global is defined in the compile unit (not extern)
    
                      
                    
    
                  366
                    
                          {  }*,  ;; Reference to the global variable
    
                      
                    
    
                  367
                    
                          uint    ;; Line number in compile unit where variable is defined
    
                      
                    
    
                  368
                    
                        }
    
                      
                    
    
                  369
                    
                      
    370 371

    These descriptors provide debug information about globals variables. The 372 provide details such as name, type and where the variable is defined.

    373 374
    375 376 377 380 381
    382 383
    
                      
                    
    
                  384
                    
                        %llvm.dbg.subprogram.type = type {
    
                      
                    
    
                  385
                    
                          uint,   ;; Tag = 46 (DW_TAG_subprogram)
    
                      
                    
    
                  386
                    
                          {  }*,  ;; Subprogram anchor = cast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to {  }*),  
    
                      
                    
    
                  387
                    
                          {  }*,  ;; Reference to compile unit
    
                      
                    
    
                  388
                    
                          sbyte*, ;; Name
    
                      
                    
    
                  389
                    
                          {  }*,  ;; Reference to type descriptor
    
                      
                    
    
                  390
                    
                          bool,   ;; True if the global is local to compile unit (static)
    
                      
                    
    
                  391
                    
                          bool    ;; True if the global is defined in the compile unit (not extern)
    
                      
                    
    
                  392
                    
                          TODO - MORE TO COME
    
                      
                    
    
                  393
                    
                        }
    
                      
                    
    
                  394
                    
                      
    
                      
                    
    
                  395
                    
                      
    396 397

    These descriptors provide debug information about functions, methods and 398 subprograms. The provide details such as name, return and argument types and 399 where the subprogram is defined.

    400 401
    402 403 404 407 408
    409 410
    
                      
                    
    
                  411
                    
                        %llvm.dbg.basictype.type = type {
    
                      
                    
    
                  412
                    
                          uint,   ;; Tag = 36 (DW_TAG_base_type)
    
                      
                    
    
                  413
                    
                          {  }*,  ;; Reference to context (typically a compile unit)
    
                      
                    
    
                  414
                    
                          sbyte*, ;; Name (may be "" for anonymous types)
    
                      
                    
    
                  415
                    
                          {  }*,  ;; Reference to compile unit where defined (may be NULL)
    
                      
                    
    
                  416
                    
                          int,    ;; Line number where defined (may be 0)
    
                      
                    
    
                  417
                    
                          uint,   ;; Size in bits
    
                      
                    
    
                  418
                    
                          uint,   ;; Alignment in bits
    
                      
                    
    
                  419
                    
                          uint,   ;; Offset in bits
    
                      
                    
    
                  420
                    
                          uint    ;; Dwarf type encoding
    
                      
                    
    
                  421
                    
                        }
    
                      
                    
    
                  422
                    
                      
    423 424

    These descriptors define primitive types used in the code. Example int, bool 425 and float. The context provides the scope of the type, which is usually the top 426 level. Since basic types are not usually user defined the compile unit and line 427 number can be left as NULL and 0. The size, alignment and offset are expressed 428 in bits and can be 64 bit values. The alignment is used to round the offset 429 when embedded in a composite type 430 (example to keep float doubles on 64 bit boundaries.) The offset is the bit 431 offset if embedded in a composite 432 type.

    433 434

    The type encoding provides the details of the type. The values are typically 435 one of the following;

    436 437
    
                      
                    
    
                  438
                    
                        DW_ATE_address = 1
    
                      
                    
    
                  439
                    
                        DW_ATE_boolean = 2
    
                      
                    
    
                  440
                    
                        DW_ATE_float = 4
    
                      
                    
    
                  441
                    
                        DW_ATE_signed = 5
    
                      
                    
    
                  442
                    
                        DW_ATE_signed_char = 6
    
                      
                    
    
                  443
                    
                        DW_ATE_unsigned = 7
    
                      
                    
    
                  444
                    
                        DW_ATE_unsigned_char = 8
    
                      
                    
    
                  445
                    
                      
    446 447
    448 449 450 453 454
    455 456
    
                      
                    
    
                  457
                    
                        %llvm.dbg.derivedtype.type = type {
    
                      
                    
    
                  458
                    
                          uint,   ;; Tag (see below)
    
                      
                    
    
                  459
                    
                          {  }*,  ;; Reference to context
    
                      
                    
    
                  460
                    
                          sbyte*, ;; Name (may be "" for anonymous types)
    
                      
                    
    
                  461
                    
                          {  }*,  ;; Reference to compile unit where defined (may be NULL)
    
                      
                    
    
                  462
                    
                          int,    ;; Line number where defined (may be 0)
    
                      
                    
    
                  463
                    
                          uint,   ;; Size in bits
    
                      
                    
    
                  464
                    
                          uint,   ;; Alignment in bits
    
                      
                    
    
                  465
                    
                          uint,   ;; Offset in bits
    
                      
                    
    
                  466
                    
                          {  }*   ;; Reference to type derived from
    
                      
                    
    
                  467
                    
                        }
    
                      
                    
    
                  468
                    
                      
    469 470

    These descriptors are used to define types derived from other types. The 471 value of the tag varies depending on the meaning. The following are possible 472 tag values;

    473 474
    
                      
                    
    
                  475
                    
                        DW_TAG_member = 13
    
                      
                    
    
                  476
                    
                        DW_TAG_pointer_type = 15
    
                      
                    
    
                  477
                    
                        DW_TAG_reference_type = 16
    
                      
                    
    
                  478
                    
                        DW_TAG_typedef = 22
    
                      
                    
    
                  479
                    
                        DW_TAG_const_type = 38
    
                      
                    
    
                  480
                    
                        DW_TAG_volatile_type = 53
    
                      
                    
    
                  481
                    
                        DW_TAG_restrict_type = 55
    
                      
                    
    
                  482
                    
                      
    483 484

    DW_TAG_member is used to define a member of a 485 href="#format_composite_type">composite type. The type of the member is the 486 derived type.

    487 488

    DW_TAG_typedef is used to 489 provide a name for the derived type.

    490 491

    DW_TAG_pointer_type, 492 DW_TAG_reference_type, DW_TAG_const_type, 493 DW_TAG_volatile_type and DW_TAG_restrict_type are used to 494 qualify the derived type.

    495 496

    Derived type location can be determined 497 from the compile unit and line number. The size, alignment and offset are 498 expressed in bits and can be 64 bit values. The alignment is used to round the 499 offset when embedded in a composite type 500 (example to keep float doubles on 64 bit boundaries.) The offset is the bit 501 offset if embedded in a composite 502 type.

    503 504

    Note that the void * type is expressed as a 505 llvm.dbg.derivedtype.type with tag of DW_TAG_pointer_type and 506 NULL derived type.

    507 508
    509 510 511 514 515
    516 517
    
                      
                    
    
                  518
                    
                        %llvm.dbg.compositetype.type = type {
    
                      
                    
    
                  519
                    
                          uint,   ;; Tag (see below)
    
                      
                    
    
                  520
                    
                          {  }*,  ;; Reference to context
    
                      
                    
    
                  521
                    
                          sbyte*, ;; Name (may be "" for anonymous types)
    
                      
                    
    
                  522
                    
                          {  }*,  ;; Reference to compile unit where defined (may be NULL)
    
                      
                    
    
                  523
                    
                          int,    ;; Line number where defined (may be 0)
    
                      
                    
    
                  524
                    
                          uint,   ;; Size in bits
    
                      
                    
    
                  525
                    
                          uint,   ;; Alignment in bits
    
                      
                    
    
                  526
                    
                          uint,   ;; Offset in bits
    
                      
                    
    
                  527
                    
                          {  }*   ;; Reference to array of member descriptors
    
                      
                    
    
                  528
                    
                        }
    
                      
                    
    
                  529
                    
                      
    530 531

    These descriptors are used to define types that are composed of 0 or more 532 elements. The value of the tag varies depending on the meaning. The following 533 are possible tag values;

    534 535
    
                      
                    
    
                  536
                    
                        DW_TAG_array_type = 1
    
                      
                    
    
                  537
                    
                        DW_TAG_enumeration_type = 4
    
                      
                    
    
                  538
                    
                        DW_TAG_structure_type = 19
    
                      
                    
    
                  539
                    
                        DW_TAG_union_type = 23
    
                      
                    
    
                  540
                    
                      
    541 542

    The members of array types (tag = DW_TAG_array_type) are 543 href="#format_subrange">subrange descriptors, each representing the range of 544 subscripts at that level of indexing.

    545 546

    The members of enumeration types (tag = DW_TAG_enumeration_type) are 547 enumerator descriptors, each representing the 548 definition of enumeration value 549 for the set.

    550 551

    The members of structure (tag = DW_TAG_structure_type) or union (tag 552 = DW_TAG_union_type) types are any one of the 553 href="#format_basic_type">basic, derived 554 or composite type descriptors, each 555 representing a field member of the structure or union.

    556 557

    Composite type location can be 558 determined from the compile unit and line number. The size, alignment and 559 offset are expressed in bits and can be 64 bit values. The alignment is used to 560 round the offset when embedded in a composite 561 type (as an example, to keep float doubles on 64 bit boundaries.) The offset 562 is the bit offset if embedded in a composite 563 type.

    564 565
    566 567 568 571 572
    573 574
    
                      
                    
    
                  575
                    
                        %llvm.dbg.subrange.type = type {
    
                      
                    
    
                  576
                    
                          uint,   ;; Tag = 33 (DW_TAG_subrange_type)
    
                      
                    
    
                  577
                    
                          uint,   ;; Low value
    
                      
                    
    
                  578
                    
                          uint    ;; High value
    
                      
                    
    
                  579
                    
                        }
    
                      
                    
    
                  580
                    
                      
    581 582

    These descriptors are used to define ranges of array subscripts for an array 583 composite type. The low value defines the 584 lower bounds typically zero for C/C++. The high value is the upper bounds. 585 Values are 64 bit. High - low + 1 is the size of the array. If 586 low == high the array will be unbounded.

    587 588
    589 590 591 594 595
    596 597
    
                      
                    
    
                  598
                    
                        %llvm.dbg.enumerator.type = type {
    
                      
                    
    
                  599
                    
                          uint,   ;; Tag = 40 (DW_TAG_enumerator)
    
                      
                    
    
                  600
                    
                          sbyte*, ;; Name
    
                      
                    
    
                  601
                    
                          uint    ;; Value
    
                      
                    
    
                  602
                    
                        }
    
                      
                    
    
                  603
                    
                      
    604 605

    These descriptors are used to define members of an enumeration 606 href="#format_composite_type">composite type, it associates the name to the 607 value.

    608 609
    610 611 697612 615 616
    617 618

    LLVM uses several intrinsic functions (name prefixed with "llvm.dbg") to 619 provide debug information at various points in generated code.

    620 621
    622 623 624 627 628
    629
    
                      
                    
    
                  630
                    
                        void %llvm.dbg.stoppoint( uint, uint, %llvm.dbg.compile_unit* )
    
                      
                    
    
                  631
                    
                      
    632 633

    This intrinsic is used to provide correspondence between the source file and 634 the generated code. The first argument is the line number (base 1), second 635 argument si the column number (0 if unknown) and the third argument the source 636 compile unit. Code following a call to this intrinsic will have been defined in 637 close proximity of the line, column and file. This information holds until the 638 next call to lvm.dbg.stoppoint.

    639 640
    641 642 643 646 647
    648
    
                      
                    
    
                  649
                    
                        void %llvm.dbg.func.start( %llvm.dbg.subprogram.type* )
    
                      
                    
    
                  650
                    
                      
    651 652

    This intrinsic is used to link the debug information in % 653 href="#format_subprograms">llvm.dbg.subprogram to the function. It also 654 defines the beginning of the function's declarative region (scope.) The 655 intrinsic should be called early in the function after the all the alloca 656 instructions.

    657 658
    659 660 661 664 665
    666
    
                      
                    
    
                  667
                    
                        void %llvm.dbg.region.start()
    
                      
                    
    
                  668
                    
                      
    669 670

    This intrinsic is used to define the beginning of a declarative scope (ex. 671 block) for local language elements. It should be paired off with a closing 672 %llvm.dbg.region.end.

    673 674
    675 676 677 680 681
    682
    
                      
                    
    
                  683
                    
                        void %llvm.dbg.region.end()
    
                      
                    
    
                  684
                    
                      
    685 686

    This intrinsic is used to define the end of a declarative scope (ex. block) 687 for local language elements. It should be paired off with an opening % 688 href="#format_common_region_start">llvm.dbg.region.start or % 689 href="#format_common_func_start">llvm.dbg.func.start.

    690 691
    692 693 694 697 698
    699
    
                      
                    
    
                  700
                    
                        void %llvm.dbg.declare( {} *, ... )
    
                      
                    
    
                  701
                    
                      
    702 703

    This intrinsic provides information about a local element (ex. variable.) 704 TODO - details.

    705 706
    707 708 709
    710 699711 Representing stopping points in the source program 700712 701713
    705717

    LLVM debugger "stop points" are a key part of the debugging representation 706718 that allows the LLVM to maintain simple semantics for 707719 href="#debugopt">debugging optimized code. The basic idea is that the 708 front-end inserts calls to the %llvm.dbg.stoppoint intrinsic function 709 at every point in the program where the debugger should be able to inspect the 710 program (these correspond to places the debugger stops when you "step" 711 through it). The front-end can choose to place these as fine-grained as it 712 would like (for example, before every subexpression evaluated), but it is 713 recommended to only put them after every source statement that includes 714 executable code.

    720 front-end inserts calls to the 721 href="#format_common_stoppoint">%llvm.dbg.stoppoint intrinsic 722 function at every point in the program where the debugger should be able to 723 inspect the program (these correspond to places the debugger stops when you 724 "step" through it). The front-end can choose to place these as 725 fine-grained as it would like (for example, before every subexpression 726 evaluated), but it is recommended to only put them after every source statement 727 that includes executable code.

    715728 716729

    Using calls to this intrinsic function to demark legal points for the 717730 debugger to inspect the program automatically disables any optimizations that 723736 optimization of subexpressions, code duplication transformations, or basic-block 724737 reordering transformations.

    725738 726

    An important aspect of the calls to the %llvm.dbg.stoppoint 727 intrinsic is that the function-local debugging information is woven together 728 with use-def chains. This makes it easy for the debugger to, for example, 729 locate the 'next' stop point. For a concrete example of stop points, see the 730 example in the next section.

    731 732739
    733740 734741 763770 9. } 764771 765772 766

    Compiled to LLVM, this function would be represented like this (FIXME: CHECK 767 AND UPDATE THIS):

    773

    Compiled to LLVM, this function would be represented like this:

    768774 769775
    
                      
                    
    
                  770776
                      void %foo() {
    
                      
                    
    
                  777
                    
                      entry:
    
                      
                    
    
                  771778
                          %X = alloca int
    
                      
                    
    
                  772779
                          %Y = alloca int
    
                      
                    
    
                  773780
                          %Z = alloca int
    
                      
                    
    
                  774
                          %D1 = call {}* %llvm.dbg.func.start(%lldb.global* %d.foo)
    
                      
                    
    
                  775
                          %D2 = call {}* %llvm.dbg.stoppoint({}* %D1, uint 2, uint 2, %lldb.compile_unit* %file)
    
                      
                    
    
                  776
                      
    
                      
                    
    
                  777
                          %D3 = call {}* %llvm.dbg.DEFINEVARIABLE({}* %D2, ...)
                      
                    
    
                  781
                    
                          
                      
                    
    
                  782
                    
                          ...
    
                      
                    
    
                  783
                    
                          
    
                      
                    
    
                  784
                    
                          call void %llvm.dbg.func.start( %llvm.dbg.subprogram.type* %llvm.dbg.subprogram )
    
                      
                    
    
                  785
                    
                          
    
                      
                    
    
                  786
                    
                          call void %llvm.dbg.stoppoint( uint 2, uint 2, %llvm.dbg.compile_unit* %llvm.dbg.compile_unit )
    
                      
                    
    
                  787
                    
                          
    
                      
                    
    
                  788
                    
                          call void %llvm.dbg.declare({}* %X, ...)
    
                      
                    
    
                  789
                    
                          call void %llvm.dbg.declare({}* %Y, ...)
    
                      
                    
    
                  790
                    
                          
    
                      
                    
    
                  778791
                          ;; Evaluate expression on line 2, assigning to X.
    
                      
                    
    
                  779
                          %D4 = call {}* %llvm.dbg.stoppoint({}* %D3, uint 3, uint 2, %lldb.compile_unit* %file)
    
                      
                    
    
                  780
                      
    
                      
                    
    
                  781
                          %D5 = call {}* %llvm.dbg.DEFINEVARIABLE({}* %D4, ...)
                      
                    
    
                  792
                    
                          
                      
                    
    
                  793
                    
                          call void %llvm.dbg.stoppoint( uint 3, uint 2, %llvm.dbg.compile_unit* %llvm.dbg.compile_unit )
    
                      
                    
    
                  794
                    
                          
    
                      
                    
    
                  782795
                          ;; Evaluate expression on line 3, assigning to Y.
    
                      
                    
    
                  783
                          %D6 = call {}* %llvm.dbg.stoppoint({}* %D5, uint 5, uint 4, %lldb.compile_unit* %file)
    
                      
                    
    
                  784
                      
    
                      
                    
    
                  785
                          %D7 = call {}* %llvm.region.start({}* %D6)
    
                      
                    
    
                  786
                          %D8 = call {}* %llvm.dbg.DEFINEVARIABLE({}* %D7, ...)
                      
                    
    
                  796
                    
                          
                      
                    
    
                  797
                    
                          call void %llvm.region.start()
    
                      
                    
    
                  798
                    
                          call void %llvm.dbg.stoppoint( uint 5, uint 4, %llvm.dbg.compile_unit* %llvm.dbg.compile_unit )
    
                      
                    
    
                  799
                    
                          call void %llvm.dbg.declare({}* %X, ...)
    
                      
                    
    
                  800
                    
                          
    
                      
                    
    
                  787801
                          ;; Evaluate expression on line 5, assigning to Z.
    
                      
                    
    
                  788
                          %D9 = call {}* %llvm.dbg.stoppoint({}* %D8, uint 6, uint 4, %lldb.compile_unit* %file)
    
                      
                    
    
                  789
                      
    
                      
                    
    
                  790
                          ;; Code for line 6.
    
                      
                    
    
                  791
                          %D10 = call {}* %llvm.region.end({}* %D9)
    
                      
                    
    
                  792
                          %D11 = call {}* %llvm.dbg.stoppoint({}* %D10, uint 8, uint 2, %lldb.compile_unit* %file)
    
                      
                    
    
                  793
                      
    
                      
                    
    
                  794
                          ;; Code for line 8.
    
                      
                    
    
                  795
                          %D12 = call {}* %llvm.region.end({}* %D11)
                      
                    
    
                  802
                    
                          
                      
                    
    
                  803
                    
                          call void %llvm.dbg.stoppoint( uint 7, uint 2, %llvm.dbg.compile_unit* %llvm.dbg.compile_unit )
    
                      
                    
    
                  804
                    
                          call void %llvm.region.end()
    
                      
                    
    
                  805
                    
                          
    
                      
                    
    
                  806
                    
                          call void %llvm.dbg.stoppoint( uint 9, uint 2, %llvm.dbg.compile_unit* %llvm.dbg.compile_unit )
    
                      
                    
    
                  807
                    
                          
    
                      
                    
    
                  808
                    
                          call void %llvm.region.end()
    
                      
                    
    
                  809
                    
                          
    
                      
                    
    
                  796810
                          ret void
    
                      
                    
    
                  797811
                      }
    
                      
                    
    
                  798812
                      
    799813 800814

    This example illustrates a few important details about the LLVM debugging 801 information. In particular, it shows how the various intrinsics used are woven 802 together with def-use and use-def chains, similar to how 803 href="#format_common_anchors">anchors are used with globals. This allows 804 the debugger to analyze the relationship between statements, variable 805 definitions, and the code used to implement the function.

    806 807

    In this example, two explicit regions are defined, one with the 808 href="#icl_ex_D1">definition of the %D1 variable and one with the 809 definition of %D7. In the case of 810 %D1, the debug information indicates that the function whose 811 href="#format_program_objects">descriptor is specified as an argument to the 812 intrinsic. This defines a new stack frame whose lifetime ends when the region 813 is ended by the %D12 call.

    815 information. In particular, it shows how the various intrinsics are applied 816 together to allow a debugger to analyze the relationship between statements, 817 variable definitions, and the code used to implement the function.

    818 819

    The first intrinsic % 820 href="#format_common_func_start">llvm.dbg.func.start provides 821 a link with the subprogram descriptor 822 containing the details of this function. This call also defines the beginning 823 of the function region, bounded by the % 824 href="#format_common_region_end">llvm.region.end at the end of 825 the function. This region is used to bracket the lifetime of variables declared 826 within. For a function, this outer region defines a new stack frame whose 827 lifetime ends when the region is ended.

    828 829

    It is possible to define inner regions for short term variables by using the 830 %llvm.region.start and 831 href="#format_common_region_end">%llvm.region.end to bound a 832 region. The inner region in this example would be for the block containing the 833 declaration of Z.

    814834 815835

    Using regions to represent the boundaries of source-level functions allow 816836 LLVM interprocedural optimizations to arbitrarily modify LLVM functions without 823843 inlined function from the debugger).

    824844 825845

    Once the function has been defined, the 826 href="#format_common_stoppoint">stopping point corresponding to line #2 of 827 the function is encountered. At this point in the function, no local 828 variables are live. As lines 2 and 3 of the example are executed, their 829 variable definitions are automatically introduced into the program, without the 846 href="#format_common_stoppoint">stopping point corresponding to 847 line #2 (column #2) of the function is encountered. At this point in the 848 function, no local variables are live. As lines 2 and 3 of the example 849 are executed, their variable definitions are introduced into the program using 850 %llvm.dbg.declare, without the 830851 need to specify a new region. These variables do not require new regions to be 831852 introduced because they go out of scope at the same point in the program: line 832853 9.

    833854 834855

    In contrast, the Z variable goes out of scope at a different time, 835 on line 7. For this reason, it is defined within the 836 %D7 region, which kills the availability of Z before the 837 code for line 8 is executed. In this way, regions can support arbitrary 838 source-language scoping rules, as long as they can only be nested (ie, one scope 839 cannot partially overlap with a part of another scope).

    856 on line 7. For this reason, it is defined within the inner region, which kills 857 the availability of Z before the code for line 8 is executed. In this 858 way, regions can support arbitrary source-language scoping rules, as long as 859 they can only be nested (ie, one scope cannot partially overlap with a part of 860 another scope).

    840861 841862

    It is worth noting that this scoping mechanism is used to control scoping of 842863 all declarations, not just variable declarations. For example, the scope of a 843 C++ using declaration is controlled with this, and the llvm-db C++ 844 support routines could use this to change how name lookup is performed (though 845 this is not implemented yet).

    846 847
    848 849 850 853 854
    855

    The LLVM debugger expects the descriptors for program objects to start in a 856 canonical format, but the descriptors can include additional information 857 appended at the end that is source-language specific. All LLVM debugging 858 information is versioned, allowing backwards compatibility in the case that the 859 core structures need to change in some way. Also, all debugging information 860 objects start with a tag to indicate what type 861 of object it is. The source-language is allows to define its own objects, by 862 using unreserved tag numbers.

    863 864

    The lowest-level descriptor are those describing 865 href="#format_common_source_files">the files containing the program source 866 code, as most other descriptors (sometimes indirectly) refer to them. 867

    868
    869 870 871 929 932 933
    934

    935 The LLVM debugger needs to know about some source-language program objects, in 936 order to build stack traces, print information about local variables, and other 937 related activities. The LLVM debugger differentiates between three different 938 types of program objects: subprograms (functions, messages, methods, etc), 939 variables (locals and globals), and others. Because source-languages have 940 widely varying forms of these objects, the LLVM debugger expects only a few 941 fields in the descriptor for each object: 942

    943 944
    
                      
                    
    
                  945
                      %lldb.object = type {
    
                      
                    
    
                  946
                             uint,                  ;; A tag
    
                      
                    
    
                  947
                             any*,                  ;; The context for the object
    
                      
                    
    
                  948
                             sbyte*                 ;; The object 'name'
    
                      
                    
    
                  949
                      }
    
                      
                    
    
                  950
                      
    951 952

    The first field contains a tag for the descriptor. The second field contains 953 either a pointer to the descriptor for the containing 954 href="#format_common_source_files">source file, or it contains a pointer to 955 another program object whose context pointer eventually reaches a source file. 956 Through this context pointer, the 957 LLVM debugger can establish the debug version number of the object.

    958 959

    The third field contains a string that the debugger can use to identify the 960 object if it does not contain explicit support for the source-language in use 961 (ie, the 'unknown' source language handler uses this string). This should be 962 some sort of unmangled string that corresponds to the object, but it is a 963 quality of implementation issue what exactly it contains (it is legal, though 964 not useful, for all of these strings to be null).

    965 966

    Note again that descriptors can be extended to include 967 source-language-specific information in addition to the fields required by the 968 LLVM debugger. See the section on the C/C++ 969 front-end for more information. Also remember that global objects 970 (functions, selectors, global variables, etc) must contain an 971 href="#format_common_anchors">anchor to the llvm.dbg.globals 972 variable.

    973
    974 975 976 977 980 981
    982
    
                      
                    
    
                  983
                      Allow source-language specific contexts, use to identify namespaces etc
    
                      
                    
    
                  984
                      Must end up in a source file descriptor.
    
                      
                    
    
                  985
                      Debugger core ignores all unknown context objects.
    
                      
                    
    
                  986
                      
    987
    988 989 990 993 994
    995
    
                      
                    
    
                  996
                      Define each intrinsics, as an extension of the language reference manual.
    
                      
                    
    
                  997
                      
    
                      
                    
    
                  998
                      llvm.dbg.stoppoint
    
                      
                    
    
                  999
                      llvm.dbg.region.start
    
                      
                    
    
                  1000
                      llvm.dbg.region.end
    
                      
                    
    
                  1001
                      llvm.dbg.function.start
    
                      
                    
    
                  1002
                      llvm.dbg.declare
    
                      
                    
    
                  1003
                      
    1004
    1005 1006 1007 1010 1011
    1012 1013

    Happen to be the same value as the similarly named Dwarf-3 tags, this may 1014 change in the future.

    1015 1016
    
                      
                    
    
                  1017
                        LLVM_COMPILE_UNIT     : 17
    
                      
                    
    
                  1018
                        LLVM_SUBPROGRAM       : 46
    
                      
                    
    
                  1019
                        LLVM_VARIABLE         : 52
    
                      
                    
    
                  1020
                      
    
                      
                    
    
                  1021
                      
    864 C++ using declaration is controlled with this couldchange how name lookup is 865 performed.

    866 1022867
    1023868 1024869 1038883 debuggers by generating standard dwarf information, and contains enough 1039884 information for non-dwarf targets to translate it as needed.

    1040885 1041

    The basic debug information required by the debugger is (intentionally) 1042 designed to be as minimal as possible. This basic information is so minimal 1043 that it is unlikely that any source-language could be adequately 1044 described by it. Because of this, the debugger format was designed for 1045 extension to support source-language-specific information. The extended 1046 descriptors are read and interpreted by the 1047 href="#arch_info">language-specific modules in the debugger if there is 1048 support available, otherwise it is ignored.

    1049 1050

    This section describes the extensions used to represent C and C++ programs. 1051 Other languages could pattern themselves after this (which itself is tuned to 886

    This section describes the forms used to represent C and C++ programs. Other 887 languages could pattern themselves after this (which itself is tuned to 1052888 representing programs in the same way that Dwarf 3 does), or they could choose 1053 to provide completely different extensions if they don't fit into the Dwarf 1054 model. As support for debugging information gets added to the various LLVM 889 to provide completely different forms if they don't fit into the Dwarf model. 890 As support for debugging information gets added to the various LLVM 1055891 source-language front-ends, the information used should be documented here.

    1056892 893

    The following sections provide examples of various C/C++ constructs and the 894 debug information that would best describe those constructs.

    895 1057896
    1058897 1059898 1060899 1063 1064
    1065

    TODO

    1066
    1067 1068 1069 1072 1073
    1074

    1075 Translation units do not add any information over the standard 1076 href="#format_common_source_files">source file representation already 1077 expected by the debugger. As such, it uses descriptors of the type specified, 1078 with a trailing anchor. 1079

    1080
    1081 1082 1083 1086 1087 902 903
    904 905

    Given the source files "MySource.cpp" and "MyHeader.h" located in the 906 directory "/Users/mine/sources", the following code;

    907 908
    
                      
                    
    
                  909
                    
                      #include "MyHeader.h"
    
                      
                    
    
                  910
                    
                      
    
                      
                    
    
                  911
                    
                      int main(int argc, char *argv[]) {
    
                      
                    
    
                  912
                    
                        return 0;
    
                      
                    
    
                  913
                    
                      }
    
                      
                    
    
                  914
                    
                      
    915 916

    a C/C++ front-end would generate the following descriptors;

    917 918
    
                      
                    
    
                  919
                    
                      ...
    
                      
                    
    
                  920
                    
                      ;;
    
                      
                    
    
                  921
                    
                      ;; Define types used.  In this case we need one for compile unit anchors and one
    
                      
                    
    
                  922
                    
                      ;; for compile units.
    
                      
                    
    
                  923
                    
                      ;;
    
                      
                    
    
                  924
                    
                      %llvm.dbg.anchor.type = type { uint, uint }
    
                      
                    
    
                  925
                    
                      %llvm.dbg.compile_unit.type = type { uint, {  }*, uint, uint, sbyte*, sbyte*, sbyte* }
    
                      
                    
    
                  926
                    
                      ...
    
                      
                    
    
                  927
                    
                      ;;
    
                      
                    
    
                  928
                    
                      ;; Define the anchor for compile units.  Note that the second field of the
    
                      
                    
    
                  929
                    
                      ;; anchor is 17, which is the same as the tag for compile units
    
                      
                    
    
                  930
                    
                      ;; (17 = DW_TAG_compile_unit.)
    
                      
                    
    
                  931
                    
                      ;;
    
                      
                    
    
                  932
                    
                      %llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 17 }, section "llvm.metadata"
    
                      
                    
    
                  933
                    
                      
    
                      
                    
    
                  934
                    
                      ;;
    
                      
                    
    
                  935
                    
                      ;; Define the compile unit for the source file "/Users/mine/sources/MySource.cpp".
    
                      
                    
    
                  936
                    
                      ;;
    
                      
                    
    
                  937
                    
                      %llvm.dbg.compile_unit1 = internal constant %llvm.dbg.compile_unit.type {
    
                      
                    
    
                  938
                    
                          uint 17, 
    
                      
                    
    
                  939
                    
                          {  }* cast (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to {  }*), 
    
                      
                    
    
                  940
                    
                          uint 1, 
    
                      
                    
    
                  941
                    
                          uint 1, 
    
                      
                    
    
                  942
                    
                          sbyte* getelementptr ([13 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  943
                    
                          sbyte* getelementptr ([21 x sbyte]* %str2, int 0, int 0), 
    
                      
                    
    
                  944
                    
                          sbyte* getelementptr ([33 x sbyte]* %str3, int 0, int 0) }, section "llvm.metadata"
    
                      
                    
    
                  945
                    
                          
    
                      
                    
    
                  946
                    
                      ;;
    
                      
                    
    
                  947
                    
                      ;; Define the compile unit for the header file "/Users/mine/sources/MyHeader.h".
    
                      
                    
    
                  948
                    
                      ;;
    
                      
                    
    
                  949
                    
                      %llvm.dbg.compile_unit2 = internal constant %llvm.dbg.compile_unit.type {
    
                      
                    
    
                  950
                    
                          uint 17, 
    
                      
                    
    
                  951
                    
                          {  }* cast (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to {  }*), 
    
                      
                    
    
                  952
                    
                          uint 1, 
    
                      
                    
    
                  953
                    
                          uint 1, 
    
                      
                    
    
                  954
                    
                          sbyte* getelementptr ([11 x sbyte]* %str4, int 0, int 0), 
    
                      
                    
    
                  955
                    
                          sbyte* getelementptr ([21 x sbyte]* %str2, int 0, int 0), 
    
                      
                    
    
                  956
                    
                          sbyte* getelementptr ([33 x sbyte]* %str3, int 0, int 0) }, section "llvm.metadata"
    
                      
                    
    
                  957
                    
                      
    
                      
                    
    
                  958
                    
                      ;;
    
                      
                    
    
                  959
                    
                      ;; Define each of the strings used in the compile units.
    
                      
                    
    
                  960
                    
                      ;;
    
                      
                    
    
                  961
                    
                      %str1 = internal constant [13 x sbyte] c"MySource.cpp\00", section "llvm.metadata";
    
                      
                    
    
                  962
                    
                      %str2 = internal constant [21 x sbyte] c"/Users/mine/sources/\00", section "llvm.metadata";
    
                      
                    
    
                  963
                    
                      %str3 = internal constant [33 x sbyte] c"4.0.1 LLVM (LLVM research group)\00", section "llvm.metadata";
    
                      
                    
    
                  964
                    
                      %str4 = internal constant [11 x sbyte] c"MyHeader.h\00", section "llvm.metadata";
    
                      
                    
    
                  965
                    
                      ...
    
                      
                    
    
                  966
                    
                      
    967 1089968
    1090969 1091970 1092971 1095 1096
    1097

    TODO

    1098
    1099 972 C/C++ global variable information 973 974 975
    976 977

    Given an integer global variable declared as follows;

    978 979
    
                      
                    
    
                  980
                    
                      int MyGlobal = 100;
    
                      
                    
    
                  981
                    
                      
    982 983

    a C/C++ front-end would generate the following descriptors;

    984 985
    
                      
                    
    
                  986
                    
                      ;;
    
                      
                    
    
                  987
                    
                      ;; Define types used. One for global variable anchors, one for the global
    
                      
                    
    
                  988
                    
                      ;; variable descriptor, one for the global's basic type and one for the global's
    
                      
                    
    
                  989
                    
                      ;; compile unit.
    
                      
                    
    
                  990
                    
                      ;;
    
                      
                    
    
                  991
                    
                      %llvm.dbg.anchor.type = type { uint, uint }
    
                      
                    
    
                  992
                    
                      %llvm.dbg.global_variable.type = type { uint, {  }*, {  }*, sbyte*, {  }*, bool, bool, {  }*, uint }
    
                      
                    
    
                  993
                    
                      %llvm.dbg.basictype.type = type { uint, {  }*, sbyte*, {  }*, int, uint, uint, uint, uint }
    
                      
                    
    
                  994
                    
                      %llvm.dbg.compile_unit.type = ...
    
                      
                    
    
                  995
                    
                      ...
    
                      
                    
    
                  996
                    
                      ;;
    
                      
                    
    
                  997
                    
                      ;; Define the global itself.
    
                      
                    
    
                  998
                    
                      ;;
    
                      
                    
    
                  999
                    
                      %MyGlobal = global int 100
    
                      
                    
    
                  1000
                    
                      ...
    
                      
                    
    
                  1001
                    
                      ;;
    
                      
                    
    
                  1002
                    
                      ;; Define the anchor for global variables.  Note that the second field of the
    
                      
                    
    
                  1003
                    
                      ;; anchor is 52, which is the same as the tag for global variables
    
                      
                    
    
                  1004
                    
                      ;; (52 = DW_TAG_variable.)
    
                      
                    
    
                  1005
                    
                      ;;
    
                      
                    
    
                  1006
                    
                      %llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 52 }, section "llvm.metadata"
    
                      
                    
    
                  1007
                    
                      
    
                      
                    
    
                  1008
                    
                      ;;
    
                      
                    
    
                  1009
                    
                      ;; Define the global variable descriptor.  Note the reference to the global
    
                      
                    
    
                  1010
                    
                      ;; variable anchor and the global variable itself.
    
                      
                    
    
                  1011
                    
                      ;;
    
                      
                    
    
                  1012
                    
                      %llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type {
    
                      
                    
    
                  1013
                    
                          uint 52, 
    
                      
                    
    
                  1014
                    
                          {  }* cast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to {  }*), 
    
                      
                    
    
                  1015
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1016
                    
                          sbyte* getelementptr ([9 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1017
                    
                          {  }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*), 
    
                      
                    
    
                  1018
                    
                          bool false, 
    
                      
                    
    
                  1019
                    
                          bool true, 
    
                      
                    
    
                  1020
                    
                          {  }* cast (int* %MyGlobal to {  }*), 
    
                      
                    
    
                  1021
                    
                          uint 1 }, section "llvm.metadata"
    
                      
                    
    
                  1022
                    
                          
    
                      
                    
    
                  1023
                    
                      ;;
    
                      
                    
    
                  1024
                    
                      ;; Define the basic type of 32 bit signed integer.  Note that since int is an
    
                      
                    
    
                  1025
                    
                      ;; intrinsic type the source file is NULL and line 0.
    
                      
                    
    
                  1026
                    
                      ;;    
    
                      
                    
    
                  1027
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1028
                    
                          uint 36, 
    
                      
                    
    
                  1029
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1030
                    
                          sbyte* getelementptr ([4 x sbyte]* %str2, int 0, int 0), 
    
                      
                    
    
                  1031
                    
                          {  }* null, 
    
                      
                    
    
                  1032
                    
                          int 0, 
    
                      
                    
    
                  1033
                    
                          uint 32, 
    
                      
                    
    
                  1034
                    
                          uint 32, 
    
                      
                    
    
                  1035
                    
                          uint 0, 
    
                      
                    
    
                  1036
                    
                          uint 5 }, section "llvm.metadata"
    
                      
                    
    
                  1037
                    
                      
    
                      
                    
    
                  1038
                    
                      ;;
    
                      
                    
    
                  1039
                    
                      ;; Define the names of the global variable and basic type.
    
                      
                    
    
                  1040
                    
                      ;;
    
                      
                    
    
                  1041
                    
                      %str1 = internal constant [9 x sbyte] c"MyGlobal\00", section "llvm.metadata"
    
                      
                    
    
                  1042
                    
                      %str2 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
    
                      
                    
    
                  1043
                    
                      
    1044 1045
    1046 1047 1048 1051 1052
    1053 1054

    Given a function declared as follows;

    1055 1056
    
                      
                    
    
                  1057
                    
                      int main(int argc, char *argv[]) {
    
                      
                    
    
                  1058
                    
                        return 0;
    
                      
                    
    
                  1059
                    
                      }
    
                      
                    
    
                  1060
                    
                      
    1061 1062

    a C/C++ front-end would generate the following descriptors;

    1063 1064
    
                      
                    
    
                  1065
                    
                      ;;
    
                      
                    
    
                  1066
                    
                      ;; Define types used. One for subprogram anchors, one for the subprogram
    
                      
                    
    
                  1067
                    
                      ;; descriptor, one for the global's basic type and one for the subprogram's
    
                      
                    
    
                  1068
                    
                      ;; compile unit.
    
                      
                    
    
                  1069
                    
                      ;;
    
                      
                    
    
                  1070
                    
                      %llvm.dbg.subprogram.type = type { uint, {  }*, {  }*, sbyte*, {  }*, bool, bool }
    
                      
                    
    
                  1071
                    
                      %llvm.dbg.anchor.type = type { uint, uint }
    
                      
                    
    
                  1072
                    
                      %llvm.dbg.compile_unit.type = ...
    
                      
                    
    
                  1073
                    
                      	
    
                      
                    
    
                  1074
                    
                      ;;
    
                      
                    
    
                  1075
                    
                      ;; Define the anchor for subprograms.  Note that the second field of the
    
                      
                    
    
                  1076
                    
                      ;; anchor is 46, which is the same as the tag for subprograms
    
                      
                    
    
                  1077
                    
                      ;; (46 = DW_TAG_subprogram.)
    
                      
                    
    
                  1078
                    
                      ;;
    
                      
                    
    
                  1079
                    
                      %llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 46 }, section "llvm.metadata"
    
                      
                    
    
                  1080
                    
                      
    
                      
                    
    
                  1081
                    
                      ;;
    
                      
                    
    
                  1082
                    
                      ;; Define the descriptor for the subprogram.  TODO - more details.
    
                      
                    
    
                  1083
                    
                      ;;
    
                      
                    
    
                  1084
                    
                      %llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type {
    
                      
                    
    
                  1085
                    
                          uint 46, 
    
                      
                    
    
                  1086
                    
                          {  }* cast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to {  }*), 
    
                      
                    
    
                  1087
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1088
                    
                          sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1089
                    
                          {  }* null, 
    
                      
                    
    
                  1090
                    
                          bool false, 
    
                      
                    
    
                  1091
                    
                          bool true }, section "llvm.metadata"
    
                      
                    
    
                  1092
                    
                      
    
                      
                    
    
                  1093
                    
                      ;;
    
                      
                    
    
                  1094
                    
                      ;; Define the name of the subprogram.
    
                      
                    
    
                  1095
                    
                      ;;
    
                      
                    
    
                  1096
                    
                      %str1 = internal constant [5 x sbyte] c"main\00", section "llvm.metadata"
    
                      
                    
    
                  1097
                    
                      
    
                      
                    
    
                  1098
                    
                      ;;
    
                      
                    
    
                  1099
                    
                      ;; Define the subprogram itself.
    
                      
                    
    
                  1100
                    
                      ;;
    
                      
                    
    
                  1101
                    
                      int %main(int %argc, sbyte** %argv) {
    
                      
                    
    
                  1102
                    
                      ...
    
                      
                    
    
                  1103
                    
                      }
    
                      
                    
    
                  1104
                    
                      
    1105 1106
    1107 1108 1109 1112 1113
    1114 1115

    The following are the basic type descriptors for C/C++ core types;

    1116 1117
    1118 1119 1120 1123 1124
    1125 1126
    
                      
                    
    
                  1127
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1128
                    
                          uint 36, 
    
                      
                    
    
                  1129
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1130
                    
                          sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1131
                    
                          {  }* null, 
    
                      
                    
    
                  1132
                    
                          int 0, 
    
                      
                    
    
                  1133
                    
                          uint 32, 
    
                      
                    
    
                  1134
                    
                          uint 32, 
    
                      
                    
    
                  1135
                    
                          uint 0, 
    
                      
                    
    
                  1136
                    
                          uint 2 }, section "llvm.metadata"
    
                      
                    
    
                  1137
                    
                      %str1 = internal constant [5 x sbyte] c"bool\00", section "llvm.metadata"
    
                      
                    
    
                  1138
                    
                      
    1139 1140
    1141 1142 1143 1146 1147
    1148 1149
    
                      
                    
    
                  1150
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1151
                    
                          uint 36, 
    
                      
                    
    
                  1152
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1153
                    
                          sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1154
                    
                          {  }* null, 
    
                      
                    
    
                  1155
                    
                          int 0, 
    
                      
                    
    
                  1156
                    
                          uint 8, 
    
                      
                    
    
                  1157
                    
                          uint 8, 
    
                      
                    
    
                  1158
                    
                          uint 0, 
    
                      
                    
    
                  1159
                    
                          uint 6 }, section "llvm.metadata"
    
                      
                    
    
                  1160
                    
                      %str1 = internal constant [5 x sbyte] c"char\00", section "llvm.metadata"
    
                      
                    
    
                  1161
                    
                      
    1162 1163
    1164 1165 1166 1169 1170
    1171 1172
    
                      
                    
    
                  1173
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1174
                    
                          uint 36, 
    
                      
                    
    
                  1175
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1176
                    
                          sbyte* getelementptr ([14 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1177
                    
                          {  }* null, 
    
                      
                    
    
                  1178
                    
                          int 0, 
    
                      
                    
    
                  1179
                    
                          uint 8, 
    
                      
                    
    
                  1180
                    
                          uint 8, 
    
                      
                    
    
                  1181
                    
                          uint 0, 
    
                      
                    
    
                  1182
                    
                          uint 8 }, section "llvm.metadata"
    
                      
                    
    
                  1183
                    
                      %str1 = internal constant [14 x sbyte] c"unsigned char\00", section "llvm.metadata"
    
                      
                    
    
                  1184
                    
                      
    1185 1186
    1187 1188 1189 1192 1193
    1194 1195
    
                      
                    
    
                  1196
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1197
                    
                          uint 36, 
    
                      
                    
    
                  1198
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1199
                    
                          sbyte* getelementptr ([10 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1200
                    
                          {  }* null, 
    
                      
                    
    
                  1201
                    
                          int 0, 
    
                      
                    
    
                  1202
                    
                          uint 16, 
    
                      
                    
    
                  1203
                    
                          uint 16, 
    
                      
                    
    
                  1204
                    
                          uint 0, 
    
                      
                    
    
                  1205
                    
                          uint 5 }, section "llvm.metadata"
    
                      
                    
    
                  1206
                    
                      %str1 = internal constant [10 x sbyte] c"short int\00", section "llvm.metadata"
    
                      
                    
    
                  1207
                    
                      
    1208 1209
    1210 1211 1212 1215 1216
    1217 1218
    
                      
                    
    
                  1219
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1220
                    
                          uint 36, 
    
                      
                    
    
                  1221
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1222
                    
                          sbyte* getelementptr ([19 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1223
                    
                          {  }* null, 
    
                      
                    
    
                  1224
                    
                          int 0, 
    
                      
                    
    
                  1225
                    
                          uint 16, 
    
                      
                    
    
                  1226
                    
                          uint 16, 
    
                      
                    
    
                  1227
                    
                          uint 0, 
    
                      
                    
    
                  1228
                    
                          uint 7 }, section "llvm.metadata"
    
                      
                    
    
                  1229
                    
                      %str1 = internal constant [19 x sbyte] c"short unsigned int\00", section "llvm.metadata"
    
                      
                    
    
                  1230
                    
                      
    1231 1232
    1233 1234 1235 1238 1239
    1240 1241
    
                      
                    
    
                  1242
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1243
                    
                          uint 36, 
    
                      
                    
    
                  1244
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1245
                    
                          sbyte* getelementptr ([4 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1246
                    
                          {  }* null, 
    
                      
                    
    
                  1247
                    
                          int 0, 
    
                      
                    
    
                  1248
                    
                          uint 32, 
    
                      
                    
    
                  1249
                    
                          uint 32, 
    
                      
                    
    
                  1250
                    
                          uint 0, 
    
                      
                    
    
                  1251
                    
                          uint 5 }, section "llvm.metadata"
    
                      
                    
    
                  1252
                    
                      %str1 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
    
                      
                    
    
                  1253
                    
                      
    1254 1255
    1256 1257 1258 1261 1262
    1263 1264
    
                      
                    
    
                  1265
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1266
                    
                          uint 36, 
    
                      
                    
    
                  1267
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1268
                    
                          sbyte* getelementptr ([13 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1269
                    
                          {  }* null, 
    
                      
                    
    
                  1270
                    
                          int 0, 
    
                      
                    
    
                  1271
                    
                          uint 32, 
    
                      
                    
    
                  1272
                    
                          uint 32, 
    
                      
                    
    
                  1273
                    
                          uint 0, 
    
                      
                    
    
                  1274
                    
                          uint 7 }, section "llvm.metadata"
    
                      
                    
    
                  1275
                    
                      %str1 = internal constant [13 x sbyte] c"unsigned int\00", section "llvm.metadata"
    
                      
                    
    
                  1276
                    
                      
    1277 1278
    1279 1280 1281 1284 1285
    1286 1287
    
                      
                    
    
                  1288
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1289
                    
                          uint 36, 
    
                      
                    
    
                  1290
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1291
                    
                          sbyte* getelementptr ([14 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1292
                    
                          {  }* null, 
    
                      
                    
    
                  1293
                    
                          int 0, 
    
                      
                    
    
                  1294
                    
                          uint 64, 
    
                      
                    
    
                  1295
                    
                          uint 64, 
    
                      
                    
    
                  1296
                    
                          uint 0, 
    
                      
                    
    
                  1297
                    
                          uint 5 }, section "llvm.metadata"
    
                      
                    
    
                  1298
                    
                      %str1 = internal constant [14 x sbyte] c"long long int\00", section "llvm.metadata"
    
                      
                    
    
                  1299
                    
                      
    1300 1301
    1302 1303 1304 1307 1308
    1309 1310
    
                      
                    
    
                  1311
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1312
                    
                          uint 36, 
    
                      
                    
    
                  1313
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1314
                    
                          sbyte* getelementptr ([23 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1315
                    
                          {  }* null, 
    
                      
                    
    
                  1316
                    
                          int 0, 
    
                      
                    
    
                  1317
                    
                          uint 64, 
    
                      
                    
    
                  1318
                    
                          uint 64, 
    
                      
                    
    
                  1319
                    
                          uint 0, 
    
                      
                    
    
                  1320
                    
                          uint 7 }, section "llvm.metadata"
    
                      
                    
    
                  1321
                    
                      %str1 = internal constant [23 x sbyte] c"long long unsigned int\00", section "llvm.metadata"
    
                      
                    
    
                  1322
                    
                      
    1323 1324
    1325 1326 1327 1330 1331
    1332 1333
    
                      
                    
    
                  1334
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1335
                    
                          uint 36, 
    
                      
                    
    
                  1336
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1337
                    
                          sbyte* getelementptr ([6 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1338
                    
                          {  }* null, 
    
                      
                    
    
                  1339
                    
                          int 0, 
    
                      
                    
    
                  1340
                    
                          uint 32, 
    
                      
                    
    
                  1341
                    
                          uint 32, 
    
                      
                    
    
                  1342
                    
                          uint 0, 
    
                      
                    
    
                  1343
                    
                          uint 4 }, section "llvm.metadata"
    
                      
                    
    
                  1344
                    
                      %str1 = internal constant [6 x sbyte] c"float\00", section "llvm.metadata"
    
                      
                    
    
                  1345
                    
                      
    1346 1347
    1348 1349 1350 1353 1354
    1355 1356
    
                      
                    
    
                  1357
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1358
                    
                          uint 36, 
    
                      
                    
    
                  1359
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1360
                    
                          sbyte* getelementptr ([7 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1361
                    
                          {  }* null, 
    
                      
                    
    
                  1362
                    
                          int 0, 
    
                      
                    
    
                  1363
                    
                          uint 64, 
    
                      
                    
    
                  1364
                    
                          uint 64, 
    
                      
                    
    
                  1365
                    
                          uint 0, 
    
                      
                    
    
                  1366
                    
                          uint 4 }, section "llvm.metadata"
    
                      
                    
    
                  1367
                    
                      %str1 = internal constant [7 x sbyte] c"double\00", section "llvm.metadata"
    
                      
                    
    
                  1368
                    
                      
    1369 1370
    1371 1372 1373 1376 1377
    1378 1379

    Given the following as an example of C/C++ derived type;

    1380 1381
    
                      
                    
    
                  1382
                    
                      typedef const int *IntPtr;
    
                      
                    
    
                  1383
                    
                      
    1384 1385

    a C/C++ front-end would generate the following descriptors;

    1386 1387
    
                      
                    
    
                  1388
                    
                      ;;
    
                      
                    
    
                  1389
                    
                      ;; Define the typedef "IntPtr".
    
                      
                    
    
                  1390
                    
                      ;;
    
                      
                    
    
                  1391
                    
                      %llvm.dbg.derivedtype1 = internal constant %llvm.dbg.derivedtype.type {
    
                      
                    
    
                  1392
                    
                          uint 22, 
    
                      
                    
    
                  1393
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1394
                    
                          sbyte* getelementptr ([7 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1395
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1396
                    
                          int 1, 
    
                      
                    
    
                  1397
                    
                          uint 0, 
    
                      
                    
    
                  1398
                    
                          uint 0, 
    
                      
                    
    
                  1399
                    
                          uint 0, 
    
                      
                    
    
                  1400
                    
                          {  }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype2 to {  }*) }, section "llvm.metadata"
    
                      
                    
    
                  1401
                    
                      %str1 = internal constant [7 x sbyte] c"IntPtr\00", section "llvm.metadata"
    
                      
                    
    
                  1402
                    
                      
    
                      
                    
    
                  1403
                    
                      ;;
    
                      
                    
    
                  1404
                    
                      ;; Define the pointer type.
    
                      
                    
    
                  1405
                    
                      ;;
    
                      
                    
    
                  1406
                    
                      %llvm.dbg.derivedtype2 = internal constant %llvm.dbg.derivedtype.type {
    
                      
                    
    
                  1407
                    
                          uint 15, 
    
                      
                    
    
                  1408
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1409
                    
                          sbyte* getelementptr ([1 x sbyte]* %str2, int 0, int 0), 
    
                      
                    
    
                  1410
                    
                          {  }* null, 
    
                      
                    
    
                  1411
                    
                          int 0, 
    
                      
                    
    
                  1412
                    
                          uint 32, 
    
                      
                    
    
                  1413
                    
                          uint 32, 
    
                      
                    
    
                  1414
                    
                          uint 0, 
    
                      
                    
    
                  1415
                    
                          {  }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype3 to {  }*) }, section "llvm.metadata"
    
                      
                    
    
                  1416
                    
                      %str2 = internal constant [1 x sbyte] zeroinitializer, section "llvm.metadata"
    
                      
                    
    
                  1417
                    
                      
    
                      
                    
    
                  1418
                    
                      ;;
    
                      
                    
    
                  1419
                    
                      ;; Define the const type.
    
                      
                    
    
                  1420
                    
                      ;;
    
                      
                    
    
                  1421
                    
                      %llvm.dbg.derivedtype3 = internal constant %llvm.dbg.derivedtype.type {
    
                      
                    
    
                  1422
                    
                          uint 38, 
    
                      
                    
    
                  1423
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1424
                    
                          sbyte* getelementptr ([1 x sbyte]* %str2, int 0, int 0), 
    
                      
                    
    
                  1425
                    
                          {  }* null, 
    
                      
                    
    
                  1426
                    
                          int 0, 
    
                      
                    
    
                  1427
                    
                          uint 0, 
    
                      
                    
    
                  1428
                    
                          uint 0, 
    
                      
                    
    
                  1429
                    
                          uint 0, 
    
                      
                    
    
                  1430
                    
                          {  }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype1 to {  }*) }, section "llvm.metadata"	
    
                      
                    
    
                  1431
                    
                      
    
                      
                    
    
                  1432
                    
                      ;;
    
                      
                    
    
                  1433
                    
                      ;; Define the int type.
    
                      
                    
    
                  1434
                    
                      ;;
    
                      
                    
    
                  1435
                    
                      %llvm.dbg.basictype1 = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1436
                    
                          uint 36, 
    
                      
                    
    
                  1437
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1438
                    
                          sbyte* getelementptr ([4 x sbyte]* %str4, int 0, int 0), 
    
                      
                    
    
                  1439
                    
                          {  }* null, 
    
                      
                    
    
                  1440
                    
                          int 0, 
    
                      
                    
    
                  1441
                    
                          uint 32, 
    
                      
                    
    
                  1442
                    
                          uint 32, 
    
                      
                    
    
                  1443
                    
                          uint 0, 
    
                      
                    
    
                  1444
                    
                          uint 5 }, section "llvm.metadata"
    
                      
                    
    
                  1445
                    
                      %str4 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
    
                      
                    
    
                  1446
                    
                      
    1447 1448
    1449 1450 1451 1454 1455
    1456 1457

    Given the following as an example of C/C++ struct type;

    1458 1459
    
                      
                    
    
                  1460
                    
                      struct Color {
    
                      
                    
    
                  1461
                    
                        unsigned Red;
    
                      
                    
    
                  1462
                    
                        unsigned Green;
    
                      
                    
    
                  1463
                    
                        unsigned Blue;
    
                      
                    
    
                  1464
                    
                      };
    
                      
                    
    
                  1465
                    
                      
    1466 1467

    a C/C++ front-end would generate the following descriptors;

    1468 1469
    
                      
                    
    
                  1470
                    
                      ;;
    
                      
                    
    
                  1471
                    
                      ;; Define basic type for unsigned int.
    
                      
                    
    
                  1472
                    
                      ;;
    
                      
                    
    
                  1473
                    
                      %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
    
                      
                    
    
                  1474
                    
                          uint 36, 
    
                      
                    
    
                  1475
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1476
                    
                          sbyte* getelementptr ([13 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1477
                    
                          {  }* null, 
    
                      
                    
    
                  1478
                    
                          int 0, 
    
                      
                    
    
                  1479
                    
                          uint 32, 
    
                      
                    
    
                  1480
                    
                          uint 32, 
    
                      
                    
    
                  1481
                    
                          uint 0, 
    
                      
                    
    
                  1482
                    
                          uint 7 }, section "llvm.metadata"
    
                      
                    
    
                  1483
                    
                      %str1 = internal constant [13 x sbyte] c"unsigned int\00", section "llvm.metadata"
    
                      
                    
    
                  1484
                    
                      
    
                      
                    
    
                  1485
                    
                      ;;
    
                      
                    
    
                  1486
                    
                      ;; Define composite type for struct Color.
    
                      
                    
    
                  1487
                    
                      ;;
    
                      
                    
    
                  1488
                    
                      %llvm.dbg.compositetype = internal constant %llvm.dbg.compositetype.type {
    
                      
                    
    
                  1489
                    
                          uint 19, 
    
                      
                    
    
                  1490
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1491
                    
                          sbyte* getelementptr ([6 x sbyte]* %str2, int 0, int 0), 
    
                      
                    
    
                  1492
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1493
                    
                          int 1, 
    
                      
                    
    
                  1494
                    
                          uint 96, 
    
                      
                    
    
                  1495
                    
                          uint 32, 
    
                      
                    
    
                  1496
                    
                          uint 0, 
    
                      
                    
    
                  1497
                    
                          {  }* null, 
    
                      
                    
    
                  1498
                    
                          {  }* cast ([3 x {  }*]* %llvm.dbg.array to {  }*) }, section "llvm.metadata"
    
                      
                    
    
                  1499
                    
                      %str2 = internal constant [6 x sbyte] c"Color\00", section "llvm.metadata"
    
                      
                    
    
                  1500
                    
                      
    
                      
                    
    
                  1501
                    
                      ;;
    
                      
                    
    
                  1502
                    
                      ;; Define the Red field.
    
                      
                    
    
                  1503
                    
                      ;;
    
                      
                    
    
                  1504
                    
                      %llvm.dbg.derivedtype1 = internal constant %llvm.dbg.derivedtype.type {
    
                      
                    
    
                  1505
                    
                          uint 13, 
    
                      
                    
    
                  1506
                    
                          {  }* null, 
    
                      
                    
    
                  1507
                    
                          sbyte* getelementptr ([4 x sbyte]* %str3, int 0, int 0), 
    
                      
                    
    
                  1508
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1509
                    
                          int 2, 
    
                      
                    
    
                  1510
                    
                          uint 32, 
    
                      
                    
    
                  1511
                    
                          uint 32, 
    
                      
                    
    
                  1512
                    
                          uint 0, 
    
                      
                    
    
                  1513
                    
                          {  }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*) }, section "llvm.metadata"
    
                      
                    
    
                  1514
                    
                      %str3 = internal constant [4 x sbyte] c"Red\00", section "llvm.metadata"
    
                      
                    
    
                  1515
                    
                      
    
                      
                    
    
                  1516
                    
                      ;;
    
                      
                    
    
                  1517
                    
                      ;; Define the Green field.
    
                      
                    
    
                  1518
                    
                      ;;
    
                      
                    
    
                  1519
                    
                      %llvm.dbg.derivedtype2 = internal constant %llvm.dbg.derivedtype.type {
    
                      
                    
    
                  1520
                    
                          uint 13, 
    
                      
                    
    
                  1521
                    
                          {  }* null, 
    
                      
                    
    
                  1522
                    
                          sbyte* getelementptr ([6 x sbyte]* %str4, int 0, int 0), 
    
                      
                    
    
                  1523
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1524
                    
                          int 3, 
    
                      
                    
    
                  1525
                    
                          uint 32, 
    
                      
                    
    
                  1526
                    
                          uint 32, 
    
                      
                    
    
                  1527
                    
                          uint 32, 
    
                      
                    
    
                  1528
                    
                          {  }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*) }, section "llvm.metadata"
    
                      
                    
    
                  1529
                    
                      %str4 = internal constant [6 x sbyte] c"Green\00", section "llvm.metadata"
    
                      
                    
    
                  1530
                    
                      
    
                      
                    
    
                  1531
                    
                      ;;
    
                      
                    
    
                  1532
                    
                      ;; Define the Blue field.
    
                      
                    
    
                  1533
                    
                      ;;
    
                      
                    
    
                  1534
                    
                      %llvm.dbg.derivedtype3 = internal constant %llvm.dbg.derivedtype.type {
    
                      
                    
    
                  1535
                    
                          uint 13, 
    
                      
                    
    
                  1536
                    
                          {  }* null, 
    
                      
                    
    
                  1537
                    
                          sbyte* getelementptr ([5 x sbyte]* %str5, int 0, int 0), 
    
                      
                    
    
                  1538
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1539
                    
                          int 4, 
    
                      
                    
    
                  1540
                    
                          uint 32, 
    
                      
                    
    
                  1541
                    
                          uint 32, 
    
                      
                    
    
                  1542
                    
                          uint 64, 
    
                      
                    
    
                  1543
                    
                          {  }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*) }, section "llvm.metadata"
    
                      
                    
    
                  1544
                    
                      %str5 = internal constant [5 x sbyte] c"Blue\00", section "llvm.metadata"
    
                      
                    
    
                  1545
                    
                      
    
                      
                    
    
                  1546
                    
                      ;;
    
                      
                    
    
                  1547
                    
                      ;; Define the array of fields used by the composite type Color.
    
                      
                    
    
                  1548
                    
                      ;;
    
                      
                    
    
                  1549
                    
                      %llvm.dbg.array = internal constant [3 x {  }*] [
    
                      
                    
    
                  1550
                    
                            {  }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype1 to {  }*),
    
                      
                    
    
                  1551
                    
                            {  }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype2 to {  }*),
    
                      
                    
    
                  1552
                    
                            {  }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype3 to {  }*) ], section "llvm.metadata"
    
                      
                    
    
                  1553
                    
                      
    1554 1555
    1556 1557 1558 1561 1562
    1563 1564

    Given the following as an example of C/C++ enumeration type;

    1565 1566
    
                      
                    
    
                  1567
                    
                      enum Trees {
    
                      
                    
    
                  1568
                    
                        Spruce = 100,
    
                      
                    
    
                  1569
                    
                        Oak = 200,
    
                      
                    
    
                  1570
                    
                        Maple = 300
    
                      
                    
    
                  1571
                    
                      };
    
                      
                    
    
                  1572
                    
                      
    1573 1574

    a C/C++ front-end would generate the following descriptors;

    1575 1576
    
                      
                    
    
                  1577
                    
                      ;;
    
                      
                    
    
                  1578
                    
                      ;; Define composite type for enum Trees
    
                      
                    
    
                  1579
                    
                      ;;
    
                      
                    
    
                  1580
                    
                      %llvm.dbg.compositetype = internal constant %llvm.dbg.compositetype.type {
    
                      
                    
    
                  1581
                    
                          uint 4, 
    
                      
                    
    
                  1582
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1583
                    
                          sbyte* getelementptr ([6 x sbyte]* %str1, int 0, int 0), 
    
                      
                    
    
                  1584
                    
                          {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
    
                      
                    
    
                  1585
                    
                          int 1, 
    
                      
                    
    
                  1586
                    
                          uint 32, 
    
                      
                    
    
                  1587
                    
                          uint 32, 
    
                      
                    
    
                  1588
                    
                          uint 0, 
    
                      
                    
    
                  1589
                    
                          {  }* null, 
    
                      
                    
    
                  1590
                    
                          {  }* cast ([3 x {  }*]* %llvm.dbg.array to {  }*) }, section "llvm.metadata"
    
                      
                    
    
                  1591
                    
                      %str1 = internal constant [6 x sbyte] c"Trees\00", section "llvm.metadata"
    
                      
                    
    
                  1592
                    
                      
    
                      
                    
    
                  1593
                    
                      ;;
    
                      
                    
    
                  1594
                    
                      ;; Define Spruce enumerator.
    
                      
                    
    
                  1595
                    
                      ;;
    
                      
                    
    
                  1596
                    
                      %llvm.dbg.enumerator1 = internal constant %llvm.dbg.enumerator.type {
    
                      
                    
    
                  1597
                    
                          uint 40, 
    
                      
                    
    
                  1598
                    
                          sbyte* getelementptr ([7 x sbyte]* %str2, int 0, int 0), 
    
                      
                    
    
                  1599
                    
                          int 100 }, section "llvm.metadata"
    
                      
                    
    
                  1600
                    
                      %str2 = internal constant [7 x sbyte] c"Spruce\00", section "llvm.metadata"
    
                      
                    
    
                  1601
                    
                      
    
                      
                    
    
                  1602
                    
                      ;;
    
                      
                    
    
                  1603
                    
                      ;; Define Oak enumerator.
    
                      
                    
    
                  1604
                    
                      ;;
    
                      
                    
    
                  1605
                    
                      %llvm.dbg.enumerator2 = internal constant %llvm.dbg.enumerator.type {
    
                      
                    
    
                  1606
                    
                          uint 40, 
    
                      
                    
    
                  1607
                    
                          sbyte* getelementptr ([4 x sbyte]* %str3, int 0, int 0), 
    
                      
                    
    
                  1608
                    
                          int 200 }, section "llvm.metadata"
    
                      
                    
    
                  1609
                    
                      %str3 = internal constant [4 x sbyte] c"Oak\00", section "llvm.metadata"
    
                      
                    
    
                  1610
                    
                      
    
                      
                    
    
                  1611
                    
                      ;;
    
                      
                    
    
                  1612
                    
                      ;; Define Maple enumerator.
    
                      
                    
    
                  1613
                    
                      ;;
    
                      
                    
    
                  1614
                    
                      %llvm.dbg.enumerator3 = internal constant %llvm.dbg.enumerator.type {
    
                      
                    
    
                  1615
                    
                          uint 40, 
    
                      
                    
    
                  1616
                    
                          sbyte* getelementptr ([6 x sbyte]* %str4, int 0, int 0), 
    
                      
                    
    
                  1617
                    
                          int 300 }, section "llvm.metadata"
    
                      
                    
    
                  1618
                    
                      %str4 = internal constant [6 x sbyte] c"Maple\00", section "llvm.metadata"
    
                      
                    
    
                  1619
                    
                      
    
                      
                    
    
                  1620
                    
                      ;;
    
                      
                    
    
                  1621
                    
                      ;; Define the array of enumerators used by composite type Trees.
    
                      
                    
    
                  1622
                    
                      ;;
    
                      
                    
    
                  1623
                    
                      %llvm.dbg.array = internal constant [3 x {  }*] [
    
                      
                    
    
                  1624
                    
                        {  }* cast (%llvm.dbg.enumerator.type* %llvm.dbg.enumerator1 to {  }*),
    
                      
                    
    
                  1625
                    
                        {  }* cast (%llvm.dbg.enumerator.type* %llvm.dbg.enumerator2 to {  }*),
    
                      
                    
    
                  1626
                    
                        {  }* cast (%llvm.dbg.enumerator.type* %llvm.dbg.enumerator3 to {  }*) ], section "llvm.metadata"
    
                      
                    
    
                  1627
                    
                      
    1628 1629
    11001630 11011631 11021632