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 a reference.
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 \DWATaddrbaseNAME\addtoindexx{address table base attribute}
374 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
375 attribute, whose value is a reference.
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 a reference.
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}.
924 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
925 \addtoindexx{Fortran!use statement}
926 itself imported by a use statement without an explicit mention
927 may be represented by an imported declaration entry that refers
928 to the original debugging information entry. For example, given
945 \textit{the imported declaration entry for Q within module C refers
946 directly to the variable declaration entry for X in module A
947 because there is no explicit representation for X in module B.
950 \textit{A similar situation arises for a \addtoindex{C++} using declaration
951 \addtoindexx{namespace (C++)!using declaration}
952 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
953 that imports an entity in terms of a namespace alias. See
954 Appendix \refersec{app:namespaceexamples}
958 \subsection{Imported Unit Entries}
959 \label{chap:importedunitentries}
961 \hypertarget{chap:DWATimportimportedunit}{}
962 place where a normal or partial unit is imported is
963 represented by a debugging information entry with the
964 \addtoindexx{imported unit entry}
965 tag \DWTAGimportedunitTARG.
966 An imported unit entry contains
967 \addtoindexx{import attribute}
969 \DWATimportDEFN{} attribute
970 whose value is a \livelink{chap:classreference}{reference} to the
971 normal or partial compilation unit whose declarations logically
972 belong at the place of the imported unit entry.
974 \textit{An imported unit entry does not necessarily correspond to
975 any entity or construct in the source program. It is merely
976 \doublequote{glue} used to relate a partial unit, or a compilation
977 unit used as a partial unit, to a place in some other
980 \section{Subroutine and Entry Point Entries}
981 \label{chap:subroutineandentrypointentries}
983 The following tags exist to describe
984 debugging information entries
985 \addtoindexx{function entry|see{subroutine entry}}
987 \addtoindexx{subroutine entry}
989 \addtoindexx{subprogram entry}
991 % FIXME: is entry point entry the right index 'entry'?
992 \addtoindexx{entry point entry}
995 \begin{tabular}{lp{9.0cm}}
996 \DWTAGsubprogramTARG{} & A subroutine or function \\
997 \DWTAGinlinedsubroutine{} & A particular inlined
998 \addtoindexx{inlined subprogram entry}
999 instance of a subroutine or function \\
1000 \DWTAGentrypointTARG{} & An alternate entry point \\
1005 \subsection{General Subroutine and Entry Point Information}
1006 \label{chap:generalsubroutineandentrypointinformation}
1007 The subroutine or entry point entry has a \DWATname{}
1008 attribute whose value is a null-terminated string containing the
1009 subroutine or entry point name as it appears in the source program.
1010 It may also have a \DWATlinkagename{} attribute as
1011 described in Section \refersec{chap:linkagenames}.
1013 If the name of the subroutine described by an entry with the
1014 \addtoindexx{subprogram entry}
1015 tag \DWTAGsubprogram{}
1016 is visible outside of its containing
1017 \hypertarget{chap:DWATexternalexternalsubroutine}{}
1018 compilation unit, that entry has
1019 \addtoindexx{external attribute}
1021 \DWATexternalDEFN{} attribute,
1022 which is a \livelink{chap:classflag}{flag}.
1024 \textit{Additional attributes for functions that are members of a
1025 class or structure are described in
1026 Section \refersec{chap:memberfunctionentries}.
1030 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
1033 \DWATmainsubprogramDEFN{}
1035 \addtoindexx{main subprogram attribute}
1037 a \CLASSflag{} whose presence indicates that the
1038 subroutine has been identified as the starting function of
1039 the program. If more than one subprogram contains this
1041 any one of them may be the starting subroutine of the program.
1043 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1044 which is used to specify
1045 and provide a user\dash supplied name for the main subroutine of
1049 \subsubsection{Calling Convention Information}
1050 A subroutine entry may
1051 \hypertarget{chap:DWATcallingconventionforsubprograms}{}
1053 \DWATcallingconventionDEFN{}
1054 \addtoindexx{calling convention attribute!for subprogram}
1055 attribute, whose value is an
1056 \livelink{chap:classconstant}{integer constant}. The set of
1057 \addtoindexi{calling convention codes for subroutines}{calling convention codes!for subroutines}
1058 is given in Table \refersec{tab:callingconventioncodesforsubroutines}.
1060 \begin{simplenametable}[1.4in]{Calling convention codes for subroutines}{tab:callingconventioncodesforsubroutines}
1064 \end{simplenametable}
1066 If this attribute is not present, or its value is the constant
1067 \DWCCnormalTARG, then the subroutine may be safely called by
1068 obeying the \doublequote{standard} calling conventions of the target
1069 architecture. If the value of the calling convention attribute
1070 is the constant \DWCCnocallTARG, the subroutine does not obey
1071 standard calling conventions, and it may not be safe for the
1072 debugger to call this subroutine.
1074 \textit{Note that \DWCCnormal{} is also used as a calling convention
1075 code for certain types
1076 (see Table \refersec{tab:callingconventioncodesfortypes}).}
1078 If the semantics of the language of the compilation unit
1079 containing the subroutine entry distinguishes between ordinary
1080 subroutines and subroutines that can serve as the \doublequote{main
1081 program,} that is, subroutines that cannot be called
1082 directly according to the ordinary calling conventions,
1083 then the debugging information entry for such a subroutine
1084 may have a calling convention attribute whose value is the
1085 constant \DWCCprogramTARG.
1087 \textit{A common debugger feature is to allow the debugger user to call
1088 a subroutine within the subject program. In certain cases,
1089 however, the generated code for a subroutine will not obey
1090 the standard calling conventions for the target architecture
1091 and will therefore not be safe to call from within a debugger.}
1093 \textit{The \DWCCprogram{}
1094 value is intended to support \addtoindex{Fortran} main
1095 \addtoindexx{Fortran!main program}
1096 programs which in some implementations may not be callable
1097 or which must be invoked in a special way. It is not intended
1098 as a way of finding the entry address for the program.}
1101 \subsubsection{Miscellaneous Subprogram Properties}
1102 \textit{In \addtoindex{C}
1103 there is a difference between the types of functions
1104 declared using function prototype style declarations and
1105 those declared using non\dash prototype declarations.}
1107 A subroutine entry declared with a function prototype style
1108 declaration may have
1109 \addtoindexx{prototyped attribute}
1111 \DWATprototypedNAME{} attribute, which is
1114 \textit{The \addtoindex{Fortran}
1115 language allows the keywords \texttt{elemental}, \texttt{pure}
1116 and \texttt{recursive} to be included as part of the declaration of
1117 a subroutine; these attributes reflect that usage. These
1118 attributes are not relevant for languages that do not support
1119 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1120 attribute is neither needed nor appropriate in languages such
1122 where functions support recursion by default.
1125 A subprogram entry may have a
1126 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1127 \DWATelementalDEFN{} attribute,\addtoindexx{elemental attribute}
1128 which is a \livelink{chap:classflag}{flag}.
1129 The attribute indicates whether the subroutine
1130 or entry point was declared with the \doublequote{elemental} keyword
1134 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1135 subprogram entry may have
1136 \addtoindexx{pure attribute}
1138 \DWATpureDEFN{} attribute, which is
1139 a \livelink{chap:classflag}{flag}.
1140 The attribute indicates whether the subroutine was
1141 declared with the \doublequote{pure} keyword or property.
1144 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1145 subprogram entry may have a
1146 \DWATrecursiveDEFN{} attribute, which
1147 is a \livelink{chap:classflag}{flag}.
1148 The attribute indicates whether the subroutine
1149 or entry point was declared with the \doublequote{recursive} keyword
1152 A subprogram entry may have a
1154 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1155 which is a \CLASSflag. The attribute
1156 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1157 indicating that the subprogram can be called, but will never return to its caller.
1159 \subsubsection{Call Site-Related Attributes}
1160 \textit{While subprogram attributes in the pervious section provide
1161 information about the subprogram and it's entry point(s) as a whole,
1162 the following attributes provide summary information about the calls
1163 that occur within a subprogram.}
1165 A subroutine entry may have \DWATcallalltailcallsNAME,
1166 \DWATcallallcallsNAME{} and/or \DWATcallallsourcecallsNAME{}
1167 attributes, each of which is a
1168 \livelink{chap:classflag}{flag}.
1169 \addtoindexx{call site summary information}
1170 \addtoindexx{subroutine call site summary attributes}
1171 These flags indicate the completeness of the call site
1172 information provided by call site entries (see
1173 Section \refersec{chap:callsiteentries}) within the subprogram.
1175 The \DWATcallalltailcallsDEFN{}
1176 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1177 indicates that every tail call
1178 that occurs in the code for the subprogram is described by a
1179 \DWTAGcallsite{} entry.
1180 (There may or may not be other non-tail calls to some of the same
1181 target subprograms.)
1183 The \DWATcallallcallsDEFN{}
1184 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1185 indicates that every non-inlined call
1186 (either a tail call or a normal call) that occurs in the code for the subprogram
1187 is described by a \DWTAGcallsite{} entry.
1189 The \DWATcallallsourcecallsDEFN{}
1190 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1191 indicates that every call that occurs in the
1192 code for the subprogram, including every call inlined into it, is described by either a
1193 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1194 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1195 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1197 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1198 information format consumers that analyse call graphs.}
1200 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1201 \DWATcallallcalls{} and \DWATcallalltailcalls{} attributes are necessarily also true, and
1202 those attributes need not be present. Similarly, if the value of the
1203 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1204 attribute is also true and the latter attribute need not be present.
1207 \subsection{Subroutine and Entry Point Return Types}
1208 \label{chap:subroutineandentrypointreturntypes}
1211 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1212 the subroutine or entry point
1213 \addtoindexx{return type of subroutine}
1214 is a function that returns a
1215 value, then its debugging information entry has
1216 \addtoindexx{type attribute}
1217 a \DWATtypeDEFN{} attribute
1218 to denote the type returned by that function.
1220 \textit{Debugging information entries for
1221 \addtoindex{C} void functions should
1222 not have an attribute for the return type. }
1224 \textit{Debugging information entries for declarations of \addtoindex{C++}
1225 member functions with an
1226 \autoreturntype{} specifier should use an unspecified type entry (see
1227 Section \refersec{chap:unspecifiedtypeentries}).
1228 The debugging information entry for the corresponding definition
1229 should provide the deduced return type. This practice causes the description of
1230 the containing class to be consistent across compilation units, allowing the class
1231 declaration to be placed into a separate type unit if desired.}
1234 \subsection{Subroutine and Entry Point Locations}
1235 \label{chap:subroutineandentrypointlocations}
1237 A subroutine entry may have either a \DWATlowpc{} and
1238 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1239 \addtoindexx{ranges attribute}
1241 \addtoindexx{high PC attribute}
1243 \addtoindexx{low PC attribute}
1244 encode the contiguous or non\dash contiguous address
1245 ranges, respectively, of the machine instructions generated
1246 for the subroutine (see
1247 Section \refersec{chap:codeaddressesandranges}).
1250 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1251 subroutine entry may also have
1252 \addtoindexx{entry PC attribute!for subroutine}
1254 \DWATentrypc{} attribute
1255 whose value is the address of the first executable instruction
1256 of the subroutine (see
1257 Section \refersec{chap:entryaddress}).
1259 An entry point has a \DWATlowpc{} attribute whose value is the
1260 relocated address of the first machine instruction generated
1261 for the entry point.
1264 \DWATentrypc{} attribute
1265 \addtoindexx{entry pc attribute!for subroutine}
1267 also seem appropriate
1268 for this purpose, historically the
1269 \DWATlowpc{} attribute
1271 \DWATentrypc{} was introduced (in
1272 \addtoindex{DWARF Version 3}).
1273 There is insufficient reason to change this.}
1279 \addtoindexx{address class attribute}
1281 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1285 \DWATaddressclassDEFN{} attributes,
1286 as appropriate, to specify
1287 which segments the code for the subroutine resides in and
1288 the addressing mode to be used in calling that subroutine.
1290 A subroutine entry representing a subroutine declaration
1291 that is not also a definition does not have code address or
1295 \subsection{Declarations Owned by Subroutines and Entry Points}
1296 \label{chap:declarationsownedbysubroutinesandentrypoints}
1297 \addtoindexx{subroutine formal parameters}
1298 The declarations enclosed by a subroutine or entry point are
1299 represented by debugging information entries that are owned
1300 by the subroutine or entry point entry. Entries representing
1301 \addtoindexx{formal parameter}
1302 the formal parameters of the subroutine or entry point appear
1303 in the same order as the corresponding declarations in the
1307 \textit{There is no ordering requirement for entries for declarations
1308 other than formal parameters. The formal parameter
1309 entries may be interspersed with other entries used by formal
1310 parameter entries, such as type entries.}
1312 The unspecified (sometimes called \doublequote{varying})
1313 parameters of a subroutine parameter list are
1314 represented by a debugging information
1315 entry\addtoindexx{unspecified parameters entry}
1316 with the tag \DWTAGunspecifiedparametersTARG.
1319 The entry for a subroutine that includes a
1320 \addtoindex{Fortran}
1321 \addtoindexx{Fortran!common block}
1322 \livelink{chap:fortrancommonblock}{common}
1323 \livelink{chap:commonblockentry}{block}
1324 \addtoindexx{common block|see{Fortran common block}}
1325 has a child entry with the
1326 tag \DWTAGcommoninclusionTARG.
1328 \hypertarget{chap:commonreferencecommonblockusage}{}
1329 common inclusion entry has a
1330 \DWATcommonreferenceDEFN{} attribute
1331 \addtoindexx{common block reference attribute}
1332 whose value is a \livelink{chap:classreference}{reference}
1333 to the debugging information entry
1334 for the common \nolink{block} being included
1335 (see Section \refersec{chap:commonblockentries}).
1337 \subsection{Low-Level Information}
1338 \label{chap:lowlevelinformation}
1341 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1342 subroutine or entry point entry may have a
1343 \addtoindexx{return address attribute}
1344 \DWATreturnaddrDEFN{}
1345 attribute, whose value is a location description. The location
1346 specified is the place where the return address for the
1347 subroutine or entry point is stored.
1350 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1351 subroutine or entry point entry may also have
1352 \addtoindexx{frame base attribute}
1354 \DWATframebaseDEFN{} attribute, whose value is a location
1355 description that describes the \doublequote{frame base} for the
1356 subroutine or entry point. If the location description is
1357 a simple register location description, the given register
1358 contains the frame base address. If the location description is
1359 a DWARF expression, the result of evaluating that expression
1360 is the frame base address. Finally, for a
1361 \addtoindex{location list},
1362 this interpretation applies to each location description
1363 contained in the list of \addtoindex{location list} entries.
1365 \textit{The use of one of the \DWOPregn{}
1367 context is equivalent to using
1370 compact. However, these are not equivalent in general.}
1373 \textit{The frame base for a subprogram is typically an address
1374 relative to the first unit of storage allocated for the
1375 subprogram\textquoteright s stack frame. The \DWATframebase{} attribute
1376 can be used in several ways:}
1377 \begin{enumerate}[1. ]
1378 \item \textit{In subprograms that need
1379 \addtoindexx{location list}
1380 location lists to locate local
1381 variables, the \DWATframebase{} can hold the needed location
1382 list, while all variables\textquoteright\ location descriptions can be
1383 simpler ones involving the frame base.}
1385 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1386 within nested routines.
1387 (See also \DWATstaticlink, below)}
1391 \textit{Some languages support nested subroutines. In such languages,
1392 it is possible to reference the local variables of an
1393 outer subroutine from within an inner subroutine. The
1394 \DWATstaticlink{} and \DWATframebase{} attributes allow
1395 debuggers to support this same kind of referencing.}
1398 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1400 \addtoindexx{address!uplevel|see {static link attribute}}
1401 \addtoindexx{uplevel address|see {static link attribute}}
1402 subroutine or entry point is nested, it may have a
1403 \DWATstaticlinkDEFN{}
1404 attribute, whose value is a location
1405 description that computes the frame base of the relevant
1406 instance of the subroutine that immediately encloses the
1407 subroutine or entry point.
1409 In the context of supporting nested subroutines, the
1410 \DWATframebase{} attribute value should obey the following
1413 \begin{enumerate}[1. ]
1414 \item It should compute a value that does not change during the
1415 life of the subprogram, and
1417 \item The computed value should be unique among instances of
1418 the same subroutine. (For typical \DWATframebase{} use, this
1419 means that a recursive subroutine\textquoteright s stack frame must have
1420 non\dash zero size.)
1423 \textit{If a debugger is attempting to resolve an up\dash level reference
1424 to a variable, it uses the nesting structure of DWARF to
1425 determine which subroutine is the lexical parent and the
1426 \DWATstaticlink{} value to identify the appropriate active
1427 frame of the parent. It can then attempt to find the reference
1428 within the context of the parent.}
1432 \subsection{Types Thrown by Exceptions}
1433 \label{chap:typesthrownbyexceptions}
1435 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1436 it may validly throw.}
1438 If a subroutine explicitly declares that it may throw
1439 \addtoindexx{exception thrown|see{thrown type entry}}
1441 \addtoindexx{thrown exception|see{thrown type entry}}
1442 exception of one or more types, each such type is
1443 represented by a debugging information entry with
1444 \addtoindexx{thrown type entry}
1446 \DWTAGthrowntypeTARG.
1447 Each such entry is a child of the entry
1448 representing the subroutine that may throw this type. Each
1449 thrown type entry contains
1450 \addtoindexx{type attribute}
1451 a \DWATtype{} attribute, whose
1452 value is a \livelink{chap:classreference}{reference}
1453 to an entry describing the type of the
1454 exception that may be thrown.
1456 \subsection{Function Template Instantiations}
1457 \label{chap:functiontemplateinstantiations}
1459 \textit{In \addtoindex{C++}, a function template is a generic definition of
1460 a function that is instantiated differently for calls with
1461 values of different types. DWARF does not represent the generic
1462 template definition, but does represent each instantiation.}
1465 A \addtoindex{function template instantiation}\addtoindexx{template instantiation!function}
1466 is represented by a debugging information entry with the
1467 \addtoindexx{subprogram entry!use for template instantiation}
1468 tag \DWTAGsubprogram.
1470 exceptions, such an entry will contain the same attributes and
1471 will have the same types of child entries as would an entry
1472 for a subroutine defined explicitly using the instantiation
1473 types and values. The exceptions are:
1475 \begin{enumerate}[1. ]
1476 \item Template parameters are described and referenced as specified in
1477 Section \refersec{chap:templateparameters}.
1480 \item If the compiler has generated a special compilation unit
1481 to hold the template instantiation and that compilation unit
1482 has a different name from the compilation unit containing
1483 the template definition, the name attribute for the debugging
1484 information entry representing that compilation unit is empty
1487 \item If the subprogram entry representing the template
1488 instantiation or any of its child entries contain declaration
1489 coordinate attributes, those attributes refer to the source
1490 for the template definition, not to any source generated
1491 artificially by the compiler for this instantiation.
1496 \subsection{Inlinable and Inlined Subroutines}
1497 \label{chap:inlinedsubroutines}
1498 A declaration or a definition of an inlinable subroutine
1499 is represented by a debugging information entry with the
1503 \addtoindexx{subprogram entry!use in inlined subprogram}
1505 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1506 explicitly declared to be available for inline expansion or
1507 that was expanded inline implicitly by the compiler has
1508 \addtoindexx{inline attribute}
1510 \DWATinlineDEFN{} attribute whose value is an
1511 \livelink{chap:classconstant}{integer constant}. The
1512 set of values for the \DWATinline{} attribute is given in
1513 Table \refersec{tab:inlinecodes}.
1517 \caption{Inline codes}
1518 \label{tab:inlinecodes}
1519 \begin{tabular}{l|P{8cm}}
1521 Name&Meaning\\ \hline
1522 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1523 \mbox{compiler} (equivalent to the absence of the
1524 containing \DWATinline{} attribute) \\
1525 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1526 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1527 not inlined by the \mbox{compiler} \\
1528 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1534 \textit{In \addtoindex{C++}, a function or a constructor declared with
1535 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1536 instance (see below) is represented by a debugging information
1537 entry with the tag \DWTAGsubprogram. Such an entry has a
1538 \DWATinline{} attribute whose value is \DWINLinlined.}
1541 \subsubsection{Abstract Instances}
1542 \label{chap:abstractinstances}
1543 Any subroutine entry that contains a
1544 \DWATinlineDEFN{} attribute\addtoindexx{inline attribute}
1545 whose value is other than
1548 \doublequote{abstract instance root.}\addtoindexx{abstract instance!root}
1549 \hypertarget{chap:DWATinlineabstracttinstance}{}
1550 Any debugging information entry that is owned (either
1551 directly or indirectly) by an abstract instance root
1553 \doublequote{abstract instance entry.}\addtoindexx{abstract instance!entry}
1554 Any set of abstract instance entries that are all
1555 children (either directly or indirectly) of some abstract
1556 instance root, together with the root itself, is known as an
1557 \doublequote{abstract instance tree.}\addtoindexx{abstract instance!tree}
1558 However, in the case where an abstract instance tree is
1559 nested within another abstract instance tree, the entries in the
1560 \addtoindex{nested abstract instance}
1561 tree are not considered to be entries in the outer abstract
1564 Each abstract instance root is either part of a larger
1565 \addtoindexx{abstract instance!root}
1566 tree (which gives a context for the root) or
1567 \addtoindexx{specification attribute}
1569 \DWATspecification{}
1570 to refer to the declaration in context.
1572 \textit{For example, in \addtoindex{C++} the context might be a namespace
1573 declaration or a class declaration.}
1575 \textit{Abstract instance trees are defined so that no entry is part
1576 of more than one abstract instance tree. This simplifies the
1577 following descriptions.}
1579 A debugging information entry that is a member of an abstract
1580 instance tree should not contain any attributes which describe
1581 aspects of the subroutine which vary between distinct inlined
1582 expansions or distinct out\dash of\dash line expansions. For example,
1583 \addtoindexx{entry pc attribute!and abstract instance}
1594 \addtoindexx{location attribute!and abstract instance}
1596 \addtoindexx{ranges attribute!and abstract instance}
1598 \addtoindexx{high PC attribute!and abstract instance}
1600 \addtoindexx{low PC attribute!and abstract instance}
1602 \addtoindexx{segment attribute!and abstract instance}
1604 \addtoindexx{return address attribute!and abstract instance}
1606 \addtoindexx{segment attribute!and abstract instance}
1608 \addtoindexx{start scope attribute!and abstract instance}
1612 \textit{It would not make sense normally to put these attributes into
1613 abstract instance entries since such entries do not represent
1614 actual (concrete) instances and thus do not actually exist at
1615 run\dash time. However,
1616 see Appendix \refersec{app:inlineouteronenormalinner}
1617 for a contrary example.}
1619 The rules for the relative location of entries belonging to
1620 abstract instance trees are exactly the same as for other
1621 similar types of entries that are not abstract. Specifically,
1622 the rule that requires that an entry representing a declaration
1623 be a direct child of the entry representing the scope of the
1624 declaration applies equally to both abstract and non\dash abstract
1625 entries. Also, the ordering rules for formal parameter entries,
1626 member entries, and so on, all apply regardless of whether
1627 or not a given entry is abstract.
1630 \subsubsection{Concrete Inlined Instances}
1631 \label{chap:concreteinlinedinstances}
1633 Each inline expansion of a subroutine is represented
1634 by a debugging information entry with the
1635 tag \DWTAGinlinedsubroutineTARG.
1636 Each such entry should be a direct
1637 child of the entry that represents the scope within which
1638 the inlining occurs.
1641 Each inlined subroutine entry may have either a
1643 and \DWAThighpc{} pair
1645 \addtoindexx{high PC attribute}
1647 \addtoindexx{low PC attribute}
1649 \addtoindexx{ranges attribute}
1652 attribute whose values encode the contiguous or non\dash contiguous
1653 address ranges, respectively, of the machine instructions
1654 generated for the inlined subroutine (see
1655 Section \referfol{chap:codeaddressesandranges}).
1657 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1658 inlined subroutine entry may
1659 \addtoindexx{inlined subprogram entry!in concrete instance}
1661 \addtoindexx{inlined subprogram entry}
1663 \addtoindexx{entry PC attribute!for inlined subprogram}
1666 attribute, representing the first executable instruction of
1667 the inline expansion (see
1668 Section \refersec{chap:entryaddress}).
1670 % Positions of the 3 targets here is a bit arbitrary.
1672 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1674 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1676 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1677 may also have \DWATcallfileDEFN,
1678 \DWATcalllineDEFN{} and \DWATcallcolumnDEFN{} attributes,
1679 \addtoindexx{inlined call location attributes}
1681 value is an \livelink{chap:classconstant}{integer constant}.
1682 These attributes represent the
1683 source file, source line number, and source column number,
1684 respectively, of the first character of the statement or
1685 expression that caused the inline expansion. The call file,
1686 call line, and call column attributes are interpreted in
1687 the same way as the declaration file, declaration line, and
1688 declaration column attributes, respectively (see
1689 Section \refersec{chap:declarationcoordinates}).
1691 \textit{The call file, call line and call column coordinates do not
1692 describe the coordinates of the subroutine declaration that
1693 was inlined, rather they describe the coordinates of the call.
1696 An inlined subroutine entry
1697 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1699 \DWATconstexprDEFN{} attribute,\addtoindexx{constant expression attribute}
1700 which is a \livelink{chap:classflag}{flag}
1701 whose presence indicates that the
1702 subroutine has been evaluated as a compile\dash time constant. Such
1703 an entry may also have a \DWATconstvalue{} attribute,
1704 whose value may be of any form that is appropriate for the
1705 representation of the subroutine's return value. The value of
1706 this attribute is the actual return value of the subroutine,
1707 represented as it would be on the target architecture.
1709 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1710 \addttindex{constexpr}
1711 is called with constant expressions, then the corresponding
1712 concrete inlined instance has a
1713 \DWATconstexpr{} attribute,
1714 as well as a \DWATconstvalue{} attribute whose value represents
1715 the actual return value of the concrete inlined instance.}
1717 Any debugging information entry that is owned (either
1718 directly or indirectly) by a debugging information entry
1719 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1720 \doublequote{concrete inlined instance entry.} Any entry that has
1722 \DWTAGinlinedsubroutine{}
1723 is known as a \doublequote{concrete inlined instance root.}
1724 Any set of concrete inlined instance
1725 entries that are all children (either directly or indirectly)
1726 of some concrete inlined instance root, together with the root
1727 itself, is known as a \doublequote{concrete inlined instance tree.}
1728 However, in the case where a concrete inlined instance tree
1729 is nested within another concrete instance tree, the entries
1730 in the \addtoindex{nested concrete inline instance} tree
1731 are not considered to
1732 be entries in the outer concrete instance tree.
1735 \textit{Concrete inlined instance trees are defined so that no entry
1736 is part of more than one concrete inlined instance tree. This
1737 simplifies later descriptions.}
1739 Each concrete inlined instance tree is uniquely associated
1740 with one (and only one) abstract instance tree.
1742 \textit{Note, however, that the reverse is not true. Any given abstract
1743 instance tree may be associated with several different concrete
1744 inlined instance trees, or may even be associated with zero
1745 concrete inlined instance trees.}
1747 Concrete inlined instance entries may omit attributes that
1748 are not specific to the concrete instance (but present in
1749 the abstract instance) and need include only attributes that
1750 are specific to the concrete instance (but omitted in the
1751 abstract instance). In place of these omitted attributes, each
1752 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1753 concrete inlined instance entry
1754 \addtoindexx{abstract origin attribute}
1756 \DWATabstractoriginDEFN{}
1757 attribute that may be used to obtain the missing information
1758 (indirectly) from the associated abstract instance entry. The
1759 value of the abstract origin attribute is a reference to the
1760 associated abstract instance entry.
1762 If an entry within a concrete inlined instance tree contains
1763 attributes describing the
1764 \addtoindexx{declaration coordinates!in concrete instance}
1765 \livelink{chap:declarationcoordinates}{declaration coordinates}
1766 of that entry, then those attributes should refer to the file, line
1767 and column of the original declaration of the subroutine,
1768 not to the point at which it was inlined. As a consequence,
1769 they may usually be omitted from any entry that has an abstract
1773 For each pair of entries that are associated via a
1774 \addtoindexx{abstract origin attribute}
1775 \DWATabstractorigin{} attribute, both members of the pair
1776 have the same tag. So, for example, an entry with the tag
1777 \DWTAGvariable{} can only be associated with another entry
1778 that also has the tag \DWTAGvariable. The only exception
1779 to this rule is that the root of a concrete instance tree
1780 (which must always have the tag \DWTAGinlinedsubroutine)
1781 can only be associated with the root of its associated abstract
1782 instance tree (which must have the tag \DWTAGsubprogram).
1785 In general, the structure and content of any given concrete
1786 inlined instance tree will be closely analogous to the
1787 structure and content of its associated abstract instance
1788 tree. There are a few exceptions:
1790 \begin{enumerate}[1. ]
1791 \item An entry in the concrete instance tree may be omitted if
1793 \addtoindexx{abstract origin attribute}
1794 \DWATabstractorigin{} attribute and either
1795 has no children, or its children are omitted. Such entries
1796 would provide no useful information. In C\dash like languages,
1797 such entries frequently include types, including structure,
1798 union, class, and interface types; and members of types. If any
1799 entry within a concrete inlined instance tree needs to refer
1800 to an entity declared within the scope of the relevant inlined
1801 subroutine and for which no concrete instance entry exists,
1802 the reference should refer to the abstract instance entry.
1805 \item Entries in the concrete instance tree which are associated
1806 with entries in the abstract instance tree such that neither
1807 has a \DWATname{} attribute,
1808 \addtoindexx{name attribute}
1809 and neither is referenced by
1810 any other debugging information entry, may be omitted. This
1811 may happen for debugging information entries in the abstract
1812 instance trees that became unnecessary in the concrete instance
1813 tree because of additional information available there. For
1814 example, an anonymous variable might have been created and
1815 described in the abstract instance tree, but because of
1816 the actual parameters for a particular inlined expansion,
1817 it could be described as a constant value without the need
1818 for that separate debugging information entry.
1821 \item A concrete instance tree may contain entries which do
1822 not correspond to entries in the abstract instance tree
1823 to describe new entities that are specific to a particular
1824 inlined expansion. In that case, they will not have associated
1825 entries in the abstract instance tree, should not contain
1826 \addtoindexx{abstract origin attribute}
1827 \DWATabstractorigin{} attributes, and must contain all their
1828 own attributes directly. This allows an abstract instance tree
1829 to omit debugging information entries for anonymous entities
1830 that are unlikely to be needed in most inlined expansions. In
1831 any expansion which deviates from that expectation, the
1832 entries can be described in its concrete inlined instance tree.
1836 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1837 \label{chap:outoflineinstancesofinlinedsubroutines}
1838 Under some conditions, compilers may need to generate concrete
1839 executable instances of inlined subroutines other than at
1840 points where those subroutines are actually called. Such
1841 concrete instances of inlined subroutines are referred to as
1842 \doublequote{concrete out\dash of\dash line instances.}
1844 \textit{In \addtoindex{C++}, for example,
1845 taking the address of a function declared
1846 to be inline can necessitate the generation of a concrete
1847 out\dash of\dash line instance of the given function.}
1849 The DWARF representation of a concrete out-of-line instance
1850 of an inlined subroutine is essentially the same as for a
1851 concrete inlined instance of that subroutine (as described in
1852 the preceding section). The representation of such a concrete
1853 % It is critical that the hypertarget and livelink be
1854 % separated to avoid problems with latex.
1856 \addtoindexx{abstract origin attribute}
1858 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1860 \DWATabstractoriginDEFN{}
1861 attributes in exactly the same way as they are used for
1862 a concrete inlined instance (that is, as references to
1863 corresponding entries within the associated abstract instance
1866 The differences between the DWARF representation of a
1867 concrete out\dash of\dash line instance of a given subroutine and the
1868 representation of a concrete inlined instance of that same
1869 subroutine are as follows:
1870 \begin{enumerate}[1. ]
1871 \item The root entry for a concrete out\dash of\dash line instance
1872 of a given inlined subroutine has the same tag as does its
1873 associated (abstract) inlined subroutine entry (that is, tag
1874 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1876 \item The root entry for a concrete out\dash of\dash line instance tree
1877 is normally owned by the same parent entry that also owns
1878 the root entry of the associated abstract instance. However,
1879 it is not required that the abstract and out\dash of\dash line instance
1880 trees be owned by the same parent entry.
1884 \subsubsection{Nested Inlined Subroutines}
1885 \label{nestedinlinedsubroutines}
1886 Some languages and compilers may permit the logical nesting of
1887 a subroutine within another subroutine, and may permit either
1888 the outer or the nested subroutine, or both, to be inlined.
1890 For a non\dash inlined subroutine nested within an inlined
1891 subroutine, the nested subroutine is described normally in
1892 both the abstract and concrete inlined instance trees for
1893 the outer subroutine. All rules pertaining to the abstract
1894 and concrete instance trees for the outer subroutine apply
1895 also to the abstract and concrete instance entries for the
1899 For an inlined subroutine nested within another inlined
1900 subroutine, the following rules apply to their abstract and
1901 \addtoindexx{abstract instance!nested}
1902 \addtoindexx{concrete instance!nested}
1903 concrete instance trees:
1905 \begin{enumerate}[1. ]
1906 \item The abstract instance tree for the nested subroutine is
1907 described within the abstract instance tree for the outer
1908 subroutine according to the rules in
1909 Section \refersec{chap:abstractinstances}, and
1910 without regard to the fact that it is within an outer abstract
1913 \item Any abstract instance tree for a nested subroutine is
1914 always omitted within the concrete instance tree for an
1917 \item A concrete instance tree for a nested subroutine is
1918 always omitted within the abstract instance tree for an
1921 \item The concrete instance tree for any inlined or
1922 \addtoindexx{out-of-line instance}
1924 \addtoindexx{out-of-line instance|see{\textit{also} concrete out-of-line instance}}
1925 expansion of the nested subroutine is described within a
1926 concrete instance tree for the outer subroutine according
1928 Sections \refersec{chap:concreteinlinedinstances} or
1929 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1931 and without regard to the fact that it is within an outer
1932 concrete instance tree.
1935 See Appendix \refersec{app:inliningexamples}
1936 for discussion and examples.
1938 \subsection{Trampolines}
1939 \label{chap:trampolines}
1941 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1942 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1943 an intermediary in making a call to another subroutine. It may
1944 adjust parameters and/or the result (if any) as appropriate
1945 to the combined calling and called execution contexts.}
1947 A trampoline is represented by a debugging information entry
1948 \addtoindexx{trampoline (subprogram) entry}
1949 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1951 \addtoindexx{trampoline attribute}
1952 a \DWATtrampolineDEFN{} attribute.
1954 attribute indicates the target subroutine of the trampoline,
1955 that is, the subroutine to which the trampoline passes
1956 control. (A trampoline entry may but need not also have a
1957 \DWATartificial{} attribute.)
1960 The value of the trampoline attribute may be represented
1961 using any of the following forms, which are listed in order
1965 \item If the value is of class \CLASSreference{}, then the value
1966 specifies the debugging information entry of the target
1969 \item If the value is of class \CLASSaddress{}, then the value is
1970 the relocated address of the target subprogram.
1973 \item If the value is of class \CLASSstring{}, then the value is the
1974 (possibly mangled) \addtoindexx{mangled names}
1975 name of the target subprogram.
1977 \item If the value is of class \CLASSflag, then the value true
1978 indicates that the containing subroutine is a trampoline but
1979 that the target subroutine is not known.
1983 The target subprogram may itself be a trampoline. (A sequence
1984 of trampolines necessarily ends with a non\dash trampoline
1987 \textit{In \addtoindex{C++}, trampolines may be used to implement
1988 derived virtual member functions; such trampolines typically
1990 \texttt{this} parameter\index{this parameter@\texttt{this} parameter}
1991 in the course of passing control.
1992 Other languages and environments may use trampolines in a manner
1993 sometimes known as transfer functions or transfer vectors.}
1995 \textit{Trampolines may sometimes pass control to the target
1996 subprogram using a branch or jump instruction instead of a
1997 call instruction, thereby leaving no trace of their existence
1998 in the subsequent execution context. }
2000 \textit{This attribute helps make it feasible for a debugger to arrange
2001 that stepping into a trampoline or setting a breakpoint in
2002 a trampoline will result in stepping into or setting the
2003 breakpoint in the target subroutine instead. This helps to
2004 hide the compiler generated subprogram from the user. }
2006 \textit{If the target subroutine is not known, a debugger may choose
2007 to repeatedly step until control arrives in a new subroutine
2008 which can be assumed to be the target subroutine. }
2010 \subsection{Call Site Entries}
2011 \label{chap:callsiteentries}
2013 A call site entry provides a way to represent the static or dynamic
2014 call graph of a program in the debugging information. It also provides
2015 information about how parameters are passed so that they may be more
2016 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
2017 call site entries can be also useful for computing values of variables
2018 and expressions where some value is no longer present in the current
2019 subroutine's registers or local stack frame, but it is known that the
2020 values are equal to some parameter passed to the function.
2021 The consumer can then use unwind
2022 information to find the caller and it's call site information and then
2023 compute the value passed in a particular parameter.}
2025 A call site is represented by a debugging information entry with the tag
2026 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
2027 debugging information entry representing the scope within which the
2028 call is present in the source program.
2030 \textit{A scope entry (for example, for a lexical block) that would not
2031 otherwise be present in the debugging information of a subroutine
2032 need not be introduced solely to represent the immediately containing scope
2035 A source call can be compiled into different types of machine code:
2038 A \textit{normal call} uses a call-like instruction which transfers
2039 control to the start of some subprogram and leaves the call site
2040 location address somewhere where unwind information can find it.
2042 A \textit{tail call} uses a jump-like instruction which
2043 transfers control to the start of some subprogram, but the call site location
2044 address is not preserved (and thus not available using the unwind information).
2046 A \textit{tail recursion call} is a call
2047 to the current subroutine which is compiled as a jump into the middle of the
2051 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2052 where at least one instruction has the location of the inlined subprogram
2053 or any of its blocks or inlined subprograms.
2057 There are also different types of \doublequote{optimized out} calls:
2060 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2061 has not been emitted (such as, for example, the call to \texttt{foo} in
2062 \texttt{if (0) foo();}).
2064 An \textit{optimized out inline call}
2065 is a call to an inlined subprogram which either did not expand to any instructions
2066 or only parts of instructions belong to it and for debug information purposes those
2067 instructions are given a location in the caller.
2070 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2071 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2072 (see Section \refersec{chap:inlinedsubroutines}).
2074 The call site entry has a
2075 \DWATcallreturnpcDEFN{}
2076 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2077 which is the return address after the call.
2078 The value of this attribute corresponds to the return address computed by
2079 call frame information in the called subprogram
2080 (see Section \refersec{datarep:callframeinformation}).
2082 \textit{On many architectures the return address is the address immediately following the
2083 call instruction, but on architectures with delay slots it might
2084 be an address after the delay slot of the call.}
2086 The call site entry may have a
2088 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2089 address of the call instruction.
2091 If the call site entry corresponds to a tail call, it has the
2092 \DWATcalltailcallDEFN{}
2093 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2094 which is a \CLASSflag.
2096 The call site entry may have a
2097 \DWATcalloriginDEFN{}
2098 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2099 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2100 known it is a reference to the called subprogram's debugging
2101 information entry. For indirect calls it may be a reference to a
2102 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2103 the subroutine pointer that is called.
2106 The call site may have a
2107 \DWATcalltargetDEFN{}
2108 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2109 a DWARF expression. For indirect calls or jumps where it is unknown at
2110 compile time which subprogram will be called the expression computes the
2111 address of the subprogram that will be called. The DWARF expression should
2112 not use register or memory locations that might be clobbered by the call.
2115 The call site entry may have a
2116 \DWATcalltargetclobberedDEFN{}
2117 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2118 which is a DWARF expression. For indirect calls or jumps where the
2119 address is not computable without use of registers or memory locations that
2120 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2121 attribute is used instead of the \DWATcalltarget{} attribute.
2123 The call site entry may have a \DWATtypeDEFN{}
2124 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2125 referencing a debugging information entry for the type of the called function.
2127 \textit{When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.}
2129 The call site entry may have
2130 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2131 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2132 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2133 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2134 each of whose value is an integer constant.
2135 These attributes represent the source file, source line number, and source
2136 column number, respectively, of the first character of the call statement or
2137 expression. The call file, call line, and call column attributes are
2138 interpreted in the same way as the declaration file, declaration
2139 line, and declaration column attributes, respectively
2140 (see Section \refersec{chap:declarationcoordinates}).
2142 \textit{The call file, call line and call column coordinates do not describe the
2143 coordinates of the subroutine declaration that was called, rather they describe
2144 the coordinates of the call.}
2147 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2148 entries\index{call site parameter entry} representing the parameters passed to the call.
2149 Each such entry has a \DWATlocation{} attribute which is a location expression.
2150 This location expression describes where the parameter is passed
2151 (usually either some register, or a memory location expressible as the
2152 contents of the stack register plus some offset).
2154 Each \DWTAGcallsiteparameter{} entry may have a
2155 \DWATcallvalueDEFN{}
2156 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2157 which is a DWARF expression. This expression computes the value
2158 passed for that parameter. The expression should not use registers or memory
2159 locations that might be clobbered by the call, as it might be evaluated after
2160 unwinding from the called function back to the caller. If it is not
2161 possible to avoid registers or memory locations that might be clobbered by
2162 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2165 \textit{The reason for the restriction is that the value of the parameter may be
2166 needed in the middle of the callee, where the call clobbered registers or
2167 memory might be already clobbered, and if the consumer was not assured by
2168 the producer it can safely use those values, the consumer could not safely
2169 use the values at all.}
2171 For parameters passed by reference, where the code passes a pointer to
2172 a location which contains the parameter, or for reference type parameters
2173 the \DWTAGcallsiteparameter{} entry may also have
2174 \DWATcalldatalocationNAME{}
2175 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2176 whose value is a location expression and a
2177 \DWATcalldatavalueNAME{}
2178 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2179 whose value is a DWARF expression. The \DWATcalldatalocationDEFN{} attribute
2180 \addtoindexx{call data location attribute}
2181 describes where the referenced value lives during the call. If it is just
2182 \DWOPpushobjectaddress{}, it may be left out. The
2183 \DWATcalldatavalueNAME{} attribute\addtoindexx{call data value attribute}
2184 describes the value in that location.
2185 The expression should not use registers or memory
2186 locations that might be clobbered by the call, as it might be evaluated after
2187 unwinding from the called function back to the caller.
2190 Each call site parameter entry may also have a
2191 \DWATcallparameterDEFN{}
2192 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2193 which contains a reference to a \DWTAGformalparameter{} entry,
2194 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2195 attribute describing the parameter's name.
2199 \section{Lexical Block Entries}
2200 \label{chap:lexicalblockentries}
2203 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2205 \addtoindexx{lexical block}
2206 a bracketed sequence of source statements
2207 that may contain any number of declarations. In some languages
2208 (including \addtoindex{C} and \addtoindex{C++}),
2209 \nolink{blocks} can be nested within other
2210 \nolink{blocks} to any depth.}
2212 % We do not need to link to the preceding paragraph.
2213 A lexical \nolink{block} is represented by a debugging information
2215 tag \DWTAGlexicalblockTARG.
2217 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2219 either a \DWATlowpc{} and
2220 \DWAThighpc{} pair of
2222 \addtoindexx{high PC attribute}
2224 \addtoindexx{low PC attribute}
2226 \DWATranges{} attribute
2227 \addtoindexx{ranges attribute}
2228 whose values encode the contiguous or non-contiguous address
2229 ranges, respectively, of the machine instructions generated
2230 for the lexical \nolink{block}
2231 (see Section \refersec{chap:codeaddressesandranges}).
2234 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2235 lexical block entry may also have
2236 \addtoindexx{entry PC attribute!for lexical block}
2238 \DWATentrypc{} attribute
2239 whose value is the address of the first executable instruction
2240 of the lexical block (see
2241 Section \refersec{chap:entryaddress}).
2243 If a name has been given to the
2244 lexical \nolink{block}
2246 program, then the corresponding
2247 lexical \nolink{block} entry has a
2248 \DWATname{} attribute whose
2249 \addtoindexx{name attribute}
2250 value is a null\dash terminated string
2251 containing the name of the lexical \nolink{block}
2255 \textit{This is not the same as a \addtoindex{C} or
2256 \addtoindex{C++} label (see below).}
2258 The lexical \nolink{block} entry owns
2259 debugging information entries that
2260 describe the declarations within that lexical \nolink{block}.
2262 one such debugging information entry for each local declaration
2263 of an identifier or inner lexical \nolink{block}.
2266 \section{Label Entries}
2267 \label{chap:labelentries}
2268 \textit{A label is a way of identifying a source statement. A labeled
2269 statement is usually the target of one or more \doublequote{go to}
2274 A label is represented by a debugging information entry with
2275 \addtoindexx{label entry}
2277 tag \DWTAGlabelTARG.
2278 The entry for a label should be owned by
2279 the debugging information entry representing the scope within
2280 which the name of the label could be legally referenced within
2283 The label entry has a \DWATlowpc{} attribute whose value
2284 is the relocated address of the first machine instruction
2285 generated for the statement identified by the label in
2286 the source program. The label entry also has a
2287 \DWATname{} attribute
2288 \addtoindexx{name attribute}
2289 whose value is a null-terminated string containing
2290 the name of the label as it appears in the source program.
2293 \section{With Statement Entries}
2294 \label{chap:withstatemententries}
2296 \textit{Both \addtoindex{Pascal} and
2297 \addtoindexx{Modula-2}
2298 Modula\dash 2 support the concept of a \doublequote{with}
2299 statement. The with statement specifies a sequence of
2300 executable statements within which the fields of a record
2301 variable may be referenced, unqualified by the name of the
2304 A with statement is represented by a
2305 \addtoindexi{debugging information entry}{with statement entry}
2306 with the tag \DWTAGwithstmtTARG.
2308 A with statement entry may have either a
2310 \DWAThighpc{} pair of attributes
2311 \addtoindexx{high PC attribute}
2313 \addtoindexx{low PC attribute}
2314 a \DWATranges{} attribute
2315 \addtoindexx{ranges attribute}
2316 whose values encode the contiguous or non\dash contiguous address
2317 ranges, respectively, of the machine instructions generated
2318 for the with statement
2319 (see Section \refersec{chap:codeaddressesandranges}).
2322 \hypertarget{chap:DWATentrypcofwithstmt}{}
2323 with statement entry may also have
2324 \addtoindexx{entry PC attribute!for with statement}
2326 \DWATentrypc{} attribute
2327 whose value is the address of the first executable instruction
2328 of the with statement (see
2329 Section \refersec{chap:entryaddress}).
2332 The with statement entry has
2333 \addtoindexx{type attribute}
2334 a \DWATtype{} attribute, denoting
2335 the type of record whose fields may be referenced without full
2336 qualification within the body of the statement. It also has
2337 \addtoindexx{location attribute}
2338 a \DWATlocation{} attribute, describing how to find the base
2339 address of the record object referenced within the body of
2343 \section{Try and Catch Block Entries}
2344 \label{chap:tryandcatchblockentries}
2345 \livetargi{chap:tryandcatchblockentries}{}
2346 \textit{In \addtoindex{C++}, a \livelink{chap:lexicalblock}{lexical block} may be
2347 designated as a \doublequote{catch \nolink{block}.}
2348 A catch \nolink{block} is an exception handler that
2349 handles exceptions thrown by an immediately preceding
2350 \doublequote{try \nolink{block}.}
2351 A catch \nolink{block}
2352 designates the type of the exception that it can handle.}
2354 A \livetargi{chap:tryblock}{try block}{try block} is represented
2355 by a debugging information entry
2356 \addtoindexx{try block entry}
2357 with the tag \DWTAGtryblockTARG.
2358 A \livetargi{chap:catchblock}{catch block} is represented by
2359 a debugging information entry
2360 \addtoindexx{catch block entry}
2361 with the tag \DWTAGcatchblockTARG.
2363 % nolink as we have links just above and do not have a combo link for both
2364 Both try and catch \nolink{block} entries may have either a
2366 \DWAThighpc{} pair of attributes
2367 \addtoindexx{high PC attribute}
2369 \addtoindexx{low PC attribute}
2371 \DWATranges{} attribute
2372 \addtoindexx{ranges attribute}
2373 whose values encode the contiguous
2374 or non\dash contiguous address ranges, respectively, of the
2375 machine instructions generated for the \nolink{block}
2376 (see Section \refersec{chap:codeaddressesandranges}).
2378 \hypertarget{chap:DWATentrypcoftryblock}{}
2379 \hypertarget{chap:DWATentrypcofcatchblock}{}
2380 A try or catch block entry may also have
2381 \addtoindexx{entry PC attribute!for try block}
2382 \addtoindexx{entry PC attribute!for catch block}
2384 \DWATentrypc{} attribute
2385 whose value is the address of the first executable instruction
2386 of the try or catch block
2387 (see Section \refersec{chap:entryaddress}).
2390 Catch \nolink{block} entries have at least one child entry,
2391 an entry representing the type of exception accepted by
2392 that catch \nolink{block}.
2393 This child entry has one of the tags
2394 \DWTAGformalparameter{}\addtoindexx{formal parameter entry!in catch block}
2396 \DWTAGunspecifiedparameters,\addtoindexx{unspecified parameters entry!in catch block}
2397 and will have the same form as other parameter entries.
2399 The siblings immediately following a try \nolink{block}
2400 entry are its corresponding catch \nolink{block} entries.