Mercurial > hg > CbC > CbC_llvm
comparison docs/SourceLevelDebugging.rst @ 95:afa8332a0e37 LLVM3.8
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | 60c9769439b8 |
children | 7d135dc70f03 |
comparison
equal
deleted
inserted
replaced
84:f3e34b893a5f | 95:afa8332a0e37 |
---|---|
151 debugger to interpret the information. | 151 debugger to interpret the information. |
152 | 152 |
153 To provide basic functionality, the LLVM debugger does have to make some | 153 To provide basic functionality, the LLVM debugger does have to make some |
154 assumptions about the source-level language being debugged, though it keeps | 154 assumptions about the source-level language being debugged, though it keeps |
155 these to a minimum. The only common features that the LLVM debugger assumes | 155 these to a minimum. The only common features that the LLVM debugger assumes |
156 exist are :ref:`source files <format_files>`, and :ref:`program objects | 156 exist are `source files <LangRef.html#difile>`_, and `program objects |
157 <format_global_variables>`. These abstract objects are used by a debugger to | 157 <LangRef.html#diglobalvariable>`_. These abstract objects are used by a |
158 form stack traces, show information about local variables, etc. | 158 debugger to form stack traces, show information about local variables, etc. |
159 | 159 |
160 This section of the documentation first describes the representation aspects | 160 This section of the documentation first describes the representation aspects |
161 common to any source-language. :ref:`ccxx_frontend` describes the data layout | 161 common to any source-language. :ref:`ccxx_frontend` describes the data layout |
162 conventions used by the C and C++ front-ends. | 162 conventions used by the C and C++ front-ends. |
163 | 163 |
164 Debug information descriptors | 164 Debug information descriptors are `specialized metadata nodes |
165 ----------------------------- | 165 <LangRef.html#specialized-metadata>`_, first-class subclasses of ``Metadata``. |
166 | |
167 In consideration of the complexity and volume of debug information, LLVM | |
168 provides a specification for well formed debug descriptors. | |
169 | |
170 Consumers of LLVM debug information expect the descriptors for program objects | |
171 to start in a canonical format, but the descriptors can include additional | |
172 information appended at the end that is source-language specific. All debugging | |
173 information objects start with a tag to indicate what type of object it is. | |
174 The source-language is allowed to define its own objects, by using unreserved | |
175 tag numbers. We recommend using with tags in the range 0x1000 through 0x2000 | |
176 (there is a defined ``enum DW_TAG_user_base = 0x1000``.) | |
177 | |
178 The fields of debug descriptors used internally by LLVM are restricted to only | |
179 the simple data types ``i32``, ``i1``, ``float``, ``double``, ``mdstring`` and | |
180 ``mdnode``. | |
181 | |
182 .. code-block:: llvm | |
183 | |
184 !1 = metadata !{ | |
185 i32, ;; A tag | |
186 ... | |
187 } | |
188 | |
189 Most of the string and integer fields in descriptors are packed into a single, | |
190 null-separated ``mdstring``. The first field of the header is always an | |
191 ``i32`` containing the DWARF tag value identifying the content of the | |
192 descriptor. | |
193 | |
194 For clarity of definition in this document, these header fields are described | |
195 below split inside an imaginary ``DIHeader`` construct. This is invalid | |
196 assembly syntax. In valid IR, these fields are stringified and concatenated, | |
197 separated by ``\00``. | |
198 | |
199 The details of the various descriptors follow. | |
200 | |
201 Compile unit descriptors | |
202 ^^^^^^^^^^^^^^^^^^^^^^^^ | |
203 | |
204 .. code-block:: llvm | |
205 | |
206 !0 = metadata !{ | |
207 DIHeader( | |
208 i32, ;; Tag = 17 (DW_TAG_compile_unit) | |
209 i32, ;; DWARF language identifier (ex. DW_LANG_C89) | |
210 mdstring, ;; Producer (ex. "4.0.1 LLVM (LLVM research group)") | |
211 i1, ;; True if this is optimized. | |
212 mdstring, ;; Flags | |
213 i32, ;; Runtime version | |
214 mdstring, ;; Split debug filename | |
215 i32 ;; Debug info emission kind (1 = Full Debug Info, 2 = Line Tables Only) | |
216 ), | |
217 metadata, ;; Source directory (including trailing slash) & file pair | |
218 metadata, ;; List of enums types | |
219 metadata, ;; List of retained types | |
220 metadata, ;; List of subprograms | |
221 metadata, ;; List of global variables | |
222 metadata ;; List of imported entities | |
223 } | |
224 | |
225 These descriptors contain a source language ID for the file (we use the DWARF | |
226 3.0 ID numbers, such as ``DW_LANG_C89``, ``DW_LANG_C_plus_plus``, | |
227 ``DW_LANG_Cobol74``, etc), a reference to a metadata node containing a pair of | |
228 strings for the source file name and the working directory, as well as an | |
229 identifier string for the compiler that produced it. | |
230 | |
231 Compile unit descriptors provide the root context for objects declared in a | |
232 specific compilation unit. File descriptors are defined using this context. | |
233 These descriptors are collected by a named metadata ``!llvm.dbg.cu``. They | |
234 keep track of subprograms, global variables, type information, and imported | |
235 entities (declarations and namespaces). | |
236 | |
237 .. _format_files: | |
238 | |
239 File descriptors | |
240 ^^^^^^^^^^^^^^^^ | |
241 | |
242 .. code-block:: llvm | |
243 | |
244 !0 = metadata !{ | |
245 DIHeader( | |
246 i32 ;; Tag = 41 (DW_TAG_file_type) | |
247 ), | |
248 metadata ;; Source directory (including trailing slash) & file pair | |
249 } | |
250 | |
251 These descriptors contain information for a file. Global variables and top | |
252 level functions would be defined using this context. File descriptors also | |
253 provide context for source line correspondence. | |
254 | |
255 Each input file is encoded as a separate file descriptor in LLVM debugging | |
256 information output. | |
257 | |
258 .. _format_global_variables: | |
259 | |
260 Global variable descriptors | |
261 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
262 | |
263 .. code-block:: llvm | |
264 | |
265 !1 = metadata !{ | |
266 DIHeader( | |
267 i32, ;; Tag = 52 (DW_TAG_variable) | |
268 mdstring, ;; Name | |
269 mdstring, ;; Display name (fully qualified C++ name) | |
270 mdstring, ;; MIPS linkage name (for C++) | |
271 i32, ;; Line number where defined | |
272 i1, ;; True if the global is local to compile unit (static) | |
273 i1 ;; True if the global is defined in the compile unit (not extern) | |
274 ), | |
275 metadata, ;; Reference to context descriptor | |
276 metadata, ;; Reference to file where defined | |
277 metadata, ;; Reference to type descriptor | |
278 {}*, ;; Reference to the global variable | |
279 metadata, ;; The static member declaration, if any | |
280 } | |
281 | |
282 These descriptors provide debug information about global variables. They | |
283 provide details such as name, type and where the variable is defined. All | |
284 global variables are collected inside the named metadata ``!llvm.dbg.cu``. | |
285 | |
286 .. _format_subprograms: | |
287 | |
288 Subprogram descriptors | |
289 ^^^^^^^^^^^^^^^^^^^^^^ | |
290 | |
291 .. code-block:: llvm | |
292 | |
293 !2 = metadata !{ | |
294 DIHeader( | |
295 i32, ;; Tag = 46 (DW_TAG_subprogram) | |
296 mdstring, ;; Name | |
297 mdstring, ;; Display name (fully qualified C++ name) | |
298 mdstring, ;; MIPS linkage name (for C++) | |
299 i32, ;; Line number where defined | |
300 i1, ;; True if the global is local to compile unit (static) | |
301 i1, ;; True if the global is defined in the compile unit (not extern) | |
302 i32, ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual | |
303 i32, ;; Index into a virtual function | |
304 i32, ;; Flags - Artificial, Private, Protected, Explicit, Prototyped. | |
305 i1, ;; isOptimized | |
306 i32 ;; Line number where the scope of the subprogram begins | |
307 ), | |
308 metadata, ;; Source directory (including trailing slash) & file pair | |
309 metadata, ;; Reference to context descriptor | |
310 metadata, ;; Reference to type descriptor | |
311 metadata, ;; indicates which base type contains the vtable pointer for the | |
312 ;; derived class | |
313 {}*, ;; Reference to the LLVM function | |
314 metadata, ;; Lists function template parameters | |
315 metadata, ;; Function declaration descriptor | |
316 metadata ;; List of function variables | |
317 } | |
318 | |
319 These descriptors provide debug information about functions, methods and | |
320 subprograms. They provide details such as name, return types and the source | |
321 location where the subprogram is defined. | |
322 | |
323 Block descriptors | |
324 ^^^^^^^^^^^^^^^^^ | |
325 | |
326 .. code-block:: llvm | |
327 | |
328 !3 = metadata !{ | |
329 DIHeader( | |
330 i32, ;; Tag = 11 (DW_TAG_lexical_block) | |
331 i32, ;; Line number | |
332 i32, ;; Column number | |
333 i32 ;; Unique ID to identify blocks from a template function | |
334 ), | |
335 metadata, ;; Source directory (including trailing slash) & file pair | |
336 metadata ;; Reference to context descriptor | |
337 } | |
338 | |
339 This descriptor provides debug information about nested blocks within a | |
340 subprogram. The line number and column numbers are used to dinstinguish two | |
341 lexical blocks at same depth. | |
342 | |
343 .. code-block:: llvm | |
344 | |
345 !3 = metadata !{ | |
346 DIHeader( | |
347 i32, ;; Tag = 11 (DW_TAG_lexical_block) | |
348 i32 ;; DWARF path discriminator value | |
349 ), | |
350 metadata, ;; Source directory (including trailing slash) & file pair | |
351 metadata ;; Reference to the scope we're annotating with a file change | |
352 } | |
353 | |
354 This descriptor provides a wrapper around a lexical scope to handle file | |
355 changes in the middle of a lexical block. | |
356 | |
357 .. _format_basic_type: | |
358 | |
359 Basic type descriptors | |
360 ^^^^^^^^^^^^^^^^^^^^^^ | |
361 | |
362 .. code-block:: llvm | |
363 | |
364 !4 = metadata !{ | |
365 DIHeader( | |
366 i32, ;; Tag = 36 (DW_TAG_base_type) | |
367 mdstring, ;; Name (may be "" for anonymous types) | |
368 i32, ;; Line number where defined (may be 0) | |
369 i64, ;; Size in bits | |
370 i64, ;; Alignment in bits | |
371 i64, ;; Offset in bits | |
372 i32, ;; Flags | |
373 i32 ;; DWARF type encoding | |
374 ), | |
375 metadata, ;; Source directory (including trailing slash) & file pair (may be null) | |
376 metadata ;; Reference to context | |
377 } | |
378 | |
379 These descriptors define primitive types used in the code. Example ``int``, | |
380 ``bool`` and ``float``. The context provides the scope of the type, which is | |
381 usually the top level. Since basic types are not usually user defined the | |
382 context and line number can be left as NULL and 0. The size, alignment and | |
383 offset are expressed in bits and can be 64 bit values. The alignment is used | |
384 to round the offset when embedded in a :ref:`composite type | |
385 <format_composite_type>` (example to keep float doubles on 64 bit boundaries). | |
386 The offset is the bit offset if embedded in a :ref:`composite type | |
387 <format_composite_type>`. | |
388 | |
389 The type encoding provides the details of the type. The values are typically | |
390 one of the following: | |
391 | |
392 .. code-block:: llvm | |
393 | |
394 DW_ATE_address = 1 | |
395 DW_ATE_boolean = 2 | |
396 DW_ATE_float = 4 | |
397 DW_ATE_signed = 5 | |
398 DW_ATE_signed_char = 6 | |
399 DW_ATE_unsigned = 7 | |
400 DW_ATE_unsigned_char = 8 | |
401 | |
402 .. _format_derived_type: | |
403 | |
404 Derived type descriptors | |
405 ^^^^^^^^^^^^^^^^^^^^^^^^ | |
406 | |
407 .. code-block:: llvm | |
408 | |
409 !5 = metadata !{ | |
410 DIHeader( | |
411 i32, ;; Tag (see below) | |
412 mdstring, ;; Name (may be "" for anonymous types) | |
413 i32, ;; Line number where defined (may be 0) | |
414 i64, ;; Size in bits | |
415 i64, ;; Alignment in bits | |
416 i64, ;; Offset in bits | |
417 i32 ;; Flags to encode attributes, e.g. private | |
418 ), | |
419 metadata, ;; Source directory (including trailing slash) & file pair (may be null) | |
420 metadata, ;; Reference to context | |
421 metadata, ;; Reference to type derived from | |
422 metadata ;; (optional) Objective C property node | |
423 } | |
424 | |
425 These descriptors are used to define types derived from other types. The value | |
426 of the tag varies depending on the meaning. The following are possible tag | |
427 values: | |
428 | |
429 .. code-block:: llvm | |
430 | |
431 DW_TAG_formal_parameter = 5 | |
432 DW_TAG_member = 13 | |
433 DW_TAG_pointer_type = 15 | |
434 DW_TAG_reference_type = 16 | |
435 DW_TAG_typedef = 22 | |
436 DW_TAG_ptr_to_member_type = 31 | |
437 DW_TAG_const_type = 38 | |
438 DW_TAG_volatile_type = 53 | |
439 DW_TAG_restrict_type = 55 | |
440 | |
441 ``DW_TAG_member`` is used to define a member of a :ref:`composite type | |
442 <format_composite_type>` or :ref:`subprogram <format_subprograms>`. The type | |
443 of the member is the :ref:`derived type <format_derived_type>`. | |
444 ``DW_TAG_formal_parameter`` is used to define a member which is a formal | |
445 argument of a subprogram. | |
446 | |
447 ``DW_TAG_typedef`` is used to provide a name for the derived type. | |
448 | |
449 ``DW_TAG_pointer_type``, ``DW_TAG_reference_type``, ``DW_TAG_const_type``, | |
450 ``DW_TAG_volatile_type`` and ``DW_TAG_restrict_type`` are used to qualify the | |
451 :ref:`derived type <format_derived_type>`. | |
452 | |
453 :ref:`Derived type <format_derived_type>` location can be determined from the | |
454 context and line number. The size, alignment and offset are expressed in bits | |
455 and can be 64 bit values. The alignment is used to round the offset when | |
456 embedded in a :ref:`composite type <format_composite_type>` (example to keep | |
457 float doubles on 64 bit boundaries.) The offset is the bit offset if embedded | |
458 in a :ref:`composite type <format_composite_type>`. | |
459 | |
460 Note that the ``void *`` type is expressed as a type derived from NULL. | |
461 | |
462 .. _format_composite_type: | |
463 | |
464 Composite type descriptors | |
465 ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
466 | |
467 .. code-block:: llvm | |
468 | |
469 !6 = metadata !{ | |
470 DIHeader( | |
471 i32, ;; Tag (see below) | |
472 mdstring, ;; Name (may be "" for anonymous types) | |
473 i32, ;; Line number where defined (may be 0) | |
474 i64, ;; Size in bits | |
475 i64, ;; Alignment in bits | |
476 i64, ;; Offset in bits | |
477 i32, ;; Flags | |
478 i32 ;; Runtime languages | |
479 ), | |
480 metadata, ;; Source directory (including trailing slash) & file pair (may be null) | |
481 metadata, ;; Reference to context | |
482 metadata, ;; Reference to type derived from | |
483 metadata, ;; Reference to array of member descriptors | |
484 metadata, ;; Base type containing the vtable pointer for this type | |
485 metadata, ;; Template parameters | |
486 mdstring ;; A unique identifier for type uniquing purpose (may be null) | |
487 } | |
488 | |
489 These descriptors are used to define types that are composed of 0 or more | |
490 elements. The value of the tag varies depending on the meaning. The following | |
491 are possible tag values: | |
492 | |
493 .. code-block:: llvm | |
494 | |
495 DW_TAG_array_type = 1 | |
496 DW_TAG_enumeration_type = 4 | |
497 DW_TAG_structure_type = 19 | |
498 DW_TAG_union_type = 23 | |
499 DW_TAG_subroutine_type = 21 | |
500 DW_TAG_inheritance = 28 | |
501 | |
502 The vector flag indicates that an array type is a native packed vector. | |
503 | |
504 The members of array types (tag = ``DW_TAG_array_type``) are | |
505 :ref:`subrange descriptors <format_subrange>`, each | |
506 representing the range of subscripts at that level of indexing. | |
507 | |
508 The members of enumeration types (tag = ``DW_TAG_enumeration_type``) are | |
509 :ref:`enumerator descriptors <format_enumerator>`, each representing the | |
510 definition of enumeration value for the set. All enumeration type descriptors | |
511 are collected inside the named metadata ``!llvm.dbg.cu``. | |
512 | |
513 The members of structure (tag = ``DW_TAG_structure_type``) or union (tag = | |
514 ``DW_TAG_union_type``) types are any one of the :ref:`basic | |
515 <format_basic_type>`, :ref:`derived <format_derived_type>` or :ref:`composite | |
516 <format_composite_type>` type descriptors, each representing a field member of | |
517 the structure or union. | |
518 | |
519 For C++ classes (tag = ``DW_TAG_structure_type``), member descriptors provide | |
520 information about base classes, static members and member functions. If a | |
521 member is a :ref:`derived type descriptor <format_derived_type>` and has a tag | |
522 of ``DW_TAG_inheritance``, then the type represents a base class. If the member | |
523 of is a :ref:`global variable descriptor <format_global_variables>` then it | |
524 represents a static member. And, if the member is a :ref:`subprogram | |
525 descriptor <format_subprograms>` then it represents a member function. For | |
526 static members and member functions, ``getName()`` returns the members link or | |
527 the C++ mangled name. ``getDisplayName()`` the simplied version of the name. | |
528 | |
529 The first member of subroutine (tag = ``DW_TAG_subroutine_type``) type elements | |
530 is the return type for the subroutine. The remaining elements are the formal | |
531 arguments to the subroutine. | |
532 | |
533 :ref:`Composite type <format_composite_type>` location can be determined from | |
534 the context and line number. The size, alignment and offset are expressed in | |
535 bits and can be 64 bit values. The alignment is used to round the offset when | |
536 embedded in a :ref:`composite type <format_composite_type>` (as an example, to | |
537 keep float doubles on 64 bit boundaries). The offset is the bit offset if | |
538 embedded in a :ref:`composite type <format_composite_type>`. | |
539 | |
540 .. _format_subrange: | |
541 | |
542 Subrange descriptors | |
543 ^^^^^^^^^^^^^^^^^^^^ | |
544 | |
545 .. code-block:: llvm | |
546 | |
547 !42 = metadata !{ | |
548 DIHeader( | |
549 i32, ;; Tag = 33 (DW_TAG_subrange_type) | |
550 i64, ;; Low value | |
551 i64 ;; High value | |
552 ) | |
553 } | |
554 | |
555 These descriptors are used to define ranges of array subscripts for an array | |
556 :ref:`composite type <format_composite_type>`. The low value defines the lower | |
557 bounds typically zero for C/C++. The high value is the upper bounds. Values | |
558 are 64 bit. ``High - Low + 1`` is the size of the array. If ``Low > High`` | |
559 the array bounds are not included in generated debugging information. | |
560 | |
561 .. _format_enumerator: | |
562 | |
563 Enumerator descriptors | |
564 ^^^^^^^^^^^^^^^^^^^^^^ | |
565 | |
566 .. code-block:: llvm | |
567 | |
568 !6 = metadata !{ | |
569 DIHeader( | |
570 i32, ;; Tag = 40 (DW_TAG_enumerator) | |
571 mdstring, ;; Name | |
572 i64 ;; Value | |
573 ) | |
574 } | |
575 | |
576 These descriptors are used to define members of an enumeration :ref:`composite | |
577 type <format_composite_type>`, it associates the name to the value. | |
578 | |
579 Local variables | |
580 ^^^^^^^^^^^^^^^ | |
581 | |
582 .. code-block:: llvm | |
583 | |
584 !7 = metadata !{ | |
585 DIHeader( | |
586 i32, ;; Tag (see below) | |
587 mdstring, ;; Name | |
588 i32, ;; 24 bit - Line number where defined | |
589 ;; 8 bit - Argument number. 1 indicates 1st argument. | |
590 i32 ;; flags | |
591 ), | |
592 metadata, ;; Context | |
593 metadata, ;; Reference to file where defined | |
594 metadata, ;; Reference to the type descriptor | |
595 metadata ;; (optional) Reference to inline location | |
596 } | |
597 | |
598 These descriptors are used to define variables local to a sub program. The | |
599 value of the tag depends on the usage of the variable: | |
600 | |
601 .. code-block:: llvm | |
602 | |
603 DW_TAG_auto_variable = 256 | |
604 DW_TAG_arg_variable = 257 | |
605 | |
606 An auto variable is any variable declared in the body of the function. An | |
607 argument variable is any variable that appears as a formal argument to the | |
608 function. | |
609 | |
610 The context is either the subprogram or block where the variable is defined. | |
611 Name the source variable name. Context and line indicate where the variable | |
612 was defined. Type descriptor defines the declared type of the variable. | |
613 | |
614 Complex Expressions | |
615 ^^^^^^^^^^^^^^^^^^^ | |
616 .. code-block:: llvm | |
617 | |
618 !8 = metadata !{ | |
619 i32, ;; DW_TAG_expression | |
620 ... | |
621 } | |
622 | |
623 Complex expressions describe variable storage locations in terms of | |
624 prefix-notated DWARF expressions. Currently the only supported | |
625 operators are ``DW_OP_plus``, ``DW_OP_deref``, and ``DW_OP_piece``. | |
626 | |
627 The ``DW_OP_piece`` operator is used for (typically larger aggregate) | |
628 variables that are fragmented across several locations. It takes two | |
629 i32 arguments, an offset and a size in bytes to describe which piece | |
630 of the variable is at this location. | |
631 | |
632 | 166 |
633 .. _format_common_intrinsics: | 167 .. _format_common_intrinsics: |
634 | 168 |
635 Debugger intrinsic functions | 169 Debugger intrinsic functions |
636 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 170 ---------------------------- |
637 | 171 |
638 LLVM uses several intrinsic functions (name prefixed with "``llvm.dbg``") to | 172 LLVM uses several intrinsic functions (name prefixed with "``llvm.dbg``") to |
639 provide debug information at various points in generated code. | 173 provide debug information at various points in generated code. |
640 | 174 |
641 ``llvm.dbg.declare`` | 175 ``llvm.dbg.declare`` |
642 ^^^^^^^^^^^^^^^^^^^^ | 176 ^^^^^^^^^^^^^^^^^^^^ |
643 | 177 |
644 .. code-block:: llvm | 178 .. code-block:: llvm |
645 | 179 |
646 void %llvm.dbg.declare(metadata, metadata) | 180 void @llvm.dbg.declare(metadata, metadata, metadata) |
647 | 181 |
648 This intrinsic provides information about a local element (e.g., variable). | 182 This intrinsic provides information about a local element (e.g., variable). |
649 The first argument is metadata holding the alloca for the variable. The second | 183 The first argument is metadata holding the alloca for the variable. The second |
650 argument is metadata containing a description of the variable. | 184 argument is a `local variable <LangRef.html#dilocalvariable>`_ containing a |
185 description of the variable. The third argument is a `complex expression | |
186 <LangRef.html#diexpression>`_. | |
651 | 187 |
652 ``llvm.dbg.value`` | 188 ``llvm.dbg.value`` |
653 ^^^^^^^^^^^^^^^^^^ | 189 ^^^^^^^^^^^^^^^^^^ |
654 | 190 |
655 .. code-block:: llvm | 191 .. code-block:: llvm |
656 | 192 |
657 void %llvm.dbg.value(metadata, i64, metadata) | 193 void @llvm.dbg.value(metadata, i64, metadata, metadata) |
658 | 194 |
659 This intrinsic provides information when a user source variable is set to a new | 195 This intrinsic provides information when a user source variable is set to a new |
660 value. The first argument is the new value (wrapped as metadata). The second | 196 value. The first argument is the new value (wrapped as metadata). The second |
661 argument is the offset in the user source variable where the new value is | 197 argument is the offset in the user source variable where the new value is |
662 written. The third argument is metadata containing a description of the user | 198 written. The third argument is a `local variable |
663 source variable. | 199 <LangRef.html#dilocalvariable>`_ containing a description of the variable. The |
200 third argument is a `complex expression <LangRef.html#diexpression>`_. | |
664 | 201 |
665 Object lifetimes and scoping | 202 Object lifetimes and scoping |
666 ============================ | 203 ============================ |
667 | 204 |
668 In many languages, the local variables in functions can have their lifetimes or | 205 In many languages, the local variables in functions can have their lifetimes or |
691 | 228 |
692 Compiled to LLVM, this function would be represented like this: | 229 Compiled to LLVM, this function would be represented like this: |
693 | 230 |
694 .. code-block:: llvm | 231 .. code-block:: llvm |
695 | 232 |
233 ; Function Attrs: nounwind ssp uwtable | |
696 define void @foo() #0 { | 234 define void @foo() #0 { |
697 entry: | 235 entry: |
698 %X = alloca i32, align 4 | 236 %X = alloca i32, align 4 |
699 %Y = alloca i32, align 4 | 237 %Y = alloca i32, align 4 |
700 %Z = alloca i32, align 4 | 238 %Z = alloca i32, align 4 |
701 call void @llvm.dbg.declare(metadata !{i32* %X}, metadata !10), !dbg !12 | 239 call void @llvm.dbg.declare(metadata i32* %X, metadata !11, metadata !13), !dbg !14 |
702 ; [debug line = 2:7] [debug variable = X] | 240 store i32 21, i32* %X, align 4, !dbg !14 |
703 store i32 21, i32* %X, align 4, !dbg !12 | 241 call void @llvm.dbg.declare(metadata i32* %Y, metadata !15, metadata !13), !dbg !16 |
704 call void @llvm.dbg.declare(metadata !{i32* %Y}, metadata !13), !dbg !14 | 242 store i32 22, i32* %Y, align 4, !dbg !16 |
705 ; [debug line = 3:7] [debug variable = Y] | 243 call void @llvm.dbg.declare(metadata i32* %Z, metadata !17, metadata !13), !dbg !19 |
706 store i32 22, i32* %Y, align 4, !dbg !14 | 244 store i32 23, i32* %Z, align 4, !dbg !19 |
707 call void @llvm.dbg.declare(metadata !{i32* %Z}, metadata !15), !dbg !17 | 245 %0 = load i32, i32* %X, align 4, !dbg !20 |
708 ; [debug line = 5:9] [debug variable = Z] | 246 store i32 %0, i32* %Z, align 4, !dbg !21 |
709 store i32 23, i32* %Z, align 4, !dbg !17 | 247 %1 = load i32, i32* %Y, align 4, !dbg !22 |
710 %0 = load i32* %X, align 4, !dbg !18 | 248 store i32 %1, i32* %X, align 4, !dbg !23 |
711 [debug line = 6:5] | 249 ret void, !dbg !24 |
712 store i32 %0, i32* %Z, align 4, !dbg !18 | |
713 %1 = load i32* %Y, align 4, !dbg !19 | |
714 [debug line = 8:3] | |
715 store i32 %1, i32* %X, align 4, !dbg !19 | |
716 ret void, !dbg !20 | |
717 } | 250 } |
718 | 251 |
719 ; Function Attrs: nounwind readnone | 252 ; Function Attrs: nounwind readnone |
720 declare void @llvm.dbg.declare(metadata, metadata) #1 | 253 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
721 | 254 |
722 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" | 255 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
723 "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" | |
724 "no-infs-fp-math"="false" "no-nans-fp-math"="false" | |
725 "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" | |
726 "use-soft-float"="false" } | |
727 attributes #1 = { nounwind readnone } | 256 attributes #1 = { nounwind readnone } |
728 | 257 |
729 !llvm.dbg.cu = !{!0} | 258 !llvm.dbg.cu = !{!0} |
730 !llvm.module.flags = !{!8} | 259 !llvm.module.flags = !{!7, !8, !9} |
731 !llvm.ident = !{!9} | 260 !llvm.ident = !{!10} |
732 | 261 |
733 !0 = metadata !{i32 786449, metadata !1, i32 12, | 262 !0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) |
734 metadata !"clang version 3.4 (trunk 193128) (llvm/trunk 193139)", | 263 !1 = !DIFile(filename: "/dev/stdin", directory: "/Users/dexonsmith/data/llvm/debug-info") |
735 i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, | 264 !2 = !{} |
736 metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] \ | 265 !3 = !{!4} |
737 [/private/tmp/foo.c] \ | 266 !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, function: void ()* @foo, variables: !2) |
738 [DW_LANG_C99] | 267 !5 = !DISubroutineType(types: !6) |
739 !1 = metadata !{metadata !"t.c", metadata !"/private/tmp"} | 268 !6 = !{null} |
740 !2 = metadata !{i32 0} | 269 !7 = !{i32 2, !"Dwarf Version", i32 2} |
741 !3 = metadata !{metadata !4} | 270 !8 = !{i32 2, !"Debug Info Version", i32 3} |
742 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"foo", | 271 !9 = !{i32 1, !"PIC Level", i32 2} |
743 metadata !"foo", metadata !"", i32 1, metadata !6, | 272 !10 = !{!"clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)"} |
744 i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, | 273 !11 = !DILocalVariable(name: "X", scope: !4, file: !1, line: 2, type: !12) |
745 void ()* @foo, null, null, metadata !2, i32 1} | 274 !12 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
746 ; [ DW_TAG_subprogram ] [line 1] [def] [foo] | 275 !13 = !DIExpression() |
747 !5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] \ | 276 !14 = !DILocation(line: 2, column: 9, scope: !4) |
748 [/private/tmp/t.c] | 277 !15 = !DILocalVariable(name: "Y", scope: !4, file: !1, line: 3, type: !12) |
749 !6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, | 278 !16 = !DILocation(line: 3, column: 9, scope: !4) |
750 i64 0, i32 0, null, metadata !7, i32 0, null, null, null} | 279 !17 = !DILocalVariable(name: "Z", scope: !18, file: !1, line: 5, type: !12) |
751 ; [ DW_TAG_subroutine_type ] \ | 280 !18 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 5) |
752 [line 0, size 0, align 0, offset 0] [from ] | 281 !19 = !DILocation(line: 5, column: 11, scope: !18) |
753 !7 = metadata !{null} | 282 !20 = !DILocation(line: 6, column: 11, scope: !18) |
754 !8 = metadata !{i32 2, metadata !"Dwarf Version", i32 2} | 283 !21 = !DILocation(line: 6, column: 9, scope: !18) |
755 !9 = metadata !{metadata !"clang version 3.4 (trunk 193128) (llvm/trunk 193139)"} | 284 !22 = !DILocation(line: 8, column: 9, scope: !4) |
756 !10 = metadata !{i32 786688, metadata !4, metadata !"X", metadata !5, i32 2, | 285 !23 = !DILocation(line: 8, column: 7, scope: !4) |
757 metadata !11, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [X] \ | 286 !24 = !DILocation(line: 9, column: 3, scope: !4) |
758 [line 2] | 287 |
759 !11 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, | |
760 i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] \ | |
761 [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] | |
762 !12 = metadata !{i32 2, i32 0, metadata !4, null} | |
763 !13 = metadata !{i32 786688, metadata !4, metadata !"Y", metadata !5, i32 3, | |
764 metadata !11, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [Y] \ | |
765 [line 3] | |
766 !14 = metadata !{i32 3, i32 0, metadata !4, null} | |
767 !15 = metadata !{i32 786688, metadata !16, metadata !"Z", metadata !5, i32 5, | |
768 metadata !11, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [Z] \ | |
769 [line 5] | |
770 !16 = metadata !{i32 786443, metadata !1, metadata !4, i32 4, i32 0, i32 0} \ | |
771 ; [ DW_TAG_lexical_block ] [/private/tmp/t.c] | |
772 !17 = metadata !{i32 5, i32 0, metadata !16, null} | |
773 !18 = metadata !{i32 6, i32 0, metadata !16, null} | |
774 !19 = metadata !{i32 8, i32 0, metadata !4, null} ; [ DW_TAG_imported_declaration ] | |
775 !20 = metadata !{i32 9, i32 0, metadata !4, null} | |
776 | 288 |
777 This example illustrates a few important details about LLVM debugging | 289 This example illustrates a few important details about LLVM debugging |
778 information. In particular, it shows how the ``llvm.dbg.declare`` intrinsic and | 290 information. In particular, it shows how the ``llvm.dbg.declare`` intrinsic and |
779 location information, which are attached to an instruction, are applied | 291 location information, which are attached to an instruction, are applied |
780 together to allow a debugger to analyze the relationship between statements, | 292 together to allow a debugger to analyze the relationship between statements, |
781 variable definitions, and the code used to implement the function. | 293 variable definitions, and the code used to implement the function. |
782 | 294 |
783 .. code-block:: llvm | 295 .. code-block:: llvm |
784 | 296 |
785 call void @llvm.dbg.declare(metadata !{i32* %X}, metadata !10), !dbg !12 | 297 call void @llvm.dbg.declare(metadata i32* %X, metadata !11, metadata !13), !dbg !14 |
786 ; [debug line = 2:7] [debug variable = X] | 298 ; [debug line = 2:7] [debug variable = X] |
787 | 299 |
788 The first intrinsic ``%llvm.dbg.declare`` encodes debugging information for the | 300 The first intrinsic ``%llvm.dbg.declare`` encodes debugging information for the |
789 variable ``X``. The metadata ``!dbg !12`` attached to the intrinsic provides | 301 variable ``X``. The metadata ``!dbg !14`` attached to the intrinsic provides |
790 scope information for the variable ``X``. | 302 scope information for the variable ``X``. |
791 | 303 |
792 .. code-block:: llvm | 304 .. code-block:: llvm |
793 | 305 |
794 !12 = metadata !{i32 2, i32 0, metadata !4, null} | 306 !14 = !DILocation(line: 2, column: 9, scope: !4) |
795 !4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"foo", | 307 !4 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, |
796 metadata !"foo", metadata !"", i32 1, metadata !6, | 308 isLocal: false, isDefinition: true, scopeLine: 1, |
797 i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, | 309 isOptimized: false, function: void ()* @foo, |
798 void ()* @foo, null, null, metadata !2, i32 1} | 310 variables: !2) |
799 ; [ DW_TAG_subprogram ] [line 1] [def] [foo] | 311 |
800 | 312 Here ``!14`` is metadata providing `location information |
801 Here ``!12`` is metadata providing location information. It has four fields: | 313 <LangRef.html#dilocation>`_. In this example, scope is encoded by ``!4``, a |
802 line number, column number, scope, and original scope. The original scope | 314 `subprogram descriptor <LangRef.html#disubprogram>`_. This way the location |
803 represents inline location if this instruction is inlined inside a caller, and | |
804 is null otherwise. In this example, scope is encoded by ``!4``, a | |
805 :ref:`subprogram descriptor <format_subprograms>`. This way the location | |
806 information attached to the intrinsics indicates that the variable ``X`` is | 315 information attached to the intrinsics indicates that the variable ``X`` is |
807 declared at line number 2 at a function level scope in function ``foo``. | 316 declared at line number 2 at a function level scope in function ``foo``. |
808 | 317 |
809 Now lets take another example. | 318 Now lets take another example. |
810 | 319 |
811 .. code-block:: llvm | 320 .. code-block:: llvm |
812 | 321 |
813 call void @llvm.dbg.declare(metadata !{i32* %Z}, metadata !15), !dbg !17 | 322 call void @llvm.dbg.declare(metadata i32* %Z, metadata !17, metadata !13), !dbg !19 |
814 ; [debug line = 5:9] [debug variable = Z] | 323 ; [debug line = 5:9] [debug variable = Z] |
815 | 324 |
816 The third intrinsic ``%llvm.dbg.declare`` encodes debugging information for | 325 The third intrinsic ``%llvm.dbg.declare`` encodes debugging information for |
817 variable ``Z``. The metadata ``!dbg !17`` attached to the intrinsic provides | 326 variable ``Z``. The metadata ``!dbg !19`` attached to the intrinsic provides |
818 scope information for the variable ``Z``. | 327 scope information for the variable ``Z``. |
819 | 328 |
820 .. code-block:: llvm | 329 .. code-block:: llvm |
821 | 330 |
822 !16 = metadata !{i32 786443, metadata !1, metadata !4, i32 4, i32 0, i32 0} \ | 331 !18 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 5) |
823 ; [ DW_TAG_lexical_block ] [/private/tmp/t.c] | 332 !19 = !DILocation(line: 5, column: 11, scope: !18) |
824 !17 = metadata !{i32 5, i32 0, metadata !16, null} | 333 |
825 | 334 Here ``!19`` indicates that ``Z`` is declared at line number 5 and column |
826 Here ``!15`` indicates that ``Z`` is declared at line number 5 and | 335 number 0 inside of lexical scope ``!18``. The lexical scope itself resides |
827 column number 0 inside of lexical scope ``!16``. The lexical scope itself | 336 inside of subprogram ``!4`` described above. |
828 resides inside of subprogram ``!4`` described above. | |
829 | 337 |
830 The scope information attached with each instruction provides a straightforward | 338 The scope information attached with each instruction provides a straightforward |
831 way to find instructions covered by a scope. | 339 way to find instructions covered by a scope. |
832 | 340 |
833 .. _ccxx_frontend: | 341 .. _ccxx_frontend: |
858 C/C++ source file information | 366 C/C++ source file information |
859 ----------------------------- | 367 ----------------------------- |
860 | 368 |
861 ``llvm::Instruction`` provides easy access to metadata attached with an | 369 ``llvm::Instruction`` provides easy access to metadata attached with an |
862 instruction. One can extract line number information encoded in LLVM IR using | 370 instruction. One can extract line number information encoded in LLVM IR using |
863 ``Instruction::getMetadata()`` and ``DILocation::getLineNumber()``. | 371 ``Instruction::getDebugLoc()`` and ``DILocation::getLine()``. |
864 | 372 |
865 .. code-block:: c++ | 373 .. code-block:: c++ |
866 | 374 |
867 if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction | 375 if (DILocation *Loc = I->getDebugLoc()) { // Here I is an LLVM instruction |
868 DILocation Loc(N); // DILocation is in DebugInfo.h | 376 unsigned Line = Loc->getLine(); |
869 unsigned Line = Loc.getLineNumber(); | 377 StringRef File = Loc->getFilename(); |
870 StringRef File = Loc.getFilename(); | 378 StringRef Dir = Loc->getDirectory(); |
871 StringRef Dir = Loc.getDirectory(); | |
872 } | 379 } |
873 | 380 |
874 C/C++ global variable information | 381 C/C++ global variable information |
875 --------------------------------- | 382 --------------------------------- |
876 | 383 |
886 | 393 |
887 ;; | 394 ;; |
888 ;; Define the global itself. | 395 ;; Define the global itself. |
889 ;; | 396 ;; |
890 @MyGlobal = global i32 100, align 4 | 397 @MyGlobal = global i32 100, align 4 |
891 ... | 398 |
892 ;; | 399 ;; |
893 ;; List of debug info of globals | 400 ;; List of debug info of globals |
894 ;; | 401 ;; |
895 !llvm.dbg.cu = !{!0} | 402 !llvm.dbg.cu = !{!0} |
896 | 403 |
404 ;; Some unrelated metadata. | |
405 !llvm.module.flags = !{!6, !7} | |
406 | |
897 ;; Define the compile unit. | 407 ;; Define the compile unit. |
898 !0 = metadata !{ | 408 !0 = !DICompileUnit(language: DW_LANG_C99, file: !1, |
899 ; Header( | 409 producer: |
900 ; i32 17, ;; Tag | 410 "clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)", |
901 ; i32 0, ;; Context | 411 isOptimized: false, runtimeVersion: 0, emissionKind: 1, |
902 ; i32 4, ;; Language | 412 enums: !2, retainedTypes: !2, subprograms: !2, globals: |
903 ; metadata !"clang version 3.6.0 ", ;; Producer | 413 !3, imports: !2) |
904 ; i1 false, ;; "isOptimized"? | 414 |
905 ; metadata !"", ;; Flags | 415 ;; |
906 ; i32 0, ;; Runtime Version | 416 ;; Define the file |
907 ; "", ;; Split debug filename | 417 ;; |
908 ; 1 ;; Full debug info | 418 !1 = !DIFile(filename: "/dev/stdin", |
909 ; ) | 419 directory: "/Users/dexonsmith/data/llvm/debug-info") |
910 metadata !"0x11\0012\00clang version 3.6.0 \000\00\000\00\001", | |
911 metadata !1, ;; File | |
912 metadata !2, ;; Enum Types | |
913 metadata !2, ;; Retained Types | |
914 metadata !2, ;; Subprograms | |
915 metadata !3, ;; Global Variables | |
916 metadata !2 ;; Imported entities | |
917 } ; [ DW_TAG_compile_unit ] | |
918 | |
919 ;; The file/directory pair. | |
920 !1 = metadata !{ | |
921 metadata !"foo.c", ;; Filename | |
922 metadata !"/Users/dexonsmith/data/llvm/debug-info" ;; Directory | |
923 } | |
924 | 420 |
925 ;; An empty array. | 421 ;; An empty array. |
926 !2 = metadata !{} | 422 !2 = !{} |
927 | 423 |
928 ;; The Array of Global Variables | 424 ;; The Array of Global Variables |
929 !3 = metadata !{ | 425 !3 = !{!4} |
930 metadata !4 | |
931 } | |
932 | 426 |
933 ;; | 427 ;; |
934 ;; Define the global variable itself. | 428 ;; Define the global variable itself. |
935 ;; | 429 ;; |
936 !4 = metadata !{ | 430 !4 = !DIGlobalVariable(name: "MyGlobal", scope: !0, file: !1, line: 1, |
937 ; Header( | 431 type: !5, isLocal: false, isDefinition: true, |
938 ; i32 52, ;; Tag | 432 variable: i32* @MyGlobal) |
939 ; metadata !"MyGlobal", ;; Name | |
940 ; metadata !"MyGlobal", ;; Display Name | |
941 ; metadata !"", ;; Linkage Name | |
942 ; i32 1, ;; Line | |
943 ; i32 0, ;; IsLocalToUnit | |
944 ; i32 1 ;; IsDefinition | |
945 ; ) | |
946 metadata !"0x34\00MyGlobal\00MyGlobal\00\001\000\001", | |
947 null, ;; Unused | |
948 metadata !5, ;; File | |
949 metadata !6, ;; Type | |
950 i32* @MyGlobal, ;; LLVM-IR Value | |
951 null ;; Static member declaration | |
952 } ; [ DW_TAG_variable ] | |
953 | |
954 ;; | |
955 ;; Define the file | |
956 ;; | |
957 !5 = metadata !{ | |
958 ; Header( | |
959 ; i32 41 ;; Tag | |
960 ; ) | |
961 metadata !"0x29", | |
962 metadata !1 ;; File/directory pair | |
963 } ; [ DW_TAG_file_type ] | |
964 | 433 |
965 ;; | 434 ;; |
966 ;; Define the type | 435 ;; Define the type |
967 ;; | 436 ;; |
968 !6 = metadata !{ | 437 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
969 ; Header( | 438 |
970 ; i32 36, ;; Tag | 439 ;; Dwarf version to output. |
971 ; metadata !"int", ;; Name | 440 !6 = !{i32 2, !"Dwarf Version", i32 2} |
972 ; i32 0, ;; Line | 441 |
973 ; i64 32, ;; Size in Bits | 442 ;; Debug info schema version. |
974 ; i64 32, ;; Align in Bits | 443 !7 = !{i32 2, !"Debug Info Version", i32 3} |
975 ; i64 0, ;; Offset | |
976 ; i32 0, ;; Flags | |
977 ; i32 5 ;; Encoding | |
978 ; ) | |
979 metadata !"0x24\00int\000\0032\0032\000\000\005", | |
980 null, ;; Unused | |
981 null ;; Unused | |
982 } ; [ DW_TAG_base_type ] | |
983 | 444 |
984 C/C++ function information | 445 C/C++ function information |
985 -------------------------- | 446 -------------------------- |
986 | 447 |
987 Given a function declared as follows: | 448 Given a function declared as follows: |
997 .. code-block:: llvm | 458 .. code-block:: llvm |
998 | 459 |
999 ;; | 460 ;; |
1000 ;; Define the anchor for subprograms. | 461 ;; Define the anchor for subprograms. |
1001 ;; | 462 ;; |
1002 !6 = metadata !{ | 463 !4 = !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !5, |
1003 ; Header( | 464 isLocal: false, isDefinition: true, scopeLine: 1, |
1004 ; i32 46, ;; Tag | 465 flags: DIFlagPrototyped, isOptimized: false, |
1005 ; metadata !"main", ;; Name | 466 function: i32 (i32, i8**)* @main, variables: !2) |
1006 ; metadata !"main", ;; Display name | |
1007 ; metadata !"", ;; Linkage name | |
1008 ; i32 1, ;; Line number | |
1009 ; i1 false, ;; Is local | |
1010 ; i1 true, ;; Is definition | |
1011 ; i32 0, ;; Virtuality attribute, e.g. pure virtual function | |
1012 ; i32 0, ;; Index into virtual table for C++ methods | |
1013 ; i32 256, ;; Flags | |
1014 ; i1 0, ;; True if this function is optimized | |
1015 ; 1 ;; Line number of the opening '{' of the function | |
1016 ; ) | |
1017 metadata !"0x2e\00main\00main\00\001\000\001\000\000\00256\000\001", | |
1018 metadata !1, ;; File | |
1019 metadata !5, ;; Context | |
1020 metadata !6, ;; Type | |
1021 null, ;; Containing type | |
1022 i32 (i32, i8**)* @main, ;; Pointer to llvm::Function | |
1023 null, ;; Function template parameters | |
1024 null, ;; Function declaration | |
1025 metadata !2 ;; List of function variables (emitted when optimizing) | |
1026 } | |
1027 | 467 |
1028 ;; | 468 ;; |
1029 ;; Define the subprogram itself. | 469 ;; Define the subprogram itself. |
1030 ;; | 470 ;; |
1031 define i32 @main(i32 %argc, i8** %argv) { | 471 define i32 @main(i32 %argc, i8** %argv) { |
1266 qualified name. Debugger users tend not to enter their search strings as | 706 qualified name. Debugger users tend not to enter their search strings as |
1267 "``a::b::c(int,const Foo&) const``", but rather as "``c``", "``b::c``" , or | 707 "``a::b::c(int,const Foo&) const``", but rather as "``c``", "``b::c``" , or |
1268 "``a::b::c``". So the name entered in the name table must be demangled in | 708 "``a::b::c``". So the name entered in the name table must be demangled in |
1269 order to chop it up appropriately and additional names must be manually entered | 709 order to chop it up appropriately and additional names must be manually entered |
1270 into the table to make it effective as a name lookup table for debuggers to | 710 into the table to make it effective as a name lookup table for debuggers to |
1271 se. | 711 use. |
1272 | 712 |
1273 All debuggers currently ignore the "``.debug_pubnames``" table as a result of | 713 All debuggers currently ignore the "``.debug_pubnames``" table as a result of |
1274 its inconsistent and useless public-only name content making it a waste of | 714 its inconsistent and useless public-only name content making it a waste of |
1275 space in the object file. These tables, when they are written to disk, are not | 715 space in the object file. These tables, when they are written to disk, are not |
1276 sorted in any way, leaving every debugger to do its own parsing and sorting. | 716 sorted in any way, leaving every debugger to do its own parsing and sorting. |