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{} section. Indirect string references
339 (using \DWFORMstrx) within the compilation unit are
340 interpreted as indices relative to this base.
342 \item A \DWATaddrbaseNAME\addtoindexx{address table base attribute}
343 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
344 attribute, whose value is a reference.
345 This attribute points to the beginning of the compilation
346 unit's contribution to the \dotdebugaddr{} section.
347 Indirect references (using \DWFORMaddrx, \DWOPaddrx, or
348 \DWOPconstx) within the compilation unit are
349 interpreted as indices relative to this base.
352 \item A \DWATrangesbaseNAME\addtoindexx{ranges table base attribute}
353 \hypertarget{chap:DWATrangesbaseforrangestable}{}
354 attribute, whose value is a reference.
355 This attribute points to the beginning of the compilation
356 unit's contribution to the \dotdebugranges{} section.
357 References to range lists (using \DWFORMsecoffset)
358 within the compilation unit are
359 interpreted as offsets relative to this base.
364 The base address of a compilation unit is defined as the
365 value of the \DWATlowpc{} attribute, if present; otherwise,
366 it is undefined. If the base address is undefined, then any
367 DWARF entry or structure defined in terms of the base address
368 of that compilation unit is not valid.
370 \subsection{Skeleton Compilation Unit Entries}
371 \label{chap:skeletoncompilationunitentries}
372 When generating a split DWARF object (see
373 Section \refersec{datarep:splitdwarfobjects}), the
374 compilation unit in the \dotdebuginfo{} section is a "skeleton"
375 compilation unit, which contains only a subset of the
376 attributes of the full compilation unit. In general, it
377 contains those attributes that are necessary for the consumer
378 to locate the DWARF object where the full compilation unit
379 can be found, and for the consumer to interpret references to
380 addresses in the program.
382 A skeleton compilation unit has no
383 children, and may have the following attributes:
384 \begin{enumerate}[1. ]
387 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
388 or a \DWATranges{} attribute (the same as for regular
389 compilation unit entries).
392 A \DWATstmtlist{} attribute (the same as for regular
393 compilation unit entries).
396 A \DWATcompdir{} attribute (the same as for regular
397 compilation unit entries).
400 A \DWATdwoname{} attribute whose value is a
401 null-terminated string containing the full or relative
402 path name of the DWARF object file that contains the full
406 A \DWATdwoid{} attribute whose value is an 8-byte
407 unsigned hash of the full compilation unit. This hash
408 value is computed by the method described in
409 Section \refersec{datarep:typesignaturecomputation}.
412 A \DWATrangesbase{} attribute (the same as for regular
413 compilation unit entries).
416 A \DWATaddrbase{} attribute (the same as for regular
417 compilation unit entries).
420 All other attributes of a compilation unit entry (described
421 in Section \refersec{chap:normalandpartialcompilationunitentries})
422 should be placed in the full compilation
423 unit entry in the \dotdebuginfodwo{} section of the split DWARF
424 object. The attributes provided by the skeleton compilation
425 unit entry do not need to be repeated in the full compilation
426 unit entry, except for \DWATdwoid, which should appear in
427 both entries so that the consumer can verify that it has
428 found the correct DWARF object.
431 \subsection{Imported Unit Entries}
432 \label{chap:importedunitentries}
434 \hypertarget{chap:DWATimportimportedunit}{}
435 place where a normal or partial unit is imported is
436 represented by a debugging information entry with the
437 \addtoindexx{imported unit entry}
438 tag \DWTAGimportedunitTARG.
439 An imported unit entry contains
440 \addtoindexx{import attribute}
442 \DWATimport{} attribute
443 whose value is a \livelink{chap:classreference}{reference} to the
444 normal or partial compilation unit whose declarations logically
445 belong at the place of the imported unit entry.
447 \textit{An imported unit entry does not necessarily correspond to
448 any entity or construct in the source program. It is merely
449 \doublequote{glue} used to relate a partial unit, or a compilation
450 unit used as a partial unit, to a place in some other
453 \subsection{Separate Type Unit Entries}
454 \label{chap:separatetypeunitentries}
455 An object file may contain any number of separate type
456 unit entries, each representing a single complete type
458 Each \addtoindex{type unit} must be uniquely identified by
459 a 64\dash bit signature, stored as part of the type unit, which
460 can be used to reference the type definition from debugging
461 information entries in other compilation units and type units.
463 A type unit is represented by a debugging information entry
464 with the tag \DWTAGtypeunitTARG.
465 A \addtoindex{type unit entry} owns debugging
466 information entries that represent the definition of a single
467 type, plus additional debugging information entries that may
468 be necessary to include as part of the definition of the type.
470 A type unit entry may have a
471 \DWATlanguage{} attribute,
473 \addtoindexx{language attribute}
474 constant value is an integer code indicating the source
475 language used to define the type. The set of language names
476 and their meanings are given in Table \refersec{tab:languagenames}.
478 A type unit entry may have a
479 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
480 attribute, whose value is a reference. This attribute points
481 to the first string offset of the type unit's contribution to
482 the \dotdebugstroffsets{} section. Indirect string references
483 (using \DWFORMstrx) within the type unit must be interpreted
484 as indices relative to this base.
486 A type unit entry may have a \DWATstmtlist{} attribute, whose
487 value is a section offset to a line number table for this
488 type unit. Because type units do not describe any code, they
489 do not actually need a line number table, but the line number
490 tables also contain a list of directories and file names that
491 may be referenced by the \DWATdeclfile{} attribute. In a
492 normal object file with a regular compilation unit entry, the
493 type unit entries can simply refer to the line number table
494 used by the compilation unit. In a split DWARF object, where
495 the type units are located in a separate DWARF object file,
496 the \DWATstmtlist{} attribute refers to a "skeleton"
497 line number table in the \dotdebuglinedwo{} section, which
498 contains only the list of directories and file names. All
499 type unit entries in a split DWARF object may (but are not
500 required to) refer to the same skeleton line number table.
502 A \addtoindex{type unit} entry for a given type T owns a debugging
503 information entry that represents a defining declaration
504 of type T. If the type is nested within enclosing types or
505 namespaces, the debugging information entry for T is nested
506 within debugging information entries describing its containers;
507 otherwise, T is a direct child of the type unit entry.
509 A type unit entry may also own additional debugging information
510 entries that represent declarations of additional types that
511 are referenced by type T and have not themselves been placed in
512 separate type units. Like T, if an additional type U is nested
513 within enclosing types or namespaces, the debugging information
514 entry for U is nested within entries describing its containers;
515 otherwise, U is a direct child of the type unit entry.
517 The containing entries for types T and U are declarations,
518 and the outermost containing entry for any given type T or
519 U is a direct child of the type unit entry. The containing
520 entries may be shared among the additional types and between
521 T and the additional types.
523 \textit{Types are not required to be placed in type units. In general,
524 only large types such as structure, class, enumeration, and
525 union types included from header files should be considered
526 for separate type units. Base types and other small types
527 are not usually worth the overhead of placement in separate
528 type units. Types that are unlikely to be replicated, such
529 as those defined in the main source file, are also better
530 left in the main compilation unit.}
532 \section{Module, Namespace and Importing Entries}
533 \textit{Modules and namespaces provide a means to collect related
534 entities into a single entity and to manage the names of
537 \subsection{Module Entries}
538 \label{chap:moduleentries}
539 \textit{Several languages have the concept of a \doublequote{module.}
540 \addtoindexx{Modula-2}
541 A Modula\dash 2 definition module
542 \addtoindexx{Modula-2!definition module}
543 may be represented by a module
545 \addtoindex{declaration attribute}
546 (\DWATdeclaration). A
547 \addtoindex{Fortran 90} module
548 \addtoindexx{Fortran!module (Fortran 90)}
549 may also be represented by a module entry
550 (but no declaration attribute is warranted because \addtoindex{Fortran}
551 has no concept of a corresponding module body).}
553 A module is represented by a debugging information entry
555 tag \DWTAGmoduleTARG.
556 Module entries may own other
557 debugging information entries describing program entities
558 whose declaration scopes end at the end of the module itself.
560 If the module has a name, the module entry has a
561 \DWATname{} attribute
562 \addtoindexx{name attribute}
563 whose value is a null\dash terminated string containing
564 the module name as it appears in the source program.
566 The \addtoindex{module entry} may have either a
570 \addtoindexx{high PC attribute}
572 \addtoindexx{low PC attribute}
574 \DWATranges{} attribute
575 \addtoindexx{ranges attribute}
576 whose values encode the contiguous or non\dash contiguous address
577 ranges, respectively, of the machine instructions generated for
578 the module initialization code
579 (see Section \refersec{chap:codeaddressesandranges}).
580 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
582 \addtoindexx{entry pc attribute!for module initialization}
584 \DWATentrypc{} attribute whose value is the address of
585 the first executable instruction of that initialization code
586 (see Section \refersec{chap:entryaddress}).
589 \hypertarget{chap:DWATprioritymodulepriority}{}
590 the module has been assigned a priority, it may have
591 \addtoindexx{priority attribute}
593 \DWATpriority{} attribute.
594 The value of this attribute is a
595 reference to another debugging information entry describing
596 a variable with a constant value. The value of this variable
597 is the actual constant value of the module\textquoteright s priority,
598 represented as it would be on the target architecture.
600 \subsection{Namespace Entries}
601 \label{chap:namespaceentries}
602 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
603 \addtoindexx{namespace (C++)}
604 implement name hiding, so that names of unrelated things
605 do not accidentally clash in the
606 \addtoindex{global namespace} when an
607 application is linked together.}
609 A namespace is represented by a debugging information entry
611 tag \DWTAGnamespaceTARG.
612 A namespace extension is
613 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
615 \DWTAGnamespace{} entry
617 \addtoindexx{extension attribute}
620 attribute referring to the previous extension, or if there
621 is no previous extension, to the original
623 entry. A namespace extension entry does not need to duplicate
624 information in a previous extension entry of the namespace
625 nor need it duplicate information in the original namespace
626 entry. (Thus, for a namespace with a name,
627 a \DWATname{} attribute
628 \addtoindexx{name attribute}
629 need only be attached directly to the original
630 \DWTAGnamespace{} entry.)
633 Namespace and namespace extension entries may own
634 \addtoindexx{namespace extension entry}
636 \addtoindexx{namespace declaration entry}
637 debugging information entries describing program entities
638 whose declarations occur in the namespace.
640 \textit{For \addtoindex{C++}, such
641 owned program entities may be declarations,
642 including certain declarations that are also object or
643 function definitions.}
645 If a type, variable, or function declared in a namespace is
646 defined outside of the body of the namespace declaration,
647 that type, variable, or function definition entry has a
648 \DWATspecification{} attribute
649 \addtoindexx{specification attribute}
650 whose value is a \livelink{chap:classreference}{reference} to the
651 debugging information entry representing the declaration of
652 the type, variable or function. Type, variable, or function
654 \DWATspecification{} attribute
655 \addtoindexx{specification attribute}
657 to duplicate information provided by the declaration entry
658 referenced by the specification attribute.
660 \textit{The \addtoindex{C++} \addtoindex{global namespace}
662 \addtoindexx{global namespace|see{namespace (C++), global}}
664 \addtoindexx{namespace (C++)!global}
666 \texttt{::f}, for example) is not explicitly represented in
667 DWARF with a namespace entry (thus mirroring the situation
668 in \addtoindex{C++} source).
669 Global items may be simply declared with no
670 reference to a namespace.}
672 \textit{The \addtoindex{C++}
673 compilation unit specific \doublequote{unnamed namespace} may
674 \addtoindexx{namespace (C++)!unnamed}
675 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
676 be represented by a namespace entry with no name attribute in
677 the original namespace declaration entry (and therefore no name
678 attribute in any namespace extension entry of this namespace).
681 \textit{A compiler emitting namespace information may choose to
682 explicitly represent namespace extensions, or to represent the
683 final namespace declaration of a compilation unit; this is a
684 quality\dash of\dash implementation issue and no specific requirements
685 are given here. If only the final namespace is represented,
686 \addtoindexx{namespace (C++)!using declaration}
687 it is impossible for a debugger to interpret using declaration
688 references in exactly the manner defined by the
689 \addtoindex{C++} language.
692 \textit{Emitting all namespace declaration information in all
693 compilation units can result in a significant increase in the
694 size of the debug information and significant duplication of
695 information across compilation units.
696 The \addtoindex{C++} namespace std,
698 \addtoindexx{namespace (C++)!std}
699 is large and will probably be referenced in
700 every \addtoindex{C++} compilation unit.
703 \textit{For a \addtoindex{C++} namespace example,
704 see Appendix \refersec{app:namespaceexample}.
709 \subsection{Imported (or Renamed) Declaration Entries}
710 \label{chap:importedorrenameddeclarationentries}
711 \textit{Some languages support the concept of importing into or making
712 accessible in a given unit declarations made in a different
713 module or scope. An imported declaration may sometimes be
718 imported declaration is represented by one or
719 \addtoindexx{imported declaration entry}
720 more debugging information entries with the
721 tag \DWTAGimporteddeclarationTARG.
723 \hypertarget{chap:DWATimportimporteddeclaration}{}
725 is imported, there is one imported declaration entry for
727 \addtoindexx{import attribute}
728 Each imported declaration entry has a
729 \DWATimport{} attribute,
730 whose value is a \livelink{chap:classreference}{reference} to the
731 debugging information entry representing the declaration that
734 An imported declaration may also have a
737 \addtoindexx{name attribute}
738 whose value is a null\dash terminated string containing the
739 name, as it appears in the source program, by which the
740 imported entity is to be known in the context of the imported
741 declaration entry (which may be different than the name of
742 the entity being imported). If no name is present, then the
743 name by which the entity is to be known is the same as the
744 name of the entity being imported.
746 An imported declaration entry with a name attribute may be
747 used as a general means to rename or provide an alias for
748 \addtoindexx{alias declaration|see{imported declaration entry}}
749 an entity, regardless of the context in which the importing
750 declaration or the imported entity occurs.
752 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
753 \hypertarget{chap:DWATimportnamespacealias}{}
755 \addtoindexx{namespace (C++)!alias}
756 with a name attribute whose value is
757 a null\dash terminated string containing the alias name as it
758 appears in the source program and an import attribute whose
759 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
760 namespace extension entry.
763 \textit{A \addtoindex{C++} using declaration may be represented by one or more
764 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
766 \addtoindexx{namespace (C++)!using declaration}
767 declaration entries. When the using declaration
768 refers to an overloaded function, there is one imported
769 declaration entry corresponding to each overloading. Each
770 imported declaration entry has no name attribute but it does
771 have an import attribute that refers to the entry for the
772 entity being imported. (\addtoindex{C++}
773 provides no means to \doublequote{rename}
774 an imported entity, other than a namespace).
777 \textit{A \addtoindex{Fortran} use statement
778 \addtoindexx{Fortran!use statement}
779 \addtoindexx{use statement|see {Fortran, use statement}}
780 with an \doublequote{only list} may be
781 represented by a series of imported declaration entries,
782 one (or more) for each entity that is imported. An entity
783 \addtoindexx{renamed declaration|see{imported declaration entry}}
784 that is renamed in the importing context may be represented
785 by an imported declaration entry with a name attribute that
786 specifies the new local name.
789 \subsection{Imported Module Entries}
790 \label{chap:importedmoduleentries}
792 \textit{Some languages support the concept of importing into or making
793 accessible in a given unit all of the declarations contained
794 within a separate module or namespace.
797 An imported module declaration is represented by a debugging
798 information entry with
799 \addtoindexx{imported module attribute}
801 \addtoindexx{imported module entry}
802 tag \DWTAGimportedmoduleTARG.
804 imported module entry contains a
805 \DWATimport{} attribute
806 \addtoindexx{import attribute}
807 whose value is a \livelink{chap:classreference}{reference}
808 to the module or namespace entry
809 containing the definition and/or declaration entries for
810 the entities that are to be imported into the context of the
811 imported module entry.
813 An imported module declaration may own a set of imported
814 declaration entries, each of which refers to an entry in the
815 module whose corresponding entity is to be known in the context
816 of the imported module declaration by a name other than its
817 name in that module. Any entity in the module that is not
818 renamed in this way is known in the context of the imported
819 module entry by the same name as it is declared in the module.
821 \textit{A \addtoindex{C++} using directive
822 \addtoindexx{namespace (C++)!using directive}
823 \addtoindexx{using directive|see {namespace (C++), using directive}}
824 may be represented by an imported module
825 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
826 entry, with an import attribute referring to the namespace
827 entry of the appropriate extension of the namespace (which
828 might be the original namespace entry) and no owned entries.
831 \textit{A \addtoindex{Fortran} use statement
832 \addtoindexx{Fortran!use statement}
833 with a \doublequote{rename list} may be
834 represented by an imported module entry with an import
835 attribute referring to the module and owned entries
836 corresponding to those entities that are renamed as part of
840 \textit{A \addtoindex{Fortran} use statement
841 \addtoindexx{Fortran!use statement}
842 with neither a \doublequote{rename list} nor
843 an \doublequote{only list} may be represented by an imported module
844 entry with an import attribute referring to the module and
845 no owned child entries.
848 \textit{A use statement with an \doublequote{only list} is represented by a
849 series of individual imported declaration entries as described
850 in Section \refersec{chap:importedorrenameddeclarationentries}.
853 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
854 \addtoindexx{Fortran!use statement}
855 itself imported by a use statement without an explicit mention
856 may be represented by an imported declaration entry that refers
857 to the original debugging information entry. For example, given
874 \textit{the imported declaration entry for Q within module C refers
875 directly to the variable declaration entry for X in module A
876 because there is no explicit representation for X in module B.
879 \textit{A similar situation arises for a \addtoindex{C++} using declaration
880 \addtoindexx{namespace (C++)!using declaration}
881 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
882 that imports an entity in terms of a namespace alias. See
883 Appendix \refersec{app:namespaceexample}
887 \section{Subroutine and Entry Point Entries}
888 \label{chap:subroutineandentrypointentries}
890 The following tags exist to describe
891 debugging information entries
892 \addtoindexx{function entry|see{subroutine entry}}
894 \addtoindexx{subroutine entry}
896 \addtoindexx{subprogram entry}
898 % FIXME: is entry point entry the right index 'entry'?
899 \addtoindexx{entry point entry}
902 \begin{tabular}{lp{9.0cm}}
903 \DWTAGsubprogramTARG{} & A subroutine or function \\
904 \DWTAGinlinedsubroutine{} & A particular inlined
905 \addtoindexx{inlined subprogram entry}
906 instance of a subroutine or function \\
907 \DWTAGentrypointTARG{} & An alternate entry point \\
910 \subsection{General Subroutine and Entry Point Information}
911 \label{chap:generalsubroutineandentrypointinformation}
912 The subroutine or entry point entry has a \DWATname{}
913 attribute whose value is a null-terminated string containing the
914 subroutine or entry point name as it appears in the source program.
915 It may also have a \DWATlinkagename{} attribute as
916 described in Section \refersec{chap:linkagenames}.
918 If the name of the subroutine described by an entry with the
919 \addtoindexx{subprogram entry}
920 tag \DWTAGsubprogram{}
921 is visible outside of its containing
922 \hypertarget{chap:DWATexternalexternalsubroutine}{}
923 compilation unit, that entry has
924 \addtoindexx{external attribute}
926 \DWATexternal{} attribute,
927 which is a \livelink{chap:classflag}{flag}.
929 \textit{Additional attributes for functions that are members of a
930 class or structure are described in
931 Section \refersec{chap:memberfunctionentries}.
935 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
938 \DWATmainsubprogram{}
940 \addtoindexx{main subprogram attribute}
942 a \livelink{chap:classflag}{flag} whose presence indicates that the
943 subroutine has been identified as the starting function of
944 the program. If more than one subprogram contains this
946 any one of them may be the starting subroutine of the program.
948 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
949 which is used to specify
950 and provide a user\dash supplied name for the main subroutine of
954 \textit{A common debugger feature is to allow the debugger user to call
955 a subroutine within the subject program. In certain cases,
956 however, the generated code for a subroutine will not obey
957 the standard calling conventions for the target architecture
958 and will therefore not be safe to call from within a debugger.
961 A subroutine entry may
962 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}{}
964 \DWATcallingconvention{}
965 attribute, whose value is an
966 \livelink{chap:classconstant}{integer constant}. The set of
967 calling convention codes is given in
968 Table \refersec{tab:callingconventioncodes}.
970 \begin{simplenametable}[1.4in]{Calling convention codes}{tab:callingconventioncodes}
974 \end{simplenametable}
976 If this attribute is not present, or its value is the constant
977 \DWCCnormalTARG, then the subroutine may be safely called by
978 obeying the \doublequote{standard} calling conventions of the target
979 architecture. If the value of the calling convention attribute
980 is the constant \DWCCnocallTARG, the subroutine does not obey
981 standard calling conventions, and it may not be safe for the
982 debugger to call this subroutine.
984 If the semantics of the language of the compilation unit
985 containing the subroutine entry distinguishes between ordinary
986 subroutines and subroutines that can serve as the \doublequote{main
987 program,} that is, subroutines that cannot be called
988 directly according to the ordinary calling conventions,
989 then the debugging information entry for such a subroutine
990 may have a calling convention attribute whose value is the
991 constant \DWCCprogramTARG.
993 \textit{The \DWCCprogram{}
994 value is intended to support \addtoindex{Fortran} main
995 \addtoindexx{Fortran!main program}
996 programs which in some implementations may not be callable
997 or which must be invoked in a special way. It is not intended
998 as a way of finding the entry address for the program.
1001 \textit{In \addtoindex{C}
1002 there is a difference between the types of functions
1003 declared using function prototype style declarations and
1004 those declared using non\dash prototype declarations.
1007 A subroutine entry declared with a function prototype style
1008 declaration may have
1009 \addtoindexx{prototyped attribute}
1011 \DWATprototyped{} attribute, which is
1012 a \livelink{chap:classflag}{flag}.
1014 \textit{The \addtoindex{Fortran}
1015 language allows the keywords \texttt{elemental}, \texttt{pure}
1016 and \texttt{recursive} to be included as part of the declaration of
1017 a subroutine; these attributes reflect that usage. These
1018 attributes are not relevant for languages that do not support
1019 similar keywords or syntax. In particular, the \DWATrecursive{}
1020 attribute is neither needed nor appropriate in languages such
1022 where functions support recursion by default.
1026 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1028 \addtoindexx{elemental attribute}
1030 \DWATelemental{} attribute, which
1031 is a \livelink{chap:classflag}{flag}.
1032 The attribute indicates whether the subroutine
1033 or entry point was declared with the \doublequote{elemental} keyword
1037 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1038 subprogram entry may have
1039 \addtoindexx{pure attribute}
1041 \DWATpure{} attribute, which is
1042 a \livelink{chap:classflag}{flag}.
1043 The attribute indicates whether the subroutine was
1044 declared with the \doublequote{pure} keyword or property.
1047 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}
1048 subprogram entry may have a
1049 \DWATrecursive{} attribute, which
1050 is a \livelink{chap:classflag}{flag}.
1051 The attribute indicates whether the subroutine
1052 or entry point was declared with the \doublequote{recursive} keyword
1057 \subsection{Subroutine and Entry Point Return Types}
1058 \label{chap:subroutineandentrypointreturntypes}
1061 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1062 the subroutine or entry point
1063 \addtoindexx{return type of subroutine}
1064 is a function that returns a
1065 value, then its debugging information entry has
1066 \addtoindexx{type attribute}
1067 a \DWATtype{} attribute
1068 to denote the type returned by that function.
1070 \textit{Debugging information entries for
1071 \addtoindex{C} void functions should
1072 not have an attribute for the return type. }
1075 \subsection{Subroutine and Entry Point Locations}
1076 \label{chap:subroutineandentrypointlocations}
1078 A subroutine entry may have either a \DWATlowpc{} and
1079 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1080 \addtoindexx{ranges attribute}
1082 \addtoindexx{high PC attribute}
1084 \addtoindexx{low PC attribute}
1085 encode the contiguous or non\dash contiguous address
1086 ranges, respectively, of the machine instructions generated
1087 for the subroutine (see
1088 Section \refersec{chap:codeaddressesandranges}).
1091 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1092 subroutine entry may also have
1093 \addtoindexx{entry pc attribute!for subroutine}
1095 \DWATentrypc{} attribute
1096 whose value is the address of the first executable instruction
1097 of the subroutine (see
1098 Section \refersec{chap:entryaddress}).
1100 An entry point has a \DWATlowpc{} attribute whose value is the
1101 relocated address of the first machine instruction generated
1102 for the entry point.
1105 \DWATentrypc{} attribute
1106 \addtoindexx{entry pc attribute!for subroutine}
1108 also seem appropriate
1109 for this purpose, historically the
1110 \DWATlowpc{} attribute
1112 \DWATentrypc{} was introduced (in
1113 \addtoindex{DWARF Version 3}).
1114 There is insufficient reason to change this.}
1120 \addtoindexx{address class!attribute}
1122 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1126 \DWATaddressclass{} attributes,
1127 as appropriate, to specify
1128 which segments the code for the subroutine resides in and
1129 the addressing mode to be used in calling that subroutine.
1131 A subroutine entry representing a subroutine declaration
1132 that is not also a definition does not have code address or
1136 \subsection{Declarations Owned by Subroutines and Entry Points}
1137 \label{chap:declarationsownedbysubroutinesandentrypoints}
1139 The declarations enclosed by a subroutine or entry point are
1140 represented by debugging information entries that are owned
1141 by the subroutine or entry point entry. Entries representing
1142 \addtoindexx{formal parameter}
1143 the formal parameters of the subroutine or entry point appear
1144 in the same order as the corresponding declarations in the
1148 \textit{There is no ordering requirement for entries for declarations
1149 that are children of subroutine or entry point entries but
1150 that do not represent formal parameters. The formal parameter
1151 entries may be interspersed with other entries used by formal
1152 parameter entries, such as type entries.}
1154 The unspecified parameters of a variable parameter list are
1155 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1157 \DWTAGunspecifiedparametersTARG.
1159 The entry for a subroutine that includes a
1160 \addtoindex{Fortran}
1161 \addtoindexx{Fortran!common block}
1162 \livelink{chap:fortrancommonblock}{common}
1163 \livelink{chap:commonblockentry}{block}
1164 \addtoindexx{common block|see{Fortran common block}}
1165 has a child entry with the
1166 tag \DWTAGcommoninclusionTARG.
1168 \hypertarget{chap:commonreferencecommonblockusage}{}
1169 common inclusion entry has a
1170 \DWATcommonreference{} attribute
1171 whose value is a \livelink{chap:classreference}{reference}
1172 to the debugging information entry
1173 for the common \nolink{block} being included
1174 (see Section \refersec{chap:commonblockentries}).
1176 \subsection{Low-Level Information}
1177 \label{chap:lowlevelinformation}
1180 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1181 subroutine or entry point entry may have
1182 \addtoindexx{return address attribute}
1185 attribute, whose value is a location description. The location
1186 calculated is the place where the return address for the
1187 subroutine or entry point is stored.
1190 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1191 subroutine or entry point entry may also have
1192 \addtoindexx{frame base attribute}
1194 \DWATframebase{} attribute, whose value is a location
1195 description that computes the \doublequote{frame base} for the
1196 subroutine or entry point. If the location description is
1197 a simple register location description, the given register
1198 contains the frame base address. If the location description is
1199 a DWARF expression, the result of evaluating that expression
1200 is the frame base address. Finally, for a
1201 \addtoindex{location list},
1202 this interpretation applies to each location description
1203 contained in the list of \addtoindex{location list} entries.
1205 \textit{The use of one of the \DWOPregn{}
1207 context is equivalent to using
1210 compact. However, these are not equivalent in general.}
1213 \textit{The frame base for a procedure is typically an address fixed
1214 relative to the first unit of storage allocated for the
1215 procedure\textquoteright s stack frame. The \DWATframebase{} attribute
1216 can be used in several ways:}
1217 \begin{enumerate}[1. ]
1218 \item \textit{In procedures that need
1219 \addtoindexx{location list}
1220 location lists to locate local
1221 variables, the \DWATframebase{} can hold the needed location
1222 list, while all variables\textquoteright\ location descriptions can be
1223 simpler ones involving the frame base.}
1225 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1226 within nested routines.
1227 (See also \DWATstaticlink, below)}
1231 \textit{Some languages support nested subroutines. In such languages,
1232 it is possible to reference the local variables of an
1233 outer subroutine from within an inner subroutine. The
1234 \DWATstaticlink{} and \DWATframebase{} attributes allow
1235 debuggers to support this same kind of referencing.}
1238 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1240 \addtoindexx{address!uplevel|see {static link attribute}}
1241 \addtoindexx{uplevel address|see {static link attribute}}
1242 subroutine or entry point is nested, it may have a
1244 attribute, whose value is a location
1245 description that computes the frame base of the relevant
1246 instance of the subroutine that immediately encloses the
1247 subroutine or entry point.
1249 In the context of supporting nested subroutines, the
1250 \DWATframebase{} attribute value should obey the following
1253 \begin{enumerate}[1. ]
1254 \item It should compute a value that does not change during the
1255 life of the procedure, and
1257 \item The computed value should be unique among instances of
1258 the same subroutine. (For typical \DWATframebase{} use, this
1259 means that a recursive subroutine\textquoteright s stack frame must have
1260 non\dash zero size.)
1263 \textit{If a debugger is attempting to resolve an up\dash level reference
1264 to a variable, it uses the nesting structure of DWARF to
1265 determine which subroutine is the lexical parent and the
1266 \DWATstaticlink{} value to identify the appropriate active
1267 frame of the parent. It can then attempt to find the reference
1268 within the context of the parent.}
1272 \subsection{Types Thrown by Exceptions}
1273 \label{chap:typesthrownbyexceptions}
1275 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1276 it may validly throw.}
1278 If a subroutine explicitly declares that it may throw
1279 \addtoindexx{exception thrown|see{thrown type entry}}
1281 \addtoindexx{thrown exception|see{thrown type entry}}
1282 exception of one or more types, each such type is
1283 represented by a debugging information entry with
1284 \addtoindexx{thrown type entry}
1286 \DWTAGthrowntypeTARG.
1287 Each such entry is a child of the entry
1288 representing the subroutine that may throw this type. Each
1289 thrown type entry contains
1290 \addtoindexx{type attribute}
1291 a \DWATtype{} attribute, whose
1292 value is a \livelink{chap:classreference}{reference}
1293 to an entry describing the type of the
1294 exception that may be thrown.
1296 \subsection{Function Template Instantiations}
1297 \label{chap:functiontemplateinstantiations}
1299 \textit{In \addtoindex{C++}, a function template is a generic definition of
1300 a function that is instantiated differently for calls with
1301 values of different types. DWARF does not represent the generic
1302 template definition, but does represent each instantiation.}
1304 A \addtoindex{template instantiation} is represented by a debugging
1305 information entry with the
1306 \addtoindexx{subprogram entry!use for template instantiation}
1307 tag \DWTAGsubprogram.
1309 exceptions, such an entry will contain the same attributes and
1310 will have the same types of child entries as would an entry
1311 for a subroutine defined explicitly using the instantiation
1312 types. The exceptions are:
1314 \begin{enumerate}[1. ]
1315 \item Template parameters are described and referenced as specified in
1316 Section \refersec{chap:templateparameters}.
1318 \item If the compiler has generated a special compilation unit
1319 to hold the template instantiation and that compilation unit
1320 has a different name from the compilation unit containing
1321 the template definition, the name attribute for the debugging
1322 information entry representing that compilation unit is empty
1325 \item If the subprogram entry representing the template
1326 instantiation or any of its child entries contain declaration
1327 coordinate attributes, those attributes refer to the source
1328 for the template definition, not to any source generated
1329 artificially by the compiler for this instantiation.
1334 \subsection{Inlinable and Inlined Subroutines}
1335 A declaration or a definition of an inlinable subroutine
1336 is represented by a debugging information entry with the
1340 \addtoindexx{subprogram entry!use in inlined subprogram}
1342 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1343 explicitly declared to be available for inline expansion or
1344 that was expanded inline implicitly by the compiler has
1345 \addtoindexx{inline attribute}
1347 \DWATinline{} attribute whose value is an
1348 \livelink{chap:classconstant}{integer constant}. The
1349 set of values for the \DWATinline{} attribute is given in
1350 Table \refersec{tab:inlinecodes}.
1354 \caption{Inline codes}
1355 \label{tab:inlinecodes}
1356 \begin{tabular}{l|p{8cm}}
1358 Name&Meaning\\ \hline
1359 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1360 \mbox{compiler} (equivalent to the absence of the
1361 containing \DWATinline{} attribute) \\
1362 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1363 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1364 not inlined by the \mbox{compiler} \\
1365 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1371 \textit{In \addtoindex{C++}, a function or a constructor declared with
1372 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1373 instance (see below) is represented by a debugging information
1374 entry with the tag \DWTAGsubprogram. Such an entry has a
1375 \DWATinline{} attribute whose value is \DWINLinlined.}
1378 \subsubsection{Abstract Instances}
1379 \label{chap:abstractinstances}
1380 Any debugging information entry that is owned (either
1381 \hypertarget{chap:DWATinlineabstracttinstance}{}
1382 directly or indirectly) by a debugging information entry
1384 \DWATinline{} attribute is referred to
1385 \addtoindexx{abstract instance!entry}
1386 as an \doublequote{abstract instance entry.}
1387 Any subroutine entry
1389 \addtoindexx{inline attribute}
1390 a \DWATinline{} attribute whose value is other
1391 than \DWINLnotinlined{}
1393 \addtoindexx{abstract instance!root}
1394 an \doublequote{abstract instance root.}
1395 Any set of abstract instance entries that are all
1396 children (either directly or indirectly) of some abstract
1397 instance root, together with the root itself, is known as
1398 \addtoindexx{abstract instance!tree}
1399 an \doublequote{abstract instance tree.} However, in the case where
1400 an abstract instance tree is nested within another abstract
1401 instance tree, the entries in the
1402 \addtoindex{nested abstract instance}
1403 tree are not considered to be entries in the outer abstract
1406 Each abstract instance root is either part of a larger
1407 \addtoindexx{abstract instance!root}
1408 tree (which gives a context for the root) or
1409 \addtoindexx{specification attribute}
1411 \DWATspecification{}
1412 to refer to the declaration in context.
1414 \textit{For example, in \addtoindex{C++} the context might be a namespace
1415 declaration or a class declaration.}
1417 \textit{Abstract instance trees are defined so that no entry is part
1418 of more than one abstract instance tree. This simplifies the
1419 following descriptions.}
1421 A debugging information entry that is a member of an abstract
1422 instance tree should not contain any attributes which describe
1423 aspects of the subroutine which vary between distinct inlined
1424 expansions or distinct out\dash of\dash line expansions. For example,
1425 \addtoindexx{entry pc attribute!and abstract instance}
1436 \addtoindexx{location attribute!and abstract instance}
1438 \addtoindexx{ranges attribute!and abstract instance}
1440 \addtoindexx{high PC attribute!and abstract instance}
1442 \addtoindexx{low PC attribute!and abstract instance}
1444 \addtoindexx{segment attribute!and abstract instance}
1446 \addtoindexx{return address attribute!and abstract instance}
1448 \addtoindexx{segment attribute!and abstract instance}
1450 \addtoindexx{start scope attribute!and abstract instance}
1454 \textit{It would not make sense normally to put these attributes into
1455 abstract instance entries since such entries do not represent
1456 actual (concrete) instances and thus do not actually exist at
1457 run\dash time. However,
1458 see Appendix \refersec{app:inlineouteronenormalinner}
1459 for a contrary example.}
1461 The rules for the relative location of entries belonging to
1462 abstract instance trees are exactly the same as for other
1463 similar types of entries that are not abstract. Specifically,
1464 the rule that requires that an entry representing a declaration
1465 be a direct child of the entry representing the scope of the
1466 declaration applies equally to both abstract and non\dash abstract
1467 entries. Also, the ordering rules for formal parameter entries,
1468 member entries, and so on, all apply regardless of whether
1469 or not a given entry is abstract.
1471 \subsubsection{Concrete Inlined Instances}
1472 \label{chap:concreteinlinedinstances}
1474 Each inline expansion of a subroutine is represented
1475 by a debugging information entry with the
1476 tag \DWTAGinlinedsubroutineTARG.
1477 Each such entry should be a direct
1478 child of the entry that represents the scope within which
1479 the inlining occurs.
1481 Each inlined subroutine entry may have either a
1483 and \DWAThighpc{} pair
1485 \addtoindexx{high PC attribute}
1487 \addtoindexx{low PC attribute}
1489 \addtoindexx{ranges attribute}
1492 attribute whose values encode the contiguous or non\dash contiguous
1493 address ranges, respectively, of the machine instructions
1494 generated for the inlined subroutine (see
1495 Section \refersec{chap:codeaddressesandranges}).
1497 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1498 inlined subroutine entry may
1499 \addtoindexx{inlined subprogram entry!in concrete instance}
1501 \addtoindexx{inlined subprogram entry}
1503 \addtoindexx{entry pc attribute!for inlined subprogram}
1506 attribute, representing the first executable instruction of
1507 the inline expansion (see
1508 Section \refersec{chap:entryaddress}).
1510 % Positions of the 3 targets here is a bit arbitrary.
1512 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1514 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1516 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1517 may also have \DWATcallfile,
1518 \DWATcallline{} and \DWATcallcolumn{} attributes,
1520 value is an \livelink{chap:classconstant}{integer constant}.
1521 These attributes represent the
1522 source file, source line number, and source column number,
1523 respectively, of the first character of the statement or
1524 expression that caused the inline expansion. The call file,
1525 call line, and call column attributes are interpreted in
1526 the same way as the declaration file, declaration line, and
1527 declaration column attributes, respectively (see
1528 Section \refersec{chap:declarationcoordinates}).
1530 \textit{The call file, call line and call column coordinates do not
1531 describe the coordinates of the subroutine declaration that
1532 was inlined, rather they describe the coordinates of the call.
1535 An inlined subroutine entry
1536 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1539 attribute, which is a \livelink{chap:classflag}{flag}
1540 whose presence indicates that the
1541 subroutine has been evaluated as a compile\dash time constant. Such
1542 an entry may also have a \DWATconstvalue{} attribute,
1543 whose value may be of any form that is appropriate for the
1544 representation of the subroutine's return value. The value of
1545 this attribute is the actual return value of the subroutine,
1546 represented as it would be on the target architecture.
1548 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1549 \addttindex{constexpr}
1550 is called with constant expressions, then the corresponding
1551 concrete inlined instance has a
1552 \DWATconstexpr{} attribute,
1553 as well as a \DWATconstvalue{} attribute whose value represents
1554 the actual return value of the concrete inlined instance.}
1556 Any debugging information entry that is owned (either
1557 directly or indirectly) by a debugging information entry
1558 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1559 \doublequote{concrete inlined instance entry.} Any entry that has
1561 \DWTAGinlinedsubroutine{}
1562 is known as a \doublequote{concrete inlined instance root.}
1563 Any set of concrete inlined instance
1564 entries that are all children (either directly or indirectly)
1565 of some concrete inlined instance root, together with the root
1566 itself, is known as a \doublequote{concrete inlined instance tree.}
1567 However, in the case where a concrete inlined instance tree
1568 is nested within another concrete instance tree, the entries
1569 in the \addtoindex{nested concrete inline instance} tree
1570 are not considered to
1571 be entries in the outer concrete instance tree.
1573 \textit{Concrete inlined instance trees are defined so that no entry
1574 is part of more than one concrete inlined instance tree. This
1575 simplifies later descriptions.}
1577 Each concrete inlined instance tree is uniquely associated
1578 with one (and only one) abstract instance tree.
1580 \textit{Note, however, that the reverse is not true. Any given abstract
1581 instance tree may be associated with several different concrete
1582 inlined instance trees, or may even be associated with zero
1583 concrete inlined instance trees.}
1585 Concrete inlined instance entries may omit attributes that
1586 are not specific to the concrete instance (but present in
1587 the abstract instance) and need include only attributes that
1588 are specific to the concrete instance (but omitted in the
1589 abstract instance). In place of these omitted attributes, each
1590 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1591 concrete inlined instance entry
1592 \addtoindexx{abstract origin attribute}
1594 \DWATabstractorigin{}
1595 attribute that may be used to obtain the missing information
1596 (indirectly) from the associated abstract instance entry. The
1597 value of the abstract origin attribute is a reference to the
1598 associated abstract instance entry.
1600 If an entry within a concrete inlined instance tree contains
1601 attributes describing the
1602 \addtoindexx{declaration coordinates!in concrete instance}
1603 \livelink{chap:declarationcoordinates}{declaration coordinates}
1604 of that entry, then those attributes should refer to the file, line
1605 and column of the original declaration of the subroutine,
1606 not to the point at which it was inlined. As a consequence,
1607 they may usually be omitted from any entry that has an abstract
1611 For each pair of entries that are associated via a
1612 \addtoindexx{abstract origin attribute}
1613 \DWATabstractorigin{} attribute, both members of the pair
1614 have the same tag. So, for example, an entry with the tag
1615 \DWTAGvariable{} can only be associated with another entry
1616 that also has the tag \DWTAGvariable. The only exception
1617 to this rule is that the root of a concrete instance tree
1618 (which must always have the tag \DWTAGinlinedsubroutine)
1619 can only be associated with the root of its associated abstract
1620 instance tree (which must have the tag \DWTAGsubprogram).
1622 In general, the structure and content of any given concrete
1623 inlined instance tree will be closely analogous to the
1624 structure and content of its associated abstract instance
1625 tree. There are a few exceptions:
1627 \begin{enumerate}[1. ]
1628 \item An entry in the concrete instance tree may be omitted if
1630 \addtoindexx{abstract origin attribute}
1631 \DWATabstractorigin{} attribute and either
1632 has no children, or its children are omitted. Such entries
1633 would provide no useful information. In C\dash like languages,
1634 such entries frequently include types, including structure,
1635 union, class, and interface types; and members of types. If any
1636 entry within a concrete inlined instance tree needs to refer
1637 to an entity declared within the scope of the relevant inlined
1638 subroutine and for which no concrete instance entry exists,
1639 the reference should refer to the abstract instance entry.
1641 \item Entries in the concrete instance tree which are associated
1642 with entries in the abstract instance tree such that neither
1643 has a \DWATname{} attribute,
1644 \addtoindexx{name attribute}
1645 and neither is referenced by
1646 any other debugging information entry, may be omitted. This
1647 may happen for debugging information entries in the abstract
1648 instance trees that became unnecessary in the concrete instance
1649 tree because of additional information available there. For
1650 example, an anonymous variable might have been created and
1651 described in the abstract instance tree, but because of
1652 the actual parameters for a particular inlined expansion,
1653 it could be described as a constant value without the need
1654 for that separate debugging information entry.
1656 \item A concrete instance tree may contain entries which do
1657 not correspond to entries in the abstract instance tree
1658 to describe new entities that are specific to a particular
1659 inlined expansion. In that case, they will not have associated
1660 entries in the abstract instance tree, should not contain
1661 \addtoindexx{abstract origin attribute}
1662 \DWATabstractorigin{} attributes, and must contain all their
1663 own attributes directly. This allows an abstract instance tree
1664 to omit debugging information entries for anonymous entities
1665 that are unlikely to be needed in most inlined expansions. In
1666 any expansion which deviates from that expectation, the
1667 entries can be described in its concrete inlined instance tree.
1671 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1672 \label{chap:outoflineinstancesofinlinedsubroutines}
1673 Under some conditions, compilers may need to generate concrete
1674 executable instances of inlined subroutines other than at
1675 points where those subroutines are actually called. Such
1676 concrete instances of inlined subroutines are referred to as
1677 \doublequote{concrete out\dash of\dash line instances.}
1679 \textit{In \addtoindex{C++}, for example,
1680 taking the address of a function declared
1681 to be inline can necessitate the generation of a concrete
1682 out\dash of\dash line instance of the given function.}
1684 The DWARF representation of a concrete out\dash of\dash line instance
1685 of an inlined subroutine is essentially the same as for a
1686 concrete inlined instance of that subroutine (as described in
1687 the preceding section). The representation of such a concrete
1688 % It is critical that the hypertarget and livelink be
1689 % separated to avoid problems with latex.
1690 out\dash of\dash line
1691 \addtoindexx{abstract origin attribute}
1693 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1695 \DWATabstractorigin{}
1696 attributes in exactly the same way as they are used for
1697 a concrete inlined instance (that is, as references to
1698 corresponding entries within the associated abstract instance
1701 The differences between the DWARF representation of a
1702 concrete out\dash of\dash line instance of a given subroutine and the
1703 representation of a concrete inlined instance of that same
1704 subroutine are as follows:
1706 \begin{enumerate}[1. ]
1707 \item The root entry for a concrete out\dash of\dash line instance
1708 of a given inlined subroutine has the same tag as does its
1709 associated (abstract) inlined subroutine entry (that is, tag
1710 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1712 \item The root entry for a concrete out\dash of\dash line instance tree
1713 is normally owned by the same parent entry that also owns
1714 the root entry of the associated abstract instance. However,
1715 it is not required that the abstract and out\dash of\dash line instance
1716 trees be owned by the same parent entry.
1720 \subsubsection{Nested Inlined Subroutines}
1721 \label{nestedinlinedsubroutines}
1722 Some languages and compilers may permit the logical nesting of
1723 a subroutine within another subroutine, and may permit either
1724 the outer or the nested subroutine, or both, to be inlined.
1726 For a non\dash inlined subroutine nested within an inlined
1727 subroutine, the nested subroutine is described normally in
1728 both the abstract and concrete inlined instance trees for
1729 the outer subroutine. All rules pertaining to the abstract
1730 and concrete instance trees for the outer subroutine apply
1731 also to the abstract and concrete instance entries for the
1735 For an inlined subroutine nested within another inlined
1736 subroutine, the following rules apply to their abstract and
1737 \addtoindexx{abstract instance!nested}
1738 \addtoindexx{concrete instance!nested}
1739 concrete instance trees:
1741 \begin{enumerate}[1. ]
1742 \item The abstract instance tree for the nested subroutine is
1743 described within the abstract instance tree for the outer
1744 subroutine according to the rules in
1745 Section \refersec{chap:abstractinstances}, and
1746 without regard to the fact that it is within an outer abstract
1749 \item Any abstract instance tree for a nested subroutine is
1750 always omitted within the concrete instance tree for an
1753 \item A concrete instance tree for a nested subroutine is
1754 always omitted within the abstract instance tree for an
1757 \item The concrete instance tree for any inlined or
1758 \addtoindexx{out-of-line instance}
1760 \addtoindexx{out-of-line-instance|see{concrete out-of-line-instance}}
1761 expansion of the nested subroutine is described within a
1762 concrete instance tree for the outer subroutine according
1764 Sections \refersec{chap:concreteinlinedinstances} or
1765 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1767 and without regard to the fact that it is within an outer
1768 concrete instance tree.
1771 See Appendix \refersec{app:inliningexamples}
1772 for discussion and examples.
1774 \subsection{Trampolines}
1775 \label{chap:trampolines}
1777 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1778 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1779 an intermediary in making a call to another subroutine. It may
1780 adjust parameters and/or the result (if any) as appropriate
1781 to the combined calling and called execution contexts.}
1783 A trampoline is represented by a debugging information entry
1784 \addtoindexx{trampoline (subprogam) entry}
1785 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1787 \addtoindexx{trampoline attribute}
1788 a \DWATtrampoline{} attribute.
1790 attribute indicates the target subroutine of the trampoline,
1791 that is, the subroutine to which the trampoline passes
1792 control. (A trampoline entry may but need not also have a
1793 \DWATartificial{} attribute.)
1796 The value of the trampoline attribute may be represented
1797 using any of the following forms, which are listed in order
1801 \item If the value is of class reference, then the value
1802 specifies the debugging information entry of the target
1805 \item If the value is of class address, then the value is
1806 the relocated address of the target subprogram.
1808 \item If the value is of class string, then the value is the
1809 (possibly mangled) \addtoindexx{mangled names}
1810 name of the target subprogram.
1812 \item If the value is of class \livelink{chap:classflag}{flag}, then the value true
1813 indicates that the containing subroutine is a trampoline but
1814 that the target subroutine is not known.
1818 The target subprogram may itself be a trampoline. (A sequence
1819 of trampolines necessarily ends with a non\dash trampoline
1822 \textit{In \addtoindex{C++}, trampolines may be used
1823 to implement derived virtual
1824 member functions; such trampolines typically adjust the
1825 \addtoindexx{this parameter}
1826 implicit this pointer parameter in the course of passing
1828 Other languages and environments may use trampolines
1829 in a manner sometimes known as transfer functions or transfer
1832 \textit{Trampolines may sometimes pass control to the target
1833 subprogram using a branch or jump instruction instead of a
1834 call instruction, thereby leaving no trace of their existence
1835 in the subsequent execution context. }
1837 \textit{This attribute helps make it feasible for a debugger to arrange
1838 that stepping into a trampoline or setting a breakpoint in
1839 a trampoline will result in stepping into or setting the
1840 breakpoint in the target subroutine instead. This helps to
1841 hide the compiler generated subprogram from the user. }
1843 \textit{If the target subroutine is not known, a debugger may choose
1844 to repeatedly step until control arrives in a new subroutine
1845 which can be assumed to be the target subroutine. }
1849 \section{Lexical Block Entries}
1850 \label{chap:lexicalblockentries}
1853 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
1855 \addtoindexx{lexical block}
1856 a bracketed sequence of source statements
1857 that may contain any number of declarations. In some languages
1858 (including \addtoindex{C} and \addtoindex{C++}),
1859 \nolink{blocks} can be nested within other
1860 \nolink{blocks} to any depth.}
1862 % We do not need to link to the preceding paragraph.
1863 A lexical \nolink{block} is represented by a debugging information
1865 tag \DWTAGlexicalblockTARG.
1867 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
1869 either a \DWATlowpc{} and
1870 \DWAThighpc{} pair of
1872 \addtoindexx{high PC attribute}
1874 \addtoindexx{low PC attribute}
1876 \DWATranges{} attribute
1877 \addtoindexx{ranges attribute}
1878 whose values encode the contiguous or non-contiguous address
1879 ranges, respectively, of the machine instructions generated
1880 for the lexical \nolink{block}
1881 (see Section \refersec{chap:codeaddressesandranges}).
1884 \hypertarget{chap:DWATentrypcoflexicalblock}{}
1885 lexical block entry may also have
1886 \addtoindexx{entry pc attribute!for lexical block}
1888 \DWATentrypc{} attribute
1889 whose value is the address of the first executable instruction
1890 of the lexical block (see
1891 Section \refersec{chap:entryaddress}).
1893 If a name has been given to the
1894 lexical \nolink{block}
1896 program, then the corresponding
1897 lexical \nolink{block} entry has a
1898 \DWATname{} attribute whose
1899 \addtoindexx{name attribute}
1900 value is a null\dash terminated string
1901 containing the name of the lexical \nolink{block}
1905 \textit{This is not the same as a \addtoindex{C} or
1906 \addtoindex{C++} label (see below).}
1908 The lexical \nolink{block} entry owns
1909 debugging information entries that
1910 describe the declarations within that lexical \nolink{block}.
1912 one such debugging information entry for each local declaration
1913 of an identifier or inner lexical \nolink{block}.
1915 \section{Label Entries}
1916 \label{chap:labelentries}
1917 \textit{A label is a way of identifying a source statement. A labeled
1918 statement is usually the target of one or more \doublequote{go to}
1922 A label is represented by a debugging information entry with
1923 \addtoindexx{label entry}
1925 tag \DWTAGlabelTARG.
1926 The entry for a label should be owned by
1927 the debugging information entry representing the scope within
1928 which the name of the label could be legally referenced within
1931 The label entry has a \DWATlowpc{} attribute whose value
1932 is the relocated address of the first machine instruction
1933 generated for the statement identified by the label in
1934 the source program. The label entry also has a
1935 \DWATname{} attribute
1936 \addtoindexx{name attribute}
1937 whose value is a null-terminated string containing
1938 the name of the label as it appears in the source program.
1941 \section{With Statement Entries}
1942 \label{chap:withstatemententries}
1944 \textit{Both \addtoindex{Pascal} and
1945 \addtoindexx{Modula-2}
1946 Modula\dash 2 support the concept of a \doublequote{with}
1947 statement. The with statement specifies a sequence of
1948 executable statements within which the fields of a record
1949 variable may be referenced, unqualified by the name of the
1952 A with statement is represented by a
1953 \addtoindexi{debugging information entry}{with statement entry}
1954 with the tag \DWTAGwithstmtTARG.
1956 A with statement entry may have either a
1958 \DWAThighpc{} pair of attributes
1959 \addtoindexx{high PC attribute}
1961 \addtoindexx{low PC attribute}
1962 a \DWATranges{} attribute
1963 \addtoindexx{ranges attribute}
1964 whose values encode the contiguous or non\dash contiguous address
1965 ranges, respectively, of the machine instructions generated
1966 for the with statement
1967 (see Section \refersec{chap:codeaddressesandranges}).
1970 \hypertarget{chap:DWATentrypcofwithstmt}{}
1971 with statement entry may also have
1972 \addtoindexx{entry pc attribute!for with statement}
1974 \DWATentrypc{} attribute
1975 whose value is the address of the first executable instruction
1976 of the with statement (see
1977 Section \refersec{chap:entryaddress}).
1980 The with statement entry has
1981 \addtoindexx{type attribute}
1982 a \DWATtype{} attribute, denoting
1983 the type of record whose fields may be referenced without full
1984 qualification within the body of the statement. It also has
1985 \addtoindexx{location attribute}
1986 a \DWATlocation{} attribute, describing how to find the base
1987 address of the record object referenced within the body of
1990 \section{Try and Catch Block Entries}
1991 \label{chap:tryandcatchblockentries}
1993 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
1994 designated as a \doublequote{catch \nolink{block}.}
1995 A catch \livetargi{chap:catchblock}{block}{catch block} is an
1996 exception handler that handles
1997 exceptions thrown by an immediately
1998 preceding \doublequote{try \livelink{chap:tryblock}{block}.}
1999 A catch \livelink{chap:catchblock}{block}
2000 designates the type of the exception that it
2003 A try \livetargi{chap:tryblock}{block}{try block} is represented
2004 by a debugging information entry
2005 \addtoindexx{try block entry}
2006 with the tag \DWTAGtryblockTARG.
2007 A catch \livelink{chap:catchblock}{block} is represented by
2008 a debugging information entry with
2009 \addtoindexx{catch block entry}
2010 the tag \DWTAGcatchblockTARG.
2012 % nolink as we have links just above and do not have a combo link for both
2013 Both try and catch \nolink{block} entries may have either a
2015 \DWAThighpc{} pair of attributes
2016 \addtoindexx{high PC attribute}
2018 \addtoindexx{low PC attribute}
2020 \DWATranges{} attribute
2021 \addtoindexx{ranges attribute}
2022 whose values encode the contiguous
2023 or non\dash contiguous address ranges, respectively, of the
2024 machine instructions generated for the \livelink{chap:lexicalblock}{block}
2026 \refersec{chap:codeaddressesandranges}).
2029 \hypertarget{chap:DWATentrypcoftryblock}{}
2030 \hypertarget{chap:DWATentrypcofcatchblock}{}
2031 try or catch block entry may also have
2032 \addtoindexx{entry pc attribute!for try block}
2033 \addtoindexx{entry pc attribute!for catch block}
2035 \DWATentrypc{} attribute
2036 whose value is the address of the first executable instruction
2037 of the try or catch block (see
2038 Section \refersec{chap:entryaddress}).
2040 Catch \livelink{chap:catchblock}{block} entries have at
2041 least one child entry, an
2042 entry representing the type of exception accepted by
2043 that catch \livelink{chap:catchblock}{block}.
2044 This child entry has one of
2045 \addtoindexx{formal parameter entry!in catch block}
2047 \addtoindexx{unspecified parameters entry!in catch block}
2049 \DWTAGformalparameter{} or
2050 \DWTAGunspecifiedparameters,
2051 and will have the same form as other parameter entries.
2053 The siblings immediately following
2054 a try \livelink{chap:tryblock}{block} entry are its
2055 corresponding catch \livelink{chap:catchblock}{block} entries.