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:typeunitentries}),
7 these entries may be thought of
8 as bounded by ranges of text addresses within the program.
10 \section{Unit Entries}
11 \label{chap:unitentries}
12 An object file may contain one or more compilation units,
14 \addtoindexx{unit|see {compilation unit}}
15 \addtoindexx{compilation unit}
17 normal compilation units,
18 partial compilation units,
19 type units,\addtoindexx{type unit} and
21 \addtoindex{partial compilation unit}
22 is related to one or more other compilation units that
24 A skeleton unit contains only a subset of the attributes of
25 a full normal or partial compilation unit plus two attributes
26 used to locate the DWARF object file where the full
27 compilation unit can be found.
28 A \addtoindex{type unit} represents a single complete type
29 in a compilation unit of its own.
30 Either a normal compilation unit or a
31 \addtoindex{partial compilation unit}
32 may be logically incorporated into another
33 compilation unit using an
34 \addtoindex{imported unit entry}
35 (see Section \refersec{chap:importedunitentries}).
38 \subsection[Normal and Partial CU Entries]{Normal and Partial Compilation Unit Entries}
39 \label{chap:normalandpartialcompilationunitentries}
41 A \addtoindex{normal compilation unit}\addtoindexx{compilation unit!normal}
42 is represented by a debugging information entry with the tag
43 \DWTAGcompileunitTARG.
44 A \addtoindex{partial compilation unit}\addtoindexx{compilation unit!partial}
45 is represented by a debugging information entry with the tag
46 \DWTAGpartialunitTARG.
49 In a simple normal compilation, a single compilation unit with
51 \DWTAGcompileunit{} represents a complete object file
53 \DWTAGpartialunit{} is not used.
55 employing the DWARF space compression and duplicate elimination
57 Appendix \refersec{app:usingcompilationunits},
58 multiple compilation units using
60 \DWTAGcompileunit{} and/or
61 \DWTAGpartialunit{} are
62 used to represent portions of an object file.
64 \textit{A normal compilation unit typically represents the text and
65 data contributed to an executable by a single relocatable
66 object file. It may be derived from several source files,
67 including pre-processed header files.
68 A \addtoindex{partial compilation unit} typically represents a part of the text
69 and data of a relocatable object file, in a manner that can
70 potentially be shared with the results of other compilations
71 to save space. It may be derived from an \doublequote{include file,}
72 template instantiation, or other implementation\dash dependent
73 portion of a compilation. A normal compilation unit can also
74 function in a manner similar to a partial compilation unit
77 A compilation unit entry owns debugging information
78 entries that represent all or part of the declarations
79 made in the corresponding compilation. In the case of a
80 partial compilation unit, the containing scope of its owned
81 declarations is indicated by imported unit entries in one
82 or more other compilation unit entries that refer to that
83 partial compilation unit (see
84 Section \refersec{chap:importedunitentries}).
87 Compilation unit entries may have the following
89 \begin{enumerate}[1. ]
90 \item Either a \DWATlowpc{} and
92 \addtoindexx{high PC attribute}
94 \addtoindexx{low PC attribute}
96 \addtoindexx{ranges attribute}
98 \DWATranges{} attribute
99 \addtoindexx{ranges attribute}
101 \addtoindexx{discontiguous address ranges|see{non-contiguous address ranges}}
104 non\dash contiguous address ranges, respectively,
105 of the machine instructions generated for the compilation
106 unit (see Section \refersec{chap:codeaddressesandranges}).
108 A \DWATlowpc{} attribute
109 may also be specified in combination
110 \addtoindexx{ranges attribute}
112 \DWATranges{} to specify the
113 \addtoindexx{ranges attribute}
114 default base address for use in
115 \addtoindexx{location list}
116 location lists (see Section
117 \refersec{chap:locationlists}) and range lists
118 \addtoindexx{range list}
119 (see Section \refersec{chap:noncontiguousaddressranges}).
121 \item A \DWATnameDEFN{} attribute
122 \addtoindexx{name attribute}
123 whose value is a null-terminated string
124 \hypertarget{chap:DWATnamepathnameofcompilationsource}{}
125 containing the full or relative path name of the primary
126 source file from which the compilation unit was derived.
128 \item A \DWATlanguageDEFN{} attribute
129 \addtoindexx{language attribute}
130 whose constant value is an
131 \hypertarget{chap:DWATlanguageprogramminglanguage}{}
133 \addtoindexx{language attribute}
134 indicating the source language of the compilation
135 unit. The set of language names and their meanings are given
136 in Table \refersec{tab:languagenames}.
139 \setlength{\extrarowheight}{0.1cm}
140 \begin{longtable}{l|l}
141 \caption{Language names} \label{tab:languagenames} \\
142 \hline \bfseries Language name & \bfseries Meaning \\ \hline
144 \bfseries Language name & \bfseries Meaning \\ \hline
146 \hline \emph{Continued on next page}
149 \addtoindexx{ISO-defined language names}
150 \DWLANGAdaeightythreeTARG{} \dag & ISO Ada:1983 \addtoindexx{Ada:1983 (ISO)} \\
151 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada:1995 (ISO)} \\
152 \DWLANGCTARG & Non-standardized C, such as K\&R \addtoindexx{C!non-standard}\\
153 \DWLANGCeightynineTARG & ISO C:1989 \addtoindexx{C:1989 (ISO)} \\
154 \DWLANGCninetynineTARG & ISO C:1999 \addtoindexx{C:1999 (ISO)} \\
155 \DWLANGCelevenTARG & ISO C:2011 \addtoindexx{C:2011 (ISO)} \\
156 \DWLANGCplusplusTARG & ISO C++:1998 \addtoindexx{C++:1998 (ISO)} \\
157 \DWLANGCpluspluszerothreeTARG & ISO C++:2003 \addtoindexx{C++:2003 (ISO)} \\
158 \DWLANGCpluspluselevenTARG & ISO C++:2011 \addtoindexx{C++:2011 (ISO)} \\
159 \DWLANGCplusplusfourteenTARG & ISO C++:2014 \addtoindexx{C++:2014 (ISO)} \\
160 \DWLANGCobolseventyfourTARG & ISO COBOL:1974 \addtoindexx{COBOL:1974 (ISO)} \\
161 \DWLANGCoboleightyfiveTARG & ISO COBOL:1985 \addtoindexx{COBOL:1985 (ISO)} \\
162 \DWLANGDTARG{}~\dag & D \addtoindexx{D language} \\
163 \DWLANGDylanTARG~\dag & Dylan \addtoindexx{Dylan} \\
164 \DWLANGFortranseventysevenTARG & ISO FORTRAN:1977 \addtoindexx{FORTRAN:1977 (ISO)} \\
165 \DWLANGFortranninetyTARG & ISO Fortran:1990 \addtoindexx{Fortran:1990 (ISO)} \\
166 \DWLANGFortranninetyfiveTARG & ISO Fortran:1995 \addtoindexx{Fortran:1995 (ISO)} \\
167 \DWLANGFortranzerothreeTARG & ISO Fortran:2004 \addtoindexx{Fortran:2004 (ISO)} \\
168 \DWLANGFortranzeroeightTARG & ISO Fortran:2010 \addtoindexx{Fortran:2010 (ISO)} \\
169 \DWLANGGoTARG{}~\dag & \addtoindex{Go} \\
170 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell} \\
171 \DWLANGJavaTARG{} & \addtoindex{Java}\\
172 \DWLANGJuliaTARG{}~\dag & \addtoindex{Julia} \\
173 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
174 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
175 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
176 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
177 \DWLANGOCamlTARG{}~\dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
178 \DWLANGOpenCLTARG{}~\dag & \addtoindex{OpenCL} \\
179 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
180 \DWLANGPLITARG{}~\dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
181 \DWLANGPythonTARG{}~\dag & \addtoindex{Python} \\
182 \DWLANGRustTARG{}~\dag & \addtoindex{Rust} \\
183 \DWLANGSwiftTARG{}~\dag & \addtoindex{Swift} \\
184 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
185 \index{Unified Parallel C|see{UPC}} \\
187 \dag \ \ \textit{Support for these languages is limited}& \\
192 \item A \DWATstmtlistDEFN{}
193 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
194 \addtoindexx{statement list attribute}
195 attribute whose value is a
196 \addtoindexx{section offset!in statement list attribute}
197 section offset to the line number information for this compilation
200 This information is placed in a separate object file
201 section from the debugging information entries themselves. The
202 value of the statement list attribute is the offset in the
203 \dotdebugline{} section of the first byte of the line number
204 information for this compilation unit
205 (see Section \refersec{chap:linenumberinformation}).
207 \item A \DWATmacrosDEFN{}\hypertarget{chap:DWATmacrosmacroinformation}{}
209 \addtoindexx{macro information attribute}
211 \addtoindexx{section offset!in macro information attribute}
212 section offset to the macro information for this compilation unit.
214 This information is placed in a separate object file section
215 from the debugging information entries themselves. The
216 value of the macro information attribute is the offset in
217 the \dotdebugmacro{} section of the first byte of the macro
218 information for this compilation unit
219 (see Section \refersec{chap:macroinformation}).
221 \textit{The \DWATmacrosNAME{} attribute is new in \DWARFVersionV,
223 \DWATmacroinfoDEFN{} attribute of earlier DWARF versions.
224 \livetarg{chap:DWATmacroinfomacroinformation}{}
225 While \DWATmacrosNAME{} and \DWATmacroinfoNAME{} attributes cannot both occur in the same
226 compilation unit, both may be found in the set of units that make up an executable
227 or shared object file. The two attributes have distinct encodings to facilitate such
232 \DWATcompdirDEFN{} attribute\addtoindexx{compilation directory attribute}
233 \hypertarget{chap:DWATcompdircompilationdirectory}{}
235 null-terminated string containing the current working directory
236 of the compilation command that produced this compilation
237 unit in whatever form makes sense for the host system.
239 \item A \DWATproducerDEFN{} attribute
240 \addtoindexx{producer attribute}
241 whose value is a null-terminated string containing
242 information about the compiler
243 \hypertarget{chap:DWATproducercompileridentification}{}
244 that produced the compilation unit. The actual contents of
245 the string will be specific to each producer, but should
246 begin with the name of the compiler vendor or some other
247 identifying character sequence that should avoid confusion
248 with other producer values.
251 \item A \DWATidentifiercaseDEFN{}
253 \addtoindexx{identifier case attribute}
255 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
256 constant value is a code describing the treatment
257 of identifiers within this compilation unit. The
258 set of identifier case codes is given in
259 Table \refersec{tab:identifiercasecodes}.
261 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
262 \DWIDcasesensitive{} \\
265 \DWIDcaseinsensitive{} \\
266 \end{simplenametable}
268 \DWIDcasesensitiveTARG{} is the default for all compilation units
269 that do not have this attribute. It indicates that names given
270 as the values of \DWATname{} attributes
271 \addtoindexx{name attribute}
272 in debugging information
273 entries for the compilation unit reflect the names as they
274 appear in the source program. The debugger should be sensitive
275 to the case of \addtoindex{identifier names} when doing identifier
279 \DWIDupcaseTARG{} means that the
280 producer of the debugging
281 information for this compilation unit converted all source
282 names to upper case. The values of the name attributes may not
283 reflect the names as they appear in the source program. The
284 debugger should convert all names to upper case when doing
287 \DWIDdowncaseTARG{} means that
288 the producer of the debugging
289 information for this compilation unit converted all source
290 names to lower case. The values of the name attributes may not
291 reflect the names as they appear in the source program. The
292 debugger should convert all names to lower case when doing
296 \DWIDcaseinsensitiveTARG{} means that the values of the name
297 attributes reflect the names as they appear in the source
298 program but that a case insensitive lookup should be used to
302 \item A \DWATbasetypesDEFN{} attribute whose value is a
303 \livelink{chap:classreference}{reference}. This
304 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
306 \addtoindexx{base types attribute}
307 points to a debugging information entry
308 representing another compilation unit. It may be used
309 to specify the compilation unit containing the base type
310 entries used by entries in the current compilation unit
311 (see Section \refersec{chap:basetypeentries}).
314 \textit{This attribute provides a consumer a way to find the definition
315 of base types for a compilation unit that does not itself
316 contain such definitions. This allows a consumer, for example,
317 to interpret a type conversion to a base type
318 % getting this link target at the right spot is tricky.
319 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
322 \item A \DWATuseUTFeightDEFN{} attribute,
323 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
324 which is a \livelink{chap:classflag}{flag} whose
325 presence indicates that all strings (such as the names of
326 declared entities in the source program, or filenames in the line number table)
327 are represented using the UTF\dash 8 representation.
330 \item A \DWATmainsubprogramDEFN{} attribute, which is a
331 \livelink{chap:classflag}{flag}
332 \addtoindexx{main subprogram attribute}
333 whose presence indicates
334 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
335 that the compilation unit contains a
336 subprogram that has been identified as the starting function
337 of the program. If more than one compilation unit contains
338 this \nolink{flag}, any one of them may contain the starting function.
340 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
342 to specify and provide a user\dash specified name for the main
343 subroutine of a program.
344 \addtoindex{C} uses the name \doublequote{main} to identify
345 the main subprogram of a program. Some other languages provide
346 similar or other means to identify the main subprogram of
347 a program. The \DWATmainsubprogram{} attribute may also be used to
348 identify such subprograms (see
349 Section \refersec{chap:generalsubroutineandentrypointinformation}).}
351 \item A \DWATentrypc{} attribute whose value is the address of the first
352 \hypertarget{chap:DWATentrypcofcompileunit}{}
353 \hypertarget{chap:DWATentrypcofpartialunit}{}
354 \addtoindexx{entry pc attribute!for normal compilation unit}
355 \addtoindexx{entry pc attribute!for partial compilation unit}
356 executable instruction of the unit (see
357 Section \refersec{chap:entryaddress}).
360 \item A \DWATstroffsetsbaseDEFN\addtoindexx{string offset base attribute}
361 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
362 attribute, whose value is of class \CLASSstroffsetsptr.
363 This attribute points to the first string
364 offset of the compilation unit's contribution to the
365 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
366 Indirect string references
367 (using \DWFORMstrx) within the compilation unit are
368 interpreted as indices relative to this base.
371 \item A \DWATaddrbaseDEFN\addtoindexx{address table base attribute}
372 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
373 attribute, whose value is of class \CLASSaddrptr.
374 This attribute points to the beginning of the compilation
375 unit's contribution to the \dotdebugaddr{} section.
376 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
377 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
378 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
379 interpreted as indices relative to this base.
382 \item A \DWATrangesbaseDEFN\addtoindexx{ranges table base attribute}
383 \hypertarget{chap:DWATrangesbaseforrangelists}{}
384 attribute, whose value is of class \CLASSrangelistptr.
385 This attribute points to the beginning of the compilation
386 unit's contribution to the \dotdebugranges{} section.
387 References to range lists (using \DWFORMsecoffset)
388 within the compilation unit are
389 interpreted as offsets relative to this base.
393 The base address of a compilation unit is defined as the
394 value of the \DWATlowpc{} attribute, if present; otherwise,
395 it is undefined. If the base address is undefined, then any
396 DWARF entry or structure defined in terms of the base address
397 of that compilation unit is not valid.
399 \subsection{Skeleton Compilation Unit Entries}
400 \label{chap:skeletoncompilationunitentries}
401 \addtoindexx{compilation unit!skeleton}
402 \addtoindexx{skeleton compilation unit}
403 When generating a \splitDWARFobjectfile{} (see
404 Section \refersec{datarep:splitdwarfobjectfiles}), the
405 compilation unit in the \dotdebuginfo{} section is a "skeleton"
406 compilation unit with the tag \DWTAGcompileunit, which contains
407 \DWATdwoname{} and \DWATdwoid{} attributes as well as a subset of the
408 attributes of a full normal or partial compilation unit. In general,
409 it contains those attributes that are necessary for the consumer
410 to locate the object file where the full compilation unit
411 can be found, and for the consumer to interpret references to
412 addresses in the program.
414 A skeleton compilation unit has \DWATdwoname{} and
415 \DWATdwoid{} attributes and no children; it may have additional
416 attributes from among the following:
417 \begin{enumerate}[1. ]
420 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
421 or a \DWATranges{} attribute (the same as for regular
422 compilation unit entries).
425 A \DWATstmtlist{} attribute (the same as for regular
426 compilation unit entries).
429 A \DWATcompdir{} attribute (the same as for regular
430 compilation unit entries).
433 \livetarg{chap:DWATdwonameforunit}{}
434 A \DWATdwonameDEFN{} attribute
435 \addtoindexx{split DWARF object file name attribute}
437 null-terminated string containing the full or relative
438 path name of the object file that contains the full
442 \livetarg{chap:DWATdwoidforunit}{}
443 A \DWATdwoidDEFN{} attribute\addtoindexx{unit identification attribute}
444 whose implementation-defined integer constant value
445 provides unique identification of this compilation unit
446 as well as the associated compilation unit in the
447 split DWARF object file named in the \DWATdwoname{}
448 attribute. For simplicity, the skeleton compilation
449 unit and the split DWARF object file must use the same
450 form to encode this identification value.
454 A \DWATuseUTFeight{} attribute (the same as for regular compilation unit
457 \textit{This attribute applies to strings referred to by the skeleton
458 compilation unit entry itself, and strings in the associated line
460 The representation for strings in the object file referenced
461 by the \DWATdwoname{} attribute is determined by the presence
462 of a \DWATuseUTFeight{} attribute in the full compilation unit.}
465 A \DWATstroffsetsbase{} attribute, for indirect strings references
466 from the skeleton compilation unit (the same as for regular
467 compilation unit entries).
470 A \DWATaddrbase{} attribute (the same as for regular
471 compilation unit entries).
474 A \DWATrangesbase{} attribute (the same as for regular
475 compilation unit entries).
479 All other attributes of a compilation unit entry (described
480 in Section \refersec{chap:normalandpartialcompilationunitentries})
481 should be placed in the full compilation unit.
482 The attributes provided by the skeleton compilation
483 unit entry do not need to be repeated in the full compilation
484 unit entry, except for \DWATdwoid, which should appear in
485 both entries so that the consumer can verify that it has
486 found the correct object file.
488 \textit{The \DWATaddrbase{}, \DWATrangesbase{} and \DWATstroffsetsbase{}
489 attributes provide context that may be necessary to interpret the contents
490 of the corresponding \splitDWARFobjectfile.}
493 \subsection{Type Unit Entries}
494 \label{chap:typeunitentries}
495 \addtoindexx{type unit}
496 \addtoindexx{type unit|see{\textit{also} compilation unit}}
497 \addtoindexx{compilation unit!\textit{see also} type unit}
498 An object file may contain any number of separate type
499 unit entries, each representing a single complete type
501 Each \addtoindex{type unit} must be uniquely identified by
502 a 64-bit signature, stored as part of the type unit, which
503 can be used to reference the type definition from debugging
504 information entries in other compilation units and type units.
506 A type unit is represented by a debugging information entry
507 with the tag \DWTAGtypeunitTARG.
508 A \addtoindex{type unit entry} owns debugging
509 information entries that represent the definition of a single
510 type, plus additional debugging information entries that may
511 be necessary to include as part of the definition of the type.
513 A type unit entry may have the following attributes:
514 \begin{enumerate}[1. ]
517 \DWATlanguage{} attribute,
519 \addtoindexx{language attribute}
520 constant value is an integer code indicating the source
521 language used to define the type. The set of language names
522 and their meanings are given in Table \refersec{tab:languagenames}.
525 \item A \DWATstmtlist{} attribute\addtoindexx{statement list attribute}
526 whose value of class \CLASSlineptr{} points to the line number
527 information for this type unit.
528 Because type units do not describe any code, they
529 do not actually need a line number table, but the line number
530 headers contain a list of directories and file names that
531 may be referenced by the \DWATdeclfile{} attribute of the
532 type or part of its description.
535 normal object file with a regular compilation unit entry, the
536 type unit entries can simply refer to the line number table
537 used by the compilation unit.
538 \item In a \splitDWARFobjectfile, where
539 the type units are located in a separate DWARF object file,
540 the \DWATstmtlistNAME{} attribute refers to a "specialized"
541 line number table in the \dotdebuglinedwo{} section, which
542 contains only the list of directories and file names. All
543 type unit entries in a \splitDWARFobjectfile{} may (but are
544 not required to) refer to the same
545 \addtoindex{specialized line number table}.
548 \item A \DWATuseUTFeight{} attribute, which is a flag
549 whose presence indicates that all strings referred to by this type
550 unit entry, its children, and its associated
551 \addtoindex{specialized line number table},
552 are represented using the UTF-8 representation.
555 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
556 attribute, whose value is a reference. This attribute points
557 to the first string offset of the type unit's contribution to
558 the \dotdebugstroffsets{} section. Indirect string references
559 (using \DWFORMstrx) within the type unit are interpreted
560 as indices relative to this base.
564 A \addtoindex{type unit} entry for a given type T owns a debugging
565 information entry that represents a defining declaration
566 of type T. If the type is nested within enclosing types or
567 namespaces, the debugging information entry for T is nested
568 within debugging information entries describing its containers;
569 otherwise, T is a direct child of the type unit entry.
571 A type unit entry may also own additional debugging information
572 entries that represent declarations of additional types that
573 are referenced by type T and have not themselves been placed in
574 separate type units. Like T, if an additional type U is nested
575 within enclosing types or namespaces, the debugging information
576 entry for U is nested within entries describing its containers;
577 otherwise, U is a direct child of the type unit entry.
579 The containing entries for types T and U are declarations,
580 and the outermost containing entry for any given type T or
581 U is a direct child of the type unit entry. The containing
582 entries may be shared among the additional types and between
583 T and the additional types.
586 \textit{Types are not required to be placed in type units. In general,
587 only large types such as structure, class, enumeration, and
588 union types included from header files should be considered
589 for separate type units. Base types and other small types
590 are not usually worth the overhead of placement in separate
591 type units. Types that are unlikely to be replicated, such
592 as those defined in the main source file, are also better
593 left in the main compilation unit.}F
595 \section{Module, Namespace and Importing Entries}
596 \textit{Modules and namespaces provide a means to collect related
597 entities into a single entity and to manage the names of
600 \subsection{Module Entries}
601 \label{chap:moduleentries}
602 \textit{Several languages have the concept of a \doublequote{module.}
603 \addtoindexx{Modula-2}
604 A Modula\dash 2 definition module
605 \addtoindexx{Modula-2!definition module}
606 may be represented by a module
608 \addtoindex{declaration attribute}
609 (\DWATdeclaration). A
610 \addtoindex{Fortran 90} module
611 \addtoindexx{Fortran!module (Fortran 90)}
612 may also be represented by a module entry
613 (but no declaration attribute is warranted because \addtoindex{Fortran}
614 has no concept of a corresponding module body).}
616 A module is represented by a debugging information entry
618 tag \DWTAGmoduleTARG.
619 Module entries may own other
620 debugging information entries describing program entities
621 whose declaration scopes end at the end of the module itself.
623 If the module has a name, the module entry has a
624 \DWATname{} attribute
625 \addtoindexx{name attribute}
626 whose value is a null\dash terminated string containing
627 the module name as it appears in the source program.
629 The \addtoindex{module entry} may have either a
633 \addtoindexx{high PC attribute}
635 \addtoindexx{low PC attribute}
637 \DWATranges{} attribute
638 \addtoindexx{ranges attribute}
639 whose values encode the contiguous or non\dash contiguous address
640 ranges, respectively, of the machine instructions generated for
641 the module initialization code
642 (see Section \refersec{chap:codeaddressesandranges}).
643 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
645 \addtoindexx{entry PC attribute!for module initialization}
647 \DWATentrypc{} attribute whose value is the address of
648 the first executable instruction of that initialization code
649 (see Section \refersec{chap:entryaddress}).
652 \hypertarget{chap:DWATprioritymodulepriority}{}
653 the module has been assigned a priority, it may have a
654 \addtoindexx{priority attribute}
655 \DWATpriorityDEFN{} attribute.
656 The value of this attribute is a
657 reference to another debugging information entry describing
658 a variable with a constant value. The value of this variable
659 is the actual constant value of the module\textquoteright s priority,
660 represented as it would be on the target architecture.
662 \subsection{Namespace Entries}
663 \label{chap:namespaceentries}
664 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
665 \addtoindexx{namespace (C++)}
666 implement name hiding, so that names of unrelated things
667 do not accidentally clash in the
668 \addtoindex{global namespace} when an
669 application is linked together.}
671 A namespace is represented by a debugging information entry
673 tag \DWTAGnamespaceTARG.
674 A namespace extension is
675 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
677 \DWTAGnamespaceNAME{} entry
679 \addtoindexx{extension attribute}
682 attribute referring to the previous extension, or if there
683 is no previous extension, to the original
684 \DWTAGnamespaceNAME{}
685 entry. A namespace extension entry does not need to duplicate
686 information in a previous extension entry of the namespace
687 nor need it duplicate information in the original namespace
688 entry. (Thus, for a namespace with a name,
689 a \DWATname{} attribute
690 \addtoindexx{name attribute}
691 need only be attached directly to the original
692 \DWTAGnamespaceNAME{} entry.)
695 Namespace and namespace extension entries may own
696 \addtoindexx{namespace extension entry}
698 \addtoindexx{namespace declaration entry}
699 debugging information entries describing program entities
700 whose declarations occur in the namespace.
702 \textit{For \addtoindex{C++}, such
703 owned program entities may be declarations,
704 including certain declarations that are also object or
705 function definitions.}
707 A namespace may have a
708 \DWATexportsymbolsDEFN{}\livetarg{chap:DWATexportsymbolsofnamespace}{}
709 attribute\addtoindexx{export symbols attribute}
710 \addtoindexx{inline namespace|see{\textit{also} export symbols attribute}}
711 which indicates that all member names defined within the
712 namespace may be referenced as if they were defined within
713 the containing namespace.
715 \textit{This may be used to describe an \addtoindex{inline namespace} in \addtoindex{C++}}.
717 If a type, variable, or function declared in a namespace is
718 defined outside of the body of the namespace declaration,
719 that type, variable, or function definition entry has a
720 \DWATspecification{} attribute
721 \addtoindexx{specification attribute}
722 whose value is a \livelink{chap:classreference}{reference} to the
723 debugging information entry representing the declaration of
724 the type, variable or function. Type, variable, or function
726 \DWATspecification{} attribute
727 \addtoindexx{specification attribute}
729 to duplicate information provided by the declaration entry
730 referenced by the specification attribute.
732 \textit{The \addtoindex{C++} \addtoindex{global namespace}
734 \addtoindexx{global namespace|see{namespace (C++), global}}
736 \addtoindexx{namespace (C++)!global}
738 \texttt{::f}, for example) is not explicitly represented in
739 DWARF with a namespace entry (thus mirroring the situation
740 in \addtoindex{C++} source).
741 Global items may be simply declared with no
742 reference to a namespace.}
744 \textit{The \addtoindex{C++}
745 compilation unit specific \doublequote{unnamed namespace} may
746 \addtoindexx{namespace (C++)!unnamed}
747 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
748 be represented by a namespace entry with no name attribute in
749 the original namespace declaration entry (and therefore no name
750 attribute in any namespace extension entry of this namespace).
753 \textit{A compiler emitting namespace information may choose to
754 explicitly represent namespace extensions, or to represent the
755 final namespace declaration of a compilation unit; this is a
756 quality\dash of\dash implementation issue and no specific requirements
757 are given here. If only the final namespace is represented,
758 \addtoindexx{namespace (C++)!using declaration}
759 it is impossible for a debugger to interpret using declaration
760 references in exactly the manner defined by the
761 \addtoindex{C++} language.
764 \textit{Emitting all namespace declaration information in all
765 compilation units can result in a significant increase in the
766 size of the debug information and significant duplication of
767 information across compilation units.
768 The \addtoindex{C++} namespace std,
770 \addtoindexx{namespace (C++)!std}
771 is large and will probably be referenced in
772 every \addtoindex{C++} compilation unit.
775 \textit{For \addtoindex{C++} namespace examples,
776 see Appendix \refersec{app:namespaceexamples}.
781 \subsection{Imported (or Renamed) Declaration Entries}
782 \label{chap:importedorrenameddeclarationentries}
783 \textit{Some languages support the concept of importing into or making
784 accessible in a given unit declarations made in a different
785 module or scope. An imported declaration may sometimes be
789 An imported declaration is represented by one or
790 \addtoindexx{imported declaration entry}
791 more debugging information entries with the
792 tag \DWTAGimporteddeclarationTARG.
794 \hypertarget{chap:DWATimportimporteddeclaration}{}
796 is imported, there is one imported declaration entry for
798 \addtoindexx{import attribute}
799 Each imported declaration entry has a
800 \DWATimportDEFN{} attribute,
801 whose value is a \livelink{chap:classreference}{reference} to the
802 debugging information entry representing the declaration that
805 An imported declaration may also have a
808 \addtoindexx{name attribute}
809 whose value is a null-terminated string containing the
810 name, as it appears in the source program, by which the
811 imported entity is to be known in the context of the imported
812 declaration entry (which may be different than the name of
813 the entity being imported). If no name is present, then the
814 name by which the entity is to be known is the same as the
815 name of the entity being imported.
817 An imported declaration entry with a name attribute may be
818 used as a general means to rename or provide an alias for
819 \addtoindexx{alias declaration|see{imported declaration entry}}
820 an entity, regardless of the context in which the importing
821 declaration or the imported entity occurs.
823 \textit{A \addtoindex{C++} namespace alias may be represented
825 \hypertarget{chap:DWATimportnamespacealias}{}
827 \addtoindexx{namespace (C++)!alias}
828 with a name attribute whose value is
829 a null-terminated string containing the alias name as it
830 appears in the source program and a \DWATimportDEFN{} attribute
831 whose value is a \livelink{chap:classreference}{reference} to the
832 applicable original namespace or namespace extension entry.
835 \textit{A \addtoindex{C++} using declaration may be represented
837 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
839 \addtoindexx{namespace (C++)!using declaration}
840 declaration entries. When the using declaration
841 refers to an overloaded function, there is one imported
842 declaration entry corresponding to each overloading. Each
843 imported declaration entry has no name attribute but it does
844 have a \DWATimportDEFN{} attribute that refers to the entry for the
845 entity being imported. (\addtoindex{C++}
846 provides no means to \doublequote{rename}
847 an imported entity, other than a namespace).}
850 \textit{A \addtoindex{Fortran} use statement
851 \addtoindexx{Fortran!use statement}
852 \addtoindexx{use statement|see {Fortran, use statement}}
853 with an \doublequote{only list} may be
854 represented by a series of imported declaration entries,
855 one (or more) for each entity that is imported. An entity
856 \addtoindexx{renamed declaration|see{imported declaration entry}}
857 that is renamed in the importing context may be represented
858 by an imported declaration entry with a name attribute that
859 specifies the new local name.
862 \subsection{Imported Module Entries}
863 \label{chap:importedmoduleentries}
865 \textit{Some languages support the concept of importing into or making
866 accessible in a given unit all of the declarations contained
867 within a separate module or namespace.
870 An imported module declaration is represented by a debugging
871 information entry with
872 \addtoindexx{imported module attribute}
874 \addtoindexx{imported module entry}
875 tag \DWTAGimportedmoduleTARG.
877 imported module entry contains a
878 \DWATimport{} attribute
879 \addtoindexx{import attribute}
880 whose value is a \livelink{chap:classreference}{reference}
881 to the module or namespace entry
882 containing the definition and/or declaration entries for
883 the entities that are to be imported into the context of the
884 imported module entry.
886 An imported module declaration may own a set of imported
887 declaration entries, each of which refers to an entry in the
888 module whose corresponding entity is to be known in the context
889 of the imported module declaration by a name other than its
890 name in that module. Any entity in the module that is not
891 renamed in this way is known in the context of the imported
892 module entry by the same name as it is declared in the module.
894 \textit{A \addtoindex{C++} using directive
895 \addtoindexx{namespace (C++)!using directive}
896 \addtoindexx{using directive|see {namespace (C++), using directive}}
897 may be represented by an imported module
898 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
899 entry, with a \DWATimportDEFN{} attribute referring to the namespace
900 entry of the appropriate extension of the namespace (which
901 might be the original namespace entry) and no owned entries.
904 \textit{A \addtoindex{Fortran} use statement
905 \addtoindexx{Fortran!use statement}
906 with a \doublequote{rename list} may be
907 represented by an imported module entry with an import
908 attribute referring to the module and owned entries
909 corresponding to those entities that are renamed as part of
913 \textit{A \addtoindex{Fortran} use statement
914 \addtoindexx{Fortran!use statement}
915 with neither a \doublequote{rename list} nor
916 an \doublequote{only list} may be represented by an imported module
917 entry with an import attribute referring to the module and
918 no owned child entries.
921 \textit{A use statement with an \doublequote{only list} is represented by a
922 series of individual imported declaration entries as described
923 in Section \refersec{chap:importedorrenameddeclarationentries}.
927 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
928 \addtoindexx{Fortran!use statement}
929 itself imported by a use statement without an explicit mention
930 may be represented by an imported declaration entry that refers
931 to the original debugging information entry. For example, given
948 \textit{the imported declaration entry for Q within module C refers
949 directly to the variable declaration entry for X in module A
950 because there is no explicit representation for X in module B.
953 \textit{A similar situation arises for a \addtoindex{C++} using declaration
954 \addtoindexx{namespace (C++)!using declaration}
955 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
956 that imports an entity in terms of a namespace alias. See
957 Appendix \refersec{app:namespaceexamples}
961 \subsection{Imported Unit Entries}
962 \label{chap:importedunitentries}
964 \hypertarget{chap:DWATimportimportedunit}{}
965 place where a normal or partial unit is imported is
966 represented by a debugging information entry with the
967 \addtoindexx{imported unit entry}
968 tag \DWTAGimportedunitTARG.
969 An imported unit entry contains
970 \addtoindexx{import attribute}
972 \DWATimportDEFN{} attribute
973 whose value is a \livelink{chap:classreference}{reference} to the
974 normal or partial compilation unit whose declarations logically
975 belong at the place of the imported unit entry.
977 \textit{An imported unit entry does not necessarily correspond to
978 any entity or construct in the source program. It is merely
979 \doublequote{glue} used to relate a partial unit, or a compilation
980 unit used as a partial unit, to a place in some other
983 \section{Subroutine and Entry Point Entries}
984 \label{chap:subroutineandentrypointentries}
986 The following tags exist to describe
987 debugging information entries
988 \addtoindexx{function entry|see{subroutine entry}}
990 \addtoindexx{subroutine entry}
992 \addtoindexx{subprogram entry}
994 % FIXME: is entry point entry the right index 'entry'?
995 \addtoindexx{entry point entry}
998 \begin{tabular}{lp{9.0cm}}
999 \DWTAGsubprogramTARG{} & A subroutine or function \\
1000 \DWTAGinlinedsubroutine{} & A particular inlined
1001 \addtoindexx{inlined subprogram entry}
1002 instance of a subroutine or function \\
1003 \DWTAGentrypointTARG{} & An alternate entry point \\
1008 \subsection{General Subroutine and Entry Point Information}
1009 \label{chap:generalsubroutineandentrypointinformation}
1010 The subroutine or entry point entry has a \DWATname{}
1011 attribute whose value is a null-terminated string containing the
1012 subroutine or entry point name as it appears in the source program.
1013 It may also have a \DWATlinkagename{} attribute as
1014 described in Section \refersec{chap:linkagenames}.
1016 If the name of the subroutine described by an entry with the
1017 \addtoindexx{subprogram entry}
1018 tag \DWTAGsubprogram{}
1019 is visible outside of its containing
1020 \hypertarget{chap:DWATexternalexternalsubroutine}{}
1021 compilation unit, that entry has
1022 \addtoindexx{external attribute}
1024 \DWATexternalDEFN{} attribute,
1025 which is a \livelink{chap:classflag}{flag}.
1027 \textit{Additional attributes for functions that are members of a
1028 class or structure are described in
1029 Section \refersec{chap:memberfunctionentries}.
1033 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
1036 \DWATmainsubprogramDEFN{}
1038 \addtoindexx{main subprogram attribute}
1040 a \CLASSflag{} whose presence indicates that the
1041 subroutine has been identified as the starting function of
1042 the program. If more than one subprogram contains this
1044 any one of them may be the starting subroutine of the program.
1046 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1047 which is used to specify
1048 and provide a user\dash supplied name for the main subroutine of
1052 \subsubsection{Calling Convention Information}
1053 A subroutine entry may
1054 \hypertarget{chap:DWATcallingconventionforsubprograms}{}
1056 \DWATcallingconventionDEFN{}
1057 \addtoindexx{calling convention attribute!for subprogram}
1058 attribute, whose value is an
1059 \livelink{chap:classconstant}{integer constant}. The set of
1060 \addtoindexi{calling convention codes for subroutines}{calling convention codes!for subroutines}
1061 is given in Table \refersec{tab:callingconventioncodesforsubroutines}.
1063 \begin{simplenametable}[1.4in]{Calling convention codes for subroutines}{tab:callingconventioncodesforsubroutines}
1067 \end{simplenametable}
1069 If this attribute is not present, or its value is the constant
1070 \DWCCnormalTARG, then the subroutine may be safely called by
1071 obeying the \doublequote{standard} calling conventions of the target
1072 architecture. If the value of the calling convention attribute
1073 is the constant \DWCCnocallTARG, the subroutine does not obey
1074 standard calling conventions, and it may not be safe for the
1075 debugger to call this subroutine.
1077 \textit{Note that \DWCCnormal{} is also used as a calling convention
1078 code for certain types
1079 (see Table \refersec{tab:callingconventioncodesfortypes}).}
1081 If the semantics of the language of the compilation unit
1082 containing the subroutine entry distinguishes between ordinary
1083 subroutines and subroutines that can serve as the \doublequote{main
1084 program,} that is, subroutines that cannot be called
1085 directly according to the ordinary calling conventions,
1086 then the debugging information entry for such a subroutine
1087 may have a calling convention attribute whose value is the
1088 constant \DWCCprogramTARG.
1090 \textit{A common debugger feature is to allow the debugger user to call
1091 a subroutine within the subject program. In certain cases,
1092 however, the generated code for a subroutine will not obey
1093 the standard calling conventions for the target architecture
1094 and will therefore not be safe to call from within a debugger.}
1096 \textit{The \DWCCprogram{}
1097 value is intended to support \addtoindex{Fortran} main
1098 \addtoindexx{Fortran!main program}
1099 programs which in some implementations may not be callable
1100 or which must be invoked in a special way. It is not intended
1101 as a way of finding the entry address for the program.}
1104 \subsubsection{Miscellaneous Subprogram Properties}
1105 \textit{In \addtoindex{C}
1106 there is a difference between the types of functions
1107 declared using function prototype style declarations and
1108 those declared using non\dash prototype declarations.}
1110 A subroutine entry declared with a function prototype style
1111 declaration may have
1112 \addtoindexx{prototyped attribute}
1114 \DWATprototypedNAME{} attribute, which is
1117 \textit{The \addtoindex{Fortran}
1118 language allows the keywords \texttt{elemental}, \texttt{pure}
1119 and \texttt{recursive} to be included as part of the declaration of
1120 a subroutine; these attributes reflect that usage. These
1121 attributes are not relevant for languages that do not support
1122 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1123 attribute is neither needed nor appropriate in languages such
1125 where functions support recursion by default.
1128 A subprogram entry may have a
1129 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1130 \DWATelementalDEFN{} attribute,\addtoindexx{elemental attribute}
1131 which is a \livelink{chap:classflag}{flag}.
1132 The attribute indicates whether the subroutine
1133 or entry point was declared with the \doublequote{elemental} keyword
1137 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1138 subprogram entry may have
1139 \addtoindexx{pure attribute}
1141 \DWATpureDEFN{} attribute, which is
1142 a \livelink{chap:classflag}{flag}.
1143 The attribute indicates whether the subroutine was
1144 declared with the \doublequote{pure} keyword or property.
1147 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1148 subprogram entry may have a
1149 \DWATrecursiveDEFN{} attribute, which
1150 is a \livelink{chap:classflag}{flag}.
1151 The attribute indicates whether the subroutine
1152 or entry point was declared with the \doublequote{recursive} keyword
1155 A subprogram entry may have a
1157 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1158 which is a \CLASSflag. The attribute
1159 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1160 indicating that the subprogram can be called, but will never return to its caller.
1162 \subsubsection{Call Site-Related Attributes}
1163 \textit{While subprogram attributes in the pervious section provide
1164 information about the subprogram and it's entry point(s) as a whole,
1165 the following attributes provide summary information about the calls
1166 that occur within a subprogram.}
1168 A subroutine entry may have \DWATcallalltailcallsNAME,
1169 \DWATcallallcallsNAME{} and/or \DWATcallallsourcecallsNAME{}
1170 attributes, each of which is a
1171 \livelink{chap:classflag}{flag}.
1172 \addtoindexx{call site summary information}
1173 \addtoindexx{subroutine call site summary attributes}
1174 These flags indicate the completeness of the call site
1175 information provided by call site entries (see
1176 Section \refersec{chap:callsiteentries}) within the subprogram.
1178 The \DWATcallalltailcallsDEFN{}
1179 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1180 indicates that every tail call
1181 that occurs in the code for the subprogram is described by a
1182 \DWTAGcallsite{} entry.
1183 (There may or may not be other non-tail calls to some of the same
1184 target subprograms.)
1186 The \DWATcallallcallsDEFN{}
1187 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1188 indicates that every non-inlined call
1189 (either a tail call or a normal call) that occurs in the code for the subprogram
1190 is described by a \DWTAGcallsite{} entry.
1192 The \DWATcallallsourcecallsDEFN{}
1193 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1194 indicates that every call that occurs in the
1195 code for the subprogram, including every call inlined into it, is described by either a
1196 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1197 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1198 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1200 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1201 information format consumers that analyse call graphs.}
1203 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1204 \DWATcallallcalls{} and \DWATcallalltailcalls{} attributes are necessarily also true, and
1205 those attributes need not be present. Similarly, if the value of the
1206 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1207 attribute is also true and the latter attribute need not be present.
1210 \subsection{Subroutine and Entry Point Return Types}
1211 \label{chap:subroutineandentrypointreturntypes}
1214 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1215 the subroutine or entry point
1216 \addtoindexx{return type of subroutine}
1217 is a function that returns a
1218 value, then its debugging information entry has
1219 \addtoindexx{type attribute}
1220 a \DWATtypeDEFN{} attribute
1221 to denote the type returned by that function.
1223 \textit{Debugging information entries for
1224 \addtoindex{C} void functions should
1225 not have an attribute for the return type. }
1227 \textit{Debugging information entries for declarations of \addtoindex{C++}
1228 member functions with an
1229 \autoreturntype{} specifier should use an unspecified type entry (see
1230 Section \refersec{chap:unspecifiedtypeentries}).
1231 The debugging information entry for the corresponding definition
1232 should provide the deduced return type. This practice causes the description of
1233 the containing class to be consistent across compilation units, allowing the class
1234 declaration to be placed into a separate type unit if desired.}
1237 \subsection{Subroutine and Entry Point Locations}
1238 \label{chap:subroutineandentrypointlocations}
1240 A subroutine entry may have either a \DWATlowpc{} and
1241 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1242 \addtoindexx{ranges attribute}
1244 \addtoindexx{high PC attribute}
1246 \addtoindexx{low PC attribute}
1247 encode the contiguous or non\dash contiguous address
1248 ranges, respectively, of the machine instructions generated
1249 for the subroutine (see
1250 Section \refersec{chap:codeaddressesandranges}).
1253 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1254 subroutine entry may also have
1255 \addtoindexx{entry PC attribute!for subroutine}
1257 \DWATentrypc{} attribute
1258 whose value is the address of the first executable instruction
1259 of the subroutine (see
1260 Section \refersec{chap:entryaddress}).
1262 An entry point has a \DWATlowpc{} attribute whose value is the
1263 relocated address of the first machine instruction generated
1264 for the entry point.
1267 \DWATentrypc{} attribute
1268 \addtoindexx{entry pc attribute!for subroutine}
1270 also seem appropriate
1271 for this purpose, historically the
1272 \DWATlowpc{} attribute
1274 \DWATentrypc{} was introduced (in
1275 \addtoindex{DWARF Version 3}).
1276 There is insufficient reason to change this.}
1282 \addtoindexx{address class attribute}
1284 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1288 \DWATaddressclassDEFN{} attributes,
1289 as appropriate, to specify
1290 which segments the code for the subroutine resides in and
1291 the addressing mode to be used in calling that subroutine.
1293 A subroutine entry representing a subroutine declaration
1294 that is not also a definition does not have code address or
1298 \subsection{Declarations Owned by Subroutines and Entry Points}
1299 \label{chap:declarationsownedbysubroutinesandentrypoints}
1300 \addtoindexx{subroutine formal parameters}
1301 The declarations enclosed by a subroutine or entry point are
1302 represented by debugging information entries that are owned
1303 by the subroutine or entry point entry. Entries representing
1304 \addtoindexx{formal parameter}
1305 the formal parameters of the subroutine or entry point appear
1306 in the same order as the corresponding declarations in the
1310 \textit{There is no ordering requirement for entries for declarations
1311 other than formal parameters. The formal parameter
1312 entries may be interspersed with other entries used by formal
1313 parameter entries, such as type entries.}
1315 The unspecified (sometimes called \doublequote{varying})
1316 parameters of a subroutine parameter list are
1317 represented by a debugging information
1318 entry\addtoindexx{unspecified parameters entry}
1319 with the tag \DWTAGunspecifiedparametersTARG.
1322 The entry for a subroutine that includes a
1323 \addtoindex{Fortran}
1324 \addtoindexx{Fortran!common block}
1325 \livelink{chap:fortrancommonblock}{common}
1326 \livelink{chap:commonblockentry}{block}
1327 \addtoindexx{common block|see{Fortran common block}}
1328 has a child entry with the
1329 tag \DWTAGcommoninclusionTARG.
1331 \hypertarget{chap:commonreferencecommonblockusage}{}
1332 common inclusion entry has a
1333 \DWATcommonreferenceDEFN{} attribute
1334 \addtoindexx{common block reference attribute}
1335 whose value is a \livelink{chap:classreference}{reference}
1336 to the debugging information entry
1337 for the common \nolink{block} being included
1338 (see Section \refersec{chap:commonblockentries}).
1340 \subsection{Low-Level Information}
1341 \label{chap:lowlevelinformation}
1344 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1345 subroutine or entry point entry may have a
1346 \addtoindexx{return address attribute}
1347 \DWATreturnaddrDEFN{}
1348 attribute, whose value is a location description. The location
1349 specified is the place where the return address for the
1350 subroutine or entry point is stored.
1353 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1354 subroutine or entry point entry may also have
1355 \addtoindexx{frame base attribute}
1357 \DWATframebaseDEFN{} attribute, whose value is a location
1358 description that describes the \doublequote{frame base} for the
1359 subroutine or entry point. If the location description is
1360 a simple register location description, the given register
1361 contains the frame base address. If the location description is
1362 a DWARF expression, the result of evaluating that expression
1363 is the frame base address. Finally, for a
1364 \addtoindex{location list},
1365 this interpretation applies to each location description
1366 contained in the list of \addtoindex{location list} entries.
1368 \textit{The use of one of the \DWOPregn{}
1370 context is equivalent to using
1373 compact. However, these are not equivalent in general.}
1376 \textit{The frame base for a subprogram is typically an address
1377 relative to the first unit of storage allocated for the
1378 subprogram\textquoteright s stack frame. The \DWATframebase{} attribute
1379 can be used in several ways:}
1380 \begin{enumerate}[1. ]
1381 \item \textit{In subprograms that need
1382 \addtoindexx{location list}
1383 location lists to locate local
1384 variables, the \DWATframebase{} can hold the needed location
1385 list, while all variables\textquoteright\ location descriptions can be
1386 simpler ones involving the frame base.}
1388 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1389 within nested routines.
1390 (See also \DWATstaticlink, below)}
1394 \textit{Some languages support nested subroutines. In such languages,
1395 it is possible to reference the local variables of an
1396 outer subroutine from within an inner subroutine. The
1397 \DWATstaticlink{} and \DWATframebase{} attributes allow
1398 debuggers to support this same kind of referencing.}
1401 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1403 \addtoindexx{address!uplevel|see {static link attribute}}
1404 \addtoindexx{uplevel address|see {static link attribute}}
1405 subroutine or entry point is nested, it may have a
1406 \DWATstaticlinkDEFN{}
1407 attribute, whose value is a location
1408 description that computes the frame base of the relevant
1409 instance of the subroutine that immediately encloses the
1410 subroutine or entry point.
1412 In the context of supporting nested subroutines, the
1413 \DWATframebase{} attribute value should obey the following
1416 \begin{enumerate}[1. ]
1417 \item It should compute a value that does not change during the
1418 life of the subprogram, and
1420 \item The computed value should be unique among instances of
1421 the same subroutine. (For typical \DWATframebase{} use, this
1422 means that a recursive subroutine\textquoteright s stack frame must have
1423 non\dash zero size.)
1426 \textit{If a debugger is attempting to resolve an up\dash level reference
1427 to a variable, it uses the nesting structure of DWARF to
1428 determine which subroutine is the lexical parent and the
1429 \DWATstaticlink{} value to identify the appropriate active
1430 frame of the parent. It can then attempt to find the reference
1431 within the context of the parent.}
1435 \subsection{Types Thrown by Exceptions}
1436 \label{chap:typesthrownbyexceptions}
1438 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1439 it may validly throw.}
1441 If a subroutine explicitly declares that it may throw
1442 \addtoindexx{exception thrown|see{thrown type entry}}
1444 \addtoindexx{thrown exception|see{thrown type entry}}
1445 exception of one or more types, each such type is
1446 represented by a debugging information entry with
1447 \addtoindexx{thrown type entry}
1449 \DWTAGthrowntypeTARG.
1450 Each such entry is a child of the entry
1451 representing the subroutine that may throw this type. Each
1452 thrown type entry contains
1453 \addtoindexx{type attribute}
1454 a \DWATtype{} attribute, whose
1455 value is a \livelink{chap:classreference}{reference}
1456 to an entry describing the type of the
1457 exception that may be thrown.
1459 \subsection{Function Template Instantiations}
1460 \label{chap:functiontemplateinstantiations}
1462 \textit{In \addtoindex{C++}, a function template is a generic definition of
1463 a function that is instantiated differently for calls with
1464 values of different types. DWARF does not represent the generic
1465 template definition, but does represent each instantiation.}
1468 A \addtoindex{function template instantiation}\addtoindexx{template instantiation!function}
1469 is represented by a debugging information entry with the
1470 \addtoindexx{subprogram entry!use for template instantiation}
1471 tag \DWTAGsubprogram.
1473 exceptions, such an entry will contain the same attributes and
1474 will have the same types of child entries as would an entry
1475 for a subroutine defined explicitly using the instantiation
1476 types and values. The exceptions are:
1478 \begin{enumerate}[1. ]
1479 \item Template parameters are described and referenced as specified in
1480 Section \refersec{chap:templateparameters}.
1483 \item If the compiler has generated a special compilation unit
1484 to hold the template instantiation and that compilation unit
1485 has a different name from the compilation unit containing
1486 the template definition, the name attribute for the debugging
1487 information entry representing that compilation unit is empty
1490 \item If the subprogram entry representing the template
1491 instantiation or any of its child entries contain declaration
1492 coordinate attributes, those attributes refer to the source
1493 for the template definition, not to any source generated
1494 artificially by the compiler for this instantiation.
1499 \subsection{Inlinable and Inlined Subroutines}
1500 \label{chap:inlinedsubroutines}
1501 A declaration or a definition of an inlinable subroutine
1502 is represented by a debugging information entry with the
1506 \addtoindexx{subprogram entry!use in inlined subprogram}
1508 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1509 explicitly declared to be available for inline expansion or
1510 that was expanded inline implicitly by the compiler has
1511 \addtoindexx{inline attribute}
1513 \DWATinlineDEFN{} attribute whose value is an
1514 \livelink{chap:classconstant}{integer constant}. The
1515 set of values for the \DWATinline{} attribute is given in
1516 Table \refersec{tab:inlinecodes}.
1520 \caption{Inline codes}
1521 \label{tab:inlinecodes}
1522 \begin{tabular}{l|P{8cm}}
1524 Name&Meaning\\ \hline
1525 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1526 \mbox{compiler} (equivalent to the absence of the
1527 containing \DWATinline{} attribute) \\
1528 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1529 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1530 not inlined by the \mbox{compiler} \\
1531 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1537 \textit{In \addtoindex{C++}, a function or a constructor declared with
1538 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1539 instance (see below) is represented by a debugging information
1540 entry with the tag \DWTAGsubprogram. Such an entry has a
1541 \DWATinline{} attribute whose value is \DWINLinlined.}
1544 \subsubsection{Abstract Instances}
1545 \label{chap:abstractinstances}
1546 Any subroutine entry that contains a
1547 \DWATinlineDEFN{} attribute\addtoindexx{inline attribute}
1548 whose value is other than
1551 \doublequote{abstract instance root.}\addtoindexx{abstract instance!root}
1552 \hypertarget{chap:DWATinlineabstracttinstance}{}
1553 Any debugging information entry that is owned (either
1554 directly or indirectly) by an abstract instance root
1556 \doublequote{abstract instance entry.}\addtoindexx{abstract instance!entry}
1557 Any set of abstract instance entries that are all
1558 children (either directly or indirectly) of some abstract
1559 instance root, together with the root itself, is known as an
1560 \doublequote{abstract instance tree.}\addtoindexx{abstract instance!tree}
1561 However, in the case where an abstract instance tree is
1562 nested within another abstract instance tree, the entries in the
1563 \addtoindex{nested abstract instance}
1564 tree are not considered to be entries in the outer abstract
1567 Each abstract instance root is either part of a larger
1568 \addtoindexx{abstract instance!root}
1569 tree (which gives a context for the root) or
1570 \addtoindexx{specification attribute}
1572 \DWATspecification{}
1573 to refer to the declaration in context.
1575 \textit{For example, in \addtoindex{C++} the context might be a namespace
1576 declaration or a class declaration.}
1578 \textit{Abstract instance trees are defined so that no entry is part
1579 of more than one abstract instance tree. This simplifies the
1580 following descriptions.}
1582 A debugging information entry that is a member of an abstract
1583 instance tree should not contain any attributes which describe
1584 aspects of the subroutine which vary between distinct inlined
1585 expansions or distinct out\dash of\dash line expansions. For example,
1586 \addtoindexx{entry pc attribute!and abstract instance}
1597 \addtoindexx{location attribute!and abstract instance}
1599 \addtoindexx{ranges attribute!and abstract instance}
1601 \addtoindexx{high PC attribute!and abstract instance}
1603 \addtoindexx{low PC attribute!and abstract instance}
1605 \addtoindexx{segment attribute!and abstract instance}
1607 \addtoindexx{return address attribute!and abstract instance}
1609 \addtoindexx{segment attribute!and abstract instance}
1611 \addtoindexx{start scope attribute!and abstract instance}
1615 \textit{It would not make sense normally to put these attributes into
1616 abstract instance entries since such entries do not represent
1617 actual (concrete) instances and thus do not actually exist at
1618 run\dash time. However,
1619 see Appendix \refersec{app:inlineouteronenormalinner}
1620 for a contrary example.}
1622 The rules for the relative location of entries belonging to
1623 abstract instance trees are exactly the same as for other
1624 similar types of entries that are not abstract. Specifically,
1625 the rule that requires that an entry representing a declaration
1626 be a direct child of the entry representing the scope of the
1627 declaration applies equally to both abstract and non\dash abstract
1628 entries. Also, the ordering rules for formal parameter entries,
1629 member entries, and so on, all apply regardless of whether
1630 or not a given entry is abstract.
1633 \subsubsection{Concrete Inlined Instances}
1634 \label{chap:concreteinlinedinstances}
1636 Each inline expansion of a subroutine is represented
1637 by a debugging information entry with the
1638 tag \DWTAGinlinedsubroutineTARG.
1639 Each such entry should be a direct
1640 child of the entry that represents the scope within which
1641 the inlining occurs.
1644 Each inlined subroutine entry may have either a
1646 and \DWAThighpc{} pair
1648 \addtoindexx{high PC attribute}
1650 \addtoindexx{low PC attribute}
1652 \addtoindexx{ranges attribute}
1655 attribute whose values encode the contiguous or non\dash contiguous
1656 address ranges, respectively, of the machine instructions
1657 generated for the inlined subroutine (see
1658 Section \referfol{chap:codeaddressesandranges}).
1660 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1661 inlined subroutine entry may
1662 \addtoindexx{inlined subprogram entry!in concrete instance}
1664 \addtoindexx{inlined subprogram entry}
1666 \addtoindexx{entry PC attribute!for inlined subprogram}
1669 attribute, representing the first executable instruction of
1670 the inline expansion (see
1671 Section \refersec{chap:entryaddress}).
1673 % Positions of the 3 targets here is a bit arbitrary.
1675 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1677 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1679 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1680 may also have \DWATcallfileDEFN,
1681 \DWATcalllineDEFN{} and \DWATcallcolumnDEFN{} attributes,
1682 \addtoindexx{inlined call location attributes}
1684 value is an \livelink{chap:classconstant}{integer constant}.
1685 These attributes represent the
1686 source file, source line number, and source column number,
1687 respectively, of the first character of the statement or
1688 expression that caused the inline expansion. The call file,
1689 call line, and call column attributes are interpreted in
1690 the same way as the declaration file, declaration line, and
1691 declaration column attributes, respectively (see
1692 Section \refersec{chap:declarationcoordinates}).
1694 \textit{The call file, call line and call column coordinates do not
1695 describe the coordinates of the subroutine declaration that
1696 was inlined, rather they describe the coordinates of the call.
1699 An inlined subroutine entry
1700 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1702 \DWATconstexprDEFN{} attribute,\addtoindexx{constant expression attribute}
1703 which is a \livelink{chap:classflag}{flag}
1704 whose presence indicates that the
1705 subroutine has been evaluated as a compile\dash time constant. Such
1706 an entry may also have a \DWATconstvalue{} attribute,
1707 whose value may be of any form that is appropriate for the
1708 representation of the subroutine's return value. The value of
1709 this attribute is the actual return value of the subroutine,
1710 represented as it would be on the target architecture.
1712 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1713 \addttindex{constexpr}
1714 is called with constant expressions, then the corresponding
1715 concrete inlined instance has a
1716 \DWATconstexpr{} attribute,
1717 as well as a \DWATconstvalue{} attribute whose value represents
1718 the actual return value of the concrete inlined instance.}
1720 Any debugging information entry that is owned (either
1721 directly or indirectly) by a debugging information entry
1722 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1723 \doublequote{concrete inlined instance entry.} Any entry that has
1725 \DWTAGinlinedsubroutine{}
1726 is known as a \doublequote{concrete inlined instance root.}
1727 Any set of concrete inlined instance
1728 entries that are all children (either directly or indirectly)
1729 of some concrete inlined instance root, together with the root
1730 itself, is known as a \doublequote{concrete inlined instance tree.}
1731 However, in the case where a concrete inlined instance tree
1732 is nested within another concrete instance tree, the entries
1733 in the \addtoindex{nested concrete inline instance} tree
1734 are not considered to
1735 be entries in the outer concrete instance tree.
1738 \textit{Concrete inlined instance trees are defined so that no entry
1739 is part of more than one concrete inlined instance tree. This
1740 simplifies later descriptions.}
1742 Each concrete inlined instance tree is uniquely associated
1743 with one (and only one) abstract instance tree.
1745 \textit{Note, however, that the reverse is not true. Any given abstract
1746 instance tree may be associated with several different concrete
1747 inlined instance trees, or may even be associated with zero
1748 concrete inlined instance trees.}
1750 Concrete inlined instance entries may omit attributes that
1751 are not specific to the concrete instance (but present in
1752 the abstract instance) and need include only attributes that
1753 are specific to the concrete instance (but omitted in the
1754 abstract instance). In place of these omitted attributes, each
1755 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1756 concrete inlined instance entry
1757 \addtoindexx{abstract origin attribute}
1759 \DWATabstractoriginDEFN{}
1760 attribute that may be used to obtain the missing information
1761 (indirectly) from the associated abstract instance entry. The
1762 value of the abstract origin attribute is a reference to the
1763 associated abstract instance entry.
1765 If an entry within a concrete inlined instance tree contains
1766 attributes describing the
1767 \addtoindexx{declaration coordinates!in concrete instance}
1768 \livelink{chap:declarationcoordinates}{declaration coordinates}
1769 of that entry, then those attributes should refer to the file, line
1770 and column of the original declaration of the subroutine,
1771 not to the point at which it was inlined. As a consequence,
1772 they may usually be omitted from any entry that has an abstract
1776 For each pair of entries that are associated via a
1777 \addtoindexx{abstract origin attribute}
1778 \DWATabstractorigin{} attribute, both members of the pair
1779 have the same tag. So, for example, an entry with the tag
1780 \DWTAGvariable{} can only be associated with another entry
1781 that also has the tag \DWTAGvariable. The only exception
1782 to this rule is that the root of a concrete instance tree
1783 (which must always have the tag \DWTAGinlinedsubroutine)
1784 can only be associated with the root of its associated abstract
1785 instance tree (which must have the tag \DWTAGsubprogram).
1788 In general, the structure and content of any given concrete
1789 inlined instance tree will be closely analogous to the
1790 structure and content of its associated abstract instance
1791 tree. There are a few exceptions:
1793 \begin{enumerate}[1. ]
1794 \item An entry in the concrete instance tree may be omitted if
1796 \addtoindexx{abstract origin attribute}
1797 \DWATabstractorigin{} attribute and either
1798 has no children, or its children are omitted. Such entries
1799 would provide no useful information. In C\dash like languages,
1800 such entries frequently include types, including structure,
1801 union, class, and interface types; and members of types. If any
1802 entry within a concrete inlined instance tree needs to refer
1803 to an entity declared within the scope of the relevant inlined
1804 subroutine and for which no concrete instance entry exists,
1805 the reference should refer to the abstract instance entry.
1808 \item Entries in the concrete instance tree which are associated
1809 with entries in the abstract instance tree such that neither
1810 has a \DWATname{} attribute,
1811 \addtoindexx{name attribute}
1812 and neither is referenced by
1813 any other debugging information entry, may be omitted. This
1814 may happen for debugging information entries in the abstract
1815 instance trees that became unnecessary in the concrete instance
1816 tree because of additional information available there. For
1817 example, an anonymous variable might have been created and
1818 described in the abstract instance tree, but because of
1819 the actual parameters for a particular inlined expansion,
1820 it could be described as a constant value without the need
1821 for that separate debugging information entry.
1824 \item A concrete instance tree may contain entries which do
1825 not correspond to entries in the abstract instance tree
1826 to describe new entities that are specific to a particular
1827 inlined expansion. In that case, they will not have associated
1828 entries in the abstract instance tree, should not contain
1829 \addtoindexx{abstract origin attribute}
1830 \DWATabstractorigin{} attributes, and must contain all their
1831 own attributes directly. This allows an abstract instance tree
1832 to omit debugging information entries for anonymous entities
1833 that are unlikely to be needed in most inlined expansions. In
1834 any expansion which deviates from that expectation, the
1835 entries can be described in its concrete inlined instance tree.
1839 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1840 \label{chap:outoflineinstancesofinlinedsubroutines}
1841 Under some conditions, compilers may need to generate concrete
1842 executable instances of inlined subroutines other than at
1843 points where those subroutines are actually called. Such
1844 concrete instances of inlined subroutines are referred to as
1845 \doublequote{concrete out\dash of\dash line instances.}
1847 \textit{In \addtoindex{C++}, for example,
1848 taking the address of a function declared
1849 to be inline can necessitate the generation of a concrete
1850 out\dash of\dash line instance of the given function.}
1852 The DWARF representation of a concrete out-of-line instance
1853 of an inlined subroutine is essentially the same as for a
1854 concrete inlined instance of that subroutine (as described in
1855 the preceding section). The representation of such a concrete
1856 % It is critical that the hypertarget and livelink be
1857 % separated to avoid problems with latex.
1859 \addtoindexx{abstract origin attribute}
1861 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1863 \DWATabstractoriginDEFN{}
1864 attributes in exactly the same way as they are used for
1865 a concrete inlined instance (that is, as references to
1866 corresponding entries within the associated abstract instance
1869 The differences between the DWARF representation of a
1870 concrete out\dash of\dash line instance of a given subroutine and the
1871 representation of a concrete inlined instance of that same
1872 subroutine are as follows:
1873 \begin{enumerate}[1. ]
1874 \item The root entry for a concrete out\dash of\dash line instance
1875 of a given inlined subroutine has the same tag as does its
1876 associated (abstract) inlined subroutine entry (that is, tag
1877 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1879 \item The root entry for a concrete out\dash of\dash line instance tree
1880 is normally owned by the same parent entry that also owns
1881 the root entry of the associated abstract instance. However,
1882 it is not required that the abstract and out\dash of\dash line instance
1883 trees be owned by the same parent entry.
1887 \subsubsection{Nested Inlined Subroutines}
1888 \label{nestedinlinedsubroutines}
1889 Some languages and compilers may permit the logical nesting of
1890 a subroutine within another subroutine, and may permit either
1891 the outer or the nested subroutine, or both, to be inlined.
1893 For a non\dash inlined subroutine nested within an inlined
1894 subroutine, the nested subroutine is described normally in
1895 both the abstract and concrete inlined instance trees for
1896 the outer subroutine. All rules pertaining to the abstract
1897 and concrete instance trees for the outer subroutine apply
1898 also to the abstract and concrete instance entries for the
1902 For an inlined subroutine nested within another inlined
1903 subroutine, the following rules apply to their abstract and
1904 \addtoindexx{abstract instance!nested}
1905 \addtoindexx{concrete instance!nested}
1906 concrete instance trees:
1908 \begin{enumerate}[1. ]
1909 \item The abstract instance tree for the nested subroutine is
1910 described within the abstract instance tree for the outer
1911 subroutine according to the rules in
1912 Section \refersec{chap:abstractinstances}, and
1913 without regard to the fact that it is within an outer abstract
1916 \item Any abstract instance tree for a nested subroutine is
1917 always omitted within the concrete instance tree for an
1920 \item A concrete instance tree for a nested subroutine is
1921 always omitted within the abstract instance tree for an
1924 \item The concrete instance tree for any inlined or
1925 \addtoindexx{out-of-line instance}
1927 \addtoindexx{out-of-line instance|see{\textit{also} concrete out-of-line instance}}
1928 expansion of the nested subroutine is described within a
1929 concrete instance tree for the outer subroutine according
1931 Sections \refersec{chap:concreteinlinedinstances} or
1932 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1934 and without regard to the fact that it is within an outer
1935 concrete instance tree.
1938 See Appendix \refersec{app:inliningexamples}
1939 for discussion and examples.
1941 \subsection{Trampolines}
1942 \label{chap:trampolines}
1944 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1945 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1946 an intermediary in making a call to another subroutine. It may
1947 adjust parameters and/or the result (if any) as appropriate
1948 to the combined calling and called execution contexts.}
1950 A trampoline is represented by a debugging information entry
1951 \addtoindexx{trampoline (subprogram) entry}
1952 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1954 \addtoindexx{trampoline attribute}
1955 a \DWATtrampolineDEFN{} attribute.
1957 attribute indicates the target subroutine of the trampoline,
1958 that is, the subroutine to which the trampoline passes
1959 control. (A trampoline entry may but need not also have a
1960 \DWATartificial{} attribute.)
1963 The value of the trampoline attribute may be represented
1964 using any of the following forms, which are listed in order
1968 \item If the value is of class \CLASSreference{}, then the value
1969 specifies the debugging information entry of the target
1972 \item If the value is of class \CLASSaddress{}, then the value is
1973 the relocated address of the target subprogram.
1976 \item If the value is of class \CLASSstring{}, then the value is the
1977 (possibly mangled) \addtoindexx{mangled names}
1978 name of the target subprogram.
1980 \item If the value is of class \CLASSflag, then the value true
1981 indicates that the containing subroutine is a trampoline but
1982 that the target subroutine is not known.
1986 The target subprogram may itself be a trampoline. (A sequence
1987 of trampolines necessarily ends with a non\dash trampoline
1990 \textit{In \addtoindex{C++}, trampolines may be used to implement
1991 derived virtual member functions; such trampolines typically
1993 \texttt{this} parameter\index{this parameter@\texttt{this} parameter}
1994 in the course of passing control.
1995 Other languages and environments may use trampolines in a manner
1996 sometimes known as transfer functions or transfer vectors.}
1998 \textit{Trampolines may sometimes pass control to the target
1999 subprogram using a branch or jump instruction instead of a
2000 call instruction, thereby leaving no trace of their existence
2001 in the subsequent execution context. }
2003 \textit{This attribute helps make it feasible for a debugger to arrange
2004 that stepping into a trampoline or setting a breakpoint in
2005 a trampoline will result in stepping into or setting the
2006 breakpoint in the target subroutine instead. This helps to
2007 hide the compiler generated subprogram from the user. }
2009 \textit{If the target subroutine is not known, a debugger may choose
2010 to repeatedly step until control arrives in a new subroutine
2011 which can be assumed to be the target subroutine. }
2013 \subsection{Call Site Entries}
2014 \label{chap:callsiteentries}
2016 A call site entry provides a way to represent the static or dynamic
2017 call graph of a program in the debugging information. It also provides
2018 information about how parameters are passed so that they may be more
2019 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
2020 call site entries can be also useful for computing values of variables
2021 and expressions where some value is no longer present in the current
2022 subroutine's registers or local stack frame, but it is known that the
2023 values are equal to some parameter passed to the function.
2024 The consumer can then use unwind
2025 information to find the caller and it's call site information and then
2026 compute the value passed in a particular parameter.}
2028 A call site is represented by a debugging information entry with the tag
2029 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
2030 debugging information entry representing the scope within which the
2031 call is present in the source program.
2033 \textit{A scope entry (for example, for a lexical block) that would not
2034 otherwise be present in the debugging information of a subroutine
2035 need not be introduced solely to represent the immediately containing scope
2038 A source call can be compiled into different types of machine code:
2041 A \textit{normal call} uses a call-like instruction which transfers
2042 control to the start of some subprogram and leaves the call site
2043 location address somewhere where unwind information can find it.
2045 A \textit{tail call} uses a jump-like instruction which
2046 transfers control to the start of some subprogram, but the call site location
2047 address is not preserved (and thus not available using the unwind information).
2049 A \textit{tail recursion call} is a call
2050 to the current subroutine which is compiled as a jump into the middle of the
2054 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2055 where at least one instruction has the location of the inlined subprogram
2056 or any of its blocks or inlined subprograms.
2060 There are also different types of \doublequote{optimized out} calls:
2063 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2064 has not been emitted (such as, for example, the call to \texttt{foo} in
2065 \texttt{if (0) foo();}).
2067 An \textit{optimized out inline call}
2068 is a call to an inlined subprogram which either did not expand to any instructions
2069 or only parts of instructions belong to it and for debug information purposes those
2070 instructions are given a location in the caller.
2073 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2074 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2075 (see Section \refersec{chap:inlinedsubroutines}).
2077 The call site entry has a
2078 \DWATcallreturnpcDEFN{}
2079 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2080 which is the return address after the call.
2081 The value of this attribute corresponds to the return address computed by
2082 call frame information in the called subprogram
2083 (see Section \refersec{datarep:callframeinformation}).
2085 \textit{On many architectures the return address is the address immediately following the
2086 call instruction, but on architectures with delay slots it might
2087 be an address after the delay slot of the call.}
2089 The call site entry may have a
2091 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2092 address of the call instruction.
2094 If the call site entry corresponds to a tail call, it has the
2095 \DWATcalltailcallDEFN{}
2096 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2097 which is a \CLASSflag.
2099 The call site entry may have a
2100 \DWATcalloriginDEFN{}
2101 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2102 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2103 known it is a reference to the called subprogram's debugging
2104 information entry. For indirect calls it may be a reference to a
2105 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2106 the subroutine pointer that is called.
2109 The call site may have a
2110 \DWATcalltargetDEFN{}
2111 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2112 a DWARF expression. For indirect calls or jumps where it is unknown at
2113 compile time which subprogram will be called the expression computes the
2114 address of the subprogram that will be called. The DWARF expression should
2115 not use register or memory locations that might be clobbered by the call.
2118 The call site entry may have a
2119 \DWATcalltargetclobberedDEFN{}
2120 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2121 which is a DWARF expression. For indirect calls or jumps where the
2122 address is not computable without use of registers or memory locations that
2123 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2124 attribute is used instead of the \DWATcalltarget{} attribute.
2126 The call site entry may have a \DWATtypeDEFN{}
2127 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2128 referencing a debugging information entry for the type of the called function.
2130 \textit{When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.}
2132 The call site entry may have
2133 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2134 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2135 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2136 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2137 each of whose value is an integer constant.
2138 These attributes represent the source file, source line number, and source
2139 column number, respectively, of the first character of the call statement or
2140 expression. The call file, call line, and call column attributes are
2141 interpreted in the same way as the declaration file, declaration
2142 line, and declaration column attributes, respectively
2143 (see Section \refersec{chap:declarationcoordinates}).
2145 \textit{The call file, call line and call column coordinates do not describe the
2146 coordinates of the subroutine declaration that was called, rather they describe
2147 the coordinates of the call.}
2150 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2151 entries\index{call site parameter entry} representing the parameters passed to the call.
2152 Each such entry has a \DWATlocation{} attribute which is a location expression.
2153 This location expression describes where the parameter is passed
2154 (usually either some register, or a memory location expressible as the
2155 contents of the stack register plus some offset).
2157 Each \DWTAGcallsiteparameter{} entry may have a
2158 \DWATcallvalueDEFN{}
2159 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2160 which is a DWARF expression. This expression computes the value
2161 passed for that parameter. The expression should not use registers or memory
2162 locations that might be clobbered by the call, as it might be evaluated after
2163 unwinding from the called function back to the caller. If it is not
2164 possible to avoid registers or memory locations that might be clobbered by
2165 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2168 \textit{The reason for the restriction is that the value of the parameter may be
2169 needed in the middle of the callee, where the call clobbered registers or
2170 memory might be already clobbered, and if the consumer was not assured by
2171 the producer it can safely use those values, the consumer could not safely
2172 use the values at all.}
2174 For parameters passed by reference, where the code passes a pointer to
2175 a location which contains the parameter, or for reference type parameters
2176 the \DWTAGcallsiteparameter{} entry may also have
2177 \DWATcalldatalocationNAME{}
2178 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2179 whose value is a location expression and a
2180 \DWATcalldatavalueNAME{}
2181 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2182 whose value is a DWARF expression. The \DWATcalldatalocationDEFN{} attribute
2183 \addtoindexx{call data location attribute}
2184 describes where the referenced value lives during the call. If it is just
2185 \DWOPpushobjectaddress{}, it may be left out. The
2186 \DWATcalldatavalueNAME{} attribute\addtoindexx{call data value attribute}
2187 describes the value in that location.
2188 The expression should not use registers or memory
2189 locations that might be clobbered by the call, as it might be evaluated after
2190 unwinding from the called function back to the caller.
2193 Each call site parameter entry may also have a
2194 \DWATcallparameterDEFN{}
2195 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2196 which contains a reference to a \DWTAGformalparameter{} entry,
2197 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2198 attribute describing the parameter's name.
2202 \section{Lexical Block Entries}
2203 \label{chap:lexicalblockentries}
2206 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2208 \addtoindexx{lexical block}
2209 a bracketed sequence of source statements
2210 that may contain any number of declarations. In some languages
2211 (including \addtoindex{C} and \addtoindex{C++}),
2212 \nolink{blocks} can be nested within other
2213 \nolink{blocks} to any depth.}
2215 % We do not need to link to the preceding paragraph.
2216 A lexical \nolink{block} is represented by a debugging information
2218 tag \DWTAGlexicalblockTARG.
2220 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2222 either a \DWATlowpc{} and
2223 \DWAThighpc{} pair of
2225 \addtoindexx{high PC attribute}
2227 \addtoindexx{low PC attribute}
2229 \DWATranges{} attribute
2230 \addtoindexx{ranges attribute}
2231 whose values encode the contiguous or non-contiguous address
2232 ranges, respectively, of the machine instructions generated
2233 for the lexical \nolink{block}
2234 (see Section \refersec{chap:codeaddressesandranges}).
2237 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2238 lexical block entry may also have
2239 \addtoindexx{entry PC attribute!for lexical block}
2241 \DWATentrypc{} attribute
2242 whose value is the address of the first executable instruction
2243 of the lexical block (see
2244 Section \refersec{chap:entryaddress}).
2246 If a name has been given to the
2247 lexical \nolink{block}
2249 program, then the corresponding
2250 lexical \nolink{block} entry has a
2251 \DWATname{} attribute whose
2252 \addtoindexx{name attribute}
2253 value is a null\dash terminated string
2254 containing the name of the lexical \nolink{block}
2258 \textit{This is not the same as a \addtoindex{C} or
2259 \addtoindex{C++} label (see below).}
2261 The lexical \nolink{block} entry owns
2262 debugging information entries that
2263 describe the declarations within that lexical \nolink{block}.
2265 one such debugging information entry for each local declaration
2266 of an identifier or inner lexical \nolink{block}.
2269 \section{Label Entries}
2270 \label{chap:labelentries}
2271 \textit{A label is a way of identifying a source statement. A labeled
2272 statement is usually the target of one or more \doublequote{go to}
2277 A label is represented by a debugging information entry with
2278 \addtoindexx{label entry}
2280 tag \DWTAGlabelTARG.
2281 The entry for a label should be owned by
2282 the debugging information entry representing the scope within
2283 which the name of the label could be legally referenced within
2286 The label entry has a \DWATlowpc{} attribute whose value
2287 is the relocated address of the first machine instruction
2288 generated for the statement identified by the label in
2289 the source program. The label entry also has a
2290 \DWATname{} attribute
2291 \addtoindexx{name attribute}
2292 whose value is a null-terminated string containing
2293 the name of the label as it appears in the source program.
2296 \section{With Statement Entries}
2297 \label{chap:withstatemententries}
2299 \textit{Both \addtoindex{Pascal} and
2300 \addtoindexx{Modula-2}
2301 Modula\dash 2 support the concept of a \doublequote{with}
2302 statement. The with statement specifies a sequence of
2303 executable statements within which the fields of a record
2304 variable may be referenced, unqualified by the name of the
2307 A with statement is represented by a
2308 \addtoindexi{debugging information entry}{with statement entry}
2309 with the tag \DWTAGwithstmtTARG.
2311 A with statement entry may have either a
2313 \DWAThighpc{} pair of attributes
2314 \addtoindexx{high PC attribute}
2316 \addtoindexx{low PC attribute}
2317 a \DWATranges{} attribute
2318 \addtoindexx{ranges attribute}
2319 whose values encode the contiguous or non\dash contiguous address
2320 ranges, respectively, of the machine instructions generated
2321 for the with statement
2322 (see Section \refersec{chap:codeaddressesandranges}).
2325 \hypertarget{chap:DWATentrypcofwithstmt}{}
2326 with statement entry may also have
2327 \addtoindexx{entry PC attribute!for with statement}
2329 \DWATentrypc{} attribute
2330 whose value is the address of the first executable instruction
2331 of the with statement (see
2332 Section \refersec{chap:entryaddress}).
2335 The with statement entry has
2336 \addtoindexx{type attribute}
2337 a \DWATtype{} attribute, denoting
2338 the type of record whose fields may be referenced without full
2339 qualification within the body of the statement. It also has
2340 \addtoindexx{location attribute}
2341 a \DWATlocation{} attribute, describing how to find the base
2342 address of the record object referenced within the body of
2346 \section{Try and Catch Block Entries}
2347 \label{chap:tryandcatchblockentries}
2348 \livetarg{chap:tryandcatchblockentries}{}
2349 \textit{In \addtoindex{C++}, a \livelink{chap:lexicalblock}{lexical block} may be
2350 designated as a \doublequote{catch \nolink{block}.}
2351 A catch \nolink{block} is an exception handler that
2352 handles exceptions thrown by an immediately preceding
2353 \doublequote{try \nolink{block}.}
2354 A catch \nolink{block}
2355 designates the type of the exception that it can handle.}
2357 A \livetarg{chap:tryblock}{try block} is represented
2358 by a debugging information entry
2359 \addtoindexx{try block entry}
2360 with the tag \DWTAGtryblockTARG.
2361 A \livetarg{chap:catchblock}{catch block} is represented by
2362 a debugging information entry
2363 \addtoindexx{catch block entry}
2364 with the tag \DWTAGcatchblockTARG.
2366 % nolink as we have links just above and do not have a combo link for both
2367 Both try and catch \nolink{block} entries may have either a
2369 \DWAThighpc{} pair of attributes
2370 \addtoindexx{high PC attribute}
2372 \addtoindexx{low PC attribute}
2374 \DWATranges{} attribute
2375 \addtoindexx{ranges attribute}
2376 whose values encode the contiguous
2377 or non-contiguous address ranges, respectively, of the
2378 machine instructions generated for the \nolink{block}
2379 (see Section \refersec{chap:codeaddressesandranges}).
2381 \hypertarget{chap:DWATentrypcoftryblock}{}
2382 \hypertarget{chap:DWATentrypcofcatchblock}{}
2383 A try or catch block entry may also have
2384 \addtoindexx{entry PC attribute!for try block}
2385 \addtoindexx{entry PC attribute!for catch block}
2387 \DWATentrypc{} attribute
2388 whose value is the address of the first executable instruction
2389 of the try or catch block
2390 (see Section \refersec{chap:entryaddress}).
2393 Catch \nolink{block} entries have at least one child entry,
2394 an entry representing the type of exception accepted by
2395 that catch \nolink{block}.
2396 This child entry has one of the tags
2397 \DWTAGformalparameter{}\addtoindexx{formal parameter entry!in catch block}
2399 \DWTAGunspecifiedparameters{},\addtoindexx{unspecified parameters entry!in catch block}
2400 and will have the same form as other parameter entries.
2402 The siblings immediately following a try \nolink{block}
2403 entry are its corresponding catch \nolink{block} entries.