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}.
34 \subsection[Normal and Partial CU Entries]{Normal and Partial Compilation Unit Entries}
35 \label{chap:normalandpartialcompilationunitentries}
37 A \addtoindex{normal compilation unit} is represented by a debugging
38 information entry with the
39 tag \DWTAGcompileunitTARG.
40 A \addtoindex{partial compilation unit} is represented by a debugging information
42 tag \DWTAGpartialunitTARG.
44 In a simple normal compilation, a single compilation unit with
46 \DWTAGcompileunit{} represents a complete object file
48 \DWTAGpartialunit{} is not used.
50 employing the DWARF space compression and duplicate elimination
52 Appendix \refersec{app:usingcompilationunits},
53 multiple compilation units using
55 \DWTAGcompileunit{} and/or
56 \DWTAGpartialunit{} are
57 used to represent portions of an object file.
59 \textit{A normal compilation unit typically represents the text and
60 data contributed to an executable by a single relocatable
61 object file. It may be derived from several source files,
62 including pre\dash processed \doublequote{include files.}
63 A \addtoindex{partial compilation unit} typically represents a part of the text
64 and data of a relocatable object file, in a manner that can
65 potentially be shared with the results of other compilations
66 to save space. It may be derived from an \doublequote{include file,}
67 template instantiation, or other implementation\dash dependent
68 portion of a compilation. A normal compilation unit can also
69 function in a manner similar to a partial compilation unit
72 A compilation unit entry owns debugging information
73 entries that represent all or part of the declarations
74 made in the corresponding compilation. In the case of a
75 partial compilation unit, the containing scope of its owned
76 declarations is indicated by imported unit entries in one
77 or more other compilation unit entries that refer to that
78 partial compilation unit (see
79 Section \refersec{chap:importedunitentries}).
82 Compilation unit entries may have the following
84 \begin{enumerate}[1. ]
85 \item Either a \DWATlowpc{} and
87 \addtoindexx{high PC attribute}
89 \addtoindexx{low PC attribute}
91 \addtoindexx{ranges attribute}
93 \DWATranges{} attribute
94 \addtoindexx{ranges attribute}
96 \addtoindexx{discontiguous address ranges|see{non-contiguous address ranges}}
99 non\dash contiguous address ranges, respectively,
100 of the machine instructions generated for the compilation
101 unit (see Section \refersec{chap:codeaddressesandranges}).
103 A \DWATlowpc{} attribute
107 \addtoindexx{ranges attribute}
109 \DWATranges{} to specify the
110 \addtoindexx{ranges attribute}
111 default base address for use in
112 \addtoindexx{location list}
113 location lists (see Section
114 \refersec{chap:locationlists}) and range lists
115 \addtoindexx{range list}
116 (see Section \refersec{chap:noncontiguousaddressranges}).
118 \item A \DWATname{} attribute
119 \addtoindexx{name attribute}
120 whose value is a null\dash terminated
122 \hypertarget{chap:DWATnamepathnameofcompilationsource}{}
123 containing the full or relative path name of the primary
124 source file from which the compilation unit was derived.
126 \item A \DWATlanguage{} attribute
127 \addtoindexx{language attribute}
128 whose constant value is an
129 \hypertarget{chap:DWATlanguageprogramminglanguage}{}
131 \addtoindexx{language attribute}
132 indicating the source language of the compilation
133 unit. The set of language names and their meanings are given
134 in Table \refersec{tab:languagenames}.
138 \caption{Language names}
139 \label{tab:languagenames}
142 Language name & Meaning\\ \hline
143 \DWLANGAdaeightythreeTARG{} \dag & ISO \addtoindex{Ada}:1983 \addtoindexx{Ada} \\
144 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada} \\
145 \DWLANGCTARG & Non-standardized C, such as K\&R \\
146 \DWLANGCeightynineTARG & ISO C:1989 \\
147 \DWLANGCninetynineTARG & ISO \addtoindex{C}:1999 \\
148 \DWLANGCplusplusTARG & ISO \addtoindex{C++}:1998 \\
149 \DWLANGCpluspluszerothreeTARG & ISO \addtoindex{C++}:2003 \\
150 \DWLANGCpluspluselevenTARG & ISO \addtoindex{C++}:2011 \\
151 \DWLANGCobolseventyfourTARG & ISO \addtoindex{COBOL}:1974 \\
152 \DWLANGCoboleightyfiveTARG & ISO \addtoindex{COBOL}:1985 \\
153 \DWLANGDTARG{} \dag & D \addtoindexx{D language} \\
154 \DWLANGFortranseventysevenTARG &ISO \addtoindex{FORTRAN} 77\\
155 \DWLANGFortranninetyTARG & ISO \addtoindex{Fortran 90}\\
156 \DWLANGFortranninetyfiveTARG & ISO \addtoindex{Fortran 95}\\
157 \DWLANGGoTARG{} \dag & \addtoindex{Go}\\
158 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell}\\
159 \DWLANGJavaTARG{} & \addtoindex{Java}\\
160 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2}\\
161 \DWLANGModulathreeTARG & \addtoindex{Modula-3}\\
162 \DWLANGObjCTARG{} & \addtoindex{Objective C}\\
163 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++}\\
164 \DWLANGOCamlTARG{} \dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}}\\
165 \DWLANGOpenCLTARG{} \dag & \addtoindex{OpenCL}\\
166 \DWLANGPascaleightythreeTARG & ISO \addtoindex{Pascal}:1983\\
167 \DWLANGPLITARG{} \dag & ANSI \addtoindex{PL/I}:1976\\
168 \DWLANGPythonTARG{} \dag & \addtoindex{Python}\\
169 \DWLANGUPCTARG{} & \addtoindex{Unified Parallel C}\addtoindexx{UPC}\\ \hline
170 \dag \ \ \textit{Support for these languages is limited.}& \\
174 \item A \DWATstmtlist{}
175 attribute whose value is
176 \addtoindexx{statement list attribute}
178 \addtoindexx{section offset!in statement list attribute}
180 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
181 offset to the line number information for this compilation
184 This information is placed in a separate object file
185 section from the debugging information entries themselves. The
186 value of the statement list attribute is the offset in the
187 \dotdebugline{} section of the first byte of the line number
188 information for this compilation unit
189 (see Section \refersec{chap:linenumberinformation}).
192 \item A \DWATmacroinfo{} attribute
193 \addtoindexx{macro information attribute}
195 \addtoindexx{section offset!in macro information attribute}
197 \hypertarget{chap:DWATmacroinfomacroinformation}{}
198 offset to the macro information for this compilation unit.
200 This information is placed in a separate object file section
201 from the debugging information entries themselves. The
202 value of the macro information attribute is the offset in
203 the \dotdebugmacinfo{} section of the first byte of the macro
204 information for this compilation unit
205 (see Section \refersec{chap:macroinformation}).
211 \hypertarget{chap:DWATcompdircompilationdirectory}{}
213 null\dash terminated string containing the current working directory
214 of the compilation command that produced this compilation
215 unit in whatever form makes sense for the host system.
217 \item A \DWATproducer{} attribute
218 \addtoindexx{producer attribute}
219 whose value is a null\dash
220 terminated string containing information about the compiler
221 \hypertarget{chap:DWATproducercompileridentification}{}
222 that produced the compilation unit. The actual contents of
223 the string will be specific to each producer, but should
224 begin with the name of the compiler vendor or some other
225 identifying character sequence that should avoid confusion
226 with other producer values.
229 \item A \DWATidentifiercase{}
231 \addtoindexx{identifier case attribute}
233 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
234 constant value is a code describing the treatment
235 of identifiers within this compilation unit. The
236 set of identifier case codes is given in
237 Table \refersec{tab:identifiercasecodes}.
239 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
240 \DWIDcasesensitive{} \\
243 \DWIDcaseinsensitive{} \\
244 \end{simplenametable}
246 \DWIDcasesensitiveTARG{} is the default for all compilation units
247 that do not have this attribute. It indicates that names given
248 as the values of \DWATname{} attributes
249 \addtoindexx{name attribute}
250 in debugging information
251 entries for the compilation unit reflect the names as they
252 appear in the source program. The debugger should be sensitive
253 to the case of identifier names when doing identifier lookups.
255 \DWIDupcaseTARG{} means that the
256 producer of the debugging
257 information for this compilation unit converted all source
258 names to upper case. The values of the name attributes may not
259 reflect the names as they appear in the source program. The
260 debugger should convert all names to upper case when doing
263 \DWIDdowncaseTARG{} means that
264 the producer of the debugging
265 information for this compilation unit converted all source
266 names to lower case. The values of the name attributes may not
267 reflect the names as they appear in the source program. The
268 debugger should convert all names to lower case when doing
272 \DWIDcaseinsensitiveTARG{} means that the values of the name
273 attributes reflect the names as they appear in the source
274 program but that a case insensitive lookup should be used to
278 \item A \DWATbasetypes{} attribute whose value is a
279 \livelink{chap:classreference}{reference}.
282 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
284 \addtoindexx{base types attribute}
285 points to a debugging information entry
286 representing another compilation unit. It may be used
287 to specify the compilation unit containing the base type
288 entries used by entries in the current compilation unit
289 (see Section \refersec{chap:basetypeentries}).
292 This attribute provides a consumer a way to find the definition
293 of base types for a compilation unit that does not itself
294 contain such definitions. This allows a consumer, for example,
295 to interpret a type conversion to a base type
296 % getting this link target at the right spot is tricky.
297 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
300 \item A \DWATuseUTFeight{} attribute,
301 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
302 which is a \livelink{chap:classflag}{flag} whose
303 presence indicates that all strings (such as the names of
304 declared entities in the source program, or file names in the line table)
305 are represented using the UTF\dash 8 representation.
307 \item A \DWATmainsubprogram{} attribute, which is a \livelink{chap:classflag}{flag}
308 \addtoindexx{main subprogram attribute}
309 whose presence indicates
310 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
311 that the compilation unit contains a
312 subprogram that has been identified as the starting function
313 of the program. If more than one compilation unit contains
314 this \nolink{flag}, any one of them may contain the starting function.
316 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
318 to specify and provide a user\dash specified name for the main
319 subroutine of a program.
320 \addtoindex{C} uses the name \doublequote{main} to identify
321 the main subprogram of a program. Some other languages provide
322 similar or other means to identify the main subprogram of
325 \item A \DWATentrypc{} attribute whose value is the address of the first
326 \hypertarget{chap:DWATentrypcofcompileunit}{}
327 \hypertarget{chap:DWATentrypcofpartialunit}{}
328 \addtoindexx{entry pc attribute!for normal compilation unit}
329 \addtoindexx{entry pc attribute!for partial compilation unit}
330 executable instruction of the unit (see
331 Section \refersec{chap:entryaddress}).
333 \item A \DWATstroffsetsbaseNAME\addtoindexx{string offset base attribute}
334 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
335 attribute, whose value is a reference.
336 This attribute points to the first string
337 offset of the compilation unit's contribution to the
338 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
339 Indirect string references
340 (using \DWFORMstrx) within the compilation unit are
341 interpreted as indices relative to this base.
343 \item A \DWATaddrbaseNAME\addtoindexx{address table base attribute}
344 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
345 attribute, whose value is a reference.
346 This attribute points to the beginning of the compilation
347 unit's contribution to the \dotdebugaddr{} section.
348 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
349 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
350 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
351 interpreted as indices relative to this base.
354 \item A \DWATrangesbaseNAME\addtoindexx{ranges table base attribute}
355 \hypertarget{chap:DWATrangesbaseforrangelists}{}
356 attribute, whose value is a reference.
357 This attribute points to the beginning of the compilation
358 unit's contribution to the \dotdebugranges{} section.
359 References to range lists (using \DWFORMsecoffset)
360 within the compilation unit are
361 interpreted as offsets relative to this base.
366 The base address of a compilation unit is defined as the
367 value of the \DWATlowpc{} attribute, if present; otherwise,
368 it is undefined. If the base address is undefined, then any
369 DWARF entry or structure defined in terms of the base address
370 of that compilation unit is not valid.
372 \subsection{Skeleton Compilation Unit Entries}
373 \label{chap:skeletoncompilationunitentries}
374 When generating a split DWARF object (see
375 Section \refersec{datarep:splitdwarfobjects}), the
376 compilation unit in the \dotdebuginfo{} section is a "skeleton"
377 compilation unit, which contains only a subset of the
378 attributes of the full compilation unit. In general, it
379 contains those attributes that are necessary for the consumer
380 to locate the DWARF object where the full compilation unit
381 can be found, and for the consumer to interpret references to
382 addresses in the program.
384 A skeleton compilation unit has no
385 children, and may have the following attributes:
386 \begin{enumerate}[1. ]
389 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
390 or a \DWATranges{} attribute (the same as for regular
391 compilation unit entries).
394 A \DWATstmtlist{} attribute (the same as for regular
395 compilation unit entries).
398 A \DWATcompdir{} attribute (the same as for regular
399 compilation unit entries).
402 \livetarg{chap:DWATdwoidforunit}{}
403 A \DWATdwonameNAME{} attribute whose value is a
404 null-terminated string containing the full or relative
405 path name of the DWARF object file that contains the full
409 \livetarg{chap:DWATdwoidforunit}{}
410 A \DWATdwoidNAME{} attribute whose value is an 8-byte
411 unsigned hash of the full compilation unit. This hash
412 value is computed by the method described in
413 Section \refersec{datarep:typesignaturecomputation}.
416 A \DWATrangesbase{} attribute (the same as for regular
417 compilation unit entries).
421 A \DWATaddrbase{} attribute (the same as for regular
422 compilation unit entries).
425 A \DWATstroffsetsbase{} attribute, for indirect strings references
426 from the skeleton compilation unit (the same as for regular
427 compilation unit entries).
430 All other attributes of a compilation unit entry (described
431 in Section \refersec{chap:normalandpartialcompilationunitentries})
432 should be placed in the full compilation
433 unit entry in the \dotdebuginfodwo{} section of the split DWARF
434 object. The attributes provided by the skeleton compilation
435 unit entry do not need to be repeated in the full compilation
436 unit entry, except for \DWATdwoid, which should appear in
437 both entries so that the consumer can verify that it has
438 found the correct DWARF object.
441 \subsection{Imported Unit Entries}
442 \label{chap:importedunitentries}
444 \hypertarget{chap:DWATimportimportedunit}{}
445 place where a normal or partial unit is imported is
446 represented by a debugging information entry with the
447 \addtoindexx{imported unit entry}
448 tag \DWTAGimportedunitTARG.
449 An imported unit entry contains
450 \addtoindexx{import attribute}
452 \DWATimport{} attribute
453 whose value is a \livelink{chap:classreference}{reference} to the
454 normal or partial compilation unit whose declarations logically
455 belong at the place of the imported unit entry.
457 \textit{An imported unit entry does not necessarily correspond to
458 any entity or construct in the source program. It is merely
459 \doublequote{glue} used to relate a partial unit, or a compilation
460 unit used as a partial unit, to a place in some other
463 \subsection{Separate Type Unit Entries}
464 \label{chap:separatetypeunitentries}
465 An object file may contain any number of separate type
466 unit entries, each representing a single complete type
468 Each \addtoindex{type unit} must be uniquely identified by
469 a 64\dash bit signature, stored as part of the type unit, which
470 can be used to reference the type definition from debugging
471 information entries in other compilation units and type units.
473 A type unit is represented by a debugging information entry
474 with the tag \DWTAGtypeunitTARG.
475 A \addtoindex{type unit entry} owns debugging
476 information entries that represent the definition of a single
477 type, plus additional debugging information entries that may
478 be necessary to include as part of the definition of the type.
480 A type unit entry may have a
481 \DWATlanguage{} attribute,
483 \addtoindexx{language attribute}
484 constant value is an integer code indicating the source
485 language used to define the type. The set of language names
486 and their meanings are given in Table \refersec{tab:languagenames}.
488 A type unit entry may have a
489 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
490 attribute, whose value is a reference. This attribute points
491 to the first string offset of the type unit's contribution to
492 the \dotdebugstroffsets{} section. Indirect string references
493 (using \DWFORMstrx) within the type unit must be interpreted
494 as indices relative to this base.
496 A type unit entry may have a \DWATstmtlist{} attribute, whose
497 value is a section offset to a line number table for this
498 type unit. Because type units do not describe any code, they
499 do not actually need a line number table, but the line number
500 tables also contain a list of directories and file names that
501 may be referenced by the \DWATdeclfile{} attribute. In a
502 normal object file with a regular compilation unit entry, the
503 type unit entries can simply refer to the line number table
504 used by the compilation unit. In a split DWARF object, where
505 the type units are located in a separate DWARF object file,
506 the \DWATstmtlist{} attribute refers to a "skeleton"
507 line number table in the \dotdebuglinedwo{} section, which
508 contains only the list of directories and file names. All
509 type unit entries in a split DWARF object may (but are not
510 required to) refer to the same skeleton line number table.
512 A \addtoindex{type unit} entry for a given type T owns a debugging
513 information entry that represents a defining declaration
514 of type T. If the type is nested within enclosing types or
515 namespaces, the debugging information entry for T is nested
516 within debugging information entries describing its containers;
517 otherwise, T is a direct child of the type unit entry.
519 A type unit entry may also own additional debugging information
520 entries that represent declarations of additional types that
521 are referenced by type T and have not themselves been placed in
522 separate type units. Like T, if an additional type U is nested
523 within enclosing types or namespaces, the debugging information
524 entry for U is nested within entries describing its containers;
525 otherwise, U is a direct child of the type unit entry.
527 The containing entries for types T and U are declarations,
528 and the outermost containing entry for any given type T or
529 U is a direct child of the type unit entry. The containing
530 entries may be shared among the additional types and between
531 T and the additional types.
533 \textit{Types are not required to be placed in type units. In general,
534 only large types such as structure, class, enumeration, and
535 union types included from header files should be considered
536 for separate type units. Base types and other small types
537 are not usually worth the overhead of placement in separate
538 type units. Types that are unlikely to be replicated, such
539 as those defined in the main source file, are also better
540 left in the main compilation unit.}
542 \section{Module, Namespace and Importing Entries}
543 \textit{Modules and namespaces provide a means to collect related
544 entities into a single entity and to manage the names of
547 \subsection{Module Entries}
548 \label{chap:moduleentries}
549 \textit{Several languages have the concept of a \doublequote{module.}
550 \addtoindexx{Modula-2}
551 A Modula\dash 2 definition module
552 \addtoindexx{Modula-2!definition module}
553 may be represented by a module
555 \addtoindex{declaration attribute}
556 (\DWATdeclaration). A
557 \addtoindex{Fortran 90} module
558 \addtoindexx{Fortran!module (Fortran 90)}
559 may also be represented by a module entry
560 (but no declaration attribute is warranted because \addtoindex{Fortran}
561 has no concept of a corresponding module body).}
563 A module is represented by a debugging information entry
565 tag \DWTAGmoduleTARG.
566 Module entries may own other
567 debugging information entries describing program entities
568 whose declaration scopes end at the end of the module itself.
570 If the module has a name, the module entry has a
571 \DWATname{} attribute
572 \addtoindexx{name attribute}
573 whose value is a null\dash terminated string containing
574 the module name as it appears in the source program.
576 The \addtoindex{module entry} may have either a
580 \addtoindexx{high PC attribute}
582 \addtoindexx{low PC attribute}
584 \DWATranges{} attribute
585 \addtoindexx{ranges attribute}
586 whose values encode the contiguous or non\dash contiguous address
587 ranges, respectively, of the machine instructions generated for
588 the module initialization code
589 (see Section \refersec{chap:codeaddressesandranges}).
590 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
592 \addtoindexx{entry pc attribute!for module initialization}
594 \DWATentrypc{} attribute whose value is the address of
595 the first executable instruction of that initialization code
596 (see Section \refersec{chap:entryaddress}).
599 \hypertarget{chap:DWATprioritymodulepriority}{}
600 the module has been assigned a priority, it may have
601 \addtoindexx{priority attribute}
603 \DWATpriority{} attribute.
604 The value of this attribute is a
605 reference to another debugging information entry describing
606 a variable with a constant value. The value of this variable
607 is the actual constant value of the module\textquoteright s priority,
608 represented as it would be on the target architecture.
610 \subsection{Namespace Entries}
611 \label{chap:namespaceentries}
612 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
613 \addtoindexx{namespace (C++)}
614 implement name hiding, so that names of unrelated things
615 do not accidentally clash in the
616 \addtoindex{global namespace} when an
617 application is linked together.}
619 A namespace is represented by a debugging information entry
621 tag \DWTAGnamespaceTARG.
622 A namespace extension is
623 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
625 \DWTAGnamespace{} entry
627 \addtoindexx{extension attribute}
630 attribute referring to the previous extension, or if there
631 is no previous extension, to the original
633 entry. A namespace extension entry does not need to duplicate
634 information in a previous extension entry of the namespace
635 nor need it duplicate information in the original namespace
636 entry. (Thus, for a namespace with a name,
637 a \DWATname{} attribute
638 \addtoindexx{name attribute}
639 need only be attached directly to the original
640 \DWTAGnamespace{} entry.)
643 Namespace and namespace extension entries may own
644 \addtoindexx{namespace extension entry}
646 \addtoindexx{namespace declaration entry}
647 debugging information entries describing program entities
648 whose declarations occur in the namespace.
650 \textit{For \addtoindex{C++}, such
651 owned program entities may be declarations,
652 including certain declarations that are also object or
653 function definitions.}
655 If a type, variable, or function declared in a namespace is
656 defined outside of the body of the namespace declaration,
657 that type, variable, or function definition entry has a
658 \DWATspecification{} attribute
659 \addtoindexx{specification attribute}
660 whose value is a \livelink{chap:classreference}{reference} to the
661 debugging information entry representing the declaration of
662 the type, variable or function. Type, variable, or function
664 \DWATspecification{} attribute
665 \addtoindexx{specification attribute}
667 to duplicate information provided by the declaration entry
668 referenced by the specification attribute.
670 \textit{The \addtoindex{C++} \addtoindex{global namespace}
672 \addtoindexx{global namespace|see{namespace (C++), global}}
674 \addtoindexx{namespace (C++)!global}
676 \texttt{::f}, for example) is not explicitly represented in
677 DWARF with a namespace entry (thus mirroring the situation
678 in \addtoindex{C++} source).
679 Global items may be simply declared with no
680 reference to a namespace.}
682 \textit{The \addtoindex{C++}
683 compilation unit specific \doublequote{unnamed namespace} may
684 \addtoindexx{namespace (C++)!unnamed}
685 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
686 be represented by a namespace entry with no name attribute in
687 the original namespace declaration entry (and therefore no name
688 attribute in any namespace extension entry of this namespace).
691 \textit{A compiler emitting namespace information may choose to
692 explicitly represent namespace extensions, or to represent the
693 final namespace declaration of a compilation unit; this is a
694 quality\dash of\dash implementation issue and no specific requirements
695 are given here. If only the final namespace is represented,
696 \addtoindexx{namespace (C++)!using declaration}
697 it is impossible for a debugger to interpret using declaration
698 references in exactly the manner defined by the
699 \addtoindex{C++} language.
702 \textit{Emitting all namespace declaration information in all
703 compilation units can result in a significant increase in the
704 size of the debug information and significant duplication of
705 information across compilation units.
706 The \addtoindex{C++} namespace std,
708 \addtoindexx{namespace (C++)!std}
709 is large and will probably be referenced in
710 every \addtoindex{C++} compilation unit.
713 \textit{For a \addtoindex{C++} namespace example,
714 see Appendix \refersec{app:namespaceexample}.
719 \subsection{Imported (or Renamed) Declaration Entries}
720 \label{chap:importedorrenameddeclarationentries}
721 \textit{Some languages support the concept of importing into or making
722 accessible in a given unit declarations made in a different
723 module or scope. An imported declaration may sometimes be
728 imported declaration is represented by one or
729 \addtoindexx{imported declaration entry}
730 more debugging information entries with the
731 tag \DWTAGimporteddeclarationTARG.
733 \hypertarget{chap:DWATimportimporteddeclaration}{}
735 is imported, there is one imported declaration entry for
737 \addtoindexx{import attribute}
738 Each imported declaration entry has a
739 \DWATimport{} attribute,
740 whose value is a \livelink{chap:classreference}{reference} to the
741 debugging information entry representing the declaration that
744 An imported declaration may also have a
747 \addtoindexx{name attribute}
748 whose value is a null\dash terminated string containing the
749 name, as it appears in the source program, by which the
750 imported entity is to be known in the context of the imported
751 declaration entry (which may be different than the name of
752 the entity being imported). If no name is present, then the
753 name by which the entity is to be known is the same as the
754 name of the entity being imported.
756 An imported declaration entry with a name attribute may be
757 used as a general means to rename or provide an alias for
758 \addtoindexx{alias declaration|see{imported declaration entry}}
759 an entity, regardless of the context in which the importing
760 declaration or the imported entity occurs.
762 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
763 \hypertarget{chap:DWATimportnamespacealias}{}
765 \addtoindexx{namespace (C++)!alias}
766 with a name attribute whose value is
767 a null\dash terminated string containing the alias name as it
768 appears in the source program and an import attribute whose
769 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
770 namespace extension entry.
773 \textit{A \addtoindex{C++} using declaration may be represented by one or more
774 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
776 \addtoindexx{namespace (C++)!using declaration}
777 declaration entries. When the using declaration
778 refers to an overloaded function, there is one imported
779 declaration entry corresponding to each overloading. Each
780 imported declaration entry has no name attribute but it does
781 have an import attribute that refers to the entry for the
782 entity being imported. (\addtoindex{C++}
783 provides no means to \doublequote{rename}
784 an imported entity, other than a namespace).
787 \textit{A \addtoindex{Fortran} use statement
788 \addtoindexx{Fortran!use statement}
789 \addtoindexx{use statement|see {Fortran, use statement}}
790 with an \doublequote{only list} may be
791 represented by a series of imported declaration entries,
792 one (or more) for each entity that is imported. An entity
793 \addtoindexx{renamed declaration|see{imported declaration entry}}
794 that is renamed in the importing context may be represented
795 by an imported declaration entry with a name attribute that
796 specifies the new local name.
799 \subsection{Imported Module Entries}
800 \label{chap:importedmoduleentries}
802 \textit{Some languages support the concept of importing into or making
803 accessible in a given unit all of the declarations contained
804 within a separate module or namespace.
807 An imported module declaration is represented by a debugging
808 information entry with
809 \addtoindexx{imported module attribute}
811 \addtoindexx{imported module entry}
812 tag \DWTAGimportedmoduleTARG.
814 imported module entry contains a
815 \DWATimport{} attribute
816 \addtoindexx{import attribute}
817 whose value is a \livelink{chap:classreference}{reference}
818 to the module or namespace entry
819 containing the definition and/or declaration entries for
820 the entities that are to be imported into the context of the
821 imported module entry.
823 An imported module declaration may own a set of imported
824 declaration entries, each of which refers to an entry in the
825 module whose corresponding entity is to be known in the context
826 of the imported module declaration by a name other than its
827 name in that module. Any entity in the module that is not
828 renamed in this way is known in the context of the imported
829 module entry by the same name as it is declared in the module.
831 \textit{A \addtoindex{C++} using directive
832 \addtoindexx{namespace (C++)!using directive}
833 \addtoindexx{using directive|see {namespace (C++), using directive}}
834 may be represented by an imported module
835 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
836 entry, with an import attribute referring to the namespace
837 entry of the appropriate extension of the namespace (which
838 might be the original namespace entry) and no owned entries.
841 \textit{A \addtoindex{Fortran} use statement
842 \addtoindexx{Fortran!use statement}
843 with a \doublequote{rename list} may be
844 represented by an imported module entry with an import
845 attribute referring to the module and owned entries
846 corresponding to those entities that are renamed as part of
850 \textit{A \addtoindex{Fortran} use statement
851 \addtoindexx{Fortran!use statement}
852 with neither a \doublequote{rename list} nor
853 an \doublequote{only list} may be represented by an imported module
854 entry with an import attribute referring to the module and
855 no owned child entries.
858 \textit{A use statement with an \doublequote{only list} is represented by a
859 series of individual imported declaration entries as described
860 in Section \refersec{chap:importedorrenameddeclarationentries}.
863 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
864 \addtoindexx{Fortran!use statement}
865 itself imported by a use statement without an explicit mention
866 may be represented by an imported declaration entry that refers
867 to the original debugging information entry. For example, given
884 \textit{the imported declaration entry for Q within module C refers
885 directly to the variable declaration entry for X in module A
886 because there is no explicit representation for X in module B.
889 \textit{A similar situation arises for a \addtoindex{C++} using declaration
890 \addtoindexx{namespace (C++)!using declaration}
891 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
892 that imports an entity in terms of a namespace alias. See
893 Appendix \refersec{app:namespaceexample}
897 \section{Subroutine and Entry Point Entries}
898 \label{chap:subroutineandentrypointentries}
900 The following tags exist to describe
901 debugging information entries
902 \addtoindexx{function entry|see{subroutine entry}}
904 \addtoindexx{subroutine entry}
906 \addtoindexx{subprogram entry}
908 % FIXME: is entry point entry the right index 'entry'?
909 \addtoindexx{entry point entry}
912 \begin{tabular}{lp{9.0cm}}
913 \DWTAGsubprogramTARG{} & A subroutine or function \\
914 \DWTAGinlinedsubroutine{} & A particular inlined
915 \addtoindexx{inlined subprogram entry}
916 instance of a subroutine or function \\
917 \DWTAGentrypointTARG{} & An alternate entry point \\
920 \subsection{General Subroutine and Entry Point Information}
921 \label{chap:generalsubroutineandentrypointinformation}
922 The subroutine or entry point entry has a \DWATname{}
923 attribute whose value is a null-terminated string containing the
924 subroutine or entry point name as it appears in the source program.
925 It may also have a \DWATlinkagename{} attribute as
926 described in Section \refersec{chap:linkagenames}.
928 If the name of the subroutine described by an entry with the
929 \addtoindexx{subprogram entry}
930 tag \DWTAGsubprogram{}
931 is visible outside of its containing
932 \hypertarget{chap:DWATexternalexternalsubroutine}{}
933 compilation unit, that entry has
934 \addtoindexx{external attribute}
936 \DWATexternal{} attribute,
937 which is a \livelink{chap:classflag}{flag}.
939 \textit{Additional attributes for functions that are members of a
940 class or structure are described in
941 Section \refersec{chap:memberfunctionentries}.
945 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
948 \DWATmainsubprogram{}
950 \addtoindexx{main subprogram attribute}
952 a \livelink{chap:classflag}{flag} whose presence indicates that the
953 subroutine has been identified as the starting function of
954 the program. If more than one subprogram contains this
956 any one of them may be the starting subroutine of the program.
958 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
959 which is used to specify
960 and provide a user\dash supplied name for the main subroutine of
964 \textit{A common debugger feature is to allow the debugger user to call
965 a subroutine within the subject program. In certain cases,
966 however, the generated code for a subroutine will not obey
967 the standard calling conventions for the target architecture
968 and will therefore not be safe to call from within a debugger.
971 A subroutine entry may
972 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}{}
974 \DWATcallingconvention{}
975 attribute, whose value is an
976 \livelink{chap:classconstant}{integer constant}. The set of
977 calling convention codes is given in
978 Table \refersec{tab:callingconventioncodes}.
980 \begin{simplenametable}[1.4in]{Calling convention codes}{tab:callingconventioncodes}
984 \end{simplenametable}
986 If this attribute is not present, or its value is the constant
987 \DWCCnormalTARG, then the subroutine may be safely called by
988 obeying the \doublequote{standard} calling conventions of the target
989 architecture. If the value of the calling convention attribute
990 is the constant \DWCCnocallTARG, the subroutine does not obey
991 standard calling conventions, and it may not be safe for the
992 debugger to call this subroutine.
994 If the semantics of the language of the compilation unit
995 containing the subroutine entry distinguishes between ordinary
996 subroutines and subroutines that can serve as the \doublequote{main
997 program,} that is, subroutines that cannot be called
998 directly according to the ordinary calling conventions,
999 then the debugging information entry for such a subroutine
1000 may have a calling convention attribute whose value is the
1001 constant \DWCCprogramTARG.
1003 \textit{The \DWCCprogram{}
1004 value is intended to support \addtoindex{Fortran} main
1005 \addtoindexx{Fortran!main program}
1006 programs which in some implementations may not be callable
1007 or which must be invoked in a special way. It is not intended
1008 as a way of finding the entry address for the program.
1011 \textit{In \addtoindex{C}
1012 there is a difference between the types of functions
1013 declared using function prototype style declarations and
1014 those declared using non\dash prototype declarations.
1017 A subroutine entry declared with a function prototype style
1018 declaration may have
1019 \addtoindexx{prototyped attribute}
1021 \DWATprototyped{} attribute, which is
1022 a \livelink{chap:classflag}{flag}.
1024 \textit{The \addtoindex{Fortran}
1025 language allows the keywords \texttt{elemental}, \texttt{pure}
1026 and \texttt{recursive} to be included as part of the declaration of
1027 a subroutine; these attributes reflect that usage. These
1028 attributes are not relevant for languages that do not support
1029 similar keywords or syntax. In particular, the \DWATrecursive{}
1030 attribute is neither needed nor appropriate in languages such
1032 where functions support recursion by default.
1036 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1038 \addtoindexx{elemental attribute}
1040 \DWATelemental{} attribute, which
1041 is a \livelink{chap:classflag}{flag}.
1042 The attribute indicates whether the subroutine
1043 or entry point was declared with the \doublequote{elemental} keyword
1047 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1048 subprogram entry may have
1049 \addtoindexx{pure attribute}
1051 \DWATpure{} attribute, which is
1052 a \livelink{chap:classflag}{flag}.
1053 The attribute indicates whether the subroutine was
1054 declared with the \doublequote{pure} keyword or property.
1057 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}
1058 subprogram entry may have a
1059 \DWATrecursive{} attribute, which
1060 is a \livelink{chap:classflag}{flag}.
1061 The attribute indicates whether the subroutine
1062 or entry point was declared with the \doublequote{recursive} keyword
1067 \subsection{Subroutine and Entry Point Return Types}
1068 \label{chap:subroutineandentrypointreturntypes}
1071 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1072 the subroutine or entry point
1073 \addtoindexx{return type of subroutine}
1074 is a function that returns a
1075 value, then its debugging information entry has
1076 \addtoindexx{type attribute}
1077 a \DWATtype{} attribute
1078 to denote the type returned by that function.
1080 \textit{Debugging information entries for
1081 \addtoindex{C} void functions should
1082 not have an attribute for the return type. }
1085 \subsection{Subroutine and Entry Point Locations}
1086 \label{chap:subroutineandentrypointlocations}
1088 A subroutine entry may have either a \DWATlowpc{} and
1089 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1090 \addtoindexx{ranges attribute}
1092 \addtoindexx{high PC attribute}
1094 \addtoindexx{low PC attribute}
1095 encode the contiguous or non\dash contiguous address
1096 ranges, respectively, of the machine instructions generated
1097 for the subroutine (see
1098 Section \refersec{chap:codeaddressesandranges}).
1101 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1102 subroutine entry may also have
1103 \addtoindexx{entry pc attribute!for subroutine}
1105 \DWATentrypc{} attribute
1106 whose value is the address of the first executable instruction
1107 of the subroutine (see
1108 Section \refersec{chap:entryaddress}).
1110 An entry point has a \DWATlowpc{} attribute whose value is the
1111 relocated address of the first machine instruction generated
1112 for the entry point.
1115 \DWATentrypc{} attribute
1116 \addtoindexx{entry pc attribute!for subroutine}
1118 also seem appropriate
1119 for this purpose, historically the
1120 \DWATlowpc{} attribute
1122 \DWATentrypc{} was introduced (in
1123 \addtoindex{DWARF Version 3}).
1124 There is insufficient reason to change this.}
1130 \addtoindexx{address class!attribute}
1132 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1136 \DWATaddressclass{} attributes,
1137 as appropriate, to specify
1138 which segments the code for the subroutine resides in and
1139 the addressing mode to be used in calling that subroutine.
1141 A subroutine entry representing a subroutine declaration
1142 that is not also a definition does not have code address or
1146 \subsection{Declarations Owned by Subroutines and Entry Points}
1147 \label{chap:declarationsownedbysubroutinesandentrypoints}
1149 The declarations enclosed by a subroutine or entry point are
1150 represented by debugging information entries that are owned
1151 by the subroutine or entry point entry. Entries representing
1152 \addtoindexx{formal parameter}
1153 the formal parameters of the subroutine or entry point appear
1154 in the same order as the corresponding declarations in the
1158 \textit{There is no ordering requirement for entries for declarations
1159 that are children of subroutine or entry point entries but
1160 that do not represent formal parameters. The formal parameter
1161 entries may be interspersed with other entries used by formal
1162 parameter entries, such as type entries.}
1164 The unspecified parameters of a variable parameter list are
1165 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1167 \DWTAGunspecifiedparametersTARG.
1169 The entry for a subroutine that includes a
1170 \addtoindex{Fortran}
1171 \addtoindexx{Fortran!common block}
1172 \livelink{chap:fortrancommonblock}{common}
1173 \livelink{chap:commonblockentry}{block}
1174 \addtoindexx{common block|see{Fortran common block}}
1175 has a child entry with the
1176 tag \DWTAGcommoninclusionTARG.
1178 \hypertarget{chap:commonreferencecommonblockusage}{}
1179 common inclusion entry has a
1180 \DWATcommonreference{} attribute
1181 whose value is a \livelink{chap:classreference}{reference}
1182 to the debugging information entry
1183 for the common \nolink{block} being included
1184 (see Section \refersec{chap:commonblockentries}).
1186 \subsection{Low-Level Information}
1187 \label{chap:lowlevelinformation}
1190 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1191 subroutine or entry point entry may have
1192 \addtoindexx{return address attribute}
1195 attribute, whose value is a location description. The location
1196 calculated is the place where the return address for the
1197 subroutine or entry point is stored.
1200 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1201 subroutine or entry point entry may also have
1202 \addtoindexx{frame base attribute}
1204 \DWATframebase{} attribute, whose value is a location
1205 description that computes the \doublequote{frame base} for the
1206 subroutine or entry point. If the location description is
1207 a simple register location description, the given register
1208 contains the frame base address. If the location description is
1209 a DWARF expression, the result of evaluating that expression
1210 is the frame base address. Finally, for a
1211 \addtoindex{location list},
1212 this interpretation applies to each location description
1213 contained in the list of \addtoindex{location list} entries.
1215 \textit{The use of one of the \DWOPregn{}
1217 context is equivalent to using
1220 compact. However, these are not equivalent in general.}
1223 \textit{The frame base for a procedure is typically an address fixed
1224 relative to the first unit of storage allocated for the
1225 procedure\textquoteright s stack frame. The \DWATframebase{} attribute
1226 can be used in several ways:}
1227 \begin{enumerate}[1. ]
1228 \item \textit{In procedures that need
1229 \addtoindexx{location list}
1230 location lists to locate local
1231 variables, the \DWATframebase{} can hold the needed location
1232 list, while all variables\textquoteright\ location descriptions can be
1233 simpler ones involving the frame base.}
1235 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1236 within nested routines.
1237 (See also \DWATstaticlink, below)}
1241 \textit{Some languages support nested subroutines. In such languages,
1242 it is possible to reference the local variables of an
1243 outer subroutine from within an inner subroutine. The
1244 \DWATstaticlink{} and \DWATframebase{} attributes allow
1245 debuggers to support this same kind of referencing.}
1248 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1250 \addtoindexx{address!uplevel|see {static link attribute}}
1251 \addtoindexx{uplevel address|see {static link attribute}}
1252 subroutine or entry point is nested, it may have a
1254 attribute, whose value is a location
1255 description that computes the frame base of the relevant
1256 instance of the subroutine that immediately encloses the
1257 subroutine or entry point.
1259 In the context of supporting nested subroutines, the
1260 \DWATframebase{} attribute value should obey the following
1263 \begin{enumerate}[1. ]
1264 \item It should compute a value that does not change during the
1265 life of the procedure, and
1267 \item The computed value should be unique among instances of
1268 the same subroutine. (For typical \DWATframebase{} use, this
1269 means that a recursive subroutine\textquoteright s stack frame must have
1270 non\dash zero size.)
1273 \textit{If a debugger is attempting to resolve an up\dash level reference
1274 to a variable, it uses the nesting structure of DWARF to
1275 determine which subroutine is the lexical parent and the
1276 \DWATstaticlink{} value to identify the appropriate active
1277 frame of the parent. It can then attempt to find the reference
1278 within the context of the parent.}
1282 \subsection{Types Thrown by Exceptions}
1283 \label{chap:typesthrownbyexceptions}
1285 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1286 it may validly throw.}
1288 If a subroutine explicitly declares that it may throw
1289 \addtoindexx{exception thrown|see{thrown type entry}}
1291 \addtoindexx{thrown exception|see{thrown type entry}}
1292 exception of one or more types, each such type is
1293 represented by a debugging information entry with
1294 \addtoindexx{thrown type entry}
1296 \DWTAGthrowntypeTARG.
1297 Each such entry is a child of the entry
1298 representing the subroutine that may throw this type. Each
1299 thrown type entry contains
1300 \addtoindexx{type attribute}
1301 a \DWATtype{} attribute, whose
1302 value is a \livelink{chap:classreference}{reference}
1303 to an entry describing the type of the
1304 exception that may be thrown.
1306 \subsection{Function Template Instantiations}
1307 \label{chap:functiontemplateinstantiations}
1309 \textit{In \addtoindex{C++}, a function template is a generic definition of
1310 a function that is instantiated differently for calls with
1311 values of different types. DWARF does not represent the generic
1312 template definition, but does represent each instantiation.}
1314 A \addtoindex{template instantiation} is represented by a debugging
1315 information entry with the
1316 \addtoindexx{subprogram entry!use for template instantiation}
1317 tag \DWTAGsubprogram.
1319 exceptions, such an entry will contain the same attributes and
1320 will have the same types of child entries as would an entry
1321 for a subroutine defined explicitly using the instantiation
1322 types and values. The exceptions are:
1324 \begin{enumerate}[1. ]
1325 \item Template parameters are described and referenced as specified in
1326 Section \refersec{chap:templateparameters}.
1328 \item If the compiler has generated a special compilation unit
1329 to hold the template instantiation and that compilation unit
1330 has a different name from the compilation unit containing
1331 the template definition, the name attribute for the debugging
1332 information entry representing that compilation unit is empty
1335 \item If the subprogram entry representing the template
1336 instantiation or any of its child entries contain declaration
1337 coordinate attributes, those attributes refer to the source
1338 for the template definition, not to any source generated
1339 artificially by the compiler for this instantiation.
1344 \subsection{Inlinable and Inlined Subroutines}
1345 A declaration or a definition of an inlinable subroutine
1346 is represented by a debugging information entry with the
1350 \addtoindexx{subprogram entry!use in inlined subprogram}
1352 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1353 explicitly declared to be available for inline expansion or
1354 that was expanded inline implicitly by the compiler has
1355 \addtoindexx{inline attribute}
1357 \DWATinline{} attribute whose value is an
1358 \livelink{chap:classconstant}{integer constant}. The
1359 set of values for the \DWATinline{} attribute is given in
1360 Table \refersec{tab:inlinecodes}.
1364 \caption{Inline codes}
1365 \label{tab:inlinecodes}
1366 \begin{tabular}{l|p{8cm}}
1368 Name&Meaning\\ \hline
1369 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1370 \mbox{compiler} (equivalent to the absence of the
1371 containing \DWATinline{} attribute) \\
1372 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1373 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1374 not inlined by the \mbox{compiler} \\
1375 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1381 \textit{In \addtoindex{C++}, a function or a constructor declared with
1382 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1383 instance (see below) is represented by a debugging information
1384 entry with the tag \DWTAGsubprogram. Such an entry has a
1385 \DWATinline{} attribute whose value is \DWINLinlined.}
1388 \subsubsection{Abstract Instances}
1389 \label{chap:abstractinstances}
1390 Any debugging information entry that is owned (either
1391 \hypertarget{chap:DWATinlineabstracttinstance}{}
1392 directly or indirectly) by a debugging information entry
1394 \DWATinline{} attribute is referred to
1395 \addtoindexx{abstract instance!entry}
1396 as an \doublequote{abstract instance entry.}
1397 Any subroutine entry
1399 \addtoindexx{inline attribute}
1400 a \DWATinline{} attribute whose value is other
1401 than \DWINLnotinlined{}
1403 \addtoindexx{abstract instance!root}
1404 an \doublequote{abstract instance root.}
1405 Any set of abstract instance entries that are all
1406 children (either directly or indirectly) of some abstract
1407 instance root, together with the root itself, is known as
1408 \addtoindexx{abstract instance!tree}
1409 an \doublequote{abstract instance tree.} However, in the case where
1410 an abstract instance tree is nested within another abstract
1411 instance tree, the entries in the
1412 \addtoindex{nested abstract instance}
1413 tree are not considered to be entries in the outer abstract
1416 Each abstract instance root is either part of a larger
1417 \addtoindexx{abstract instance!root}
1418 tree (which gives a context for the root) or
1419 \addtoindexx{specification attribute}
1421 \DWATspecification{}
1422 to refer to the declaration in context.
1424 \textit{For example, in \addtoindex{C++} the context might be a namespace
1425 declaration or a class declaration.}
1427 \textit{Abstract instance trees are defined so that no entry is part
1428 of more than one abstract instance tree. This simplifies the
1429 following descriptions.}
1431 A debugging information entry that is a member of an abstract
1432 instance tree should not contain any attributes which describe
1433 aspects of the subroutine which vary between distinct inlined
1434 expansions or distinct out\dash of\dash line expansions. For example,
1435 \addtoindexx{entry pc attribute!and abstract instance}
1446 \addtoindexx{location attribute!and abstract instance}
1448 \addtoindexx{ranges attribute!and abstract instance}
1450 \addtoindexx{high PC attribute!and abstract instance}
1452 \addtoindexx{low PC attribute!and abstract instance}
1454 \addtoindexx{segment attribute!and abstract instance}
1456 \addtoindexx{return address attribute!and abstract instance}
1458 \addtoindexx{segment attribute!and abstract instance}
1460 \addtoindexx{start scope attribute!and abstract instance}
1464 \textit{It would not make sense normally to put these attributes into
1465 abstract instance entries since such entries do not represent
1466 actual (concrete) instances and thus do not actually exist at
1467 run\dash time. However,
1468 see Appendix \refersec{app:inlineouteronenormalinner}
1469 for a contrary example.}
1471 The rules for the relative location of entries belonging to
1472 abstract instance trees are exactly the same as for other
1473 similar types of entries that are not abstract. Specifically,
1474 the rule that requires that an entry representing a declaration
1475 be a direct child of the entry representing the scope of the
1476 declaration applies equally to both abstract and non\dash abstract
1477 entries. Also, the ordering rules for formal parameter entries,
1478 member entries, and so on, all apply regardless of whether
1479 or not a given entry is abstract.
1481 \subsubsection{Concrete Inlined Instances}
1482 \label{chap:concreteinlinedinstances}
1484 Each inline expansion of a subroutine is represented
1485 by a debugging information entry with the
1486 tag \DWTAGinlinedsubroutineTARG.
1487 Each such entry should be a direct
1488 child of the entry that represents the scope within which
1489 the inlining occurs.
1491 Each inlined subroutine entry may have either a
1493 and \DWAThighpc{} pair
1495 \addtoindexx{high PC attribute}
1497 \addtoindexx{low PC attribute}
1499 \addtoindexx{ranges attribute}
1502 attribute whose values encode the contiguous or non\dash contiguous
1503 address ranges, respectively, of the machine instructions
1504 generated for the inlined subroutine (see
1505 Section \refersec{chap:codeaddressesandranges}).
1507 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1508 inlined subroutine entry may
1509 \addtoindexx{inlined subprogram entry!in concrete instance}
1511 \addtoindexx{inlined subprogram entry}
1513 \addtoindexx{entry pc attribute!for inlined subprogram}
1516 attribute, representing the first executable instruction of
1517 the inline expansion (see
1518 Section \refersec{chap:entryaddress}).
1520 % Positions of the 3 targets here is a bit arbitrary.
1522 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1524 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1526 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1527 may also have \DWATcallfile,
1528 \DWATcallline{} and \DWATcallcolumn{} attributes,
1530 value is an \livelink{chap:classconstant}{integer constant}.
1531 These attributes represent the
1532 source file, source line number, and source column number,
1533 respectively, of the first character of the statement or
1534 expression that caused the inline expansion. The call file,
1535 call line, and call column attributes are interpreted in
1536 the same way as the declaration file, declaration line, and
1537 declaration column attributes, respectively (see
1538 Section \refersec{chap:declarationcoordinates}).
1540 \textit{The call file, call line and call column coordinates do not
1541 describe the coordinates of the subroutine declaration that
1542 was inlined, rather they describe the coordinates of the call.
1545 An inlined subroutine entry
1546 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1549 attribute, which is a \livelink{chap:classflag}{flag}
1550 whose presence indicates that the
1551 subroutine has been evaluated as a compile\dash time constant. Such
1552 an entry may also have a \DWATconstvalue{} attribute,
1553 whose value may be of any form that is appropriate for the
1554 representation of the subroutine's return value. The value of
1555 this attribute is the actual return value of the subroutine,
1556 represented as it would be on the target architecture.
1558 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1559 \addttindex{constexpr}
1560 is called with constant expressions, then the corresponding
1561 concrete inlined instance has a
1562 \DWATconstexpr{} attribute,
1563 as well as a \DWATconstvalue{} attribute whose value represents
1564 the actual return value of the concrete inlined instance.}
1566 Any debugging information entry that is owned (either
1567 directly or indirectly) by a debugging information entry
1568 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1569 \doublequote{concrete inlined instance entry.} Any entry that has
1571 \DWTAGinlinedsubroutine{}
1572 is known as a \doublequote{concrete inlined instance root.}
1573 Any set of concrete inlined instance
1574 entries that are all children (either directly or indirectly)
1575 of some concrete inlined instance root, together with the root
1576 itself, is known as a \doublequote{concrete inlined instance tree.}
1577 However, in the case where a concrete inlined instance tree
1578 is nested within another concrete instance tree, the entries
1579 in the \addtoindex{nested concrete inline instance} tree
1580 are not considered to
1581 be entries in the outer concrete instance tree.
1583 \textit{Concrete inlined instance trees are defined so that no entry
1584 is part of more than one concrete inlined instance tree. This
1585 simplifies later descriptions.}
1587 Each concrete inlined instance tree is uniquely associated
1588 with one (and only one) abstract instance tree.
1590 \textit{Note, however, that the reverse is not true. Any given abstract
1591 instance tree may be associated with several different concrete
1592 inlined instance trees, or may even be associated with zero
1593 concrete inlined instance trees.}
1595 Concrete inlined instance entries may omit attributes that
1596 are not specific to the concrete instance (but present in
1597 the abstract instance) and need include only attributes that
1598 are specific to the concrete instance (but omitted in the
1599 abstract instance). In place of these omitted attributes, each
1600 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1601 concrete inlined instance entry
1602 \addtoindexx{abstract origin attribute}
1604 \DWATabstractorigin{}
1605 attribute that may be used to obtain the missing information
1606 (indirectly) from the associated abstract instance entry. The
1607 value of the abstract origin attribute is a reference to the
1608 associated abstract instance entry.
1610 If an entry within a concrete inlined instance tree contains
1611 attributes describing the
1612 \addtoindexx{declaration coordinates!in concrete instance}
1613 \livelink{chap:declarationcoordinates}{declaration coordinates}
1614 of that entry, then those attributes should refer to the file, line
1615 and column of the original declaration of the subroutine,
1616 not to the point at which it was inlined. As a consequence,
1617 they may usually be omitted from any entry that has an abstract
1621 For each pair of entries that are associated via a
1622 \addtoindexx{abstract origin attribute}
1623 \DWATabstractorigin{} attribute, both members of the pair
1624 have the same tag. So, for example, an entry with the tag
1625 \DWTAGvariable{} can only be associated with another entry
1626 that also has the tag \DWTAGvariable. The only exception
1627 to this rule is that the root of a concrete instance tree
1628 (which must always have the tag \DWTAGinlinedsubroutine)
1629 can only be associated with the root of its associated abstract
1630 instance tree (which must have the tag \DWTAGsubprogram).
1632 In general, the structure and content of any given concrete
1633 inlined instance tree will be closely analogous to the
1634 structure and content of its associated abstract instance
1635 tree. There are a few exceptions:
1637 \begin{enumerate}[1. ]
1638 \item An entry in the concrete instance tree may be omitted if
1640 \addtoindexx{abstract origin attribute}
1641 \DWATabstractorigin{} attribute and either
1642 has no children, or its children are omitted. Such entries
1643 would provide no useful information. In C\dash like languages,
1644 such entries frequently include types, including structure,
1645 union, class, and interface types; and members of types. If any
1646 entry within a concrete inlined instance tree needs to refer
1647 to an entity declared within the scope of the relevant inlined
1648 subroutine and for which no concrete instance entry exists,
1649 the reference should refer to the abstract instance entry.
1651 \item Entries in the concrete instance tree which are associated
1652 with entries in the abstract instance tree such that neither
1653 has a \DWATname{} attribute,
1654 \addtoindexx{name attribute}
1655 and neither is referenced by
1656 any other debugging information entry, may be omitted. This
1657 may happen for debugging information entries in the abstract
1658 instance trees that became unnecessary in the concrete instance
1659 tree because of additional information available there. For
1660 example, an anonymous variable might have been created and
1661 described in the abstract instance tree, but because of
1662 the actual parameters for a particular inlined expansion,
1663 it could be described as a constant value without the need
1664 for that separate debugging information entry.
1666 \item A concrete instance tree may contain entries which do
1667 not correspond to entries in the abstract instance tree
1668 to describe new entities that are specific to a particular
1669 inlined expansion. In that case, they will not have associated
1670 entries in the abstract instance tree, should not contain
1671 \addtoindexx{abstract origin attribute}
1672 \DWATabstractorigin{} attributes, and must contain all their
1673 own attributes directly. This allows an abstract instance tree
1674 to omit debugging information entries for anonymous entities
1675 that are unlikely to be needed in most inlined expansions. In
1676 any expansion which deviates from that expectation, the
1677 entries can be described in its concrete inlined instance tree.
1681 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1682 \label{chap:outoflineinstancesofinlinedsubroutines}
1683 Under some conditions, compilers may need to generate concrete
1684 executable instances of inlined subroutines other than at
1685 points where those subroutines are actually called. Such
1686 concrete instances of inlined subroutines are referred to as
1687 \doublequote{concrete out\dash of\dash line instances.}
1689 \textit{In \addtoindex{C++}, for example,
1690 taking the address of a function declared
1691 to be inline can necessitate the generation of a concrete
1692 out\dash of\dash line instance of the given function.}
1694 The DWARF representation of a concrete out\dash of\dash line instance
1695 of an inlined subroutine is essentially the same as for a
1696 concrete inlined instance of that subroutine (as described in
1697 the preceding section). The representation of such a concrete
1698 % It is critical that the hypertarget and livelink be
1699 % separated to avoid problems with latex.
1700 out\dash of\dash line
1701 \addtoindexx{abstract origin attribute}
1703 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1705 \DWATabstractorigin{}
1706 attributes in exactly the same way as they are used for
1707 a concrete inlined instance (that is, as references to
1708 corresponding entries within the associated abstract instance
1711 The differences between the DWARF representation of a
1712 concrete out\dash of\dash line instance of a given subroutine and the
1713 representation of a concrete inlined instance of that same
1714 subroutine are as follows:
1716 \begin{enumerate}[1. ]
1717 \item The root entry for a concrete out\dash of\dash line instance
1718 of a given inlined subroutine has the same tag as does its
1719 associated (abstract) inlined subroutine entry (that is, tag
1720 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1722 \item The root entry for a concrete out\dash of\dash line instance tree
1723 is normally owned by the same parent entry that also owns
1724 the root entry of the associated abstract instance. However,
1725 it is not required that the abstract and out\dash of\dash line instance
1726 trees be owned by the same parent entry.
1730 \subsubsection{Nested Inlined Subroutines}
1731 \label{nestedinlinedsubroutines}
1732 Some languages and compilers may permit the logical nesting of
1733 a subroutine within another subroutine, and may permit either
1734 the outer or the nested subroutine, or both, to be inlined.
1736 For a non\dash inlined subroutine nested within an inlined
1737 subroutine, the nested subroutine is described normally in
1738 both the abstract and concrete inlined instance trees for
1739 the outer subroutine. All rules pertaining to the abstract
1740 and concrete instance trees for the outer subroutine apply
1741 also to the abstract and concrete instance entries for the
1745 For an inlined subroutine nested within another inlined
1746 subroutine, the following rules apply to their abstract and
1747 \addtoindexx{abstract instance!nested}
1748 \addtoindexx{concrete instance!nested}
1749 concrete instance trees:
1751 \begin{enumerate}[1. ]
1752 \item The abstract instance tree for the nested subroutine is
1753 described within the abstract instance tree for the outer
1754 subroutine according to the rules in
1755 Section \refersec{chap:abstractinstances}, and
1756 without regard to the fact that it is within an outer abstract
1759 \item Any abstract instance tree for a nested subroutine is
1760 always omitted within the concrete instance tree for an
1763 \item A concrete instance tree for a nested subroutine is
1764 always omitted within the abstract instance tree for an
1767 \item The concrete instance tree for any inlined or
1768 \addtoindexx{out-of-line instance}
1770 \addtoindexx{out-of-line-instance|see{concrete out-of-line-instance}}
1771 expansion of the nested subroutine is described within a
1772 concrete instance tree for the outer subroutine according
1774 Sections \refersec{chap:concreteinlinedinstances} or
1775 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1777 and without regard to the fact that it is within an outer
1778 concrete instance tree.
1781 See Appendix \refersec{app:inliningexamples}
1782 for discussion and examples.
1784 \subsection{Trampolines}
1785 \label{chap:trampolines}
1787 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1788 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1789 an intermediary in making a call to another subroutine. It may
1790 adjust parameters and/or the result (if any) as appropriate
1791 to the combined calling and called execution contexts.}
1793 A trampoline is represented by a debugging information entry
1794 \addtoindexx{trampoline (subprogam) entry}
1795 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1797 \addtoindexx{trampoline attribute}
1798 a \DWATtrampoline{} attribute.
1800 attribute indicates the target subroutine of the trampoline,
1801 that is, the subroutine to which the trampoline passes
1802 control. (A trampoline entry may but need not also have a
1803 \DWATartificial{} attribute.)
1806 The value of the trampoline attribute may be represented
1807 using any of the following forms, which are listed in order
1811 \item If the value is of class reference, then the value
1812 specifies the debugging information entry of the target
1815 \item If the value is of class address, then the value is
1816 the relocated address of the target subprogram.
1818 \item If the value is of class string, then the value is the
1819 (possibly mangled) \addtoindexx{mangled names}
1820 name of the target subprogram.
1822 \item If the value is of class \livelink{chap:classflag}{flag}, then the value true
1823 indicates that the containing subroutine is a trampoline but
1824 that the target subroutine is not known.
1828 The target subprogram may itself be a trampoline. (A sequence
1829 of trampolines necessarily ends with a non\dash trampoline
1832 \textit{In \addtoindex{C++}, trampolines may be used
1833 to implement derived virtual
1834 member functions; such trampolines typically adjust the
1835 \addtoindexx{this parameter}
1836 implicit this pointer parameter in the course of passing
1838 Other languages and environments may use trampolines
1839 in a manner sometimes known as transfer functions or transfer
1842 \textit{Trampolines may sometimes pass control to the target
1843 subprogram using a branch or jump instruction instead of a
1844 call instruction, thereby leaving no trace of their existence
1845 in the subsequent execution context. }
1847 \textit{This attribute helps make it feasible for a debugger to arrange
1848 that stepping into a trampoline or setting a breakpoint in
1849 a trampoline will result in stepping into or setting the
1850 breakpoint in the target subroutine instead. This helps to
1851 hide the compiler generated subprogram from the user. }
1853 \textit{If the target subroutine is not known, a debugger may choose
1854 to repeatedly step until control arrives in a new subroutine
1855 which can be assumed to be the target subroutine. }
1859 \section{Lexical Block Entries}
1860 \label{chap:lexicalblockentries}
1863 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
1865 \addtoindexx{lexical block}
1866 a bracketed sequence of source statements
1867 that may contain any number of declarations. In some languages
1868 (including \addtoindex{C} and \addtoindex{C++}),
1869 \nolink{blocks} can be nested within other
1870 \nolink{blocks} to any depth.}
1872 % We do not need to link to the preceding paragraph.
1873 A lexical \nolink{block} is represented by a debugging information
1875 tag \DWTAGlexicalblockTARG.
1877 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
1879 either a \DWATlowpc{} and
1880 \DWAThighpc{} pair of
1882 \addtoindexx{high PC attribute}
1884 \addtoindexx{low PC attribute}
1886 \DWATranges{} attribute
1887 \addtoindexx{ranges attribute}
1888 whose values encode the contiguous or non-contiguous address
1889 ranges, respectively, of the machine instructions generated
1890 for the lexical \nolink{block}
1891 (see Section \refersec{chap:codeaddressesandranges}).
1894 \hypertarget{chap:DWATentrypcoflexicalblock}{}
1895 lexical block entry may also have
1896 \addtoindexx{entry pc attribute!for lexical block}
1898 \DWATentrypc{} attribute
1899 whose value is the address of the first executable instruction
1900 of the lexical block (see
1901 Section \refersec{chap:entryaddress}).
1903 If a name has been given to the
1904 lexical \nolink{block}
1906 program, then the corresponding
1907 lexical \nolink{block} entry has a
1908 \DWATname{} attribute whose
1909 \addtoindexx{name attribute}
1910 value is a null\dash terminated string
1911 containing the name of the lexical \nolink{block}
1915 \textit{This is not the same as a \addtoindex{C} or
1916 \addtoindex{C++} label (see below).}
1918 The lexical \nolink{block} entry owns
1919 debugging information entries that
1920 describe the declarations within that lexical \nolink{block}.
1922 one such debugging information entry for each local declaration
1923 of an identifier or inner lexical \nolink{block}.
1925 \section{Label Entries}
1926 \label{chap:labelentries}
1927 \textit{A label is a way of identifying a source statement. A labeled
1928 statement is usually the target of one or more \doublequote{go to}
1932 A label is represented by a debugging information entry with
1933 \addtoindexx{label entry}
1935 tag \DWTAGlabelTARG.
1936 The entry for a label should be owned by
1937 the debugging information entry representing the scope within
1938 which the name of the label could be legally referenced within
1941 The label entry has a \DWATlowpc{} attribute whose value
1942 is the relocated address of the first machine instruction
1943 generated for the statement identified by the label in
1944 the source program. The label entry also has a
1945 \DWATname{} attribute
1946 \addtoindexx{name attribute}
1947 whose value is a null-terminated string containing
1948 the name of the label as it appears in the source program.
1951 \section{With Statement Entries}
1952 \label{chap:withstatemententries}
1954 \textit{Both \addtoindex{Pascal} and
1955 \addtoindexx{Modula-2}
1956 Modula\dash 2 support the concept of a \doublequote{with}
1957 statement. The with statement specifies a sequence of
1958 executable statements within which the fields of a record
1959 variable may be referenced, unqualified by the name of the
1962 A with statement is represented by a
1963 \addtoindexi{debugging information entry}{with statement entry}
1964 with the tag \DWTAGwithstmtTARG.
1966 A with statement entry may have either a
1968 \DWAThighpc{} pair of attributes
1969 \addtoindexx{high PC attribute}
1971 \addtoindexx{low PC attribute}
1972 a \DWATranges{} attribute
1973 \addtoindexx{ranges attribute}
1974 whose values encode the contiguous or non\dash contiguous address
1975 ranges, respectively, of the machine instructions generated
1976 for the with statement
1977 (see Section \refersec{chap:codeaddressesandranges}).
1980 \hypertarget{chap:DWATentrypcofwithstmt}{}
1981 with statement entry may also have
1982 \addtoindexx{entry pc attribute!for with statement}
1984 \DWATentrypc{} attribute
1985 whose value is the address of the first executable instruction
1986 of the with statement (see
1987 Section \refersec{chap:entryaddress}).
1990 The with statement entry has
1991 \addtoindexx{type attribute}
1992 a \DWATtype{} attribute, denoting
1993 the type of record whose fields may be referenced without full
1994 qualification within the body of the statement. It also has
1995 \addtoindexx{location attribute}
1996 a \DWATlocation{} attribute, describing how to find the base
1997 address of the record object referenced within the body of
2000 \section{Try and Catch Block Entries}
2001 \label{chap:tryandcatchblockentries}
2003 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
2004 designated as a \doublequote{catch \nolink{block}.}
2005 A catch \livetargi{chap:catchblock}{block}{catch block} is an
2006 exception handler that handles
2007 exceptions thrown by an immediately
2008 preceding \doublequote{try \livelink{chap:tryblock}{block}.}
2009 A catch \livelink{chap:catchblock}{block}
2010 designates the type of the exception that it
2013 A try \livetargi{chap:tryblock}{block}{try block} is represented
2014 by a debugging information entry
2015 \addtoindexx{try block entry}
2016 with the tag \DWTAGtryblockTARG.
2017 A catch \livelink{chap:catchblock}{block} is represented by
2018 a debugging information entry with
2019 \addtoindexx{catch block entry}
2020 the tag \DWTAGcatchblockTARG.
2022 % nolink as we have links just above and do not have a combo link for both
2023 Both try and catch \nolink{block} entries may have either a
2025 \DWAThighpc{} pair of attributes
2026 \addtoindexx{high PC attribute}
2028 \addtoindexx{low PC attribute}
2030 \DWATranges{} attribute
2031 \addtoindexx{ranges attribute}
2032 whose values encode the contiguous
2033 or non\dash contiguous address ranges, respectively, of the
2034 machine instructions generated for the \livelink{chap:lexicalblock}{block}
2036 \refersec{chap:codeaddressesandranges}).
2039 \hypertarget{chap:DWATentrypcoftryblock}{}
2040 \hypertarget{chap:DWATentrypcofcatchblock}{}
2041 try or catch block entry may also have
2042 \addtoindexx{entry pc attribute!for try block}
2043 \addtoindexx{entry pc attribute!for catch block}
2045 \DWATentrypc{} attribute
2046 whose value is the address of the first executable instruction
2047 of the try or catch block (see
2048 Section \refersec{chap:entryaddress}).
2050 Catch \livelink{chap:catchblock}{block} entries have at
2051 least one child entry, an
2052 entry representing the type of exception accepted by
2053 that catch \livelink{chap:catchblock}{block}.
2054 This child entry has one of
2055 \addtoindexx{formal parameter entry!in catch block}
2057 \addtoindexx{unspecified parameters entry!in catch block}
2059 \DWTAGformalparameter{} or
2060 \DWTAGunspecifiedparameters,
2061 and will have the same form as other parameter entries.
2063 The siblings immediately following
2064 a try \livelink{chap:tryblock}{block} entry are its
2065 corresponding catch \livelink{chap:catchblock}{block} entries.