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
112 \addtoindexx{ranges attribute}
114 \DWATranges{} to specify the
115 \addtoindexx{ranges attribute}
116 default base address for use in
117 \addtoindexx{location list}
118 location lists (see Section
119 \refersec{chap:locationlists}) and range lists
120 \addtoindexx{range list}
121 (see Section \refersec{chap:noncontiguousaddressranges}).
123 \item A \DWATnameDEFN{} attribute
124 \addtoindexx{name attribute}
125 whose value is a null-terminated string
126 \hypertarget{chap:DWATnamepathnameofcompilationsource}{}
127 containing the full or relative path name of the primary
128 source file from which the compilation unit was derived.
130 \item A \DWATlanguageDEFN{} attribute
131 \addtoindexx{language attribute}
132 whose constant value is an
133 \hypertarget{chap:DWATlanguageprogramminglanguage}{}
135 \addtoindexx{language attribute}
136 indicating the source language of the compilation
137 unit. The set of language names and their meanings are given
138 in Table \refersec{tab:languagenames}.
141 \setlength{\extrarowheight}{0.1cm}
142 \begin{longtable}{l|l}
143 \caption{Language names} \label{tab:languagenames} \\
144 \hline \bfseries Language name & \bfseries Meaning \\ \hline
146 \bfseries Language name & \bfseries Meaning \\ \hline
148 \hline \emph{Continued on next page}
151 \addtoindexx{ISO-defined language names}
152 \DWLANGAdaeightythreeTARG{} \dag & ISO Ada:1983 \addtoindexx{Ada:1983 (ISO)} \\
153 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada:1995 (ISO)} \\
154 \DWLANGCTARG & Non-standardized C, such as K\&R \addtoindexx{C!non-standard}\\
155 \DWLANGCeightynineTARG & ISO C:1989 \addtoindexx{C:1989 (ISO)} \\
156 \DWLANGCninetynineTARG & ISO C:1999 \addtoindexx{C:1999 (ISO)} \\
157 \DWLANGCelevenTARG & ISO C:2011 \addtoindexx{C:2011 (ISO)} \\
158 \DWLANGCplusplusTARG & ISO C++:1998 \addtoindexx{C++:1998 (ISO)} \\
159 \DWLANGCpluspluszerothreeTARG & ISO C++:2003 \addtoindexx{C++:2003 (ISO)} \\
160 \DWLANGCpluspluselevenTARG & ISO C++:2011 \addtoindexx{C++:2011 (ISO)} \\
161 \DWLANGCplusplusfourteenTARG & ISO C++:2014 \addtoindexx{C++:2014 (ISO)} \\
162 \DWLANGCobolseventyfourTARG & ISO COBOL:1974 \addtoindexx{COBOL:1974 (ISO)} \\
163 \DWLANGCoboleightyfiveTARG & ISO COBOL:1985 \addtoindexx{COBOL:1985 (ISO)} \\
164 \DWLANGDTARG{}~\dag & D \addtoindexx{D language} \\
165 \DWLANGDylanTARG~\dag & Dylan \addtoindexx{Dylan} \\
166 \DWLANGFortranseventysevenTARG & ISO FORTRAN:1977 \addtoindexx{FORTRAN:1977 (ISO)} \\
167 \DWLANGFortranninetyTARG & ISO Fortran:1990 \addtoindexx{Fortran:1990 (ISO)} \\
168 \DWLANGFortranninetyfiveTARG & ISO Fortran:1995 \addtoindexx{Fortran:1995 (ISO)} \\
169 \DWLANGFortranzerothreeTARG & ISO Fortran:2004 \addtoindexx{Fortran:2004 (ISO)} \\
170 \DWLANGFortranzeroeightTARG & ISO Fortran:2010 \addtoindexx{Fortran:2010 (ISO)} \\
171 \DWLANGGoTARG{}~\dag & \addtoindex{Go} \\
172 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell} \\
173 \DWLANGJavaTARG{} & \addtoindex{Java}\\
174 \DWLANGJuliaTARG{}~\dag & \addtoindex{Julia} \\
175 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
176 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
177 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
178 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
179 \DWLANGOCamlTARG{}~\dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
180 \DWLANGOpenCLTARG{}~\dag & \addtoindex{OpenCL} \\
181 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
182 \DWLANGPLITARG{}~\dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
183 \DWLANGPythonTARG{}~\dag & \addtoindex{Python} \\
184 \DWLANGRustTARG{}~\dag & \addtoindex{Rust} \\
185 \DWLANGSwiftTARG{}~\dag & \addtoindex{Swift} \\
186 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
187 \index{Unified Parallel C|see{UPC}} \\
189 \dag \ \ \textit{Support for these languages is limited}& \\
194 \item A \DWATstmtlistDEFN{}
195 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
196 \addtoindexx{statement list attribute}
197 attribute whose value is a
198 \addtoindexx{section offset!in statement list attribute}
199 section offset to the line number information for this compilation
202 This information is placed in a separate object file
203 section from the debugging information entries themselves. The
204 value of the statement list attribute is the offset in the
205 \dotdebugline{} section of the first byte of the line number
206 information for this compilation unit
207 (see Section \refersec{chap:linenumberinformation}).
209 \item A \DWATmacrosDEFN{}\hypertarget{chap:DWATmacrosmacroinformation}{}
211 \addtoindexx{macro information attribute}
213 \addtoindexx{section offset!in macro information attribute}
214 section offset to the macro information for this compilation unit.
216 This information is placed in a separate object file section
217 from the debugging information entries themselves. The
218 value of the macro information attribute is the offset in
219 the \dotdebugmacro{} section of the first byte of the macro
220 information for this compilation unit
221 (see Section \refersec{chap:macroinformation}).
223 \textit{The \DWATmacrosNAME{} attribute is new in \DWARFVersionV,
225 \DWATmacroinfoDEFN{} attribute of earlier DWARF versions.
226 \livetarg{chap:DWATmacroinfomacroinformation}{}
227 While \DWATmacrosNAME{} and \DWATmacroinfoNAME{} attributes cannot both occur in the same
228 compilation unit, both may be found in the set of units that make up an executable
229 or shared object file. The two attributes have distinct encodings to facilitate such
234 \DWATcompdirDEFN{} attribute\addtoindexx{compilation directory attribute}
235 \hypertarget{chap:DWATcompdircompilationdirectory}{}
237 null-terminated string containing the current working directory
238 of the compilation command that produced this compilation
239 unit in whatever form makes sense for the host system.
241 \item A \DWATproducerDEFN{} attribute
242 \addtoindexx{producer attribute}
243 whose value is a null-terminated string containing
244 information about the compiler
245 \hypertarget{chap:DWATproducercompileridentification}{}
246 that produced the compilation unit. The actual contents of
247 the string will be specific to each producer, but should
248 begin with the name of the compiler vendor or some other
249 identifying character sequence that should avoid confusion
250 with other producer values.
253 \item A \DWATidentifiercaseDEFN{}
255 \addtoindexx{identifier case attribute}
257 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
258 constant value is a code describing the treatment
259 of identifiers within this compilation unit. The
260 set of identifier case codes is given in
261 Table \refersec{tab:identifiercasecodes}.
263 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
264 \DWIDcasesensitive{} \\
267 \DWIDcaseinsensitive{} \\
268 \end{simplenametable}
270 \DWIDcasesensitiveTARG{} is the default for all compilation units
271 that do not have this attribute. It indicates that names given
272 as the values of \DWATname{} attributes
273 \addtoindexx{name attribute}
274 in debugging information
275 entries for the compilation unit reflect the names as they
276 appear in the source program. The debugger should be sensitive
277 to the case of \addtoindex{identifier names} when doing identifier
281 \DWIDupcaseTARG{} means that the
282 producer of the debugging
283 information for this compilation unit converted all source
284 names to upper case. The values of the name attributes may not
285 reflect the names as they appear in the source program. The
286 debugger should convert all names to upper case when doing
289 \DWIDdowncaseTARG{} means that
290 the producer of the debugging
291 information for this compilation unit converted all source
292 names to lower case. The values of the name attributes may not
293 reflect the names as they appear in the source program. The
294 debugger should convert all names to lower case when doing
298 \DWIDcaseinsensitiveTARG{} means that the values of the name
299 attributes reflect the names as they appear in the source
300 program but that a case insensitive lookup should be used to
304 \item A \DWATbasetypesDEFN{} attribute whose value is a
305 \livelink{chap:classreference}{reference}. This
306 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
308 \addtoindexx{base types attribute}
309 points to a debugging information entry
310 representing another compilation unit. It may be used
311 to specify the compilation unit containing the base type
312 entries used by entries in the current compilation unit
313 (see Section \refersec{chap:basetypeentries}).
316 \textit{This attribute provides a consumer a way to find the definition
317 of base types for a compilation unit that does not itself
318 contain such definitions. This allows a consumer, for example,
319 to interpret a type conversion to a base type
320 % getting this link target at the right spot is tricky.
321 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
324 \item A \DWATuseUTFeightDEFN{} attribute,
325 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
326 which is a \livelink{chap:classflag}{flag} whose
327 presence indicates that all strings (such as the names of
328 declared entities in the source program, or filenames in the line number table)
329 are represented using the UTF\dash 8 representation.
332 \item A \DWATmainsubprogramDEFN{} attribute, which is a
333 \livelink{chap:classflag}{flag}
334 \addtoindexx{main subprogram attribute}
335 whose presence indicates
336 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
337 that the compilation unit contains a
338 subprogram that has been identified as the starting function
339 of the program. If more than one compilation unit contains
340 this \nolink{flag}, any one of them may contain the starting function.
342 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
344 to specify and provide a user\dash specified name for the main
345 subroutine of a program.
346 \addtoindex{C} uses the name \doublequote{main} to identify
347 the main subprogram of a program. Some other languages provide
348 similar or other means to identify the main subprogram of
349 a program. The \DWATmainsubprogram{} attribute may also be used to
350 identify such subprograms (see
351 Section \refersec{chap:generalsubroutineandentrypointinformation}).}
353 \item A \DWATentrypc{} attribute whose value is the address of the first
354 \hypertarget{chap:DWATentrypcofcompileunit}{}
355 \hypertarget{chap:DWATentrypcofpartialunit}{}
356 \addtoindexx{entry pc attribute!for normal compilation unit}
357 \addtoindexx{entry pc attribute!for partial compilation unit}
358 executable instruction of the unit (see
359 Section \refersec{chap:entryaddress}).
362 \item A \DWATstroffsetsbaseDEFN\addtoindexx{string offset base attribute}
363 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
364 attribute, whose value is of class \CLASSstroffsetsptr.
365 This attribute points to the first string
366 offset of the compilation unit's contribution to the
367 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
368 Indirect string references
369 (using \DWFORMstrx) within the compilation unit are
370 interpreted as indices relative to this base.
373 \item A \DWATaddrbaseTARG\addtoindexx{address table base attribute}
374 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
375 attribute, whose value is of class \CLASSaddrptr.
376 This attribute points to the beginning of the compilation
377 unit's contribution to the \dotdebugaddr{} section.
378 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
379 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
380 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
381 interpreted as indices relative to this base.
384 \item A \DWATrangesbaseDEFN\addtoindexx{ranges table base attribute}
385 \hypertarget{chap:DWATrangesbaseforrangelists}{}
386 attribute, whose value is of class \CLASSrangelistptr.
387 This attribute points to the beginning of the compilation
388 unit's contribution to the \dotdebugranges{} section.
389 References to range lists (using \DWFORMsecoffset)
390 within the compilation unit are
391 interpreted as offsets relative to this base.
395 The base address of a compilation unit is defined as the
396 value of the \DWATlowpc{} attribute, if present; otherwise,
397 it is undefined. If the base address is undefined, then any
398 DWARF entry or structure defined in terms of the base address
399 of that compilation unit is not valid.
401 \subsection{Skeleton Compilation Unit Entries}
402 \label{chap:skeletoncompilationunitentries}
403 \addtoindexx{compilation unit!skeleton}
404 \addtoindexx{skeleton compilation unit}
405 When generating a \splitDWARFobjectfile{} (see
406 Section \refersec{datarep:splitdwarfobjectfiles}), the
407 compilation unit in the \dotdebuginfo{} section is a "skeleton"
408 compilation unit with the tag \DWTAGcompileunit, which contains
409 \DWATdwoname{} and \DWATdwoid{} attributes as well as a subset of the
410 attributes of a full normal or partial compilation unit. In general,
411 it contains those attributes that are necessary for the consumer
412 to locate the object file where the full compilation unit
413 can be found, and for the consumer to interpret references to
414 addresses in the program.
416 A skeleton compilation unit has \DWATdwoname{} and
417 \DWATdwoid{} attributes and no children; it may have additional
418 attributes from among the following:
419 \begin{enumerate}[1. ]
422 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
423 or a \DWATranges{} attribute (the same as for regular
424 compilation unit entries).
427 A \DWATstmtlist{} attribute (the same as for regular
428 compilation unit entries).
431 A \DWATcompdir{} attribute (the same as for regular
432 compilation unit entries).
435 \livetarg{chap:DWATdwonameforunit}{}
436 A \DWATdwonameDEFN{} attribute
437 \addtoindexx{split DWARF object file name attribute}
439 null-terminated string containing the full or relative
440 path name of the object file that contains the full
444 \livetarg{chap:DWATdwoidforunit}{}
445 A \DWATdwoidDEFN{} attribute\addtoindexx{unit signature attribute}
446 whose value is an 8-byte
447 unsigned hash of the full compilation unit. This hash
448 value is computed by the method described in
449 Section \refersec{datarep:typesignaturecomputation}.
453 A \DWATuseUTFeight{} attribute (the same as for regular compilation unit
456 \textit{This attribute applies to strings referred to by the skeleton
457 compilation unit entry itself, and strings in the associated line
459 The representation for strings in the object file referenced
460 by the \DWATdwoname{} attribute is determined by the presence
461 of a \DWATuseUTFeight{} attribute in the full compilation unit.}
464 A \DWATstroffsetsbase{} attribute, for indirect strings references
465 from the skeleton compilation unit (the same as for regular
466 compilation unit entries).
469 A \DWATaddrbase{} attribute (the same as for regular
470 compilation unit entries).
473 A \DWATrangesbase{} attribute (the same as for regular
474 compilation unit entries).
478 All other attributes of a compilation unit entry (described
479 in Section \refersec{chap:normalandpartialcompilationunitentries})
480 should be placed in the full compilation unit.
481 The attributes provided by the skeleton compilation
482 unit entry do not need to be repeated in the full compilation
483 unit entry, except for \DWATdwoid, which should appear in
484 both entries so that the consumer can verify that it has
485 found the correct object file.
487 \textit{The \DWATaddrbase{}, \DWATrangesbase{} and \DWATstroffsetsbase{}
488 attributes provide context that may be necessary to interpret the contents
489 of the corresponding \splitDWARFobjectfile.}
492 \subsection{Type Unit Entries}
493 \label{chap:typeunitentries}
494 \addtoindexx{type unit}
495 \addtoindexx{type unit|see{\textit{also} compilation unit}}
496 \addtoindexx{compilation unit!\textit{see also} type unit}
497 An object file may contain any number of separate type
498 unit entries, each representing a single complete type
500 Each \addtoindex{type unit} must be uniquely identified by
501 a 64-bit signature, stored as part of the type unit, which
502 can be used to reference the type definition from debugging
503 information entries in other compilation units and type units.
505 A type unit is represented by a debugging information entry
506 with the tag \DWTAGtypeunitTARG.
507 A \addtoindex{type unit entry} owns debugging
508 information entries that represent the definition of a single
509 type, plus additional debugging information entries that may
510 be necessary to include as part of the definition of the type.
512 A type unit entry may have the following attributes:
513 \begin{enumerate}[1. ]
516 \DWATlanguage{} attribute,
518 \addtoindexx{language attribute}
519 constant value is an integer code indicating the source
520 language used to define the type. The set of language names
521 and their meanings are given in Table \refersec{tab:languagenames}.
525 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
526 attribute, whose value is a reference. This attribute points
527 to the first string offset of the type unit's contribution to
528 the \dotdebugstroffsets{} section. Indirect string references
529 (using \DWFORMstrx) within the type unit must be interpreted
530 as indices relative to this base.
532 \item A \DWATstmtlist{} attribute\addtoindexx{statement list attribute}
533 whose value of class \CLASSlineptr{} points to the line number
534 information for this type unit.
535 Because type units do not describe any code, they
536 do not actually need a line number table, but the line number
537 headers contain a list of directories and file names that
538 may be referenced by the \DWATdeclfile{} attribute of the
539 type or part of its description.
542 normal object file with a regular compilation unit entry, the
543 type unit entries can simply refer to the line number table
544 used by the compilation unit.
545 \item In a \splitDWARFobjectfile, where
546 the type units are located in a separate DWARF object file,
547 the \DWATstmtlist{} attribute refers to a "specialized"
548 line number table in the \dotdebuglinedwo{} section, which
549 contains only the list of directories and file names. All
550 type unit entries in a \splitDWARFobjectfile{} may (but are not
551 required to) refer to the same \addtoindex{specialized line number table}.
554 \item A \DWATuseUTFeight{} attribute, which is a flag
555 whose presence indicates that all strings referred to by this type
556 unit entry, its children, and its associated
557 \addtoindex{specialized line number table},
558 are represented using the UTF-8 representation.
562 A \addtoindex{type unit} entry for a given type T owns a debugging
563 information entry that represents a defining declaration
564 of type T. If the type is nested within enclosing types or
565 namespaces, the debugging information entry for T is nested
566 within debugging information entries describing its containers;
567 otherwise, T is a direct child of the type unit entry.
569 A type unit entry may also own additional debugging information
570 entries that represent declarations of additional types that
571 are referenced by type T and have not themselves been placed in
572 separate type units. Like T, if an additional type U is nested
573 within enclosing types or namespaces, the debugging information
574 entry for U is nested within entries describing its containers;
575 otherwise, U is a direct child of the type unit entry.
577 The containing entries for types T and U are declarations,
578 and the outermost containing entry for any given type T or
579 U is a direct child of the type unit entry. The containing
580 entries may be shared among the additional types and between
581 T and the additional types.
584 \textit{Types are not required to be placed in type units. In general,
585 only large types such as structure, class, enumeration, and
586 union types included from header files should be considered
587 for separate type units. Base types and other small types
588 are not usually worth the overhead of placement in separate
589 type units. Types that are unlikely to be replicated, such
590 as those defined in the main source file, are also better
591 left in the main compilation unit.}F
593 \section{Module, Namespace and Importing Entries}
594 \textit{Modules and namespaces provide a means to collect related
595 entities into a single entity and to manage the names of
598 \subsection{Module Entries}
599 \label{chap:moduleentries}
600 \textit{Several languages have the concept of a \doublequote{module.}
601 \addtoindexx{Modula-2}
602 A Modula\dash 2 definition module
603 \addtoindexx{Modula-2!definition module}
604 may be represented by a module
606 \addtoindex{declaration attribute}
607 (\DWATdeclaration). A
608 \addtoindex{Fortran 90} module
609 \addtoindexx{Fortran!module (Fortran 90)}
610 may also be represented by a module entry
611 (but no declaration attribute is warranted because \addtoindex{Fortran}
612 has no concept of a corresponding module body).}
614 A module is represented by a debugging information entry
616 tag \DWTAGmoduleTARG.
617 Module entries may own other
618 debugging information entries describing program entities
619 whose declaration scopes end at the end of the module itself.
621 If the module has a name, the module entry has a
622 \DWATname{} attribute
623 \addtoindexx{name attribute}
624 whose value is a null\dash terminated string containing
625 the module name as it appears in the source program.
627 The \addtoindex{module entry} may have either a
631 \addtoindexx{high PC attribute}
633 \addtoindexx{low PC attribute}
635 \DWATranges{} attribute
636 \addtoindexx{ranges attribute}
637 whose values encode the contiguous or non\dash contiguous address
638 ranges, respectively, of the machine instructions generated for
639 the module initialization code
640 (see Section \refersec{chap:codeaddressesandranges}).
641 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
643 \addtoindexx{entry PC attribute!for module initialization}
645 \DWATentrypc{} attribute whose value is the address of
646 the first executable instruction of that initialization code
647 (see Section \refersec{chap:entryaddress}).
650 \hypertarget{chap:DWATprioritymodulepriority}{}
651 the module has been assigned a priority, it may have a
652 \addtoindexx{priority attribute}
653 \DWATpriorityDEFN{} attribute.
654 The value of this attribute is a
655 reference to another debugging information entry describing
656 a variable with a constant value. The value of this variable
657 is the actual constant value of the module\textquoteright s priority,
658 represented as it would be on the target architecture.
660 \subsection{Namespace Entries}
661 \label{chap:namespaceentries}
662 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
663 \addtoindexx{namespace (C++)}
664 implement name hiding, so that names of unrelated things
665 do not accidentally clash in the
666 \addtoindex{global namespace} when an
667 application is linked together.}
669 A namespace is represented by a debugging information entry
671 tag \DWTAGnamespaceTARG.
672 A namespace extension is
673 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
675 \DWTAGnamespaceNAME{} entry
677 \addtoindexx{extension attribute}
680 attribute referring to the previous extension, or if there
681 is no previous extension, to the original
682 \DWTAGnamespaceNAME{}
683 entry. A namespace extension entry does not need to duplicate
684 information in a previous extension entry of the namespace
685 nor need it duplicate information in the original namespace
686 entry. (Thus, for a namespace with a name,
687 a \DWATname{} attribute
688 \addtoindexx{name attribute}
689 need only be attached directly to the original
690 \DWTAGnamespaceNAME{} entry.)
693 Namespace and namespace extension entries may own
694 \addtoindexx{namespace extension entry}
696 \addtoindexx{namespace declaration entry}
697 debugging information entries describing program entities
698 whose declarations occur in the namespace.
700 \textit{For \addtoindex{C++}, such
701 owned program entities may be declarations,
702 including certain declarations that are also object or
703 function definitions.}
705 A namespace may have a
706 \DWATexportsymbolsDEFN{}\livetarg{chap:DWATexportsymbolsofnamespace}{}
707 attribute\addtoindexx{export symbols attribute}
708 \addtoindexx{inline namespace|see{\textit{also} export symbols attribute}}
709 which indicates that all member names defined within the
710 namespace may be referenced as if they were defined within
711 the containing namespace.
713 \textit{This may be used to describe an \addtoindex{inline namespace} in \addtoindex{C++}}.
715 If a type, variable, or function declared in a namespace is
716 defined outside of the body of the namespace declaration,
717 that type, variable, or function definition entry has a
718 \DWATspecification{} attribute
719 \addtoindexx{specification attribute}
720 whose value is a \livelink{chap:classreference}{reference} to the
721 debugging information entry representing the declaration of
722 the type, variable or function. Type, variable, or function
724 \DWATspecification{} attribute
725 \addtoindexx{specification attribute}
727 to duplicate information provided by the declaration entry
728 referenced by the specification attribute.
730 \textit{The \addtoindex{C++} \addtoindex{global namespace}
732 \addtoindexx{global namespace|see{namespace (C++), global}}
734 \addtoindexx{namespace (C++)!global}
736 \texttt{::f}, for example) is not explicitly represented in
737 DWARF with a namespace entry (thus mirroring the situation
738 in \addtoindex{C++} source).
739 Global items may be simply declared with no
740 reference to a namespace.}
742 \textit{The \addtoindex{C++}
743 compilation unit specific \doublequote{unnamed namespace} may
744 \addtoindexx{namespace (C++)!unnamed}
745 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
746 be represented by a namespace entry with no name attribute in
747 the original namespace declaration entry (and therefore no name
748 attribute in any namespace extension entry of this namespace).
751 \textit{A compiler emitting namespace information may choose to
752 explicitly represent namespace extensions, or to represent the
753 final namespace declaration of a compilation unit; this is a
754 quality\dash of\dash implementation issue and no specific requirements
755 are given here. If only the final namespace is represented,
756 \addtoindexx{namespace (C++)!using declaration}
757 it is impossible for a debugger to interpret using declaration
758 references in exactly the manner defined by the
759 \addtoindex{C++} language.
762 \textit{Emitting all namespace declaration information in all
763 compilation units can result in a significant increase in the
764 size of the debug information and significant duplication of
765 information across compilation units.
766 The \addtoindex{C++} namespace std,
768 \addtoindexx{namespace (C++)!std}
769 is large and will probably be referenced in
770 every \addtoindex{C++} compilation unit.
773 \textit{For \addtoindex{C++} namespace examples,
774 see Appendix \refersec{app:namespaceexamples}.
779 \subsection{Imported (or Renamed) Declaration Entries}
780 \label{chap:importedorrenameddeclarationentries}
781 \textit{Some languages support the concept of importing into or making
782 accessible in a given unit declarations made in a different
783 module or scope. An imported declaration may sometimes be
787 An imported declaration is represented by one or
788 \addtoindexx{imported declaration entry}
789 more debugging information entries with the
790 tag \DWTAGimporteddeclarationTARG.
792 \hypertarget{chap:DWATimportimporteddeclaration}{}
794 is imported, there is one imported declaration entry for
796 \addtoindexx{import attribute}
797 Each imported declaration entry has a
798 \DWATimportDEFN{} attribute,
799 whose value is a \livelink{chap:classreference}{reference} to the
800 debugging information entry representing the declaration that
803 An imported declaration may also have a
806 \addtoindexx{name attribute}
807 whose value is a null-terminated string containing the
808 name, as it appears in the source program, by which the
809 imported entity is to be known in the context of the imported
810 declaration entry (which may be different than the name of
811 the entity being imported). If no name is present, then the
812 name by which the entity is to be known is the same as the
813 name of the entity being imported.
815 An imported declaration entry with a name attribute may be
816 used as a general means to rename or provide an alias for
817 \addtoindexx{alias declaration|see{imported declaration entry}}
818 an entity, regardless of the context in which the importing
819 declaration or the imported entity occurs.
821 \textit{A \addtoindex{C++} namespace alias may be represented
823 \hypertarget{chap:DWATimportnamespacealias}{}
825 \addtoindexx{namespace (C++)!alias}
826 with a name attribute whose value is
827 a null-terminated string containing the alias name as it
828 appears in the source program and a \DWATimportDEFN{} attribute
829 whose value is a \livelink{chap:classreference}{reference} to the
830 applicable original namespace or namespace extension entry.
833 \textit{A \addtoindex{C++} using declaration may be represented
835 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
837 \addtoindexx{namespace (C++)!using declaration}
838 declaration entries. When the using declaration
839 refers to an overloaded function, there is one imported
840 declaration entry corresponding to each overloading. Each
841 imported declaration entry has no name attribute but it does
842 have a \DWATimportDEFN{} attribute that refers to the entry for the
843 entity being imported. (\addtoindex{C++}
844 provides no means to \doublequote{rename}
845 an imported entity, other than a namespace).}
848 \textit{A \addtoindex{Fortran} use statement
849 \addtoindexx{Fortran!use statement}
850 \addtoindexx{use statement|see {Fortran, use statement}}
851 with an \doublequote{only list} may be
852 represented by a series of imported declaration entries,
853 one (or more) for each entity that is imported. An entity
854 \addtoindexx{renamed declaration|see{imported declaration entry}}
855 that is renamed in the importing context may be represented
856 by an imported declaration entry with a name attribute that
857 specifies the new local name.
860 \subsection{Imported Module Entries}
861 \label{chap:importedmoduleentries}
863 \textit{Some languages support the concept of importing into or making
864 accessible in a given unit all of the declarations contained
865 within a separate module or namespace.
868 An imported module declaration is represented by a debugging
869 information entry with
870 \addtoindexx{imported module attribute}
872 \addtoindexx{imported module entry}
873 tag \DWTAGimportedmoduleTARG.
875 imported module entry contains a
876 \DWATimport{} attribute
877 \addtoindexx{import attribute}
878 whose value is a \livelink{chap:classreference}{reference}
879 to the module or namespace entry
880 containing the definition and/or declaration entries for
881 the entities that are to be imported into the context of the
882 imported module entry.
884 An imported module declaration may own a set of imported
885 declaration entries, each of which refers to an entry in the
886 module whose corresponding entity is to be known in the context
887 of the imported module declaration by a name other than its
888 name in that module. Any entity in the module that is not
889 renamed in this way is known in the context of the imported
890 module entry by the same name as it is declared in the module.
892 \textit{A \addtoindex{C++} using directive
893 \addtoindexx{namespace (C++)!using directive}
894 \addtoindexx{using directive|see {namespace (C++), using directive}}
895 may be represented by an imported module
896 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
897 entry, with a \DWATimportDEFN{} attribute referring to the namespace
898 entry of the appropriate extension of the namespace (which
899 might be the original namespace entry) and no owned entries.
902 \textit{A \addtoindex{Fortran} use statement
903 \addtoindexx{Fortran!use statement}
904 with a \doublequote{rename list} may be
905 represented by an imported module entry with an import
906 attribute referring to the module and owned entries
907 corresponding to those entities that are renamed as part of
911 \textit{A \addtoindex{Fortran} use statement
912 \addtoindexx{Fortran!use statement}
913 with neither a \doublequote{rename list} nor
914 an \doublequote{only list} may be represented by an imported module
915 entry with an import attribute referring to the module and
916 no owned child entries.
919 \textit{A use statement with an \doublequote{only list} is represented by a
920 series of individual imported declaration entries as described
921 in Section \refersec{chap:importedorrenameddeclarationentries}.
925 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
926 \addtoindexx{Fortran!use statement}
927 itself imported by a use statement without an explicit mention
928 may be represented by an imported declaration entry that refers
929 to the original debugging information entry. For example, given
946 \textit{the imported declaration entry for Q within module C refers
947 directly to the variable declaration entry for X in module A
948 because there is no explicit representation for X in module B.
951 \textit{A similar situation arises for a \addtoindex{C++} using declaration
952 \addtoindexx{namespace (C++)!using declaration}
953 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
954 that imports an entity in terms of a namespace alias. See
955 Appendix \refersec{app:namespaceexamples}
959 \subsection{Imported Unit Entries}
960 \label{chap:importedunitentries}
962 \hypertarget{chap:DWATimportimportedunit}{}
963 place where a normal or partial unit is imported is
964 represented by a debugging information entry with the
965 \addtoindexx{imported unit entry}
966 tag \DWTAGimportedunitTARG.
967 An imported unit entry contains
968 \addtoindexx{import attribute}
970 \DWATimportDEFN{} attribute
971 whose value is a \livelink{chap:classreference}{reference} to the
972 normal or partial compilation unit whose declarations logically
973 belong at the place of the imported unit entry.
975 \textit{An imported unit entry does not necessarily correspond to
976 any entity or construct in the source program. It is merely
977 \doublequote{glue} used to relate a partial unit, or a compilation
978 unit used as a partial unit, to a place in some other
981 \section{Subroutine and Entry Point Entries}
982 \label{chap:subroutineandentrypointentries}
984 The following tags exist to describe
985 debugging information entries
986 \addtoindexx{function entry|see{subroutine entry}}
988 \addtoindexx{subroutine entry}
990 \addtoindexx{subprogram entry}
992 % FIXME: is entry point entry the right index 'entry'?
993 \addtoindexx{entry point entry}
996 \begin{tabular}{lp{9.0cm}}
997 \DWTAGsubprogramTARG{} & A subroutine or function \\
998 \DWTAGinlinedsubroutine{} & A particular inlined
999 \addtoindexx{inlined subprogram entry}
1000 instance of a subroutine or function \\
1001 \DWTAGentrypointTARG{} & An alternate entry point \\
1006 \subsection{General Subroutine and Entry Point Information}
1007 \label{chap:generalsubroutineandentrypointinformation}
1008 The subroutine or entry point entry has a \DWATname{}
1009 attribute whose value is a null-terminated string containing the
1010 subroutine or entry point name as it appears in the source program.
1011 It may also have a \DWATlinkagename{} attribute as
1012 described in Section \refersec{chap:linkagenames}.
1014 If the name of the subroutine described by an entry with the
1015 \addtoindexx{subprogram entry}
1016 tag \DWTAGsubprogram{}
1017 is visible outside of its containing
1018 \hypertarget{chap:DWATexternalexternalsubroutine}{}
1019 compilation unit, that entry has
1020 \addtoindexx{external attribute}
1022 \DWATexternalDEFN{} attribute,
1023 which is a \livelink{chap:classflag}{flag}.
1025 \textit{Additional attributes for functions that are members of a
1026 class or structure are described in
1027 Section \refersec{chap:memberfunctionentries}.
1031 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
1034 \DWATmainsubprogramDEFN{}
1036 \addtoindexx{main subprogram attribute}
1038 a \CLASSflag{} whose presence indicates that the
1039 subroutine has been identified as the starting function of
1040 the program. If more than one subprogram contains this
1042 any one of them may be the starting subroutine of the program.
1044 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1045 which is used to specify
1046 and provide a user\dash supplied name for the main subroutine of
1050 \subsubsection{Calling Convention Information}
1051 A subroutine entry may
1052 \hypertarget{chap:DWATcallingconventionforsubprograms}{}
1054 \DWATcallingconventionDEFN{}
1055 \addtoindexx{calling convention attribute!for subprogram}
1056 attribute, whose value is an
1057 \livelink{chap:classconstant}{integer constant}. The set of
1058 \addtoindexi{calling convention codes for subroutines}{calling convention codes!for subroutines}
1059 is given in Table \refersec{tab:callingconventioncodesforsubroutines}.
1061 \begin{simplenametable}[1.4in]{Calling convention codes for subroutines}{tab:callingconventioncodesforsubroutines}
1065 \end{simplenametable}
1067 If this attribute is not present, or its value is the constant
1068 \DWCCnormalTARG, then the subroutine may be safely called by
1069 obeying the \doublequote{standard} calling conventions of the target
1070 architecture. If the value of the calling convention attribute
1071 is the constant \DWCCnocallTARG, the subroutine does not obey
1072 standard calling conventions, and it may not be safe for the
1073 debugger to call this subroutine.
1075 \textit{Note that \DWCCnormal{} is also used as a calling convention
1076 code for certain types
1077 (see Table \refersec{tab:callingconventioncodesfortypes}).}
1079 If the semantics of the language of the compilation unit
1080 containing the subroutine entry distinguishes between ordinary
1081 subroutines and subroutines that can serve as the \doublequote{main
1082 program,} that is, subroutines that cannot be called
1083 directly according to the ordinary calling conventions,
1084 then the debugging information entry for such a subroutine
1085 may have a calling convention attribute whose value is the
1086 constant \DWCCprogramTARG.
1088 \textit{A common debugger feature is to allow the debugger user to call
1089 a subroutine within the subject program. In certain cases,
1090 however, the generated code for a subroutine will not obey
1091 the standard calling conventions for the target architecture
1092 and will therefore not be safe to call from within a debugger.}
1094 \textit{The \DWCCprogram{}
1095 value is intended to support \addtoindex{Fortran} main
1096 \addtoindexx{Fortran!main program}
1097 programs which in some implementations may not be callable
1098 or which must be invoked in a special way. It is not intended
1099 as a way of finding the entry address for the program.}
1102 \subsubsection{Miscellaneous Subprogram Properties}
1103 \textit{In \addtoindex{C}
1104 there is a difference between the types of functions
1105 declared using function prototype style declarations and
1106 those declared using non\dash prototype declarations.}
1108 A subroutine entry declared with a function prototype style
1109 declaration may have
1110 \addtoindexx{prototyped attribute}
1112 \DWATprototypedNAME{} attribute, which is
1115 \textit{The \addtoindex{Fortran}
1116 language allows the keywords \texttt{elemental}, \texttt{pure}
1117 and \texttt{recursive} to be included as part of the declaration of
1118 a subroutine; these attributes reflect that usage. These
1119 attributes are not relevant for languages that do not support
1120 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1121 attribute is neither needed nor appropriate in languages such
1123 where functions support recursion by default.
1126 A subprogram entry may have a
1127 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1128 \DWATelementalDEFN{} attribute,\addtoindexx{elemental attribute}
1129 which is a \livelink{chap:classflag}{flag}.
1130 The attribute indicates whether the subroutine
1131 or entry point was declared with the \doublequote{elemental} keyword
1135 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1136 subprogram entry may have
1137 \addtoindexx{pure attribute}
1139 \DWATpureDEFN{} attribute, which is
1140 a \livelink{chap:classflag}{flag}.
1141 The attribute indicates whether the subroutine was
1142 declared with the \doublequote{pure} keyword or property.
1145 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1146 subprogram entry may have a
1147 \DWATrecursiveDEFN{} attribute, which
1148 is a \livelink{chap:classflag}{flag}.
1149 The attribute indicates whether the subroutine
1150 or entry point was declared with the \doublequote{recursive} keyword
1153 A subprogram entry may have a
1155 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1156 which is a \CLASSflag. The attribute
1157 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1158 indicating that the subprogram can be called, but will never return to its caller.
1160 \subsubsection{Call Site-Related Attributes}
1161 \textit{While subprogram attributes in the pervious section provide
1162 information about the subprogram and it's entry point(s) as a whole,
1163 the following attributes provide summary information about the calls
1164 that occur within a subprogram.}
1166 A subroutine entry may have \DWATcallalltailcallsNAME,
1167 \DWATcallallcallsNAME{} and/or \DWATcallallsourcecallsNAME{}
1168 attributes, each of which is a
1169 \livelink{chap:classflag}{flag}.
1170 \addtoindexx{call site summary information}
1171 \addtoindexx{subroutine call site summary attributes}
1172 These flags indicate the completeness of the call site
1173 information provided by call site entries (see
1174 Section \refersec{chap:callsiteentries}) within the subprogram.
1176 The \DWATcallalltailcallsDEFN{}
1177 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1178 indicates that every tail call
1179 that occurs in the code for the subprogram is described by a
1180 \DWTAGcallsite{} entry.
1181 (There may or may not be other non-tail calls to some of the same
1182 target subprograms.)
1184 The \DWATcallallcallsDEFN{}
1185 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1186 indicates that every non-inlined call
1187 (either a tail call or a normal call) that occurs in the code for the subprogram
1188 is described by a \DWTAGcallsite{} entry.
1190 The \DWATcallallsourcecallsDEFN{}
1191 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1192 indicates that every call that occurs in the
1193 code for the subprogram, including every call inlined into it, is described by either a
1194 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1195 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1196 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1198 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1199 information format consumers that analyse call graphs.}
1201 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1202 \DWATcallallcalls{} and \DWATcallalltailcalls{} attributes are necessarily also true, and
1203 those attributes need not be present. Similarly, if the value of the
1204 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1205 attribute is also true and the latter attribute need not be present.
1208 \subsection{Subroutine and Entry Point Return Types}
1209 \label{chap:subroutineandentrypointreturntypes}
1212 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1213 the subroutine or entry point
1214 \addtoindexx{return type of subroutine}
1215 is a function that returns a
1216 value, then its debugging information entry has
1217 \addtoindexx{type attribute}
1218 a \DWATtypeDEFN{} attribute
1219 to denote the type returned by that function.
1221 \textit{Debugging information entries for
1222 \addtoindex{C} void functions should
1223 not have an attribute for the return type. }
1225 \textit{Debugging information entries for declarations of \addtoindex{C++}
1226 member functions with an
1227 \autoreturntype{} specifier should use an unspecified type entry (see
1228 Section \refersec{chap:unspecifiedtypeentries}).
1229 The debugging information entry for the corresponding definition
1230 should provide the deduced return type. This practice causes the description of
1231 the containing class to be consistent across compilation units, allowing the class
1232 declaration to be placed into a separate type unit if desired.}
1235 \subsection{Subroutine and Entry Point Locations}
1236 \label{chap:subroutineandentrypointlocations}
1238 A subroutine entry may have either a \DWATlowpc{} and
1239 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1240 \addtoindexx{ranges attribute}
1242 \addtoindexx{high PC attribute}
1244 \addtoindexx{low PC attribute}
1245 encode the contiguous or non\dash contiguous address
1246 ranges, respectively, of the machine instructions generated
1247 for the subroutine (see
1248 Section \refersec{chap:codeaddressesandranges}).
1251 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1252 subroutine entry may also have
1253 \addtoindexx{entry PC attribute!for subroutine}
1255 \DWATentrypc{} attribute
1256 whose value is the address of the first executable instruction
1257 of the subroutine (see
1258 Section \refersec{chap:entryaddress}).
1260 An entry point has a \DWATlowpc{} attribute whose value is the
1261 relocated address of the first machine instruction generated
1262 for the entry point.
1265 \DWATentrypc{} attribute
1266 \addtoindexx{entry pc attribute!for subroutine}
1268 also seem appropriate
1269 for this purpose, historically the
1270 \DWATlowpc{} attribute
1272 \DWATentrypc{} was introduced (in
1273 \addtoindex{DWARF Version 3}).
1274 There is insufficient reason to change this.}
1280 \addtoindexx{address class attribute}
1282 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1286 \DWATaddressclassDEFN{} attributes,
1287 as appropriate, to specify
1288 which segments the code for the subroutine resides in and
1289 the addressing mode to be used in calling that subroutine.
1291 A subroutine entry representing a subroutine declaration
1292 that is not also a definition does not have code address or
1296 \subsection{Declarations Owned by Subroutines and Entry Points}
1297 \label{chap:declarationsownedbysubroutinesandentrypoints}
1298 \addtoindexx{subroutine formal parameters}
1299 The declarations enclosed by a subroutine or entry point are
1300 represented by debugging information entries that are owned
1301 by the subroutine or entry point entry. Entries representing
1302 \addtoindexx{formal parameter}
1303 the formal parameters of the subroutine or entry point appear
1304 in the same order as the corresponding declarations in the
1308 \textit{There is no ordering requirement for entries for declarations
1309 other than formal parameters. The formal parameter
1310 entries may be interspersed with other entries used by formal
1311 parameter entries, such as type entries.}
1313 The unspecified (sometimes called \doublequote{varying})
1314 parameters of a subroutine parameter list are
1315 represented by a debugging information
1316 entry\addtoindexx{unspecified parameters entry}
1317 with the tag \DWTAGunspecifiedparametersTARG.
1320 The entry for a subroutine that includes a
1321 \addtoindex{Fortran}
1322 \addtoindexx{Fortran!common block}
1323 \livelink{chap:fortrancommonblock}{common}
1324 \livelink{chap:commonblockentry}{block}
1325 \addtoindexx{common block|see{Fortran common block}}
1326 has a child entry with the
1327 tag \DWTAGcommoninclusionTARG.
1329 \hypertarget{chap:commonreferencecommonblockusage}{}
1330 common inclusion entry has a
1331 \DWATcommonreferenceDEFN{} attribute
1332 \addtoindexx{common block reference attribute}
1333 whose value is a \livelink{chap:classreference}{reference}
1334 to the debugging information entry
1335 for the common \nolink{block} being included
1336 (see Section \refersec{chap:commonblockentries}).
1338 \subsection{Low-Level Information}
1339 \label{chap:lowlevelinformation}
1342 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1343 subroutine or entry point entry may have a
1344 \addtoindexx{return address attribute}
1345 \DWATreturnaddrDEFN{}
1346 attribute, whose value is a location description. The location
1347 specified is the place where the return address for the
1348 subroutine or entry point is stored.
1351 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1352 subroutine or entry point entry may also have
1353 \addtoindexx{frame base attribute}
1355 \DWATframebaseDEFN{} attribute, whose value is a location
1356 description that describes the \doublequote{frame base} for the
1357 subroutine or entry point. If the location description is
1358 a simple register location description, the given register
1359 contains the frame base address. If the location description is
1360 a DWARF expression, the result of evaluating that expression
1361 is the frame base address. Finally, for a
1362 \addtoindex{location list},
1363 this interpretation applies to each location description
1364 contained in the list of \addtoindex{location list} entries.
1366 \textit{The use of one of the \DWOPregn{}
1368 context is equivalent to using
1371 compact. However, these are not equivalent in general.}
1374 \textit{The frame base for a subprogram is typically an address
1375 relative to the first unit of storage allocated for the
1376 subprogram\textquoteright s stack frame. The \DWATframebase{} attribute
1377 can be used in several ways:}
1378 \begin{enumerate}[1. ]
1379 \item \textit{In subprograms that need
1380 \addtoindexx{location list}
1381 location lists to locate local
1382 variables, the \DWATframebase{} can hold the needed location
1383 list, while all variables\textquoteright\ location descriptions can be
1384 simpler ones involving the frame base.}
1386 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1387 within nested routines.
1388 (See also \DWATstaticlink, below)}
1392 \textit{Some languages support nested subroutines. In such languages,
1393 it is possible to reference the local variables of an
1394 outer subroutine from within an inner subroutine. The
1395 \DWATstaticlink{} and \DWATframebase{} attributes allow
1396 debuggers to support this same kind of referencing.}
1399 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1401 \addtoindexx{address!uplevel|see {static link attribute}}
1402 \addtoindexx{uplevel address|see {static link attribute}}
1403 subroutine or entry point is nested, it may have a
1404 \DWATstaticlinkDEFN{}
1405 attribute, whose value is a location
1406 description that computes the frame base of the relevant
1407 instance of the subroutine that immediately encloses the
1408 subroutine or entry point.
1410 In the context of supporting nested subroutines, the
1411 \DWATframebase{} attribute value should obey the following
1414 \begin{enumerate}[1. ]
1415 \item It should compute a value that does not change during the
1416 life of the subprogram, and
1418 \item The computed value should be unique among instances of
1419 the same subroutine. (For typical \DWATframebase{} use, this
1420 means that a recursive subroutine\textquoteright s stack frame must have
1421 non\dash zero size.)
1424 \textit{If a debugger is attempting to resolve an up\dash level reference
1425 to a variable, it uses the nesting structure of DWARF to
1426 determine which subroutine is the lexical parent and the
1427 \DWATstaticlink{} value to identify the appropriate active
1428 frame of the parent. It can then attempt to find the reference
1429 within the context of the parent.}
1433 \subsection{Types Thrown by Exceptions}
1434 \label{chap:typesthrownbyexceptions}
1436 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1437 it may validly throw.}
1439 If a subroutine explicitly declares that it may throw
1440 \addtoindexx{exception thrown|see{thrown type entry}}
1442 \addtoindexx{thrown exception|see{thrown type entry}}
1443 exception of one or more types, each such type is
1444 represented by a debugging information entry with
1445 \addtoindexx{thrown type entry}
1447 \DWTAGthrowntypeTARG.
1448 Each such entry is a child of the entry
1449 representing the subroutine that may throw this type. Each
1450 thrown type entry contains
1451 \addtoindexx{type attribute}
1452 a \DWATtype{} attribute, whose
1453 value is a \livelink{chap:classreference}{reference}
1454 to an entry describing the type of the
1455 exception that may be thrown.
1457 \subsection{Function Template Instantiations}
1458 \label{chap:functiontemplateinstantiations}
1460 \textit{In \addtoindex{C++}, a function template is a generic definition of
1461 a function that is instantiated differently for calls with
1462 values of different types. DWARF does not represent the generic
1463 template definition, but does represent each instantiation.}
1466 A \addtoindex{function template instantiation}\addtoindexx{template instantiation!function}
1467 is represented by a debugging information entry with the
1468 \addtoindexx{subprogram entry!use for template instantiation}
1469 tag \DWTAGsubprogram.
1471 exceptions, such an entry will contain the same attributes and
1472 will have the same types of child entries as would an entry
1473 for a subroutine defined explicitly using the instantiation
1474 types and values. The exceptions are:
1476 \begin{enumerate}[1. ]
1477 \item Template parameters are described and referenced as specified in
1478 Section \refersec{chap:templateparameters}.
1481 \item If the compiler has generated a special compilation unit
1482 to hold the template instantiation and that compilation unit
1483 has a different name from the compilation unit containing
1484 the template definition, the name attribute for the debugging
1485 information entry representing that compilation unit is empty
1488 \item If the subprogram entry representing the template
1489 instantiation or any of its child entries contain declaration
1490 coordinate attributes, those attributes refer to the source
1491 for the template definition, not to any source generated
1492 artificially by the compiler for this instantiation.
1497 \subsection{Inlinable and Inlined Subroutines}
1498 \label{chap:inlinedsubroutines}
1499 A declaration or a definition of an inlinable subroutine
1500 is represented by a debugging information entry with the
1504 \addtoindexx{subprogram entry!use in inlined subprogram}
1506 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1507 explicitly declared to be available for inline expansion or
1508 that was expanded inline implicitly by the compiler has
1509 \addtoindexx{inline attribute}
1511 \DWATinlineDEFN{} attribute whose value is an
1512 \livelink{chap:classconstant}{integer constant}. The
1513 set of values for the \DWATinline{} attribute is given in
1514 Table \refersec{tab:inlinecodes}.
1518 \caption{Inline codes}
1519 \label{tab:inlinecodes}
1520 \begin{tabular}{l|P{8cm}}
1522 Name&Meaning\\ \hline
1523 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1524 \mbox{compiler} (equivalent to the absence of the
1525 containing \DWATinline{} attribute) \\
1526 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1527 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1528 not inlined by the \mbox{compiler} \\
1529 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1535 \textit{In \addtoindex{C++}, a function or a constructor declared with
1536 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1537 instance (see below) is represented by a debugging information
1538 entry with the tag \DWTAGsubprogram. Such an entry has a
1539 \DWATinline{} attribute whose value is \DWINLinlined.}
1542 \subsubsection{Abstract Instances}
1543 \label{chap:abstractinstances}
1544 Any subroutine entry that contains a
1545 \DWATinlineDEFN{} attribute\addtoindexx{inline attribute}
1546 whose value is other than
1549 \doublequote{abstract instance root.}\addtoindexx{abstract instance!root}
1550 \hypertarget{chap:DWATinlineabstracttinstance}{}
1551 Any debugging information entry that is owned (either
1552 directly or indirectly) by an abstract instance root
1554 \doublequote{abstract instance entry.}\addtoindexx{abstract instance!entry}
1555 Any set of abstract instance entries that are all
1556 children (either directly or indirectly) of some abstract
1557 instance root, together with the root itself, is known as an
1558 \doublequote{abstract instance tree.}\addtoindexx{abstract instance!tree}
1559 However, in the case where an abstract instance tree is
1560 nested within another abstract instance tree, the entries in the
1561 \addtoindex{nested abstract instance}
1562 tree are not considered to be entries in the outer abstract
1565 Each abstract instance root is either part of a larger
1566 \addtoindexx{abstract instance!root}
1567 tree (which gives a context for the root) or
1568 \addtoindexx{specification attribute}
1570 \DWATspecification{}
1571 to refer to the declaration in context.
1573 \textit{For example, in \addtoindex{C++} the context might be a namespace
1574 declaration or a class declaration.}
1576 \textit{Abstract instance trees are defined so that no entry is part
1577 of more than one abstract instance tree. This simplifies the
1578 following descriptions.}
1580 A debugging information entry that is a member of an abstract
1581 instance tree should not contain any attributes which describe
1582 aspects of the subroutine which vary between distinct inlined
1583 expansions or distinct out\dash of\dash line expansions. For example,
1584 \addtoindexx{entry pc attribute!and abstract instance}
1595 \addtoindexx{location attribute!and abstract instance}
1597 \addtoindexx{ranges attribute!and abstract instance}
1599 \addtoindexx{high PC attribute!and abstract instance}
1601 \addtoindexx{low PC attribute!and abstract instance}
1603 \addtoindexx{segment attribute!and abstract instance}
1605 \addtoindexx{return address attribute!and abstract instance}
1607 \addtoindexx{segment attribute!and abstract instance}
1609 \addtoindexx{start scope attribute!and abstract instance}
1613 \textit{It would not make sense normally to put these attributes into
1614 abstract instance entries since such entries do not represent
1615 actual (concrete) instances and thus do not actually exist at
1616 run\dash time. However,
1617 see Appendix \refersec{app:inlineouteronenormalinner}
1618 for a contrary example.}
1620 The rules for the relative location of entries belonging to
1621 abstract instance trees are exactly the same as for other
1622 similar types of entries that are not abstract. Specifically,
1623 the rule that requires that an entry representing a declaration
1624 be a direct child of the entry representing the scope of the
1625 declaration applies equally to both abstract and non\dash abstract
1626 entries. Also, the ordering rules for formal parameter entries,
1627 member entries, and so on, all apply regardless of whether
1628 or not a given entry is abstract.
1631 \subsubsection{Concrete Inlined Instances}
1632 \label{chap:concreteinlinedinstances}
1634 Each inline expansion of a subroutine is represented
1635 by a debugging information entry with the
1636 tag \DWTAGinlinedsubroutineTARG.
1637 Each such entry should be a direct
1638 child of the entry that represents the scope within which
1639 the inlining occurs.
1642 Each inlined subroutine entry may have either a
1644 and \DWAThighpc{} pair
1646 \addtoindexx{high PC attribute}
1648 \addtoindexx{low PC attribute}
1650 \addtoindexx{ranges attribute}
1653 attribute whose values encode the contiguous or non\dash contiguous
1654 address ranges, respectively, of the machine instructions
1655 generated for the inlined subroutine (see
1656 Section \referfol{chap:codeaddressesandranges}).
1658 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1659 inlined subroutine entry may
1660 \addtoindexx{inlined subprogram entry!in concrete instance}
1662 \addtoindexx{inlined subprogram entry}
1664 \addtoindexx{entry PC attribute!for inlined subprogram}
1667 attribute, representing the first executable instruction of
1668 the inline expansion (see
1669 Section \refersec{chap:entryaddress}).
1671 % Positions of the 3 targets here is a bit arbitrary.
1673 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1675 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1677 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1678 may also have \DWATcallfileDEFN,
1679 \DWATcalllineDEFN{} and \DWATcallcolumnDEFN{} attributes,
1680 \addtoindexx{inlined call location attributes}
1682 value is an \livelink{chap:classconstant}{integer constant}.
1683 These attributes represent the
1684 source file, source line number, and source column number,
1685 respectively, of the first character of the statement or
1686 expression that caused the inline expansion. The call file,
1687 call line, and call column attributes are interpreted in
1688 the same way as the declaration file, declaration line, and
1689 declaration column attributes, respectively (see
1690 Section \refersec{chap:declarationcoordinates}).
1692 \textit{The call file, call line and call column coordinates do not
1693 describe the coordinates of the subroutine declaration that
1694 was inlined, rather they describe the coordinates of the call.
1697 An inlined subroutine entry
1698 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1700 \DWATconstexprDEFN{} attribute,\addtoindexx{constant expression attribute}
1701 which is a \livelink{chap:classflag}{flag}
1702 whose presence indicates that the
1703 subroutine has been evaluated as a compile\dash time constant. Such
1704 an entry may also have a \DWATconstvalue{} attribute,
1705 whose value may be of any form that is appropriate for the
1706 representation of the subroutine's return value. The value of
1707 this attribute is the actual return value of the subroutine,
1708 represented as it would be on the target architecture.
1710 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1711 \addttindex{constexpr}
1712 is called with constant expressions, then the corresponding
1713 concrete inlined instance has a
1714 \DWATconstexpr{} attribute,
1715 as well as a \DWATconstvalue{} attribute whose value represents
1716 the actual return value of the concrete inlined instance.}
1718 Any debugging information entry that is owned (either
1719 directly or indirectly) by a debugging information entry
1720 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1721 \doublequote{concrete inlined instance entry.} Any entry that has
1723 \DWTAGinlinedsubroutine{}
1724 is known as a \doublequote{concrete inlined instance root.}
1725 Any set of concrete inlined instance
1726 entries that are all children (either directly or indirectly)
1727 of some concrete inlined instance root, together with the root
1728 itself, is known as a \doublequote{concrete inlined instance tree.}
1729 However, in the case where a concrete inlined instance tree
1730 is nested within another concrete instance tree, the entries
1731 in the \addtoindex{nested concrete inline instance} tree
1732 are not considered to
1733 be entries in the outer concrete instance tree.
1736 \textit{Concrete inlined instance trees are defined so that no entry
1737 is part of more than one concrete inlined instance tree. This
1738 simplifies later descriptions.}
1740 Each concrete inlined instance tree is uniquely associated
1741 with one (and only one) abstract instance tree.
1743 \textit{Note, however, that the reverse is not true. Any given abstract
1744 instance tree may be associated with several different concrete
1745 inlined instance trees, or may even be associated with zero
1746 concrete inlined instance trees.}
1748 Concrete inlined instance entries may omit attributes that
1749 are not specific to the concrete instance (but present in
1750 the abstract instance) and need include only attributes that
1751 are specific to the concrete instance (but omitted in the
1752 abstract instance). In place of these omitted attributes, each
1753 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1754 concrete inlined instance entry
1755 \addtoindexx{abstract origin attribute}
1757 \DWATabstractoriginDEFN{}
1758 attribute that may be used to obtain the missing information
1759 (indirectly) from the associated abstract instance entry. The
1760 value of the abstract origin attribute is a reference to the
1761 associated abstract instance entry.
1763 If an entry within a concrete inlined instance tree contains
1764 attributes describing the
1765 \addtoindexx{declaration coordinates!in concrete instance}
1766 \livelink{chap:declarationcoordinates}{declaration coordinates}
1767 of that entry, then those attributes should refer to the file, line
1768 and column of the original declaration of the subroutine,
1769 not to the point at which it was inlined. As a consequence,
1770 they may usually be omitted from any entry that has an abstract
1774 For each pair of entries that are associated via a
1775 \addtoindexx{abstract origin attribute}
1776 \DWATabstractorigin{} attribute, both members of the pair
1777 have the same tag. So, for example, an entry with the tag
1778 \DWTAGvariable{} can only be associated with another entry
1779 that also has the tag \DWTAGvariable. The only exception
1780 to this rule is that the root of a concrete instance tree
1781 (which must always have the tag \DWTAGinlinedsubroutine)
1782 can only be associated with the root of its associated abstract
1783 instance tree (which must have the tag \DWTAGsubprogram).
1786 In general, the structure and content of any given concrete
1787 inlined instance tree will be closely analogous to the
1788 structure and content of its associated abstract instance
1789 tree. There are a few exceptions:
1791 \begin{enumerate}[1. ]
1792 \item An entry in the concrete instance tree may be omitted if
1794 \addtoindexx{abstract origin attribute}
1795 \DWATabstractorigin{} attribute and either
1796 has no children, or its children are omitted. Such entries
1797 would provide no useful information. In C\dash like languages,
1798 such entries frequently include types, including structure,
1799 union, class, and interface types; and members of types. If any
1800 entry within a concrete inlined instance tree needs to refer
1801 to an entity declared within the scope of the relevant inlined
1802 subroutine and for which no concrete instance entry exists,
1803 the reference should refer to the abstract instance entry.
1806 \item Entries in the concrete instance tree which are associated
1807 with entries in the abstract instance tree such that neither
1808 has a \DWATname{} attribute,
1809 \addtoindexx{name attribute}
1810 and neither is referenced by
1811 any other debugging information entry, may be omitted. This
1812 may happen for debugging information entries in the abstract
1813 instance trees that became unnecessary in the concrete instance
1814 tree because of additional information available there. For
1815 example, an anonymous variable might have been created and
1816 described in the abstract instance tree, but because of
1817 the actual parameters for a particular inlined expansion,
1818 it could be described as a constant value without the need
1819 for that separate debugging information entry.
1822 \item A concrete instance tree may contain entries which do
1823 not correspond to entries in the abstract instance tree
1824 to describe new entities that are specific to a particular
1825 inlined expansion. In that case, they will not have associated
1826 entries in the abstract instance tree, should not contain
1827 \addtoindexx{abstract origin attribute}
1828 \DWATabstractorigin{} attributes, and must contain all their
1829 own attributes directly. This allows an abstract instance tree
1830 to omit debugging information entries for anonymous entities
1831 that are unlikely to be needed in most inlined expansions. In
1832 any expansion which deviates from that expectation, the
1833 entries can be described in its concrete inlined instance tree.
1837 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1838 \label{chap:outoflineinstancesofinlinedsubroutines}
1839 Under some conditions, compilers may need to generate concrete
1840 executable instances of inlined subroutines other than at
1841 points where those subroutines are actually called. Such
1842 concrete instances of inlined subroutines are referred to as
1843 \doublequote{concrete out\dash of\dash line instances.}
1845 \textit{In \addtoindex{C++}, for example,
1846 taking the address of a function declared
1847 to be inline can necessitate the generation of a concrete
1848 out\dash of\dash line instance of the given function.}
1850 The DWARF representation of a concrete out-of-line instance
1851 of an inlined subroutine is essentially the same as for a
1852 concrete inlined instance of that subroutine (as described in
1853 the preceding section). The representation of such a concrete
1854 % It is critical that the hypertarget and livelink be
1855 % separated to avoid problems with latex.
1857 \addtoindexx{abstract origin attribute}
1859 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1861 \DWATabstractoriginDEFN{}
1862 attributes in exactly the same way as they are used for
1863 a concrete inlined instance (that is, as references to
1864 corresponding entries within the associated abstract instance
1867 The differences between the DWARF representation of a
1868 concrete out\dash of\dash line instance of a given subroutine and the
1869 representation of a concrete inlined instance of that same
1870 subroutine are as follows:
1871 \begin{enumerate}[1. ]
1872 \item The root entry for a concrete out\dash of\dash line instance
1873 of a given inlined subroutine has the same tag as does its
1874 associated (abstract) inlined subroutine entry (that is, tag
1875 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1877 \item The root entry for a concrete out\dash of\dash line instance tree
1878 is normally owned by the same parent entry that also owns
1879 the root entry of the associated abstract instance. However,
1880 it is not required that the abstract and out\dash of\dash line instance
1881 trees be owned by the same parent entry.
1885 \subsubsection{Nested Inlined Subroutines}
1886 \label{nestedinlinedsubroutines}
1887 Some languages and compilers may permit the logical nesting of
1888 a subroutine within another subroutine, and may permit either
1889 the outer or the nested subroutine, or both, to be inlined.
1891 For a non\dash inlined subroutine nested within an inlined
1892 subroutine, the nested subroutine is described normally in
1893 both the abstract and concrete inlined instance trees for
1894 the outer subroutine. All rules pertaining to the abstract
1895 and concrete instance trees for the outer subroutine apply
1896 also to the abstract and concrete instance entries for the
1900 For an inlined subroutine nested within another inlined
1901 subroutine, the following rules apply to their abstract and
1902 \addtoindexx{abstract instance!nested}
1903 \addtoindexx{concrete instance!nested}
1904 concrete instance trees:
1906 \begin{enumerate}[1. ]
1907 \item The abstract instance tree for the nested subroutine is
1908 described within the abstract instance tree for the outer
1909 subroutine according to the rules in
1910 Section \refersec{chap:abstractinstances}, and
1911 without regard to the fact that it is within an outer abstract
1914 \item Any abstract instance tree for a nested subroutine is
1915 always omitted within the concrete instance tree for an
1918 \item A concrete instance tree for a nested subroutine is
1919 always omitted within the abstract instance tree for an
1922 \item The concrete instance tree for any inlined or
1923 \addtoindexx{out-of-line instance}
1925 \addtoindexx{out-of-line instance|see{\textit{also} concrete out-of-line instance}}
1926 expansion of the nested subroutine is described within a
1927 concrete instance tree for the outer subroutine according
1929 Sections \refersec{chap:concreteinlinedinstances} or
1930 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1932 and without regard to the fact that it is within an outer
1933 concrete instance tree.
1936 See Appendix \refersec{app:inliningexamples}
1937 for discussion and examples.
1939 \subsection{Trampolines}
1940 \label{chap:trampolines}
1942 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1943 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1944 an intermediary in making a call to another subroutine. It may
1945 adjust parameters and/or the result (if any) as appropriate
1946 to the combined calling and called execution contexts.}
1948 A trampoline is represented by a debugging information entry
1949 \addtoindexx{trampoline (subprogram) entry}
1950 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1952 \addtoindexx{trampoline attribute}
1953 a \DWATtrampolineDEFN{} attribute.
1955 attribute indicates the target subroutine of the trampoline,
1956 that is, the subroutine to which the trampoline passes
1957 control. (A trampoline entry may but need not also have a
1958 \DWATartificial{} attribute.)
1961 The value of the trampoline attribute may be represented
1962 using any of the following forms, which are listed in order
1966 \item If the value is of class \CLASSreference{}, then the value
1967 specifies the debugging information entry of the target
1970 \item If the value is of class \CLASSaddress{}, then the value is
1971 the relocated address of the target subprogram.
1974 \item If the value is of class \CLASSstring{}, then the value is the
1975 (possibly mangled) \addtoindexx{mangled names}
1976 name of the target subprogram.
1978 \item If the value is of class \CLASSflag, then the value true
1979 indicates that the containing subroutine is a trampoline but
1980 that the target subroutine is not known.
1984 The target subprogram may itself be a trampoline. (A sequence
1985 of trampolines necessarily ends with a non\dash trampoline
1988 \textit{In \addtoindex{C++}, trampolines may be used to implement
1989 derived virtual member functions; such trampolines typically
1991 \texttt{this} parameter\index{this parameter@\texttt{this} parameter}
1992 in the course of passing control.
1993 Other languages and environments may use trampolines in a manner
1994 sometimes known as transfer functions or transfer vectors.}
1996 \textit{Trampolines may sometimes pass control to the target
1997 subprogram using a branch or jump instruction instead of a
1998 call instruction, thereby leaving no trace of their existence
1999 in the subsequent execution context. }
2001 \textit{This attribute helps make it feasible for a debugger to arrange
2002 that stepping into a trampoline or setting a breakpoint in
2003 a trampoline will result in stepping into or setting the
2004 breakpoint in the target subroutine instead. This helps to
2005 hide the compiler generated subprogram from the user. }
2007 \textit{If the target subroutine is not known, a debugger may choose
2008 to repeatedly step until control arrives in a new subroutine
2009 which can be assumed to be the target subroutine. }
2011 \subsection{Call Site Entries}
2012 \label{chap:callsiteentries}
2014 A call site entry provides a way to represent the static or dynamic
2015 call graph of a program in the debugging information. It also provides
2016 information about how parameters are passed so that they may be more
2017 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
2018 call site entries can be also useful for computing values of variables
2019 and expressions where some value is no longer present in the current
2020 subroutine's registers or local stack frame, but it is known that the
2021 values are equal to some parameter passed to the function.
2022 The consumer can then use unwind
2023 information to find the caller and it's call site information and then
2024 compute the value passed in a particular parameter.}
2026 A call site is represented by a debugging information entry with the tag
2027 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
2028 debugging information entry representing the scope within which the
2029 call is present in the source program.
2031 \textit{A scope entry (for example, for a lexical block) that would not
2032 otherwise be present in the debugging information of a subroutine
2033 need not be introduced solely to represent the immediately containing scope
2036 A source call can be compiled into different types of machine code:
2039 A \textit{normal call} uses a call-like instruction which transfers
2040 control to the start of some subprogram and leaves the call site
2041 location address somewhere where unwind information can find it.
2043 A \textit{tail call} uses a jump-like instruction which
2044 transfers control to the start of some subprogram, but the call site location
2045 address is not preserved (and thus not available using the unwind information).
2047 A \textit{tail recursion call} is a call
2048 to the current subroutine which is compiled as a jump into the middle of the
2052 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2053 where at least one instruction has the location of the inlined subprogram
2054 or any of its blocks or inlined subprograms.
2058 There are also different types of \doublequote{optimized out} calls:
2061 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2062 has not been emitted (such as, for example, the call to \texttt{foo} in
2063 \texttt{if (0) foo();}).
2065 An \textit{optimized out inline call}
2066 is a call to an inlined subprogram which either did not expand to any instructions
2067 or only parts of instructions belong to it and for debug information purposes those
2068 instructions are given a location in the caller.
2071 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2072 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2073 (see Section \refersec{chap:inlinedsubroutines}).
2075 The call site entry has a
2076 \DWATcallreturnpcDEFN{}
2077 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2078 which is the return address after the call.
2079 The value of this attribute corresponds to the return address computed by
2080 call frame information in the called subprogram
2081 (see Section \refersec{datarep:callframeinformation}).
2083 \textit{On many architectures the return address is the address immediately following the
2084 call instruction, but on architectures with delay slots it might
2085 be an address after the delay slot of the call.}
2087 The call site entry may have a
2089 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2090 address of the call instruction.
2092 If the call site entry corresponds to a tail call, it has the
2093 \DWATcalltailcallDEFN{}
2094 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2095 which is a \CLASSflag.
2097 The call site entry may have a
2098 \DWATcalloriginDEFN{}
2099 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2100 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2101 known it is a reference to the called subprogram's debugging
2102 information entry. For indirect calls it may be a reference to a
2103 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2104 the subroutine pointer that is called.
2107 The call site may have a
2108 \DWATcalltargetDEFN{}
2109 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2110 a DWARF expression. For indirect calls or jumps where it is unknown at
2111 compile time which subprogram will be called the expression computes the
2112 address of the subprogram that will be called. The DWARF expression should
2113 not use register or memory locations that might be clobbered by the call.
2116 The call site entry may have a
2117 \DWATcalltargetclobberedDEFN{}
2118 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2119 which is a DWARF expression. For indirect calls or jumps where the
2120 address is not computable without use of registers or memory locations that
2121 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2122 attribute is used instead of the \DWATcalltarget{} attribute.
2124 The call site entry may have a \DWATtypeDEFN{}
2125 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2126 referencing a debugging information entry for the type of the called function.
2128 \textit{When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.}
2130 The call site entry may have
2131 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2132 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2133 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2134 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2135 each of whose value is an integer constant.
2136 These attributes represent the source file, source line number, and source
2137 column number, respectively, of the first character of the call statement or
2138 expression. The call file, call line, and call column attributes are
2139 interpreted in the same way as the declaration file, declaration
2140 line, and declaration column attributes, respectively
2141 (see Section \refersec{chap:declarationcoordinates}).
2143 \textit{The call file, call line and call column coordinates do not describe the
2144 coordinates of the subroutine declaration that was called, rather they describe
2145 the coordinates of the call.}
2148 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2149 entries\index{call site parameter entry} representing the parameters passed to the call.
2150 Each such entry has a \DWATlocation{} attribute which is a location expression.
2151 This location expression describes where the parameter is passed
2152 (usually either some register, or a memory location expressible as the
2153 contents of the stack register plus some offset).
2155 Each \DWTAGcallsiteparameter{} entry may have a
2156 \DWATcallvalueDEFN{}
2157 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2158 which is a DWARF expression. This expression computes the value
2159 passed for that parameter. The expression should not use registers or memory
2160 locations that might be clobbered by the call, as it might be evaluated after
2161 unwinding from the called function back to the caller. If it is not
2162 possible to avoid registers or memory locations that might be clobbered by
2163 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2166 \textit{The reason for the restriction is that the value of the parameter may be
2167 needed in the middle of the callee, where the call clobbered registers or
2168 memory might be already clobbered, and if the consumer was not assured by
2169 the producer it can safely use those values, the consumer could not safely
2170 use the values at all.}
2172 For parameters passed by reference, where the code passes a pointer to
2173 a location which contains the parameter, or for reference type parameters
2174 the \DWTAGcallsiteparameter{} entry may also have
2175 \DWATcalldatalocationNAME{}
2176 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2177 whose value is a location expression and a
2178 \DWATcalldatavalueNAME{}
2179 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2180 whose value is a DWARF expression. The \DWATcalldatalocationDEFN{} attribute
2181 \addtoindexx{call data location attribute}
2182 describes where the referenced value lives during the call. If it is just
2183 \DWOPpushobjectaddress{}, it may be left out. The
2184 \DWATcalldatavalueNAME{} attribute\addtoindexx{call data value attribute}
2185 describes the value in that location.
2186 The expression should not use registers or memory
2187 locations that might be clobbered by the call, as it might be evaluated after
2188 unwinding from the called function back to the caller.
2191 Each call site parameter entry may also have a
2192 \DWATcallparameterDEFN{}
2193 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2194 which contains a reference to a \DWTAGformalparameter{} entry,
2195 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2196 attribute describing the parameter's name.
2200 \section{Lexical Block Entries}
2201 \label{chap:lexicalblockentries}
2204 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2206 \addtoindexx{lexical block}
2207 a bracketed sequence of source statements
2208 that may contain any number of declarations. In some languages
2209 (including \addtoindex{C} and \addtoindex{C++}),
2210 \nolink{blocks} can be nested within other
2211 \nolink{blocks} to any depth.}
2213 % We do not need to link to the preceding paragraph.
2214 A lexical \nolink{block} is represented by a debugging information
2216 tag \DWTAGlexicalblockTARG.
2218 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2220 either a \DWATlowpc{} and
2221 \DWAThighpc{} pair of
2223 \addtoindexx{high PC attribute}
2225 \addtoindexx{low PC attribute}
2227 \DWATranges{} attribute
2228 \addtoindexx{ranges attribute}
2229 whose values encode the contiguous or non-contiguous address
2230 ranges, respectively, of the machine instructions generated
2231 for the lexical \nolink{block}
2232 (see Section \refersec{chap:codeaddressesandranges}).
2235 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2236 lexical block entry may also have
2237 \addtoindexx{entry PC attribute!for lexical block}
2239 \DWATentrypc{} attribute
2240 whose value is the address of the first executable instruction
2241 of the lexical block (see
2242 Section \refersec{chap:entryaddress}).
2244 If a name has been given to the
2245 lexical \nolink{block}
2247 program, then the corresponding
2248 lexical \nolink{block} entry has a
2249 \DWATname{} attribute whose
2250 \addtoindexx{name attribute}
2251 value is a null\dash terminated string
2252 containing the name of the lexical \nolink{block}
2256 \textit{This is not the same as a \addtoindex{C} or
2257 \addtoindex{C++} label (see below).}
2259 The lexical \nolink{block} entry owns
2260 debugging information entries that
2261 describe the declarations within that lexical \nolink{block}.
2263 one such debugging information entry for each local declaration
2264 of an identifier or inner lexical \nolink{block}.
2267 \section{Label Entries}
2268 \label{chap:labelentries}
2269 \textit{A label is a way of identifying a source statement. A labeled
2270 statement is usually the target of one or more \doublequote{go to}
2275 A label is represented by a debugging information entry with
2276 \addtoindexx{label entry}
2278 tag \DWTAGlabelTARG.
2279 The entry for a label should be owned by
2280 the debugging information entry representing the scope within
2281 which the name of the label could be legally referenced within
2284 The label entry has a \DWATlowpc{} attribute whose value
2285 is the relocated address of the first machine instruction
2286 generated for the statement identified by the label in
2287 the source program. The label entry also has a
2288 \DWATname{} attribute
2289 \addtoindexx{name attribute}
2290 whose value is a null-terminated string containing
2291 the name of the label as it appears in the source program.
2294 \section{With Statement Entries}
2295 \label{chap:withstatemententries}
2297 \textit{Both \addtoindex{Pascal} and
2298 \addtoindexx{Modula-2}
2299 Modula\dash 2 support the concept of a \doublequote{with}
2300 statement. The with statement specifies a sequence of
2301 executable statements within which the fields of a record
2302 variable may be referenced, unqualified by the name of the
2305 A with statement is represented by a
2306 \addtoindexi{debugging information entry}{with statement entry}
2307 with the tag \DWTAGwithstmtTARG.
2309 A with statement entry may have either a
2311 \DWAThighpc{} pair of attributes
2312 \addtoindexx{high PC attribute}
2314 \addtoindexx{low PC attribute}
2315 a \DWATranges{} attribute
2316 \addtoindexx{ranges attribute}
2317 whose values encode the contiguous or non\dash contiguous address
2318 ranges, respectively, of the machine instructions generated
2319 for the with statement
2320 (see Section \refersec{chap:codeaddressesandranges}).
2323 \hypertarget{chap:DWATentrypcofwithstmt}{}
2324 with statement entry may also have
2325 \addtoindexx{entry PC attribute!for with statement}
2327 \DWATentrypc{} attribute
2328 whose value is the address of the first executable instruction
2329 of the with statement (see
2330 Section \refersec{chap:entryaddress}).
2333 The with statement entry has
2334 \addtoindexx{type attribute}
2335 a \DWATtype{} attribute, denoting
2336 the type of record whose fields may be referenced without full
2337 qualification within the body of the statement. It also has
2338 \addtoindexx{location attribute}
2339 a \DWATlocation{} attribute, describing how to find the base
2340 address of the record object referenced within the body of
2344 \section{Try and Catch Block Entries}
2345 \label{chap:tryandcatchblockentries}
2346 \livetargi{chap:tryandcatchblockentries}{}
2347 \textit{In \addtoindex{C++}, a \livelink{chap:lexicalblock}{lexical block} may be
2348 designated as a \doublequote{catch \nolink{block}.}
2349 A catch \nolink{block} is an exception handler that
2350 handles exceptions thrown by an immediately preceding
2351 \doublequote{try \nolink{block}.}
2352 A catch \nolink{block}
2353 designates the type of the exception that it can handle.}
2355 A \livetarg{chap:tryblock}{try block} is represented
2356 by a debugging information entry
2357 \addtoindexx{try block entry}
2358 with the tag \DWTAGtryblockTARG.
2359 A \livetarg{chap:catchblock}{catch block} is represented by
2360 a debugging information entry
2361 \addtoindexx{catch block entry}
2362 with the tag \DWTAGcatchblockTARG.
2364 % nolink as we have links just above and do not have a combo link for both
2365 Both try and catch \nolink{block} entries may have either a
2367 \DWAThighpc{} pair of attributes
2368 \addtoindexx{high PC attribute}
2370 \addtoindexx{low PC attribute}
2372 \DWATranges{} attribute
2373 \addtoindexx{ranges attribute}
2374 whose values encode the contiguous
2375 or non\dash contiguous address ranges, respectively, of the
2376 machine instructions generated for the \nolink{block}
2377 (see Section \refersec{chap:codeaddressesandranges}).
2379 \hypertarget{chap:DWATentrypcoftryblock}{}
2380 \hypertarget{chap:DWATentrypcofcatchblock}{}
2381 A try or catch block entry may also have
2382 \addtoindexx{entry PC attribute!for try block}
2383 \addtoindexx{entry PC attribute!for catch block}
2385 \DWATentrypc{} attribute
2386 whose value is the address of the first executable instruction
2387 of the try or catch block
2388 (see Section \refersec{chap:entryaddress}).
2391 Catch \nolink{block} entries have at least one child entry,
2392 an entry representing the type of exception accepted by
2393 that catch \nolink{block}.
2394 This child entry has one of the tags
2395 \DWTAGformalparameter{}\addtoindexx{formal parameter entry!in catch block}
2397 \DWTAGunspecifiedparameters,\addtoindexx{unspecified parameters entry!in catch block}
2398 and will have the same form as other parameter entries.
2400 The siblings immediately following a try \nolink{block}
2401 entry are its corresponding catch \nolink{block} entries.