1 \chapter{Program Scope Entries}
2 \label{chap:programscopeentries}
3 This section describes debugging information entries that
4 relate to different levels of program scope: compilation,
5 module, subprogram, and so on. Except for separate type
6 entries (see Section \refersec{chap:separatetypeunitentries}),
7 these entries may be thought of
8 as bounded by ranges of text addresses within the program.
10 \section{Unit Entries}
11 An object file may contain one or more compilation units,
13 \addtoindexx{unit|see {compilation unit, partial unit \textit{or} type unit}}
14 \addtoindexx{compilation unit}
16 \addtoindexx{normal compilation unit}
17 \addtoindexx{normal compilation unit|see {compilation unit}}
18 normal compilation units,
19 partial compilation units and
20 \addtoindexx{type unit}
22 \addtoindex{partial compilation unit}
23 is related to one or more other compilation units that
25 \addtoindex{type unit} represents
26 a single complete type in a
27 separate unit. Either a normal compilation unit or a
28 \addtoindex{partial compilation unit}
29 may be logically incorporated into another
30 compilation unit using an
31 \addtoindex{imported unit entry}.
33 \subsection[Normal and Partial CU Entries]{Normal and Partial Compilation Unit Entries}
34 \label{chap:normalandpartialcompilationunitentries}
36 A \addtoindex{normal compilation unit} is represented by a debugging
37 information entry with the
38 tag \DWTAGcompileunitTARG.
39 A \addtoindex{partial compilation unit} is represented by a debugging information
41 tag \DWTAGpartialunitTARG.
43 In a simple normal compilation, a single compilation unit with
45 \DWTAGcompileunit{} represents a complete object file
47 \DWTAGpartialunit{} is not used.
49 employing the DWARF space compression and duplicate elimination
51 Appendix \refersec{app:usingcompilationunits},
52 multiple compilation units using
54 \DWTAGcompileunit{} and/or
55 \DWTAGpartialunit{} are
56 used to represent portions of an object file.
58 \textit{A normal compilation unit typically represents the text and
59 data contributed to an executable by a single relocatable
60 object file. It may be derived from several source files,
61 including pre\dash processed \doublequote{include files.}
62 A \addtoindex{partial compilation unit} typically represents a part of the text
63 and data of a relocatable object file, in a manner that can
64 potentially be shared with the results of other compilations
65 to save space. It may be derived from an \doublequote{include file,}
66 template instantiation, or other implementation\dash dependent
67 portion of a compilation. A normal compilation unit can also
68 function in a manner similar to a partial compilation unit
71 A compilation unit entry owns debugging information
72 entries that represent all or part of the declarations
73 made in the corresponding compilation. In the case of a
74 partial compilation unit, the containing scope of its owned
75 declarations is indicated by imported unit entries in one
76 or more other compilation unit entries that refer to that
77 partial compilation unit (see
78 Section \refersec{chap:importedunitentries}).
81 Compilation unit entries may have the following
83 \begin{enumerate}[1. ]
84 \item Either a \DWATlowpc{} and
86 \addtoindexx{high PC attribute}
88 \addtoindexx{low PC attribute}
90 \addtoindexx{ranges attribute}
92 \DWATranges{} attribute
93 \addtoindexx{ranges attribute}
95 \addtoindexx{discontiguous address ranges|see{non-contiguous address ranges}}
98 non\dash contiguous address ranges, respectively,
99 of the machine instructions generated for the compilation
100 unit (see Section \refersec{chap:codeaddressesandranges}).
102 A \DWATlowpc{} attribute
106 \addtoindexx{ranges attribute}
108 \DWATranges{} to specify the
109 \addtoindexx{ranges attribute}
110 default base address for use in
111 \addtoindexx{location list}
112 location lists (see Section
113 \refersec{chap:locationlists}) and range lists
114 \addtoindexx{range list}
115 (see Section \refersec{chap:noncontiguousaddressranges}).
117 \item A \DWATname{} attribute
118 \addtoindexx{name attribute}
119 whose value is a null\dash terminated
121 \hypertarget{chap:DWATnamepathnameofcompilationsource}
122 containing the full or relative path name of the primary
123 source file from which the compilation unit was derived.
125 \item A \DWATlanguage{} attribute
126 \addtoindexx{language attribute}
127 whose constant value is an
128 \hypertarget{chap:DWATlanguageprogramminglanguage}
130 \addtoindexx{language attribute}
131 indicating the source language of the compilation
132 unit. The set of language names and their meanings are given
133 in Table \refersec{tab:languagenames}.
137 \caption{Language names}
138 \label{tab:languagenames}
141 Language name & Meaning\\ \hline
142 \DWLANGAdaeightythreeTARG{} \dag & ISO \addtoindex{Ada}:1983 \addtoindexx{Ada} \\
143 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada} \\
144 \DWLANGCTARG & Non-standardized C, such as K\&R \\
145 \DWLANGCeightynineTARG & ISO C:1989 \\
146 \DWLANGCninetynineTARG & ISO \addtoindex{C}:1999 \\
147 \DWLANGCplusplusTARG & ISO \addtoindex{C++}:1998 \\
148 \DWLANGCobolseventyfourTARG & ISO \addtoindex{COBOL}:1974 \\
149 \DWLANGCoboleightyfiveTARG & ISO \addtoindex{COBOL}:1985 \\
150 \DWLANGDTARG{} \dag & D \addtoindexx{D language} \\
151 \DWLANGFortranseventysevenTARG &ISO \addtoindex{FORTRAN} 77\\
152 \DWLANGFortranninetyTARG & ISO \addtoindex{Fortran 90}\\
153 \DWLANGFortranninetyfiveTARG & ISO \addtoindex{Fortran 95}\\
154 \DWLANGGoTARG{} \dag & \addtoindex{Go}\\
155 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell}\\
156 \DWLANGJavaTARG{} & \addtoindex{Java}\\
157 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2}\\
158 \DWLANGModulathreeTARG & \addtoindex{Modula-3}\\
159 \DWLANGObjCTARG{} & \addtoindex{Objective C}\\
160 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++}\\
161 \DWLANGOpenCLTARG{} \dag & \addtoindex{OpenCL}\\
162 \DWLANGPascaleightythreeTARG & ISO \addtoindex{Pascal}:1983\\
163 \DWLANGPLITARG{} \dag & ANSI \addtoindex{PL/I}:1976\\
164 \DWLANGPythonTARG{} \dag & \addtoindex{Python}\\
165 \DWLANGUPCTARG{} & \addtoindex{Unified Parallel C}\addtoindexx{UPC}\\ \hline
166 \dag \ \ \textit{Support for these languages is limited.}& \\
170 \item A \DWATstmtlist{}
171 attribute whose value is
172 \addtoindexx{statement list attribute}
174 \addtoindexx{section offset!in statement list attribute}
176 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}
177 offset to the line number information for this compilation
180 This information is placed in a separate object file
181 section from the debugging information entries themselves. The
182 value of the statement list attribute is the offset in the
183 \dotdebugline{} section of the first byte of the line number
184 information for this compilation unit
185 (see Section \refersec{chap:linenumberinformation}).
188 \item A \DWATmacroinfo{} attribute
189 \addtoindexx{macro information attribute}
191 \addtoindexx{section offset!in macro information attribute}
193 \hypertarget{chap:DWATmacroinfomacroinformation}
194 offset to the macro information for this compilation unit.
196 This information is placed in a separate object file section
197 from the debugging information entries themselves. The
198 value of the macro information attribute is the offset in
199 the \dotdebugmacinfo{} section of the first byte of the macro
200 information for this compilation unit
201 (see Section \refersec{chap:macroinformation}).
207 \hypertarget{chap:DWATcompdircompilationdirectory}
209 null\dash terminated string containing the current working directory
210 of the compilation command that produced this compilation
211 unit in whatever form makes sense for the host system.
213 \item A \DWATproducer{} attribute
214 \addtoindexx{producer attribute}
215 whose value is a null\dash
216 terminated string containing information about the compiler
217 \hypertarget{chap:DWATproducercompileridentification}
218 that produced the compilation unit. The actual contents of
219 the string will be specific to each producer, but should
220 begin with the name of the compiler vendor or some other
221 identifying character sequence that should avoid confusion
222 with other producer values.
225 \item A \DWATidentifiercase{}
227 \addtoindexx{identifier case attribute}
229 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}
230 constant value is a code describing the treatment
231 of identifiers within this compilation unit. The
232 set of identifier case codes is given in
233 Table \refersec{tab:identifiercasecodes}.
235 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
236 \DWIDcasesensitive{} \\
239 \DWIDcaseinsensitive{} \\
240 \end{simplenametable}
242 \DWIDcasesensitiveTARG{} is the default for all compilation units
243 that do not have this attribute. It indicates that names given
244 as the values of \DWATname{} attributes
245 \addtoindexx{name attribute}
246 in debugging information
247 entries for the compilation unit reflect the names as they
248 appear in the source program. The debugger should be sensitive
249 to the case of identifier names when doing identifier lookups.
251 \DWIDupcaseTARG{} means that the
252 producer of the debugging
253 information for this compilation unit converted all source
254 names to upper case. The values of the name attributes may not
255 reflect the names as they appear in the source program. The
256 debugger should convert all names to upper case when doing
259 \DWIDdowncaseTARG{} means that
260 the producer of the debugging
261 information for this compilation unit converted all source
262 names to lower case. The values of the name attributes may not
263 reflect the names as they appear in the source program. The
264 debugger should convert all names to lower case when doing
268 \DWIDcaseinsensitiveTARG{} means that the values of the name
269 attributes reflect the names as they appear in the source
270 program but that a case insensitive lookup should be used to
274 \item A \DWATbasetypes{} attribute whose value is a
275 \livelink{chap:classreference}{reference}.
278 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}
280 \addtoindexx{base types attribute}
281 points to a debugging information entry
282 representing another compilation unit. It may be used
283 to specify the compilation unit containing the base type
284 entries used by entries in the current compilation unit
285 (see Section \refersec{chap:basetypeentries}).
288 This attribute provides a consumer a way to find the definition
289 of base types for a compilation unit that does not itself
290 contain such definitions. This allows a consumer, for example,
291 to interpret a type conversion to a base type
292 % getting this link target at the right spot is tricky.
293 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}
296 \item A \DWATuseUTFeight{} attribute,
297 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
298 which is a \livelink{chap:classflag}{flag} whose
299 presence indicates that all strings (such as the names of
300 declared entities in the source program) are represented
301 using the UTF\dash 8 representation
302 (see Section \refersec{datarep:attributeencodings}).
305 \item A \DWATmainsubprogram{} attribute, which is a \livelink{chap:classflag}{flag}
306 \addtoindexx{main subprogram attribute}
307 whose presence indicates
308 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}
309 that the compilation unit contains a
310 subprogram that has been identified as the starting function
311 of the program. If more than one compilation unit contains
312 this \nolink{flag}, any one of them may contain the starting function.
314 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
316 to specify and provide a user\dash specified name for the main
317 subroutine of a program.
318 \addtoindex{C} uses the name \doublequote{main} to identify
319 the main subprogram of a program. Some other languages provide
320 similar or other means to identify the main subprogram of
325 The base address of a compilation unit is defined as the
326 value of the \DWATlowpc{} attribute, if present; otherwise,
327 it is undefined. If the base address is undefined, then any
328 DWARF entry or structure defined in terms of the base address
329 of that compilation unit is not valid.
332 \subsection{Imported Unit Entries}
333 \label{chap:importedunitentries}
335 \hypertarget{chap:DWATimportimportedunit}
336 place where a normal or partial unit is imported is
337 represented by a debugging information entry with the
338 \addtoindexx{imported unit entry}
339 tag \DWTAGimportedunitTARG.
340 An imported unit entry contains
341 \addtoindexx{import attribute}
343 \DWATimport{} attribute
344 whose value is a \livelink{chap:classreference}{reference} to the
345 normal or partial compilation unit whose declarations logically
346 belong at the place of the imported unit entry.
348 \textit{An imported unit entry does not necessarily correspond to
349 any entity or construct in the source program. It is merely
350 \doublequote{glue} used to relate a partial unit, or a compilation
351 unit used as a partial unit, to a place in some other
354 \subsection{Separate Type Unit Entries}
355 \label{chap:separatetypeunitentries}
356 An object file may contain any number of separate type
357 unit entries, each representing a single complete type
359 Each \addtoindex{type unit} must be uniquely identified by
360 a 64\dash bit signature, stored as part of the type unit, which
361 can be used to reference the type definition from debugging
362 information entries in other compilation units and type units.
364 A type unit is represented by a debugging information entry
365 with the tag \DWTAGtypeunitTARG.
366 A \addtoindex{type unit entry} owns debugging
367 information entries that represent the definition of a single
368 type, plus additional debugging information entries that may
369 be necessary to include as part of the definition of the type.
371 A type unit entry may have a
372 \DWATlanguage{} attribute,
374 \addtoindexx{language attribute}
375 constant value is an integer code indicating the source
376 language used to define the type. The set of language names
377 and their meanings are given in Table \refersec{tab:languagenames}.
379 A \addtoindex{type unit} entry for a given type T owns a debugging
380 information entry that represents a defining declaration
381 of type T. If the type is nested within enclosing types or
382 namespaces, the debugging information entry for T is nested
383 within debugging information entries describing its containers;
384 otherwise, T is a direct child of the type unit entry.
386 A type unit entry may also own additional debugging information
387 entries that represent declarations of additional types that
388 are referenced by type T and have not themselves been placed in
389 separate type units. Like T, if an additional type U is nested
390 within enclosing types or namespaces, the debugging information
391 entry for U is nested within entries describing its containers;
392 otherwise, U is a direct child of the type unit entry.
394 The containing entries for types T and U are declarations,
395 and the outermost containing entry for any given type T or
396 U is a direct child of the type unit entry. The containing
397 entries may be shared among the additional types and between
398 T and the additional types.
400 \textit{Types are not required to be placed in type units. In general,
401 only large types such as structure, class, enumeration, and
402 union types included from header files should be considered
403 for separate type units. Base types and other small types
404 are not usually worth the overhead of placement in separate
405 type units. Types that are unlikely to be replicated, such
406 as those defined in the main source file, are also better
407 left in the main compilation unit.}
409 \section{Module, Namespace and Importing Entries}
410 \textit{Modules and namespaces provide a means to collect related
411 entities into a single entity and to manage the names of
414 \subsection{Module Entries}
415 \label{chap:moduleentries}
416 \textit{Several languages have the concept of a \doublequote{module.}
417 \addtoindexx{Modula-2}
418 A Modula\dash 2 definition module
419 \addtoindexx{Modula-2!definition module}
420 may be represented by a module
422 \addtoindex{declaration attribute}
423 (\DWATdeclaration). A
424 \addtoindex{Fortran 90} module
425 \addtoindexx{Fortran!module (Fortran 90)}
426 may also be represented by a module entry
427 (but no declaration attribute is warranted because \addtoindex{Fortran}
428 has no concept of a corresponding module body).}
430 A module is represented by a debugging information entry
432 tag \DWTAGmoduleTARG.
433 Module entries may own other
434 debugging information entries describing program entities
435 whose declaration scopes end at the end of the module itself.
437 If the module has a name, the module entry has a
438 \DWATname{} attribute
439 \addtoindexx{name attribute}
440 whose value is a null\dash terminated string containing
441 the module name as it appears in the source program.
443 The \addtoindex{module entry} may have either a
447 \addtoindexx{high PC attribute}
449 \addtoindexx{low PC attribute}
451 \DWATranges{} attribute
452 \addtoindexx{ranges attribute}
453 whose values encode the contiguous or non\dash contiguous address
454 ranges, respectively, of the machine instructions generated for
455 the module initialization code
456 (see Section \refersec{chap:codeaddressesandranges}).
457 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}
459 \addtoindexx{entry pc attribute!for module initialization}
461 \DWATentrypc{} attribute whose value is the address of
462 the first executable instruction of that initialization code
463 (see Section \refersec{chap:entryaddress}).
466 \hypertarget{chap:DWATprioritymodulepriority}
467 the module has been assigned a priority, it may have
468 \addtoindexx{priority attribute}
470 \DWATpriority{} attribute.
471 The value of this attribute is a
472 reference to another debugging information entry describing
473 a variable with a constant value. The value of this variable
474 is the actual constant value of the module\textquoteright s priority,
475 represented as it would be on the target architecture.
477 \subsection{Namespace Entries}
478 \label{chap:namespaceentries}
479 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
480 \addtoindexx{namespace (C++)}
481 implement name hiding, so that names of unrelated things
482 do not accidentally clash in the
483 \addtoindex{global namespace} when an
484 application is linked together.}
486 A namespace is represented by a debugging information entry
488 tag \DWTAGnamespaceTARG.
489 A namespace extension is
490 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}
492 \DWTAGnamespace{} entry
494 \addtoindexx{extension attribute}
497 attribute referring to the previous extension, or if there
498 is no previous extension, to the original
500 entry. A namespace extension entry does not need to duplicate
501 information in a previous extension entry of the namespace
502 nor need it duplicate information in the original namespace
503 entry. (Thus, for a namespace with a name,
504 a \DWATname{} attribute
505 \addtoindexx{name attribute}
506 need only be attached directly to the original
507 \DWTAGnamespace{} entry.)
510 Namespace and namespace extension entries may own
511 \addtoindexx{namespace extension entry}
513 \addtoindexx{namespace declaration entry}
514 debugging information entries describing program entities
515 whose declarations occur in the namespace.
517 \textit{For \addtoindex{C++}, such
518 owned program entities may be declarations,
519 including certain declarations that are also object or
520 function definitions.}
522 If a type, variable, or function declared in a namespace is
523 defined outside of the body of the namespace declaration,
524 that type, variable, or function definition entry has a
525 \DWATspecification{} attribute
526 \addtoindexx{specification attribute}
527 whose value is a \livelink{chap:classreference}{reference} to the
528 debugging information entry representing the declaration of
529 the type, variable or function. Type, variable, or function
531 \DWATspecification{} attribute
532 \addtoindexx{specification attribute}
534 to duplicate information provided by the declaration entry
535 referenced by the specification attribute.
537 \textit{The \addtoindex{C++} \addtoindex{global namespace}
539 \addtoindexx{global namespace|see{namespace (C++), global}}
541 \addtoindexx{namespace (C++)!global}
543 \texttt{::f}, for example) is not explicitly represented in
544 DWARF with a namespace entry (thus mirroring the situation
545 in \addtoindex{C++} source).
546 Global items may be simply declared with no
547 reference to a namespace.}
549 \textit{The \addtoindex{C++}
550 compilation unit specific \doublequote{unnamed namespace} may
551 \addtoindexx{namespace (C++)!unnamed}
552 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
553 be represented by a namespace entry with no name attribute in
554 the original namespace declaration entry (and therefore no name
555 attribute in any namespace extension entry of this namespace).
558 \textit{A compiler emitting namespace information may choose to
559 explicitly represent namespace extensions, or to represent the
560 final namespace declaration of a compilation unit; this is a
561 quality\dash of\dash implementation issue and no specific requirements
562 are given here. If only the final namespace is represented,
563 \addtoindexx{namespace (C++)!using declaration}
564 it is impossible for a debugger to interpret using declaration
565 references in exactly the manner defined by the
566 \addtoindex{C++} language.
569 \textit{Emitting all namespace declaration information in all
570 compilation units can result in a significant increase in the
571 size of the debug information and significant duplication of
572 information across compilation units.
573 The \addtoindex{C++} namespace std,
575 \addtoindexx{namespace (C++)!std}
576 is large and will probably be referenced in
577 every \addtoindex{C++} compilation unit.
580 \textit{For a \addtoindex{C++} namespace example,
581 see Appendix \refersec{app:namespaceexample}.
586 \subsection{Imported (or Renamed) Declaration Entries}
587 \label{chap:importedorrenameddeclarationentries}
588 \textit{Some languages support the concept of importing into or making
589 accessible in a given unit declarations made in a different
590 module or scope. An imported declaration may sometimes be
595 imported declaration is represented by one or
596 \addtoindexx{imported declaration entry}
597 more debugging information entries with the
598 tag \DWTAGimporteddeclarationTARG.
600 \hypertarget{chap:DWATimportimporteddeclaration}
602 is imported, there is one imported declaration entry for
604 \addtoindexx{import attribute}
605 Each imported declaration entry has a
606 \DWATimport{} attribute,
607 whose value is a \livelink{chap:classreference}{reference} to the
608 debugging information entry representing the declaration that
611 An imported declaration may also have a
614 \addtoindexx{name attribute}
615 whose value is a null\dash terminated string containing the
616 name, as it appears in the source program, by which the
617 imported entity is to be known in the context of the imported
618 declaration entry (which may be different than the name of
619 the entity being imported). If no name is present, then the
620 name by which the entity is to be known is the same as the
621 name of the entity being imported.
623 An imported declaration entry with a name attribute may be
624 used as a general means to rename or provide an alias for
625 \addtoindexx{alias declaration|see{imported declaration entry}}
626 an entity, regardless of the context in which the importing
627 declaration or the imported entity occurs.
629 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
630 \hypertarget{chap:DWATimportnamespacealias}
632 \addtoindexx{namespace (C++)!alias}
633 with a name attribute whose value is
634 a null\dash terminated string containing the alias name as it
635 appears in the source program and an import attribute whose
636 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
637 namespace extension entry.
640 \textit{A \addtoindex{C++} using declaration may be represented by one or more
641 \hypertarget{chap:DWATimportnamespaceusingdeclaration}
643 \addtoindexx{namespace (C++)!using declaration}
644 declaration entries. When the using declaration
645 refers to an overloaded function, there is one imported
646 declaration entry corresponding to each overloading. Each
647 imported declaration entry has no name attribute but it does
648 have an import attribute that refers to the entry for the
649 entity being imported. (\addtoindex{C++}
650 provides no means to \doublequote{rename}
651 an imported entity, other than a namespace).
654 \textit{A \addtoindex{Fortran} use statement
655 \addtoindexx{Fortran!use statement}
656 \addtoindexx{use statement|see {Fortran, use statement}}
657 with an \doublequote{only list} may be
658 represented by a series of imported declaration entries,
659 one (or more) for each entity that is imported. An entity
660 \addtoindexx{renamed declaration|see{imported declaration entry}}
661 that is renamed in the importing context may be represented
662 by an imported declaration entry with a name attribute that
663 specifies the new local name.
666 \subsection{Imported Module Entries}
667 \label{chap:importedmoduleentries}
669 \textit{Some languages support the concept of importing into or making
670 accessible in a given unit all of the declarations contained
671 within a separate module or namespace.
674 An imported module declaration is represented by a debugging
675 information entry with
676 \addtoindexx{imported module attribute}
678 \addtoindexx{imported module entry}
679 tag \DWTAGimportedmoduleTARG.
681 imported module entry contains a
682 \DWATimport{} attribute
683 \addtoindexx{import attribute}
684 whose value is a \livelink{chap:classreference}{reference}
685 to the module or namespace entry
686 containing the definition and/or declaration entries for
687 the entities that are to be imported into the context of the
688 imported module entry.
690 An imported module declaration may own a set of imported
691 declaration entries, each of which refers to an entry in the
692 module whose corresponding entity is to be known in the context
693 of the imported module declaration by a name other than its
694 name in that module. Any entity in the module that is not
695 renamed in this way is known in the context of the imported
696 module entry by the same name as it is declared in the module.
698 \textit{A \addtoindex{C++} using directive
699 \addtoindexx{namespace (C++)!using directive}
700 \addtoindexx{using directive|see {namespace (C++), using directive}}
701 may be represented by an imported module
702 \hypertarget{chap:DWATimportnamespaceusingdirective}
703 entry, with an import attribute referring to the namespace
704 entry of the appropriate extension of the namespace (which
705 might be the original namespace entry) and no owned entries.
708 \textit{A \addtoindex{Fortran} use statement
709 \addtoindexx{Fortran!use statement}
710 with a \doublequote{rename list} may be
711 represented by an imported module entry with an import
712 attribute referring to the module and owned entries
713 corresponding to those entities that are renamed as part of
717 \textit{A \addtoindex{Fortran} use statement
718 \addtoindexx{Fortran!use statement}
719 with neither a \doublequote{rename list} nor
720 an \doublequote{only list} may be represented by an imported module
721 entry with an import attribute referring to the module and
722 no owned child entries.
725 \textit{A use statement with an \doublequote{only list} is represented by a
726 series of individual imported declaration entries as described
727 in Section \refersec{chap:importedorrenameddeclarationentries}.
730 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
731 \addtoindexx{Fortran!use statement}
732 itself imported by a use statement without an explicit mention
733 may be represented by an imported declaration entry that refers
734 to the original debugging information entry. For example, given
751 \textit{the imported declaration entry for Q within module C refers
752 directly to the variable declaration entry for X in module A
753 because there is no explicit representation for X in module B.
756 \textit{A similar situation arises for a \addtoindex{C++} using declaration
757 \addtoindexx{namespace (C++)!using declaration}
758 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
759 that imports an entity in terms of a namespace alias. See
760 Appendix \refersec{app:namespaceexample}
764 \section{Subroutine and Entry Point Entries}
765 \label{chap:subroutineandentrypointentries}
767 The following tags exist to describe
768 debugging information entries
769 \addtoindexx{function entry|see{subroutine entry}}
771 \addtoindexx{subroutine entry}
773 \addtoindexx{subprogram entry}
775 % FIXME: is entry point entry the right index 'entry'?
776 \addtoindexx{entry point entry}
779 \begin{tabular}{lp{9.0cm}}
780 \DWTAGsubprogramTARG{} & A subroutine or function \\
781 \DWTAGinlinedsubroutine{} & A particular inlined
782 \addtoindexx{inlined subprogram entry}
783 instance of a subroutine or function \\
784 \DWTAGentrypointTARG{} & An alternate entry point \\
787 \subsection{General Subroutine and Entry Point Information}
788 \label{chap:generalsubroutineandentrypointinformation}
789 The subroutine or entry point entry has a \DWATname{}
790 attribute whose value is a null-terminated string containing the
791 subroutine or entry point name as it appears in the source program.
792 It may also have a \DWATlinkagename{} attribute as
793 described in Section \refersec{chap:linkagenames}.
795 If the name of the subroutine described by an entry with the
796 \addtoindexx{subprogram entry}
797 tag \DWTAGsubprogram{}
798 is visible outside of its containing
799 \hypertarget{chap:DWATexternalexternalsubroutine}
800 compilation unit, that entry has
801 \addtoindexx{external attribute}
803 \DWATexternal{} attribute,
804 which is a \livelink{chap:classflag}{flag}.
806 \textit{Additional attributes for functions that are members of a
807 class or structure are described in
808 Section \refersec{chap:memberfunctionentries}.
812 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}
815 \DWATmainsubprogram{}
817 \addtoindexx{main subprogram attribute}
819 a \livelink{chap:classflag}{flag} whose presence indicates that the
820 subroutine has been identified as the starting function of
821 the program. If more than one subprogram contains this
823 any one of them may be the starting subroutine of the program.
825 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
826 which is used to specify
827 and provide a user\dash supplied name for the main subroutine of
831 \textit{A common debugger feature is to allow the debugger user to call
832 a subroutine within the subject program. In certain cases,
833 however, the generated code for a subroutine will not obey
834 the standard calling conventions for the target architecture
835 and will therefore not be safe to call from within a debugger.
838 A subroutine entry may
839 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}
841 \DWATcallingconvention{}
842 attribute, whose value is an
843 \livelink{chap:classconstant}{integer constant}. The set of
844 calling convention codes is given in
845 Table \refersec{tab:callingconventioncodes}.
847 \begin{simplenametable}[1.4in]{Calling convention codes}{tab:callingconventioncodes}
851 \end{simplenametable}
853 If this attribute is not present, or its value is the constant
854 \DWCCnormalTARG, then the subroutine may be safely called by
855 obeying the \doublequote{standard} calling conventions of the target
856 architecture. If the value of the calling convention attribute
857 is the constant \DWCCnocallTARG, the subroutine does not obey
858 standard calling conventions, and it may not be safe for the
859 debugger to call this subroutine.
861 If the semantics of the language of the compilation unit
862 containing the subroutine entry distinguishes between ordinary
863 subroutines and subroutines that can serve as the \doublequote{main
864 program,} that is, subroutines that cannot be called
865 directly according to the ordinary calling conventions,
866 then the debugging information entry for such a subroutine
867 may have a calling convention attribute whose value is the
868 constant \DWCCprogramTARG.
870 \textit{The \DWCCprogram{}
871 value is intended to support \addtoindex{Fortran} main
872 \addtoindexx{Fortran!main program}
873 programs which in some implementations may not be callable
874 or which must be invoked in a special way. It is not intended
875 as a way of finding the entry address for the program.
878 \textit{In \addtoindex{C}
879 there is a difference between the types of functions
880 declared using function prototype style declarations and
881 those declared using non\dash prototype declarations.
884 A subroutine entry declared with a function prototype style
886 \addtoindexx{prototyped attribute}
888 \DWATprototyped{} attribute, which is
889 a \livelink{chap:classflag}{flag}.
891 \textit{The \addtoindex{Fortran}
892 language allows the keywords \texttt{elemental}, \texttt{pure}
893 and \texttt{recursive} to be included as part of the declaration of
894 a subroutine; these attributes reflect that usage. These
895 attributes are not relevant for languages that do not support
896 similar keywords or syntax. In particular, the \DWATrecursive{}
897 attribute is neither needed nor appropriate in languages such
899 where functions support recursion by default.
903 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}
905 \addtoindexx{elemental attribute}
907 \DWATelemental{} attribute, which
908 is a \livelink{chap:classflag}{flag}.
909 The attribute indicates whether the subroutine
910 or entry point was declared with the \doublequote{elemental} keyword
914 \hypertarget{chap:DWATpurepurepropertyofasubroutine}
915 subprogram entry may have
916 \addtoindexx{pure attribute}
918 \DWATpure{} attribute, which is
919 a \livelink{chap:classflag}{flag}.
920 The attribute indicates whether the subroutine was
921 declared with the \doublequote{pure} keyword or property.
924 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}
925 subprogram entry may have a
926 \DWATrecursive{} attribute, which
927 is a \livelink{chap:classflag}{flag}.
928 The attribute indicates whether the subroutine
929 or entry point was declared with the \doublequote{recursive} keyword
934 \subsection{Subroutine and Entry Point Return Types}
935 \label{chap:subroutineandentrypointreturntypes}
938 \hypertarget{chap:DWATtypetypeofsubroutinereturn}
939 the subroutine or entry point
940 \addtoindexx{return type of subroutine}
941 is a function that returns a
942 value, then its debugging information entry has
943 \addtoindexx{type attribute}
944 a \DWATtype{} attribute
945 to denote the type returned by that function.
947 \textit{Debugging information entries for
948 \addtoindex{C} void functions should
949 not have an attribute for the return type. }
952 \subsection{Subroutine and Entry Point Locations}
953 \label{chap:subroutineandentrypointlocations}
955 A subroutine entry may have either a \DWATlowpc{} and
956 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
957 \addtoindexx{ranges attribute}
959 \addtoindexx{high PC attribute}
961 \addtoindexx{low PC attribute}
962 encode the contiguous or non\dash contiguous address
963 ranges, respectively, of the machine instructions generated
964 for the subroutine (see
965 Section \refersec{chap:codeaddressesandranges}).
968 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}
969 subroutine entry may also have
970 \addtoindexx{entry pc attribute!for subroutine}
972 \DWATentrypc{} attribute
973 whose value is the address of the first executable instruction
974 of the subroutine (see
975 Section \refersec{chap:entryaddress}).
977 An entry point has a \DWATlowpc{} attribute whose value is the
978 relocated address of the first machine instruction generated
982 \DWATentrypc{} attribute
983 \addtoindexx{entry pc attribute!for subroutine}
985 also seem appropriate
986 for this purpose, historically the
987 \DWATlowpc{} attribute
989 \DWATentrypc{} was introduced (in
990 \addtoindex{DWARF Version 3}).
991 There is insufficient reason to change this.}
997 \addtoindexx{address class!attribute}
999 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}
1003 \DWATaddressclass{} attributes,
1004 as appropriate, to specify
1005 which segments the code for the subroutine resides in and
1006 the addressing mode to be used in calling that subroutine.
1008 A subroutine entry representing a subroutine declaration
1009 that is not also a definition does not have code address or
1013 \subsection{Declarations Owned by Subroutines and Entry Points}
1014 \label{chap:declarationsownedbysubroutinesandentrypoints}
1016 The declarations enclosed by a subroutine or entry point are
1017 represented by debugging information entries that are owned
1018 by the subroutine or entry point entry. Entries representing
1019 \addtoindexx{formal parameter}
1020 the formal parameters of the subroutine or entry point appear
1021 in the same order as the corresponding declarations in the
1025 \textit{There is no ordering requirement for entries for declarations
1026 that are children of subroutine or entry point entries but
1027 that do not represent formal parameters. The formal parameter
1028 entries may be interspersed with other entries used by formal
1029 parameter entries, such as type entries.}
1031 The unspecified parameters of a variable parameter list are
1032 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1034 \DWTAGunspecifiedparametersTARG.
1036 The entry for a subroutine that includes a
1037 \addtoindex{Fortran}
1038 \addtoindexx{Fortran!common block}
1039 \livelink{chap:fortrancommonblock}{common}
1040 \livelink{chap:commonblockentry}{block}
1041 \addtoindexx{common block|see{Fortran common block}}
1042 has a child entry with the
1043 tag \DWTAGcommoninclusionTARG.
1045 \hypertarget{chap:commonreferencecommonblockusage}
1046 common inclusion entry has a
1047 \DWATcommonreference{} attribute
1048 whose value is a \livelink{chap:classreference}{reference}
1049 to the debugging information entry
1050 for the common \nolink{block} being included
1051 (see Section \refersec{chap:commonblockentries}).
1053 \subsection{Low-Level Information}
1054 \label{chap:lowlevelinformation}
1057 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}
1058 subroutine or entry point entry may have
1059 \addtoindexx{return address attribute}
1062 attribute, whose value is a location description. The location
1063 calculated is the place where the return address for the
1064 subroutine or entry point is stored.
1067 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}
1068 subroutine or entry point entry may also have
1069 \addtoindexx{frame base attribute}
1071 \DWATframebase{} attribute, whose value is a location
1072 description that computes the \doublequote{frame base} for the
1073 subroutine or entry point. If the location description is
1074 a simple register location description, the given register
1075 contains the frame base address. If the location description is
1076 a DWARF expression, the result of evaluating that expression
1077 is the frame base address. Finally, for a
1078 \addtoindex{location list},
1079 this interpretation applies to each location description
1080 contained in the list of \addtoindex{location list} entries.
1082 \textit{The use of one of the \DWOPregn{}
1084 context is equivalent to using
1087 compact. However, these are not equivalent in general.}
1090 \textit{The frame base for a procedure is typically an address fixed
1091 relative to the first unit of storage allocated for the
1092 procedure\textquoteright s stack frame. The \DWATframebase{} attribute
1093 can be used in several ways:}
1094 \begin{enumerate}[1. ]
1095 \item \textit{In procedures that need
1096 \addtoindexx{location list}
1097 location lists to locate local
1098 variables, the \DWATframebase{} can hold the needed location
1099 list, while all variables\textquoteright\ location descriptions can be
1100 simpler ones involving the frame base.}
1102 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1103 within nested routines.
1104 (See also \DWATstaticlink, below)}
1108 \textit{Some languages support nested subroutines. In such languages,
1109 it is possible to reference the local variables of an
1110 outer subroutine from within an inner subroutine. The
1111 \DWATstaticlink{} and \DWATframebase{} attributes allow
1112 debuggers to support this same kind of referencing.}
1115 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}
1117 \addtoindexx{address!uplevel|see {static link attribute}}
1118 \addtoindexx{uplevel address|see {static link attribute}}
1119 subroutine or entry point is nested, it may have a
1121 attribute, whose value is a location
1122 description that computes the frame base of the relevant
1123 instance of the subroutine that immediately encloses the
1124 subroutine or entry point.
1126 In the context of supporting nested subroutines, the
1127 \DWATframebase{} attribute value should obey the following
1130 \begin{enumerate}[1. ]
1131 \item It should compute a value that does not change during the
1132 life of the procedure, and
1134 \item The computed value should be unique among instances of
1135 the same subroutine. (For typical \DWATframebase{} use, this
1136 means that a recursive subroutine\textquoteright s stack frame must have
1137 non\dash zero size.)
1140 \textit{If a debugger is attempting to resolve an up\dash level reference
1141 to a variable, it uses the nesting structure of DWARF to
1142 determine which subroutine is the lexical parent and the
1143 \DWATstaticlink{} value to identify the appropriate active
1144 frame of the parent. It can then attempt to find the reference
1145 within the context of the parent.}
1149 \subsection{Types Thrown by Exceptions}
1150 \label{chap:typesthrownbyexceptions}
1152 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1153 it may validly throw.}
1155 If a subroutine explicitly declares that it may throw
1156 \addtoindexx{exception thrown|see{thrown type entry}}
1158 \addtoindexx{thrown exception|see{thrown type entry}}
1159 exception of one or more types, each such type is
1160 represented by a debugging information entry with
1161 \addtoindexx{thrown type entry}
1163 \DWTAGthrowntypeTARG.
1164 Each such entry is a child of the entry
1165 representing the subroutine that may throw this type. Each
1166 thrown type entry contains
1167 \addtoindexx{type attribute}
1168 a \DWATtype{} attribute, whose
1169 value is a \livelink{chap:classreference}{reference}
1170 to an entry describing the type of the
1171 exception that may be thrown.
1173 \subsection{Function Template Instantiations}
1174 \label{chap:functiontemplateinstantiations}
1176 \textit{In \addtoindex{C++}, a function template is a generic definition of
1177 a function that is instantiated differently for calls with
1178 values of different types. DWARF does not represent the generic
1179 template definition, but does represent each instantiation.}
1181 A \addtoindex{template instantiation} is represented by a debugging
1182 information entry with the
1183 \addtoindexx{subprogram entry!use for template instantiation}
1184 tag \DWTAGsubprogram.
1186 exceptions, such an entry will contain the same attributes and
1187 will have the same types of child entries as would an entry
1188 for a subroutine defined explicitly using the instantiation
1189 types. The exceptions are:
1191 \begin{enumerate}[1. ]
1192 \item Each formal parameterized type declaration appearing in the
1193 template definition is represented by a debugging information
1195 \addtoindexx{template type parameter entry}
1196 tag \DWTAGtemplatetypeparameterTARG.
1198 such entry has a \DWATname{} attribute,
1199 \addtoindexx{name attribute}
1201 null\dash terminated string containing the name of the formal
1202 type parameter as it appears in the source program. The
1203 \addtoindexx{formal type parameter|see{template type parameter entry}}
1204 template type parameter entry also has
1205 \addtoindexx{type attribute}
1206 a \DWATtype{} attribute
1207 describing the actual type by which the formal is replaced
1208 for this instantiation.
1210 \item The subprogram entry and each of its child entries reference
1211 a template type parameter entry in any circumstance where
1212 the template definition referenced a formal parameterized type.
1214 \item If the compiler has generated a special compilation unit
1215 to hold the template instantiation and that compilation unit
1216 has a different name from the compilation unit containing
1217 the template definition, the name attribute for the debugging
1218 information entry representing that compilation unit is empty
1221 \item If the subprogram entry representing the template
1222 instantiation or any of its child entries contain declaration
1223 coordinate attributes, those attributes refer to the source
1224 for the template definition, not to any source generated
1225 artificially by the compiler for this instantiation.
1230 \subsection{Inlinable and Inlined Subroutines}
1231 A declaration or a definition of an inlinable subroutine
1232 is represented by a debugging information entry with the
1236 \addtoindexx{subprogram entry!use in inlined subprogram}
1238 \hypertarget{chap:DWATinlineinlinedsubroutine}
1239 explicitly declared to be available for inline expansion or
1240 that was expanded inline implicitly by the compiler has
1241 \addtoindexx{inline attribute}
1243 \DWATinline{} attribute whose value is an
1244 \livelink{chap:classconstant}{integer constant}. The
1245 set of values for the \DWATinline{} attribute is given in
1246 Table \refersec{tab:inlinecodes}.
1250 \caption{Inline codes}
1251 \label{tab:inlinecodes}
1252 \begin{tabular}{l|p{8cm}}
1254 Name&Meaning\\ \hline
1255 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1256 \mbox{compiler} (equivalent to the absence of the
1257 containing \DWATinline{} attribute) \\
1258 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1259 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1260 not inlined by the \mbox{compiler} \\
1261 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1267 \textit{In \addtoindex{C++}, a function or a constructor declared with
1268 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1269 instance (see below) is represented by a debugging information
1270 entry with the tag \DWTAGsubprogram. Such an entry has a
1271 \DWATinline{} attribute whose value is \DWINLinlined.}
1274 \subsubsection{Abstract Instances}
1275 \label{chap:abstractinstances}
1276 Any debugging information entry that is owned (either
1277 \hypertarget{chap:DWATinlineabstracttinstance}
1278 directly or indirectly) by a debugging information entry
1280 \DWATinline{} attribute is referred to
1281 \addtoindexx{abstract instance!entry}
1282 as an \doublequote{abstract instance entry.}
1283 Any subroutine entry
1285 \addtoindexx{inline attribute}
1286 a \DWATinline{} attribute whose value is other
1287 than \DWINLnotinlined{}
1289 \addtoindexx{abstract instance!root}
1290 an \doublequote{abstract instance root.}
1291 Any set of abstract instance entries that are all
1292 children (either directly or indirectly) of some abstract
1293 instance root, together with the root itself, is known as
1294 \addtoindexx{abstract instance!tree}
1295 an \doublequote{abstract instance tree.} However, in the case where
1296 an abstract instance tree is nested within another abstract
1297 instance tree, the entries in the
1298 \addtoindex{nested abstract instance}
1299 tree are not considered to be entries in the outer abstract
1302 Each abstract instance root is either part of a larger
1303 \addtoindexx{abstract instance!root}
1304 tree (which gives a context for the root) or
1305 \addtoindexx{specification attribute}
1307 \DWATspecification{}
1308 to refer to the declaration in context.
1310 \textit{For example, in \addtoindex{C++} the context might be a namespace
1311 declaration or a class declaration.}
1313 \textit{Abstract instance trees are defined so that no entry is part
1314 of more than one abstract instance tree. This simplifies the
1315 following descriptions.}
1317 A debugging information entry that is a member of an abstract
1318 instance tree should not contain any attributes which describe
1319 aspects of the subroutine which vary between distinct inlined
1320 expansions or distinct out\dash of\dash line expansions. For example,
1321 \addtoindexx{entry pc attribute!and abstract instance}
1332 \addtoindexx{location attribute!and abstract instance}
1334 \addtoindexx{ranges attribute!and abstract instance}
1336 \addtoindexx{high PC attribute!and abstract instance}
1338 \addtoindexx{low PC attribute!and abstract instance}
1340 \addtoindexx{segment attribute!and abstract instance}
1342 \addtoindexx{return address attribute!and abstract instance}
1344 \addtoindexx{segment attribute!and abstract instance}
1346 \addtoindexx{start scope attribute!and abstract instance}
1350 \textit{It would not make sense normally to put these attributes into
1351 abstract instance entries since such entries do not represent
1352 actual (concrete) instances and thus do not actually exist at
1353 run\dash time. However,
1354 see Appendix \refersec{app:inlineouteronenormalinner}
1355 for a contrary example.}
1357 The rules for the relative location of entries belonging to
1358 abstract instance trees are exactly the same as for other
1359 similar types of entries that are not abstract. Specifically,
1360 the rule that requires that an entry representing a declaration
1361 be a direct child of the entry representing the scope of the
1362 declaration applies equally to both abstract and non\dash abstract
1363 entries. Also, the ordering rules for formal parameter entries,
1364 member entries, and so on, all apply regardless of whether
1365 or not a given entry is abstract.
1367 \subsubsection{Concrete Inlined Instances}
1368 \label{chap:concreteinlinedinstances}
1370 Each inline expansion of a subroutine is represented
1371 by a debugging information entry with the
1372 tag \DWTAGinlinedsubroutineTARG.
1373 Each such entry should be a direct
1374 child of the entry that represents the scope within which
1375 the inlining occurs.
1377 Each inlined subroutine entry may have either a
1379 and \DWAThighpc{} pair
1381 \addtoindexx{high PC attribute}
1383 \addtoindexx{low PC attribute}
1385 \addtoindexx{ranges attribute}
1388 attribute whose values encode the contiguous or non\dash contiguous
1389 address ranges, respectively, of the machine instructions
1390 generated for the inlined subroutine (see
1391 Section \refersec{chap:codeaddressesandranges}).
1393 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}
1394 inlined subroutine entry may
1395 \addtoindexx{inlined subprogram entry!in concrete instance}
1397 \addtoindexx{inlined subprogram entry}
1399 \addtoindexx{entry pc attribute!for inlined subprogram}
1402 attribute, representing the first executable instruction of
1403 the inline expansion (see
1404 Section \refersec{chap:entryaddress}).
1406 % Positions of the 3 targets here is a bit arbitrary.
1408 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}
1410 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}
1412 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}
1413 may also have \DWATcallfile,
1414 \DWATcallline{} and \DWATcallcolumn{} attributes,
1416 value is an \livelink{chap:classconstant}{integer constant}.
1417 These attributes represent the
1418 source file, source line number, and source column number,
1419 respectively, of the first character of the statement or
1420 expression that caused the inline expansion. The call file,
1421 call line, and call column attributes are interpreted in
1422 the same way as the declaration file, declaration line, and
1423 declaration column attributes, respectively (see
1424 Section \refersec{chap:declarationcoordinates}).
1426 \textit{The call file, call line and call column coordinates do not
1427 describe the coordinates of the subroutine declaration that
1428 was inlined, rather they describe the coordinates of the call.
1431 An inlined subroutine entry
1432 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}
1435 attribute, which is a \livelink{chap:classflag}{flag}
1436 whose presence indicates that the
1437 subroutine has been evaluated as a compile\dash time constant. Such
1438 an entry may also have a \DWATconstvalue{} attribute,
1439 whose value may be of any form that is appropriate for the
1440 representation of the subroutine's return value. The value of
1441 this attribute is the actual return value of the subroutine,
1442 represented as it would be on the target architecture.
1444 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1445 \addttindex{constexpr}
1446 is called with constant expressions, then the corresponding
1447 concrete inlined instance has a
1448 \DWATconstexpr{} attribute,
1449 as well as a \DWATconstvalue{} attribute whose value represents
1450 the actual return value of the concrete inlined instance.}
1452 Any debugging information entry that is owned (either
1453 directly or indirectly) by a debugging information entry
1454 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1455 \doublequote{concrete inlined instance entry.} Any entry that has
1457 \DWTAGinlinedsubroutine{}
1458 is known as a \doublequote{concrete inlined instance root.}
1459 Any set of concrete inlined instance
1460 entries that are all children (either directly or indirectly)
1461 of some concrete inlined instance root, together with the root
1462 itself, is known as a \doublequote{concrete inlined instance tree.}
1463 However, in the case where a concrete inlined instance tree
1464 is nested within another concrete instance tree, the entries
1465 in the \addtoindex{nested concrete inline instance} tree
1466 are not considered to
1467 be entries in the outer concrete instance tree.
1469 \textit{Concrete inlined instance trees are defined so that no entry
1470 is part of more than one concrete inlined instance tree. This
1471 simplifies later descriptions.}
1473 Each concrete inlined instance tree is uniquely associated
1474 with one (and only one) abstract instance tree.
1476 \textit{Note, however, that the reverse is not true. Any given abstract
1477 instance tree may be associated with several different concrete
1478 inlined instance trees, or may even be associated with zero
1479 concrete inlined instance trees.}
1481 Concrete inlined instance entries may omit attributes that
1482 are not specific to the concrete instance (but present in
1483 the abstract instance) and need include only attributes that
1484 are specific to the concrete instance (but omitted in the
1485 abstract instance). In place of these omitted attributes, each
1486 \hypertarget{chap:DWATabstractorigininlineinstance}
1487 concrete inlined instance entry
1488 \addtoindexx{abstract origin attribute}
1490 \DWATabstractorigin{}
1491 attribute that may be used to obtain the missing information
1492 (indirectly) from the associated abstract instance entry. The
1493 value of the abstract origin attribute is a reference to the
1494 associated abstract instance entry.
1496 If an entry within a concrete inlined instance tree contains
1497 attributes describing the
1498 \addtoindexx{declaration coordinates!in concrete instance}
1499 \livelink{chap:declarationcoordinates}{declaration coordinates}
1500 of that entry, then those attributes should refer to the file, line
1501 and column of the original declaration of the subroutine,
1502 not to the point at which it was inlined. As a consequence,
1503 they may usually be omitted from any entry that has an abstract
1507 For each pair of entries that are associated via a
1508 \addtoindexx{abstract origin attribute}
1509 \DWATabstractorigin{} attribute, both members of the pair
1510 have the same tag. So, for example, an entry with the tag
1511 \DWTAGvariable{} can only be associated with another entry
1512 that also has the tag \DWTAGvariable. The only exception
1513 to this rule is that the root of a concrete instance tree
1514 (which must always have the tag \DWTAGinlinedsubroutine)
1515 can only be associated with the root of its associated abstract
1516 instance tree (which must have the tag \DWTAGsubprogram).
1518 In general, the structure and content of any given concrete
1519 inlined instance tree will be closely analogous to the
1520 structure and content of its associated abstract instance
1521 tree. There are a few exceptions:
1523 \begin{enumerate}[1. ]
1524 \item An entry in the concrete instance tree may be omitted if
1526 \addtoindexx{abstract origin attribute}
1527 \DWATabstractorigin{} attribute and either
1528 has no children, or its children are omitted. Such entries
1529 would provide no useful information. In C\dash like languages,
1530 such entries frequently include types, including structure,
1531 union, class, and interface types; and members of types. If any
1532 entry within a concrete inlined instance tree needs to refer
1533 to an entity declared within the scope of the relevant inlined
1534 subroutine and for which no concrete instance entry exists,
1535 the reference should refer to the abstract instance entry.
1537 \item Entries in the concrete instance tree which are associated
1538 with entries in the abstract instance tree such that neither
1539 has a \DWATname{} attribute,
1540 \addtoindexx{name attribute}
1541 and neither is referenced by
1542 any other debugging information entry, may be omitted. This
1543 may happen for debugging information entries in the abstract
1544 instance trees that became unnecessary in the concrete instance
1545 tree because of additional information available there. For
1546 example, an anonymous variable might have been created and
1547 described in the abstract instance tree, but because of
1548 the actual parameters for a particular inlined expansion,
1549 it could be described as a constant value without the need
1550 for that separate debugging information entry.
1552 \item A concrete instance tree may contain entries which do
1553 not correspond to entries in the abstract instance tree
1554 to describe new entities that are specific to a particular
1555 inlined expansion. In that case, they will not have associated
1556 entries in the abstract instance tree, should not contain
1557 \addtoindexx{abstract origin attribute}
1558 \DWATabstractorigin{} attributes, and must contain all their
1559 own attributes directly. This allows an abstract instance tree
1560 to omit debugging information entries for anonymous entities
1561 that are unlikely to be needed in most inlined expansions. In
1562 any expansion which deviates from that expectation, the
1563 entries can be described in its concrete inlined instance tree.
1567 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1568 \label{chap:outoflineinstancesofinlinedsubroutines}
1569 Under some conditions, compilers may need to generate concrete
1570 executable instances of inlined subroutines other than at
1571 points where those subroutines are actually called. Such
1572 concrete instances of inlined subroutines are referred to as
1573 \doublequote{concrete out\dash of\dash line instances.}
1575 \textit{In \addtoindex{C++}, for example,
1576 taking the address of a function declared
1577 to be inline can necessitate the generation of a concrete
1578 out\dash of\dash line instance of the given function.}
1580 The DWARF representation of a concrete out\dash of\dash line instance
1581 of an inlined subroutine is essentially the same as for a
1582 concrete inlined instance of that subroutine (as described in
1583 the preceding section). The representation of such a concrete
1584 % It is critical that the hypertarget and livelink be
1585 % separated to avoid problems with latex.
1586 out\dash of\dash line
1587 \addtoindexx{abstract origin attribute}
1589 \hypertarget{chap:DWATabstractoriginoutoflineinstance}
1591 \DWATabstractorigin{}
1592 attributes in exactly the same way as they are used for
1593 a concrete inlined instance (that is, as references to
1594 corresponding entries within the associated abstract instance
1597 The differences between the DWARF representation of a
1598 concrete out\dash of\dash line instance of a given subroutine and the
1599 representation of a concrete inlined instance of that same
1600 subroutine are as follows:
1602 \begin{enumerate}[1. ]
1603 \item The root entry for a concrete out\dash of\dash line instance
1604 of a given inlined subroutine has the same tag as does its
1605 associated (abstract) inlined subroutine entry (that is, tag
1606 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1608 \item The root entry for a concrete out\dash of\dash line instance tree
1609 is normally owned by the same parent entry that also owns
1610 the root entry of the associated abstract instance. However,
1611 it is not required that the abstract and out\dash of\dash line instance
1612 trees be owned by the same parent entry.
1616 \subsubsection{Nested Inlined Subroutines}
1617 \label{nestedinlinedsubroutines}
1618 Some languages and compilers may permit the logical nesting of
1619 a subroutine within another subroutine, and may permit either
1620 the outer or the nested subroutine, or both, to be inlined.
1622 For a non\dash inlined subroutine nested within an inlined
1623 subroutine, the nested subroutine is described normally in
1624 both the abstract and concrete inlined instance trees for
1625 the outer subroutine. All rules pertaining to the abstract
1626 and concrete instance trees for the outer subroutine apply
1627 also to the abstract and concrete instance entries for the
1631 For an inlined subroutine nested within another inlined
1632 subroutine, the following rules apply to their abstract and
1633 \addtoindexx{abstract instance!nested}
1634 \addtoindexx{concrete instance!nested}
1635 concrete instance trees:
1637 \begin{enumerate}[1. ]
1638 \item The abstract instance tree for the nested subroutine is
1639 described within the abstract instance tree for the outer
1640 subroutine according to the rules in
1641 Section \refersec{chap:abstractinstances}, and
1642 without regard to the fact that it is within an outer abstract
1645 \item Any abstract instance tree for a nested subroutine is
1646 always omitted within the concrete instance tree for an
1649 \item A concrete instance tree for a nested subroutine is
1650 always omitted within the abstract instance tree for an
1653 \item The concrete instance tree for any inlined or
1654 \addtoindexx{out-of-line instance}
1656 \addtoindexx{out-of-line-instance|see{concrete out-of-line-instance}}
1657 expansion of the nested subroutine is described within a
1658 concrete instance tree for the outer subroutine according
1660 Sections \refersec{chap:concreteinlinedinstances} or
1661 \refersec{chap:outoflineinstancesofinlinedsubroutines}
1663 and without regard to the fact that it is within an outer
1664 concrete instance tree.
1667 See Appendix \refersec{app:inliningexamples}
1668 for discussion and examples.
1670 \subsection{Trampolines}
1671 \label{chap:trampolines}
1673 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1674 \hypertarget{chap:DWATtrampolinetargetsubroutine}
1675 an intermediary in making a call to another subroutine. It may
1676 adjust parameters and/or the result (if any) as appropriate
1677 to the combined calling and called execution contexts.}
1679 A trampoline is represented by a debugging information entry
1680 \addtoindexx{trampoline (subprogam) entry}
1681 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1683 \addtoindexx{trampoline attribute}
1684 a \DWATtrampoline{} attribute.
1686 attribute indicates the target subroutine of the trampoline,
1687 that is, the subroutine to which the trampoline passes
1688 control. (A trampoline entry may but need not also have a
1689 \DWATartificial{} attribute.)
1692 The value of the trampoline attribute may be represented
1693 using any of the following forms, which are listed in order
1697 \item If the value is of class reference, then the value
1698 specifies the debugging information entry of the target
1701 \item If the value is of class address, then the value is
1702 the relocated address of the target subprogram.
1704 \item If the value is of class string, then the value is the
1705 (possibly mangled) \addtoindexx{mangled names}
1706 name of the target subprogram.
1708 \item If the value is of class \livelink{chap:classflag}{flag}, then the value true
1709 indicates that the containing subroutine is a trampoline but
1710 that the target subroutine is not known.
1714 The target subprogram may itself be a trampoline. (A sequence
1715 of trampolines necessarily ends with a non\dash trampoline
1718 \textit{In \addtoindex{C++}, trampolines may be used
1719 to implement derived virtual
1720 member functions; such trampolines typically adjust the
1721 \addtoindexx{this parameter}
1722 implicit this pointer parameter in the course of passing
1724 Other languages and environments may use trampolines
1725 in a manner sometimes known as transfer functions or transfer
1728 \textit{Trampolines may sometimes pass control to the target
1729 subprogram using a branch or jump instruction instead of a
1730 call instruction, thereby leaving no trace of their existence
1731 in the subsequent execution context. }
1733 \textit{This attribute helps make it feasible for a debugger to arrange
1734 that stepping into a trampoline or setting a breakpoint in
1735 a trampoline will result in stepping into or setting the
1736 breakpoint in the target subroutine instead. This helps to
1737 hide the compiler generated subprogram from the user. }
1739 \textit{If the target subroutine is not known, a debugger may choose
1740 to repeatedly step until control arrives in a new subroutine
1741 which can be assumed to be the target subroutine. }
1745 \section{Lexical Block Entries}
1746 \label{chap:lexicalblockentries}
1749 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
1751 \addtoindexx{lexical block}
1752 a bracketed sequence of source statements
1753 that may contain any number of declarations. In some languages
1754 (including \addtoindex{C} and \addtoindex{C++}),
1755 \nolink{blocks} can be nested within other
1756 \nolink{blocks} to any depth.}
1758 % We do not need to link to the preceding paragraph.
1759 A lexical \nolink{block} is represented by a debugging information
1761 tag \DWTAGlexicalblockTARG.
1763 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
1765 either a \DWATlowpc{} and
1766 \DWAThighpc{} pair of
1768 \addtoindexx{high PC attribute}
1770 \addtoindexx{low PC attribute}
1772 \DWATranges{} attribute
1773 \addtoindexx{ranges attribute}
1774 whose values encode the contiguous or non-contiguous address
1775 ranges, respectively, of the machine instructions generated
1776 for the lexical \nolink{block}
1777 (see Section \refersec{chap:codeaddressesandranges}).
1779 If a name has been given to the
1780 lexical \nolink{block}
1782 program, then the corresponding
1783 lexical \nolink{block} entry has a
1784 \DWATname{} attribute whose
1785 \addtoindexx{name attribute}
1786 value is a null\dash terminated string
1787 containing the name of the lexical \nolink{block}
1791 \textit{This is not the same as a \addtoindex{C} or
1792 \addtoindex{C++} label (see below).}
1794 The lexical \nolink{block} entry owns
1795 debugging information entries that
1796 describe the declarations within that lexical \nolink{block}.
1798 one such debugging information entry for each local declaration
1799 of an identifier or inner lexical \nolink{block}.
1801 \section{Label Entries}
1802 \label{chap:labelentries}
1803 \textit{A label is a way of identifying a source statement. A labeled
1804 statement is usually the target of one or more \doublequote{go to}
1808 A label is represented by a debugging information entry with
1809 \addtoindexx{label entry}
1811 tag \DWTAGlabelTARG.
1812 The entry for a label should be owned by
1813 the debugging information entry representing the scope within
1814 which the name of the label could be legally referenced within
1817 The label entry has a \DWATlowpc{} attribute whose value
1818 is the relocated address of the first machine instruction
1819 generated for the statement identified by the label in
1820 the source program. The label entry also has a
1821 \DWATname{} attribute
1822 \addtoindexx{name attribute}
1823 whose value is a null-terminated string containing
1824 the name of the label as it appears in the source program.
1827 \section{With Statement Entries}
1828 \label{chap:withstatemententries}
1830 \textit{Both \addtoindex{Pascal} and
1831 \addtoindexx{Modula-2}
1832 Modula\dash 2 support the concept of a \doublequote{with}
1833 statement. The with statement specifies a sequence of
1834 executable statements within which the fields of a record
1835 variable may be referenced, unqualified by the name of the
1838 A with statement is represented by a
1839 \addtoindexi{debugging information entry}{with statement entry}
1840 with the tag \DWTAGwithstmtTARG.
1842 A with statement entry may have either a
1844 \DWAThighpc{} pair of attributes
1845 \addtoindexx{high PC attribute}
1847 \addtoindexx{low PC attribute}
1848 a \DWATranges{} attribute
1849 \addtoindexx{ranges attribute}
1850 whose values encode the contiguous or non\dash contiguous address
1851 ranges, respectively, of the machine instructions generated
1852 for the with statement
1853 (see Section \refersec{chap:codeaddressesandranges}).
1855 The with statement entry has
1856 \addtoindexx{type attribute}
1857 a \DWATtype{} attribute, denoting
1858 the type of record whose fields may be referenced without full
1859 qualification within the body of the statement. It also has
1860 \addtoindexx{location attribute}
1861 a \DWATlocation{} attribute, describing how to find the base
1862 address of the record object referenced within the body of
1865 \section{Try and Catch Block Entries}
1866 \label{chap:tryandcatchblockentries}
1868 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
1869 designated as a \doublequote{catch \nolink{block}.}
1870 A catch \livetargi{chap:catchblock}{block}{catch block} is an
1871 exception handler that handles
1872 exceptions thrown by an immediately
1873 preceding \doublequote{try \livelink{chap:tryblock}{block}.}
1874 A catch \livelink{chap:catchblock}{block}
1875 designates the type of the exception that it
1878 A try \livetargi{chap:tryblock}{block}{try block} is represented
1879 by a debugging information entry
1880 \addtoindexx{try block entry}
1881 with the tag \DWTAGtryblockTARG.
1882 A catch \livelink{chap:catchblock}{block} is represented by
1883 a debugging information entry with
1884 \addtoindexx{catch block entry}
1885 the tag \DWTAGcatchblockTARG.
1887 % nolink as we have links just above and do not have a combo link for both
1888 Both try and catch \nolink{block} entries may have either a
1890 \DWAThighpc{} pair of attributes
1891 \addtoindexx{high PC attribute}
1893 \addtoindexx{low PC attribute}
1895 \DWATranges{} attribute
1896 \addtoindexx{ranges attribute}
1897 whose values encode the contiguous
1898 or non\dash contiguous address ranges, respectively, of the
1899 machine instructions generated for the \livelink{chap:lexicalblock}{block}
1901 \refersec{chap:codeaddressesandranges}).
1903 Catch \livelink{chap:catchblock}{block} entries have at
1904 least one child entry, an
1905 entry representing the type of exception accepted by
1906 that catch \livelink{chap:catchblock}{block}.
1907 This child entry has one of
1908 \addtoindexx{formal parameter entry!in catch block}
1910 \addtoindexx{unspecified parameters entry!in catch block}
1912 \DWTAGformalparameter{} or
1913 \DWTAGunspecifiedparameters,
1914 and will have the same form as other parameter entries.
1916 The siblings immediately following
1917 a try \livelink{chap:tryblock}{block} entry are its
1918 corresponding catch \livelink{chap:catchblock}{block} entries.