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 \DWATname{} attribute
124 \addtoindexx{name attribute}
125 whose value is a null\dash terminated
127 \hypertarget{chap:DWATnamepathnameofcompilationsource}{}
128 containing the full or relative path name of the primary
129 source file from which the compilation unit was derived.
131 \item A \DWATlanguage{} attribute
132 \addtoindexx{language attribute}
133 whose constant value is an
134 \hypertarget{chap:DWATlanguageprogramminglanguage}{}
136 \addtoindexx{language attribute}
137 indicating the source language of the compilation
138 unit. The set of language names and their meanings are given
139 in Table \refersec{tab:languagenames}.
142 \setlength{\extrarowheight}{0.1cm}
143 \begin{longtable}{l|l}
144 \caption{Language names} \label{tab:languagenames} \\
145 \hline \bfseries Language name & \bfseries Meaning \\ \hline
147 \bfseries Language name & \bfseries Meaning \\ \hline
149 \hline \emph{Continued on next page}
152 \addtoindexx{ISO-defined language names}
153 \DWLANGAdaeightythreeTARG{} \dag & ISO Ada:1983 \addtoindexx{Ada:1983 (ISO)} \\
154 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada:1995 (ISO)} \\
155 \DWLANGCTARG & Non-standardized C, such as K\&R \addtoindexx{C!non-standard}\\
156 \DWLANGCeightynineTARG & ISO C:1989 \addtoindexx{C:1989 (ISO)} \\
157 \DWLANGCninetynineTARG & ISO C:1999 \addtoindexx{C:1999 (ISO)} \\
158 \DWLANGCelevenTARG & ISO C:2011 \addtoindexx{C:2011 (ISO)} \\
159 \DWLANGCplusplusTARG & ISO C++:1998 \addtoindexx{C++:1998 (ISO)} \\
160 \DWLANGCpluspluszerothreeTARG & ISO C++:2003 \addtoindexx{C++:2003 (ISO)} \\
161 \DWLANGCpluspluselevenTARG & ISO C++:2011 \addtoindexx{C++:2011 (ISO)} \\
162 \DWLANGCplusplusfourteenTARG & ISO C++:2014 \addtoindexx{C++:2014 (ISO)} \\
163 \DWLANGCobolseventyfourTARG & ISO COBOL:1974 \addtoindexx{COBOL:1974 (ISO)} \\
164 \DWLANGCoboleightyfiveTARG & ISO COBOL:1985 \addtoindexx{COBOL:1985 (ISO)} \\
165 \DWLANGDTARG{}~\dag & D \addtoindexx{D language} \\
166 \DWLANGDylanTARG~\dag & Dylan \addtoindexx{Dylan} \\
167 \DWLANGFortranseventysevenTARG & ISO FORTRAN:1977 \addtoindexx{FORTRAN:1977 (ISO)} \\
168 \DWLANGFortranninetyTARG & ISO Fortran:1990 \addtoindexx{Fortran:1990 (ISO)} \\
169 \DWLANGFortranninetyfiveTARG & ISO Fortran:1995 \addtoindexx{Fortran:1995 (ISO)} \\
170 \DWLANGFortranzerothreeTARG & ISO Fortran:2004 \addtoindexx{Fortran:2004 (ISO)} \\
171 \DWLANGFortranzeroeightTARG & ISO Fortran:2010 \addtoindexx{Fortran:2010 (ISO)} \\
172 \DWLANGGoTARG{}~\dag & \addtoindex{Go} \\
173 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell} \\
174 \DWLANGJavaTARG{} & \addtoindex{Java}\\
175 \DWLANGJuliaTARG{}~\dag & \addtoindex{Julia} \\
176 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
177 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
178 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
179 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
180 \DWLANGOCamlTARG{}~\dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
181 \DWLANGOpenCLTARG{}~\dag & \addtoindex{OpenCL} \\
182 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
183 \DWLANGPLITARG{}~\dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
184 \DWLANGPythonTARG{}~\dag & \addtoindex{Python} \\
185 \DWLANGRustTARG{}~\dag & \addtoindex{Rust} \\
186 \DWLANGSwiftTARG{}~\dag & \addtoindex{Swift} \\
187 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
188 \index{Unified Parallel C|see{UPC}} \\
190 \dag \ \ \textit{Support for these languages is limited}& \\
195 \item A \DWATstmtlist{}\hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
196 attribute whose value is
197 \addtoindexx{statement list attribute}
199 \addtoindexx{section offset!in statement list attribute}
200 section offset to the line number information for this compilation
203 This information is placed in a separate object file
204 section from the debugging information entries themselves. The
205 value of the statement list attribute is the offset in the
206 \dotdebugline{} section of the first byte of the line number
207 information for this compilation unit
208 (see Section \refersec{chap:linenumberinformation}).
210 \item A \DWATmacros{}\hypertarget{chap:DWATmacrosmacroinformation}{}
212 \addtoindexx{macro information attribute}
214 \addtoindexx{section offset!in macro information attribute}
215 section offset to the macro information for this compilation unit.
217 This information is placed in a separate object file section
218 from the debugging information entries themselves. The
219 value of the macro information attribute is the offset in
220 the \dotdebugmacro{} section of the first byte of the macro
221 information for this compilation unit
222 (see Section \refersec{chap:macroinformation}).
224 \textit{The \DWATmacros{} attribute is new in \DWARFVersionV,
226 \DWATmacroinfo{} attribute of earlier DWARF versions.
227 \livetarg{chap:DWATmacroinfomacroinformation}{}
228 While \DWATmacros{} and \DWATmacroinfo{} attributes cannot both occur in the same
229 compilation unit, both may be found in the set of units that make up an executable
230 or shared object file. The two attributes have distinct encodings to facilitate such
237 \hypertarget{chap:DWATcompdircompilationdirectory}{}
239 null\dash terminated string containing the current working directory
240 of the compilation command that produced this compilation
241 unit in whatever form makes sense for the host system.
243 \item A \DWATproducer{} attribute
244 \addtoindexx{producer attribute}
245 whose value is a null\dash
246 terminated string containing information about the compiler
247 \hypertarget{chap:DWATproducercompileridentification}{}
248 that produced the compilation unit. The actual contents of
249 the string will be specific to each producer, but should
250 begin with the name of the compiler vendor or some other
251 identifying character sequence that should avoid confusion
252 with other producer values.
255 \item A \DWATidentifiercase{}
257 \addtoindexx{identifier case attribute}
259 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
260 constant value is a code describing the treatment
261 of identifiers within this compilation unit. The
262 set of identifier case codes is given in
263 Table \refersec{tab:identifiercasecodes}.
265 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
266 \DWIDcasesensitive{} \\
269 \DWIDcaseinsensitive{} \\
270 \end{simplenametable}
272 \DWIDcasesensitiveTARG{} is the default for all compilation units
273 that do not have this attribute. It indicates that names given
274 as the values of \DWATname{} attributes
275 \addtoindexx{name attribute}
276 in debugging information
277 entries for the compilation unit reflect the names as they
278 appear in the source program. The debugger should be sensitive
279 to the case of \addtoindex{identifier names} when doing identifier
283 \DWIDupcaseTARG{} means that the
284 producer of the debugging
285 information for this compilation unit converted all source
286 names to upper case. The values of the name attributes may not
287 reflect the names as they appear in the source program. The
288 debugger should convert all names to upper case when doing
291 \DWIDdowncaseTARG{} means that
292 the producer of the debugging
293 information for this compilation unit converted all source
294 names to lower case. The values of the name attributes may not
295 reflect the names as they appear in the source program. The
296 debugger should convert all names to lower case when doing
300 \DWIDcaseinsensitiveTARG{} means that the values of the name
301 attributes reflect the names as they appear in the source
302 program but that a case insensitive lookup should be used to
306 \item A \DWATbasetypes{} attribute whose value is a
307 \livelink{chap:classreference}{reference}.
310 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
312 \addtoindexx{base types attribute}
313 points to a debugging information entry
314 representing another compilation unit. It may be used
315 to specify the compilation unit containing the base type
316 entries used by entries in the current compilation unit
317 (see Section \refersec{chap:basetypeentries}).
320 \textit{This attribute provides a consumer a way to find the definition
321 of base types for a compilation unit that does not itself
322 contain such definitions. This allows a consumer, for example,
323 to interpret a type conversion to a base type
324 % getting this link target at the right spot is tricky.
325 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
328 \item A \DWATuseUTFeight{} attribute,
329 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
330 which is a \livelink{chap:classflag}{flag} whose
331 presence indicates that all strings (such as the names of
332 declared entities in the source program, or filenames in the line number table)
333 are represented using the UTF\dash 8 representation.
336 \item A \DWATmainsubprogram{} attribute, which is a \livelink{chap:classflag}{flag}
337 \addtoindexx{main subprogram attribute}
338 whose presence indicates
339 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
340 that the compilation unit contains a
341 subprogram that has been identified as the starting function
342 of the program. If more than one compilation unit contains
343 this \nolink{flag}, any one of them may contain the starting function.
345 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
347 to specify and provide a user\dash specified name for the main
348 subroutine of a program.
349 \addtoindex{C} uses the name \doublequote{main} to identify
350 the main subprogram of a program. Some other languages provide
351 similar or other means to identify the main subprogram of
352 a program. The \DWATmainsubprogram{} attribute may also be used to
353 identify such subprograms (see
354 Section \refersec{chap:generalsubroutineandentrypointinformation}).}
356 \item A \DWATentrypc{} attribute whose value is the address of the first
357 \hypertarget{chap:DWATentrypcofcompileunit}{}
358 \hypertarget{chap:DWATentrypcofpartialunit}{}
359 \addtoindexx{entry pc attribute!for normal compilation unit}
360 \addtoindexx{entry pc attribute!for partial compilation unit}
361 executable instruction of the unit (see
362 Section \refersec{chap:entryaddress}).
365 \item A \DWATstroffsetsbaseNAME\addtoindexx{string offset base attribute}
366 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
367 attribute, whose value is a reference.
368 This attribute points to the first string
369 offset of the compilation unit's contribution to the
370 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
371 Indirect string references
372 (using \DWFORMstrx) within the compilation unit are
373 interpreted as indices relative to this base.
376 \item A \DWATaddrbaseNAME\addtoindexx{address table base attribute}
377 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
378 attribute, whose value is a reference.
379 This attribute points to the beginning of the compilation
380 unit's contribution to the \dotdebugaddr{} section.
381 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
382 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
383 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
384 interpreted as indices relative to this base.
387 \item A \DWATrangesbaseNAME\addtoindexx{ranges table base attribute}
388 \hypertarget{chap:DWATrangesbaseforrangelists}{}
389 attribute, whose value is a reference.
390 This attribute points to the beginning of the compilation
391 unit's contribution to the \dotdebugranges{} section.
392 References to range lists (using \DWFORMsecoffset)
393 within the compilation unit are
394 interpreted as offsets relative to this base.
398 The base address of a compilation unit is defined as the
399 value of the \DWATlowpc{} attribute, if present; otherwise,
400 it is undefined. If the base address is undefined, then any
401 DWARF entry or structure defined in terms of the base address
402 of that compilation unit is not valid.
404 \subsection{Skeleton Compilation Unit Entries}
405 \label{chap:skeletoncompilationunitentries}
406 \addtoindexx{compilation unit!skeleton}
407 \addtoindexx{skeleton compilation unit}
408 When generating a \splitDWARFobjectfile{} (see
409 Section \refersec{datarep:splitdwarfobjectfiles}), the
410 compilation unit in the \dotdebuginfo{} section is a "skeleton"
411 compilation unit, which contains \DWATdwoname{} and \DWATdwoid{}
412 attributes as well as a subset of the
413 attributes of a full normal or partial compilation unit. In general,
414 it contains those attributes that are necessary for the consumer
415 to locate the object file where the full compilation unit
416 can be found, and for the consumer to interpret references to
417 addresses in the program.
419 A skeleton compilation unit has \DWATdwoname{} and
420 \DWATdwoid{} attributes and no children; it may have additional
421 attributes from among the following:
422 \begin{enumerate}[1. ]
425 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
426 or a \DWATranges{} attribute (the same as for regular
427 compilation unit entries).
430 A \DWATstmtlist{} attribute (the same as for regular
431 compilation unit entries).
434 A \DWATcompdir{} attribute (the same as for regular
435 compilation unit entries).
438 \livetarg{chap:DWATdwonameforunit}{}
439 A \DWATdwonameNAME{} attribute whose value is a
440 null-terminated string containing the full or relative
441 path name of the object file that contains the full
445 \livetarg{chap:DWATdwoidforunit}{}
446 A \DWATdwoidNAME{} attribute 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.
488 \subsection{Type Unit Entries}
489 \label{chap:typeunitentries}
490 \addtoindexx{type unit}
491 \addtoindexx{type unit|see{\textit{also} compilation unit}}
492 \addtoindexx{compilation unit!\textit{see also} type unit}
493 An object file may contain any number of separate type
494 unit entries, each representing a single complete type
496 Each \addtoindex{type unit} must be uniquely identified by
497 a 64-bit signature, stored as part of the type unit, which
498 can be used to reference the type definition from debugging
499 information entries in other compilation units and type units.
501 A type unit is represented by a debugging information entry
502 with the tag \DWTAGtypeunitTARG.
503 A \addtoindex{type unit entry} owns debugging
504 information entries that represent the definition of a single
505 type, plus additional debugging information entries that may
506 be necessary to include as part of the definition of the type.
508 A type unit entry may have the following attributes:
509 \begin{enumerate}[1. ]
512 \DWATlanguage{} attribute,
514 \addtoindexx{language attribute}
515 constant value is an integer code indicating the source
516 language used to define the type. The set of language names
517 and their meanings are given in Table \refersec{tab:languagenames}.
521 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
522 attribute, whose value is a reference. This attribute points
523 to the first string offset of the type unit's contribution to
524 the \dotdebugstroffsets{} section. Indirect string references
525 (using \DWFORMstrx) within the type unit must be interpreted
526 as indices relative to this base.
528 \item A \DWATstmtlist{} attribute\addtoindexx{statement list attribute}
529 whose value of class \CLASSlineptr{} points to the line number
530 information for this type unit.
531 Because type units do not describe any code, they
532 do not actually need a line number table, but the line number
533 tables also contain a list of directories and file names that
534 may be referenced by the \DWATdeclfile{} attribute. In a
535 normal object file with a regular compilation unit entry, the
536 type unit entries can simply refer to the line number table
537 used by the compilation unit. In a \splitDWARFobjectfile, where
538 the type units are located in a separate DWARF object file,
539 the \DWATstmtlist{} attribute refers to a "specialized"
540 line number table in the \dotdebuglinedwo{} section, which
541 contains only the list of directories and file names. All
542 type unit entries in a \splitDWARFobjectfile{} may (but are not
543 required to) refer to the same \addtoindex{specialized line number table}.
545 \item A \DWATuseUTFeight{} attribute, which is a flag
546 whose presence indicates that all strings referred to by this type
547 unit entry, its children, and its associated
548 \addtoindex{specialized line number table},
549 are represented using the UTF-8 representation.
553 A \addtoindex{type unit} entry for a given type T owns a debugging
554 information entry that represents a defining declaration
555 of type T. If the type is nested within enclosing types or
556 namespaces, the debugging information entry for T is nested
557 within debugging information entries describing its containers;
558 otherwise, T is a direct child of the type unit entry.
560 A type unit entry may also own additional debugging information
561 entries that represent declarations of additional types that
562 are referenced by type T and have not themselves been placed in
563 separate type units. Like T, if an additional type U is nested
564 within enclosing types or namespaces, the debugging information
565 entry for U is nested within entries describing its containers;
566 otherwise, U is a direct child of the type unit entry.
568 The containing entries for types T and U are declarations,
569 and the outermost containing entry for any given type T or
570 U is a direct child of the type unit entry. The containing
571 entries may be shared among the additional types and between
572 T and the additional types.
575 \textit{Types are not required to be placed in type units. In general,
576 only large types such as structure, class, enumeration, and
577 union types included from header files should be considered
578 for separate type units. Base types and other small types
579 are not usually worth the overhead of placement in separate
580 type units. Types that are unlikely to be replicated, such
581 as those defined in the main source file, are also better
582 left in the main compilation unit.}F
584 \section{Module, Namespace and Importing Entries}
585 \textit{Modules and namespaces provide a means to collect related
586 entities into a single entity and to manage the names of
589 \subsection{Module Entries}
590 \label{chap:moduleentries}
591 \textit{Several languages have the concept of a \doublequote{module.}
592 \addtoindexx{Modula-2}
593 A Modula\dash 2 definition module
594 \addtoindexx{Modula-2!definition module}
595 may be represented by a module
597 \addtoindex{declaration attribute}
598 (\DWATdeclaration). A
599 \addtoindex{Fortran 90} module
600 \addtoindexx{Fortran!module (Fortran 90)}
601 may also be represented by a module entry
602 (but no declaration attribute is warranted because \addtoindex{Fortran}
603 has no concept of a corresponding module body).}
605 A module is represented by a debugging information entry
607 tag \DWTAGmoduleTARG.
608 Module entries may own other
609 debugging information entries describing program entities
610 whose declaration scopes end at the end of the module itself.
612 If the module has a name, the module entry has a
613 \DWATname{} attribute
614 \addtoindexx{name attribute}
615 whose value is a null\dash terminated string containing
616 the module name as it appears in the source program.
618 The \addtoindex{module entry} may have either a
622 \addtoindexx{high PC attribute}
624 \addtoindexx{low PC attribute}
626 \DWATranges{} attribute
627 \addtoindexx{ranges attribute}
628 whose values encode the contiguous or non\dash contiguous address
629 ranges, respectively, of the machine instructions generated for
630 the module initialization code
631 (see Section \refersec{chap:codeaddressesandranges}).
632 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
634 \addtoindexx{entry PC attribute!for module initialization}
636 \DWATentrypc{} attribute whose value is the address of
637 the first executable instruction of that initialization code
638 (see Section \refersec{chap:entryaddress}).
641 \hypertarget{chap:DWATprioritymodulepriority}{}
642 the module has been assigned a priority, it may have
643 \addtoindexx{priority attribute}
645 \DWATpriority{} attribute.
646 The value of this attribute is a
647 reference to another debugging information entry describing
648 a variable with a constant value. The value of this variable
649 is the actual constant value of the module\textquoteright s priority,
650 represented as it would be on the target architecture.
652 \subsection{Namespace Entries}
653 \label{chap:namespaceentries}
654 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
655 \addtoindexx{namespace (C++)}
656 implement name hiding, so that names of unrelated things
657 do not accidentally clash in the
658 \addtoindex{global namespace} when an
659 application is linked together.}
661 A namespace is represented by a debugging information entry
663 tag \DWTAGnamespaceTARG.
664 A namespace extension is
665 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
667 \DWTAGnamespace{} entry
669 \addtoindexx{extension attribute}
672 attribute referring to the previous extension, or if there
673 is no previous extension, to the original
675 entry. A namespace extension entry does not need to duplicate
676 information in a previous extension entry of the namespace
677 nor need it duplicate information in the original namespace
678 entry. (Thus, for a namespace with a name,
679 a \DWATname{} attribute
680 \addtoindexx{name attribute}
681 need only be attached directly to the original
682 \DWTAGnamespace{} entry.)
685 Namespace and namespace extension entries may own
686 \addtoindexx{namespace extension entry}
688 \addtoindexx{namespace declaration entry}
689 debugging information entries describing program entities
690 whose declarations occur in the namespace.
692 \textit{For \addtoindex{C++}, such
693 owned program entities may be declarations,
694 including certain declarations that are also object or
695 function definitions.}
697 A namespace may have a
698 \DWATexportsymbolsNAME{}\livetarg{chap:DWATexportsymbolsofnamespace}{}
699 attribute\addtoindexx{export symbols attribute}
700 \addtoindexx{inline namespace|see{\textit{also} export symbols attribute}}
701 which indicates that all member names defined within the
702 namespace may be referenced as if they were defined within
703 the containing namespace.
705 \textit{This may be used to describe an \addtoindex{inline namespace} in \addtoindex{C++}}.
707 If a type, variable, or function declared in a namespace is
708 defined outside of the body of the namespace declaration,
709 that type, variable, or function definition entry has a
710 \DWATspecification{} attribute
711 \addtoindexx{specification attribute}
712 whose value is a \livelink{chap:classreference}{reference} to the
713 debugging information entry representing the declaration of
714 the type, variable or function. Type, variable, or function
716 \DWATspecification{} attribute
717 \addtoindexx{specification attribute}
719 to duplicate information provided by the declaration entry
720 referenced by the specification attribute.
722 \textit{The \addtoindex{C++} \addtoindex{global namespace}
724 \addtoindexx{global namespace|see{namespace (C++), global}}
726 \addtoindexx{namespace (C++)!global}
728 \texttt{::f}, for example) is not explicitly represented in
729 DWARF with a namespace entry (thus mirroring the situation
730 in \addtoindex{C++} source).
731 Global items may be simply declared with no
732 reference to a namespace.}
734 \textit{The \addtoindex{C++}
735 compilation unit specific \doublequote{unnamed namespace} may
736 \addtoindexx{namespace (C++)!unnamed}
737 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
738 be represented by a namespace entry with no name attribute in
739 the original namespace declaration entry (and therefore no name
740 attribute in any namespace extension entry of this namespace).
743 \textit{A compiler emitting namespace information may choose to
744 explicitly represent namespace extensions, or to represent the
745 final namespace declaration of a compilation unit; this is a
746 quality\dash of\dash implementation issue and no specific requirements
747 are given here. If only the final namespace is represented,
748 \addtoindexx{namespace (C++)!using declaration}
749 it is impossible for a debugger to interpret using declaration
750 references in exactly the manner defined by the
751 \addtoindex{C++} language.
754 \textit{Emitting all namespace declaration information in all
755 compilation units can result in a significant increase in the
756 size of the debug information and significant duplication of
757 information across compilation units.
758 The \addtoindex{C++} namespace std,
760 \addtoindexx{namespace (C++)!std}
761 is large and will probably be referenced in
762 every \addtoindex{C++} compilation unit.
765 \textit{For \addtoindex{C++} namespace examples,
766 see Appendix \refersec{app:namespaceexamples}.
771 \subsection{Imported (or Renamed) Declaration Entries}
772 \label{chap:importedorrenameddeclarationentries}
773 \textit{Some languages support the concept of importing into or making
774 accessible in a given unit declarations made in a different
775 module or scope. An imported declaration may sometimes be
780 imported declaration is represented by one or
781 \addtoindexx{imported declaration entry}
782 more debugging information entries with the
783 tag \DWTAGimporteddeclarationTARG.
785 \hypertarget{chap:DWATimportimporteddeclaration}{}
787 is imported, there is one imported declaration entry for
789 \addtoindexx{import attribute}
790 Each imported declaration entry has a
791 \DWATimport{} attribute,
792 whose value is a \livelink{chap:classreference}{reference} to the
793 debugging information entry representing the declaration that
796 An imported declaration may also have a
799 \addtoindexx{name attribute}
800 whose value is a null-terminated string containing the
801 name, as it appears in the source program, by which the
802 imported entity is to be known in the context of the imported
803 declaration entry (which may be different than the name of
804 the entity being imported). If no name is present, then the
805 name by which the entity is to be known is the same as the
806 name of the entity being imported.
808 An imported declaration entry with a name attribute may be
809 used as a general means to rename or provide an alias for
810 \addtoindexx{alias declaration|see{imported declaration entry}}
811 an entity, regardless of the context in which the importing
812 declaration or the imported entity occurs.
814 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
815 \hypertarget{chap:DWATimportnamespacealias}{}
817 \addtoindexx{namespace (C++)!alias}
818 with a name attribute whose value is
819 a null\dash terminated string containing the alias name as it
820 appears in the source program and an import attribute whose
821 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
822 namespace extension entry.
825 \textit{A \addtoindex{C++} using declaration may be represented by one or more
826 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
828 \addtoindexx{namespace (C++)!using declaration}
829 declaration entries. When the using declaration
830 refers to an overloaded function, there is one imported
831 declaration entry corresponding to each overloading. Each
832 imported declaration entry has no name attribute but it does
833 have an import attribute that refers to the entry for the
834 entity being imported. (\addtoindex{C++}
835 provides no means to \doublequote{rename}
836 an imported entity, other than a namespace).
839 \textit{A \addtoindex{Fortran} use statement
840 \addtoindexx{Fortran!use statement}
841 \addtoindexx{use statement|see {Fortran, use statement}}
842 with an \doublequote{only list} may be
843 represented by a series of imported declaration entries,
844 one (or more) for each entity that is imported. An entity
845 \addtoindexx{renamed declaration|see{imported declaration entry}}
846 that is renamed in the importing context may be represented
847 by an imported declaration entry with a name attribute that
848 specifies the new local name.
851 \subsection{Imported Module Entries}
852 \label{chap:importedmoduleentries}
854 \textit{Some languages support the concept of importing into or making
855 accessible in a given unit all of the declarations contained
856 within a separate module or namespace.
859 An imported module declaration is represented by a debugging
860 information entry with
861 \addtoindexx{imported module attribute}
863 \addtoindexx{imported module entry}
864 tag \DWTAGimportedmoduleTARG.
866 imported module entry contains a
867 \DWATimport{} attribute
868 \addtoindexx{import attribute}
869 whose value is a \livelink{chap:classreference}{reference}
870 to the module or namespace entry
871 containing the definition and/or declaration entries for
872 the entities that are to be imported into the context of the
873 imported module entry.
875 An imported module declaration may own a set of imported
876 declaration entries, each of which refers to an entry in the
877 module whose corresponding entity is to be known in the context
878 of the imported module declaration by a name other than its
879 name in that module. Any entity in the module that is not
880 renamed in this way is known in the context of the imported
881 module entry by the same name as it is declared in the module.
883 \textit{A \addtoindex{C++} using directive
884 \addtoindexx{namespace (C++)!using directive}
885 \addtoindexx{using directive|see {namespace (C++), using directive}}
886 may be represented by an imported module
887 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
888 entry, with an import attribute referring to the namespace
889 entry of the appropriate extension of the namespace (which
890 might be the original namespace entry) and no owned entries.
893 \textit{A \addtoindex{Fortran} use statement
894 \addtoindexx{Fortran!use statement}
895 with a \doublequote{rename list} may be
896 represented by an imported module entry with an import
897 attribute referring to the module and owned entries
898 corresponding to those entities that are renamed as part of
902 \textit{A \addtoindex{Fortran} use statement
903 \addtoindexx{Fortran!use statement}
904 with neither a \doublequote{rename list} nor
905 an \doublequote{only list} may be represented by an imported module
906 entry with an import attribute referring to the module and
907 no owned child entries.
910 \textit{A use statement with an \doublequote{only list} is represented by a
911 series of individual imported declaration entries as described
912 in Section \refersec{chap:importedorrenameddeclarationentries}.
915 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
916 \addtoindexx{Fortran!use statement}
917 itself imported by a use statement without an explicit mention
918 may be represented by an imported declaration entry that refers
919 to the original debugging information entry. For example, given
936 \textit{the imported declaration entry for Q within module C refers
937 directly to the variable declaration entry for X in module A
938 because there is no explicit representation for X in module B.
941 \textit{A similar situation arises for a \addtoindex{C++} using declaration
942 \addtoindexx{namespace (C++)!using declaration}
943 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
944 that imports an entity in terms of a namespace alias. See
945 Appendix \refersec{app:namespaceexamples}
949 \subsection{Imported Unit Entries}
950 \label{chap:importedunitentries}
952 \hypertarget{chap:DWATimportimportedunit}{}
953 place where a normal or partial unit is imported is
954 represented by a debugging information entry with the
955 \addtoindexx{imported unit entry}
956 tag \DWTAGimportedunitTARG.
957 An imported unit entry contains
958 \addtoindexx{import attribute}
960 \DWATimport{} attribute
961 whose value is a \livelink{chap:classreference}{reference} to the
962 normal or partial compilation unit whose declarations logically
963 belong at the place of the imported unit entry.
965 \textit{An imported unit entry does not necessarily correspond to
966 any entity or construct in the source program. It is merely
967 \doublequote{glue} used to relate a partial unit, or a compilation
968 unit used as a partial unit, to a place in some other
971 \section{Subroutine and Entry Point Entries}
972 \label{chap:subroutineandentrypointentries}
974 The following tags exist to describe
975 debugging information entries
976 \addtoindexx{function entry|see{subroutine entry}}
978 \addtoindexx{subroutine entry}
980 \addtoindexx{subprogram entry}
982 % FIXME: is entry point entry the right index 'entry'?
983 \addtoindexx{entry point entry}
986 \begin{tabular}{lp{9.0cm}}
987 \DWTAGsubprogramTARG{} & A subroutine or function \\
988 \DWTAGinlinedsubroutine{} & A particular inlined
989 \addtoindexx{inlined subprogram entry}
990 instance of a subroutine or function \\
991 \DWTAGentrypointTARG{} & An alternate entry point \\
996 \subsection{General Subroutine and Entry Point Information}
997 \label{chap:generalsubroutineandentrypointinformation}
998 The subroutine or entry point entry has a \DWATname{}
999 attribute whose value is a null-terminated string containing the
1000 subroutine or entry point name as it appears in the source program.
1001 It may also have a \DWATlinkagename{} attribute as
1002 described in Section \refersec{chap:linkagenames}.
1004 If the name of the subroutine described by an entry with the
1005 \addtoindexx{subprogram entry}
1006 tag \DWTAGsubprogram{}
1007 is visible outside of its containing
1008 \hypertarget{chap:DWATexternalexternalsubroutine}{}
1009 compilation unit, that entry has
1010 \addtoindexx{external attribute}
1012 \DWATexternalNAME{} attribute,
1013 which is a \livelink{chap:classflag}{flag}.
1015 \textit{Additional attributes for functions that are members of a
1016 class or structure are described in
1017 Section \refersec{chap:memberfunctionentries}.
1021 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
1024 \DWATmainsubprogramNAME{}
1026 \addtoindexx{main subprogram attribute}
1028 a \CLASSflag{} whose presence indicates that the
1029 subroutine has been identified as the starting function of
1030 the program. If more than one subprogram contains this
1032 any one of them may be the starting subroutine of the program.
1034 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1035 which is used to specify
1036 and provide a user\dash supplied name for the main subroutine of
1040 \subsubsection{Calling Convention Information}
1041 A subroutine entry may
1042 \hypertarget{chap:DWATcallingconventionforsubprograms}{}
1044 \DWATcallingconventionNAME{}
1045 \addtoindexx{calling convention attribute}
1046 attribute, whose value is an
1047 \livelink{chap:classconstant}{integer constant}. The set of
1048 \addtoindexi{calling convention codes for subroutines}{calling convention codes!for subroutines}
1049 is given in Table \refersec{tab:callingconventioncodesforsubroutines}.
1051 \begin{simplenametable}[1.4in]{Calling convention codes for subroutines}{tab:callingconventioncodesforsubroutines}
1055 \end{simplenametable}
1057 If this attribute is not present, or its value is the constant
1058 \DWCCnormalTARG, then the subroutine may be safely called by
1059 obeying the \doublequote{standard} calling conventions of the target
1060 architecture. If the value of the calling convention attribute
1061 is the constant \DWCCnocallTARG, the subroutine does not obey
1062 standard calling conventions, and it may not be safe for the
1063 debugger to call this subroutine.
1065 \textit{Note that \DWCCnormal{} is also used as a calling convention
1066 code for certain types
1067 (see Table \refersec{tab:callingconventioncodesfortypes}).}
1069 If the semantics of the language of the compilation unit
1070 containing the subroutine entry distinguishes between ordinary
1071 subroutines and subroutines that can serve as the \doublequote{main
1072 program,} that is, subroutines that cannot be called
1073 directly according to the ordinary calling conventions,
1074 then the debugging information entry for such a subroutine
1075 may have a calling convention attribute whose value is the
1076 constant \DWCCprogramTARG.
1078 \textit{A common debugger feature is to allow the debugger user to call
1079 a subroutine within the subject program. In certain cases,
1080 however, the generated code for a subroutine will not obey
1081 the standard calling conventions for the target architecture
1082 and will therefore not be safe to call from within a debugger.}
1084 \textit{The \DWCCprogram{}
1085 value is intended to support \addtoindex{Fortran} main
1086 \addtoindexx{Fortran!main program}
1087 programs which in some implementations may not be callable
1088 or which must be invoked in a special way. It is not intended
1089 as a way of finding the entry address for the program.}
1092 \subsubsection{Miscellaneous Subprogram Properties}
1093 \textit{In \addtoindex{C}
1094 there is a difference between the types of functions
1095 declared using function prototype style declarations and
1096 those declared using non\dash prototype declarations.}
1098 A subroutine entry declared with a function prototype style
1099 declaration may have
1100 \addtoindexx{prototyped attribute}
1102 \DWATprototypedNAME{} attribute, which is
1105 \textit{The \addtoindex{Fortran}
1106 language allows the keywords \texttt{elemental}, \texttt{pure}
1107 and \texttt{recursive} to be included as part of the declaration of
1108 a subroutine; these attributes reflect that usage. These
1109 attributes are not relevant for languages that do not support
1110 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1111 attribute is neither needed nor appropriate in languages such
1113 where functions support recursion by default.
1117 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1119 \addtoindexx{elemental attribute}
1121 \DWATelementalNAME{} attribute, which
1122 is a \livelink{chap:classflag}{flag}.
1123 The attribute indicates whether the subroutine
1124 or entry point was declared with the \doublequote{elemental} keyword
1128 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1129 subprogram entry may have
1130 \addtoindexx{pure attribute}
1132 \DWATpureNAME{} attribute, which is
1133 a \livelink{chap:classflag}{flag}.
1134 The attribute indicates whether the subroutine was
1135 declared with the \doublequote{pure} keyword or property.
1138 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1139 subprogram entry may have a
1140 \DWATrecursiveNAME{} attribute, which
1141 is a \livelink{chap:classflag}{flag}.
1142 The attribute indicates whether the subroutine
1143 or entry point was declared with the \doublequote{recursive} keyword
1146 A subprogram entry may have a
1148 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1149 which is a \CLASSflag. The attribute
1150 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1151 indicating that the subprogram can be called, but will never return to its caller.
1153 \subsubsection{Call Site-Related Attributes}
1154 \textit{While subprogram attributes in the pervious section provide
1155 information about the subprogram and it's entry point(s) as a whole,
1156 the following attributes provide summary information about the calls
1157 that occur within a subprogram.}
1159 A subroutine entry may have \DWATcallalltailcalls, \DWATcallallcalls{}
1160 and/or \DWATcallallsourcecalls{} attributes, each of which is a
1161 \livelink{chap:classflag}{flag}.
1162 \addtoindexx{call site summary information}
1163 \addtoindexx{subroutine call site summary attributes}
1164 These flags indicate the completeness of the call site information
1165 provided by call site entries (see
1166 Section \refersec{chap:callsiteentries}) within the subprogram.
1168 The \DWATcallalltailcallsNAME{}
1169 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1170 indicates that every tail call
1171 that occurs in the code for the subprogram is described by a
1172 \DWTAGcallsite{} entry.
1173 (There may or may not be other non-tail calls to some of the same
1174 target subprograms.)
1176 The \DWATcallallcallsNAME{}
1177 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1178 indicates that every non-inlined call
1179 (either a tail call or a normal call) that occurs in the code for the subprogram
1180 is described by a \DWTAGcallsite{} entry.
1182 The \DWATcallallsourcecallsNAME{}
1183 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1184 indicates that every call that occurs in the
1185 code for the subprogram, including every call inlined into it, is described by either a
1186 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1187 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1188 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1190 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1191 information format consumers that analyse call graphs.}
1193 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1194 \DWATcallallcalls{} and \DWATcallalltailcalls{} attributes are necessarily also true, and
1195 those attributes need not be present. Similarly, if the value of the
1196 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1197 attribute is also true and the latter attribute need not be present.
1200 \subsection{Subroutine and Entry Point Return Types}
1201 \label{chap:subroutineandentrypointreturntypes}
1204 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1205 the subroutine or entry point
1206 \addtoindexx{return type of subroutine}
1207 is a function that returns a
1208 value, then its debugging information entry has
1209 \addtoindexx{type attribute}
1210 a \DWATtype{} attribute
1211 to denote the type returned by that function.
1213 \textit{Debugging information entries for
1214 \addtoindex{C} void functions should
1215 not have an attribute for the return type. }
1217 \textit{Debugging information entries for declarations of \addtoindex{C++}
1218 member functions with an
1219 \autoreturntype{} specifier should use an unspecified type entry (see
1220 Section \refersec{chap:unspecifiedtypeentries}).
1221 The debugging information entry for the corresponding definition
1222 should provide the deduced return type. This practice causes the description of
1223 the containing class to be consistent across compilation units, allowing the class
1224 declaration to be placed into a separate type unit if desired.}
1227 \subsection{Subroutine and Entry Point Locations}
1228 \label{chap:subroutineandentrypointlocations}
1230 A subroutine entry may have either a \DWATlowpc{} and
1231 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1232 \addtoindexx{ranges attribute}
1234 \addtoindexx{high PC attribute}
1236 \addtoindexx{low PC attribute}
1237 encode the contiguous or non\dash contiguous address
1238 ranges, respectively, of the machine instructions generated
1239 for the subroutine (see
1240 Section \refersec{chap:codeaddressesandranges}).
1243 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1244 subroutine entry may also have
1245 \addtoindexx{entry PC attribute!for subroutine}
1247 \DWATentrypc{} attribute
1248 whose value is the address of the first executable instruction
1249 of the subroutine (see
1250 Section \refersec{chap:entryaddress}).
1252 An entry point has a \DWATlowpc{} attribute whose value is the
1253 relocated address of the first machine instruction generated
1254 for the entry point.
1257 \DWATentrypc{} attribute
1258 \addtoindexx{entry pc attribute!for subroutine}
1260 also seem appropriate
1261 for this purpose, historically the
1262 \DWATlowpc{} attribute
1264 \DWATentrypc{} was introduced (in
1265 \addtoindex{DWARF Version 3}).
1266 There is insufficient reason to change this.}
1272 \addtoindexx{address class attribute}
1274 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1278 \DWATaddressclass{} attributes,
1279 as appropriate, to specify
1280 which segments the code for the subroutine resides in and
1281 the addressing mode to be used in calling that subroutine.
1283 A subroutine entry representing a subroutine declaration
1284 that is not also a definition does not have code address or
1288 \subsection{Declarations Owned by Subroutines and Entry Points}
1289 \label{chap:declarationsownedbysubroutinesandentrypoints}
1290 \addtoindexx{subroutine formal parameters}
1291 The declarations enclosed by a subroutine or entry point are
1292 represented by debugging information entries that are owned
1293 by the subroutine or entry point entry. Entries representing
1294 \addtoindexx{formal parameter}
1295 the formal parameters of the subroutine or entry point appear
1296 in the same order as the corresponding declarations in the
1300 \textit{There is no ordering requirement for entries for declarations
1301 other than formal parameters. The formal parameter
1302 entries may be interspersed with other entries used by formal
1303 parameter entries, such as type entries.}
1305 The unspecified (sometimes called \doublequote{varying})
1306 parameters of a subroutine parameter list are
1307 represented by a debugging information
1308 entry\addtoindexx{unspecified parameters entry}
1309 with the tag \DWTAGunspecifiedparametersTARG.
1312 The entry for a subroutine that includes a
1313 \addtoindex{Fortran}
1314 \addtoindexx{Fortran!common block}
1315 \livelink{chap:fortrancommonblock}{common}
1316 \livelink{chap:commonblockentry}{block}
1317 \addtoindexx{common block|see{Fortran common block}}
1318 has a child entry with the
1319 tag \DWTAGcommoninclusionTARG.
1321 \hypertarget{chap:commonreferencecommonblockusage}{}
1322 common inclusion entry has a
1323 \DWATcommonreference{} attribute
1324 whose value is a \livelink{chap:classreference}{reference}
1325 to the debugging information entry
1326 for the common \nolink{block} being included
1327 (see Section \refersec{chap:commonblockentries}).
1329 \subsection{Low-Level Information}
1330 \label{chap:lowlevelinformation}
1333 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1334 subroutine or entry point entry may have
1335 \addtoindexx{return address attribute}
1338 attribute, whose value is a location description. The location
1339 specified is the place where the return address for the
1340 subroutine or entry point is stored.
1343 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1344 subroutine or entry point entry may also have
1345 \addtoindexx{frame base attribute}
1347 \DWATframebase{} attribute, whose value is a location
1348 description that describes the \doublequote{frame base} for the
1349 subroutine or entry point. If the location description is
1350 a simple register location description, the given register
1351 contains the frame base address. If the location description is
1352 a DWARF expression, the result of evaluating that expression
1353 is the frame base address. Finally, for a
1354 \addtoindex{location list},
1355 this interpretation applies to each location description
1356 contained in the list of \addtoindex{location list} entries.
1358 \textit{The use of one of the \DWOPregn{}
1360 context is equivalent to using
1363 compact. However, these are not equivalent in general.}
1366 \textit{The frame base for a subprogram is typically an address
1367 relative to the first unit of storage allocated for the
1368 subprogram\textquoteright s stack frame. The \DWATframebase{} attribute
1369 can be used in several ways:}
1370 \begin{enumerate}[1. ]
1371 \item \textit{In subprograms that need
1372 \addtoindexx{location list}
1373 location lists to locate local
1374 variables, the \DWATframebase{} can hold the needed location
1375 list, while all variables\textquoteright\ location descriptions can be
1376 simpler ones involving the frame base.}
1378 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1379 within nested routines.
1380 (See also \DWATstaticlink, below)}
1384 \textit{Some languages support nested subroutines. In such languages,
1385 it is possible to reference the local variables of an
1386 outer subroutine from within an inner subroutine. The
1387 \DWATstaticlink{} and \DWATframebase{} attributes allow
1388 debuggers to support this same kind of referencing.}
1391 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1393 \addtoindexx{address!uplevel|see {static link attribute}}
1394 \addtoindexx{uplevel address|see {static link attribute}}
1395 subroutine or entry point is nested, it may have a
1397 attribute, whose value is a location
1398 description that computes the frame base of the relevant
1399 instance of the subroutine that immediately encloses the
1400 subroutine or entry point.
1402 In the context of supporting nested subroutines, the
1403 \DWATframebase{} attribute value should obey the following
1406 \begin{enumerate}[1. ]
1407 \item It should compute a value that does not change during the
1408 life of the subprogram, and
1410 \item The computed value should be unique among instances of
1411 the same subroutine. (For typical \DWATframebase{} use, this
1412 means that a recursive subroutine\textquoteright s stack frame must have
1413 non\dash zero size.)
1416 \textit{If a debugger is attempting to resolve an up\dash level reference
1417 to a variable, it uses the nesting structure of DWARF to
1418 determine which subroutine is the lexical parent and the
1419 \DWATstaticlink{} value to identify the appropriate active
1420 frame of the parent. It can then attempt to find the reference
1421 within the context of the parent.}
1425 \subsection{Types Thrown by Exceptions}
1426 \label{chap:typesthrownbyexceptions}
1428 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1429 it may validly throw.}
1431 If a subroutine explicitly declares that it may throw
1432 \addtoindexx{exception thrown|see{thrown type entry}}
1434 \addtoindexx{thrown exception|see{thrown type entry}}
1435 exception of one or more types, each such type is
1436 represented by a debugging information entry with
1437 \addtoindexx{thrown type entry}
1439 \DWTAGthrowntypeTARG.
1440 Each such entry is a child of the entry
1441 representing the subroutine that may throw this type. Each
1442 thrown type entry contains
1443 \addtoindexx{type attribute}
1444 a \DWATtype{} attribute, whose
1445 value is a \livelink{chap:classreference}{reference}
1446 to an entry describing the type of the
1447 exception that may be thrown.
1449 \subsection{Function Template Instantiations}
1450 \label{chap:functiontemplateinstantiations}
1452 \textit{In \addtoindex{C++}, a function template is a generic definition of
1453 a function that is instantiated differently for calls with
1454 values of different types. DWARF does not represent the generic
1455 template definition, but does represent each instantiation.}
1458 A \addtoindex{function template instantiation}\addtoindexx{template instantiation!function}
1459 is represented by a debugging information entry with the
1460 \addtoindexx{subprogram entry!use for template instantiation}
1461 tag \DWTAGsubprogram.
1463 exceptions, such an entry will contain the same attributes and
1464 will have the same types of child entries as would an entry
1465 for a subroutine defined explicitly using the instantiation
1466 types and values. The exceptions are:
1468 \begin{enumerate}[1. ]
1469 \item Template parameters are described and referenced as specified in
1470 Section \refersec{chap:templateparameters}.
1473 \item If the compiler has generated a special compilation unit
1474 to hold the template instantiation and that compilation unit
1475 has a different name from the compilation unit containing
1476 the template definition, the name attribute for the debugging
1477 information entry representing that compilation unit is empty
1480 \item If the subprogram entry representing the template
1481 instantiation or any of its child entries contain declaration
1482 coordinate attributes, those attributes refer to the source
1483 for the template definition, not to any source generated
1484 artificially by the compiler for this instantiation.
1489 \subsection{Inlinable and Inlined Subroutines}
1490 \label{chap:inlinedsubroutines}
1491 A declaration or a definition of an inlinable subroutine
1492 is represented by a debugging information entry with the
1496 \addtoindexx{subprogram entry!use in inlined subprogram}
1498 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1499 explicitly declared to be available for inline expansion or
1500 that was expanded inline implicitly by the compiler has
1501 \addtoindexx{inline attribute}
1503 \DWATinline{} attribute whose value is an
1504 \livelink{chap:classconstant}{integer constant}. The
1505 set of values for the \DWATinline{} attribute is given in
1506 Table \refersec{tab:inlinecodes}.
1510 \caption{Inline codes}
1511 \label{tab:inlinecodes}
1512 \begin{tabular}{l|p{8cm}}
1514 Name&Meaning\\ \hline
1515 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1516 \mbox{compiler} (equivalent to the absence of the
1517 containing \DWATinline{} attribute) \\
1518 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1519 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1520 not inlined by the \mbox{compiler} \\
1521 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1527 \textit{In \addtoindex{C++}, a function or a constructor declared with
1528 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1529 instance (see below) is represented by a debugging information
1530 entry with the tag \DWTAGsubprogram. Such an entry has a
1531 \DWATinline{} attribute whose value is \DWINLinlined.}
1534 \subsubsection{Abstract Instances}
1535 \label{chap:abstractinstances}
1536 Any subroutine entry that contains a
1537 \DWATinline{} attribute\addtoindexx{inline attribute}
1538 whose value is other than
1541 \doublequote{abstract instance root.}\addtoindexx{abstract instance!root}
1542 \hypertarget{chap:DWATinlineabstracttinstance}{}
1543 Any debugging information entry that is owned (either
1544 directly or indirectly) by an abstract instance root
1546 \doublequote{abstract instance entry.}\addtoindexx{abstract instance!entry}
1547 Any set of abstract instance entries that are all
1548 children (either directly or indirectly) of some abstract
1549 instance root, together with the root itself, is known as an
1550 \doublequote{abstract instance tree.}\addtoindexx{abstract instance!tree}
1551 However, in the case where an abstract instance tree is
1552 nested within another abstract instance tree, the entries in the
1553 \addtoindex{nested abstract instance}
1554 tree are not considered to be entries in the outer abstract
1557 Each abstract instance root is either part of a larger
1558 \addtoindexx{abstract instance!root}
1559 tree (which gives a context for the root) or
1560 \addtoindexx{specification attribute}
1562 \DWATspecification{}
1563 to refer to the declaration in context.
1565 \textit{For example, in \addtoindex{C++} the context might be a namespace
1566 declaration or a class declaration.}
1568 \textit{Abstract instance trees are defined so that no entry is part
1569 of more than one abstract instance tree. This simplifies the
1570 following descriptions.}
1572 A debugging information entry that is a member of an abstract
1573 instance tree should not contain any attributes which describe
1574 aspects of the subroutine which vary between distinct inlined
1575 expansions or distinct out\dash of\dash line expansions. For example,
1576 \addtoindexx{entry pc attribute!and abstract instance}
1587 \addtoindexx{location attribute!and abstract instance}
1589 \addtoindexx{ranges attribute!and abstract instance}
1591 \addtoindexx{high PC attribute!and abstract instance}
1593 \addtoindexx{low PC attribute!and abstract instance}
1595 \addtoindexx{segment attribute!and abstract instance}
1597 \addtoindexx{return address attribute!and abstract instance}
1599 \addtoindexx{segment attribute!and abstract instance}
1601 \addtoindexx{start scope attribute!and abstract instance}
1605 \textit{It would not make sense normally to put these attributes into
1606 abstract instance entries since such entries do not represent
1607 actual (concrete) instances and thus do not actually exist at
1608 run\dash time. However,
1609 see Appendix \refersec{app:inlineouteronenormalinner}
1610 for a contrary example.}
1612 The rules for the relative location of entries belonging to
1613 abstract instance trees are exactly the same as for other
1614 similar types of entries that are not abstract. Specifically,
1615 the rule that requires that an entry representing a declaration
1616 be a direct child of the entry representing the scope of the
1617 declaration applies equally to both abstract and non\dash abstract
1618 entries. Also, the ordering rules for formal parameter entries,
1619 member entries, and so on, all apply regardless of whether
1620 or not a given entry is abstract.
1623 \subsubsection{Concrete Inlined Instances}
1624 \label{chap:concreteinlinedinstances}
1626 Each inline expansion of a subroutine is represented
1627 by a debugging information entry with the
1628 tag \DWTAGinlinedsubroutineTARG.
1629 Each such entry should be a direct
1630 child of the entry that represents the scope within which
1631 the inlining occurs.
1634 Each inlined subroutine entry may have either a
1636 and \DWAThighpc{} pair
1638 \addtoindexx{high PC attribute}
1640 \addtoindexx{low PC attribute}
1642 \addtoindexx{ranges attribute}
1645 attribute whose values encode the contiguous or non\dash contiguous
1646 address ranges, respectively, of the machine instructions
1647 generated for the inlined subroutine (see
1648 Section \referfol{chap:codeaddressesandranges}).
1650 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1651 inlined subroutine entry may
1652 \addtoindexx{inlined subprogram entry!in concrete instance}
1654 \addtoindexx{inlined subprogram entry}
1656 \addtoindexx{entry PC attribute!for inlined subprogram}
1659 attribute, representing the first executable instruction of
1660 the inline expansion (see
1661 Section \refersec{chap:entryaddress}).
1663 % Positions of the 3 targets here is a bit arbitrary.
1665 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1667 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1669 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1670 may also have \DWATcallfile,
1671 \DWATcallline{} and \DWATcallcolumn{} attributes,
1673 value is an \livelink{chap:classconstant}{integer constant}.
1674 These attributes represent the
1675 source file, source line number, and source column number,
1676 respectively, of the first character of the statement or
1677 expression that caused the inline expansion. The call file,
1678 call line, and call column attributes are interpreted in
1679 the same way as the declaration file, declaration line, and
1680 declaration column attributes, respectively (see
1681 Section \refersec{chap:declarationcoordinates}).
1683 \textit{The call file, call line and call column coordinates do not
1684 describe the coordinates of the subroutine declaration that
1685 was inlined, rather they describe the coordinates of the call.
1688 An inlined subroutine entry
1689 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1692 attribute, which is a \livelink{chap:classflag}{flag}
1693 whose presence indicates that the
1694 subroutine has been evaluated as a compile\dash time constant. Such
1695 an entry may also have a \DWATconstvalue{} attribute,
1696 whose value may be of any form that is appropriate for the
1697 representation of the subroutine's return value. The value of
1698 this attribute is the actual return value of the subroutine,
1699 represented as it would be on the target architecture.
1701 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1702 \addttindex{constexpr}
1703 is called with constant expressions, then the corresponding
1704 concrete inlined instance has a
1705 \DWATconstexpr{} attribute,
1706 as well as a \DWATconstvalue{} attribute whose value represents
1707 the actual return value of the concrete inlined instance.}
1709 Any debugging information entry that is owned (either
1710 directly or indirectly) by a debugging information entry
1711 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1712 \doublequote{concrete inlined instance entry.} Any entry that has
1714 \DWTAGinlinedsubroutine{}
1715 is known as a \doublequote{concrete inlined instance root.}
1716 Any set of concrete inlined instance
1717 entries that are all children (either directly or indirectly)
1718 of some concrete inlined instance root, together with the root
1719 itself, is known as a \doublequote{concrete inlined instance tree.}
1720 However, in the case where a concrete inlined instance tree
1721 is nested within another concrete instance tree, the entries
1722 in the \addtoindex{nested concrete inline instance} tree
1723 are not considered to
1724 be entries in the outer concrete instance tree.
1727 \textit{Concrete inlined instance trees are defined so that no entry
1728 is part of more than one concrete inlined instance tree. This
1729 simplifies later descriptions.}
1731 Each concrete inlined instance tree is uniquely associated
1732 with one (and only one) abstract instance tree.
1734 \textit{Note, however, that the reverse is not true. Any given abstract
1735 instance tree may be associated with several different concrete
1736 inlined instance trees, or may even be associated with zero
1737 concrete inlined instance trees.}
1739 Concrete inlined instance entries may omit attributes that
1740 are not specific to the concrete instance (but present in
1741 the abstract instance) and need include only attributes that
1742 are specific to the concrete instance (but omitted in the
1743 abstract instance). In place of these omitted attributes, each
1744 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1745 concrete inlined instance entry
1746 \addtoindexx{abstract origin attribute}
1748 \DWATabstractorigin{}
1749 attribute that may be used to obtain the missing information
1750 (indirectly) from the associated abstract instance entry. The
1751 value of the abstract origin attribute is a reference to the
1752 associated abstract instance entry.
1754 If an entry within a concrete inlined instance tree contains
1755 attributes describing the
1756 \addtoindexx{declaration coordinates!in concrete instance}
1757 \livelink{chap:declarationcoordinates}{declaration coordinates}
1758 of that entry, then those attributes should refer to the file, line
1759 and column of the original declaration of the subroutine,
1760 not to the point at which it was inlined. As a consequence,
1761 they may usually be omitted from any entry that has an abstract
1765 For each pair of entries that are associated via a
1766 \addtoindexx{abstract origin attribute}
1767 \DWATabstractorigin{} attribute, both members of the pair
1768 have the same tag. So, for example, an entry with the tag
1769 \DWTAGvariable{} can only be associated with another entry
1770 that also has the tag \DWTAGvariable. The only exception
1771 to this rule is that the root of a concrete instance tree
1772 (which must always have the tag \DWTAGinlinedsubroutine)
1773 can only be associated with the root of its associated abstract
1774 instance tree (which must have the tag \DWTAGsubprogram).
1777 In general, the structure and content of any given concrete
1778 inlined instance tree will be closely analogous to the
1779 structure and content of its associated abstract instance
1780 tree. There are a few exceptions:
1782 \begin{enumerate}[1. ]
1783 \item An entry in the concrete instance tree may be omitted if
1785 \addtoindexx{abstract origin attribute}
1786 \DWATabstractorigin{} attribute and either
1787 has no children, or its children are omitted. Such entries
1788 would provide no useful information. In C\dash like languages,
1789 such entries frequently include types, including structure,
1790 union, class, and interface types; and members of types. If any
1791 entry within a concrete inlined instance tree needs to refer
1792 to an entity declared within the scope of the relevant inlined
1793 subroutine and for which no concrete instance entry exists,
1794 the reference should refer to the abstract instance entry.
1797 \item Entries in the concrete instance tree which are associated
1798 with entries in the abstract instance tree such that neither
1799 has a \DWATname{} attribute,
1800 \addtoindexx{name attribute}
1801 and neither is referenced by
1802 any other debugging information entry, may be omitted. This
1803 may happen for debugging information entries in the abstract
1804 instance trees that became unnecessary in the concrete instance
1805 tree because of additional information available there. For
1806 example, an anonymous variable might have been created and
1807 described in the abstract instance tree, but because of
1808 the actual parameters for a particular inlined expansion,
1809 it could be described as a constant value without the need
1810 for that separate debugging information entry.
1813 \item A concrete instance tree may contain entries which do
1814 not correspond to entries in the abstract instance tree
1815 to describe new entities that are specific to a particular
1816 inlined expansion. In that case, they will not have associated
1817 entries in the abstract instance tree, should not contain
1818 \addtoindexx{abstract origin attribute}
1819 \DWATabstractorigin{} attributes, and must contain all their
1820 own attributes directly. This allows an abstract instance tree
1821 to omit debugging information entries for anonymous entities
1822 that are unlikely to be needed in most inlined expansions. In
1823 any expansion which deviates from that expectation, the
1824 entries can be described in its concrete inlined instance tree.
1828 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1829 \label{chap:outoflineinstancesofinlinedsubroutines}
1830 Under some conditions, compilers may need to generate concrete
1831 executable instances of inlined subroutines other than at
1832 points where those subroutines are actually called. Such
1833 concrete instances of inlined subroutines are referred to as
1834 \doublequote{concrete out\dash of\dash line instances.}
1836 \textit{In \addtoindex{C++}, for example,
1837 taking the address of a function declared
1838 to be inline can necessitate the generation of a concrete
1839 out\dash of\dash line instance of the given function.}
1841 The DWARF representation of a concrete out\dash of\dash line instance
1842 of an inlined subroutine is essentially the same as for a
1843 concrete inlined instance of that subroutine (as described in
1844 the preceding section). The representation of such a concrete
1845 % It is critical that the hypertarget and livelink be
1846 % separated to avoid problems with latex.
1847 out\dash of\dash line
1848 \addtoindexx{abstract origin attribute}
1850 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1852 \DWATabstractorigin{}
1853 attributes in exactly the same way as they are used for
1854 a concrete inlined instance (that is, as references to
1855 corresponding entries within the associated abstract instance
1858 The differences between the DWARF representation of a
1859 concrete out\dash of\dash line instance of a given subroutine and the
1860 representation of a concrete inlined instance of that same
1861 subroutine are as follows:
1862 \begin{enumerate}[1. ]
1863 \item The root entry for a concrete out\dash of\dash line instance
1864 of a given inlined subroutine has the same tag as does its
1865 associated (abstract) inlined subroutine entry (that is, tag
1866 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1868 \item The root entry for a concrete out\dash of\dash line instance tree
1869 is normally owned by the same parent entry that also owns
1870 the root entry of the associated abstract instance. However,
1871 it is not required that the abstract and out\dash of\dash line instance
1872 trees be owned by the same parent entry.
1876 \subsubsection{Nested Inlined Subroutines}
1877 \label{nestedinlinedsubroutines}
1878 Some languages and compilers may permit the logical nesting of
1879 a subroutine within another subroutine, and may permit either
1880 the outer or the nested subroutine, or both, to be inlined.
1882 For a non\dash inlined subroutine nested within an inlined
1883 subroutine, the nested subroutine is described normally in
1884 both the abstract and concrete inlined instance trees for
1885 the outer subroutine. All rules pertaining to the abstract
1886 and concrete instance trees for the outer subroutine apply
1887 also to the abstract and concrete instance entries for the
1891 For an inlined subroutine nested within another inlined
1892 subroutine, the following rules apply to their abstract and
1893 \addtoindexx{abstract instance!nested}
1894 \addtoindexx{concrete instance!nested}
1895 concrete instance trees:
1897 \begin{enumerate}[1. ]
1898 \item The abstract instance tree for the nested subroutine is
1899 described within the abstract instance tree for the outer
1900 subroutine according to the rules in
1901 Section \refersec{chap:abstractinstances}, and
1902 without regard to the fact that it is within an outer abstract
1905 \item Any abstract instance tree for a nested subroutine is
1906 always omitted within the concrete instance tree for an
1909 \item A concrete instance tree for a nested subroutine is
1910 always omitted within the abstract instance tree for an
1913 \item The concrete instance tree for any inlined or
1914 \addtoindexx{out-of-line instance}
1916 \addtoindexx{out-of-line instance|see{\textit{also} concrete out-of-line instance}}
1917 expansion of the nested subroutine is described within a
1918 concrete instance tree for the outer subroutine according
1920 Sections \refersec{chap:concreteinlinedinstances} or
1921 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1923 and without regard to the fact that it is within an outer
1924 concrete instance tree.
1927 See Appendix \refersec{app:inliningexamples}
1928 for discussion and examples.
1930 \subsection{Trampolines}
1931 \label{chap:trampolines}
1933 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1934 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1935 an intermediary in making a call to another subroutine. It may
1936 adjust parameters and/or the result (if any) as appropriate
1937 to the combined calling and called execution contexts.}
1939 A trampoline is represented by a debugging information entry
1940 \addtoindexx{trampoline (subprogram) entry}
1941 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1943 \addtoindexx{trampoline attribute}
1944 a \DWATtrampoline{} attribute.
1946 attribute indicates the target subroutine of the trampoline,
1947 that is, the subroutine to which the trampoline passes
1948 control. (A trampoline entry may but need not also have a
1949 \DWATartificial{} attribute.)
1952 The value of the trampoline attribute may be represented
1953 using any of the following forms, which are listed in order
1957 \item If the value is of class \CLASSreference{}, then the value
1958 specifies the debugging information entry of the target
1961 \item If the value is of class \CLASSaddress{}, then the value is
1962 the relocated address of the target subprogram.
1965 \item If the value is of class \CLASSstring{}, then the value is the
1966 (possibly mangled) \addtoindexx{mangled names}
1967 name of the target subprogram.
1969 \item If the value is of class \CLASSflag, then the value true
1970 indicates that the containing subroutine is a trampoline but
1971 that the target subroutine is not known.
1975 The target subprogram may itself be a trampoline. (A sequence
1976 of trampolines necessarily ends with a non\dash trampoline
1979 \textit{In \addtoindex{C++}, trampolines may be used to implement
1980 derived virtual member functions; such trampolines typically
1982 \texttt{this} parameter\index{this parameter@\texttt{this} parameter}
1983 in the course of passing control.
1984 Other languages and environments may use trampolines in a manner
1985 sometimes known as transfer functions or transfer vectors.}
1987 \textit{Trampolines may sometimes pass control to the target
1988 subprogram using a branch or jump instruction instead of a
1989 call instruction, thereby leaving no trace of their existence
1990 in the subsequent execution context. }
1992 \textit{This attribute helps make it feasible for a debugger to arrange
1993 that stepping into a trampoline or setting a breakpoint in
1994 a trampoline will result in stepping into or setting the
1995 breakpoint in the target subroutine instead. This helps to
1996 hide the compiler generated subprogram from the user. }
1998 \textit{If the target subroutine is not known, a debugger may choose
1999 to repeatedly step until control arrives in a new subroutine
2000 which can be assumed to be the target subroutine. }
2002 \subsection{Call Site Entries}
2003 \label{chap:callsiteentries}
2005 A call site entry provides a way to represent the static or dynamic
2006 call graph of a program in the debugging information. It also provides
2007 information about how parameters are passed so that they may be more
2008 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
2009 call site entries can be also useful for computing values of variables
2010 and expressions where some value is no longer present in the current
2011 subroutine's registers or local stack frame, but it is known that the
2012 values are equal to some parameter passed to the function.
2013 The consumer can then use unwind
2014 information to find the caller and it's call site information and then
2015 compute the value passed in a particular parameter.}
2017 A call site is represented by a debugging information entry with the tag
2018 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
2019 debugging information entry representing the scope within which the
2020 call is present in the source program.
2022 \textit{A scope entry (for example, for a lexical block) that would not
2023 otherwise be present in the debugging information of a subroutine
2024 need not be introduced solely to represent the immediately containing scope
2027 A source call can be compiled into different types of machine code:
2030 A \textit{normal call} uses a call-like instruction which transfers
2031 control to the start of some subprogram and leaves the call site
2032 location address somewhere where unwind information can find it.
2034 A \textit{tail call} uses a jump-like instruction which
2035 transfers control to the start of some subprogram, but the call site location
2036 address is not preserved (and thus not available using the unwind information).
2038 A \textit{tail recursion call} is a call
2039 to the current subroutine which is compiled as a jump into the middle of the
2043 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2044 where at least one instruction has the location of the inlined subprogram
2045 or any of its blocks or inlined subprograms.
2049 There are also different types of \doublequote{optimized out} calls:
2052 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2053 has not been emitted (such as, for example, the call to \texttt{foo} in
2054 \texttt{if (0) foo();}).
2056 An \textit{optimized out inline call}
2057 is a call to an inlined subprogram which either did not expand to any instructions
2058 or only parts of instructions belong to it and for debug information purposes those
2059 instructions are given a location in the caller.
2062 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2063 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2064 (see Section \refersec{chap:inlinedsubroutines}).
2066 The call site entry has a
2067 \DWATcallreturnpcNAME{}
2068 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2069 which is the return address after the call.
2070 The value of this attribute corresponds to the return address computed by
2071 call frame information in the called subprogram
2072 (see Section \refersec{datarep:callframeinformation}).
2074 \textit{On many architectures the return address is the address immediately following the
2075 call instruction, but on architectures with delay slots it might
2076 be an address after the delay slot of the call.}
2078 The call site entry may have a
2080 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2081 address of the call instruction.
2083 If the call site entry corresponds to a tail call, it has the
2084 \DWATcalltailcallNAME{}
2085 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2086 which is a \CLASSflag.
2088 The call site entry may have a
2089 \DWATcalloriginNAME{}
2090 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2091 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2092 known it is a reference to the called subprogram's debugging
2093 information entry. For indirect calls it may be a reference to a
2094 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2095 the subroutine pointer that is called.
2098 The call site may have a
2099 \DWATcalltargetNAME{}
2100 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2101 a DWARF expression. For indirect calls or jumps where it is unknown at
2102 compile time which subprogram will be called the expression computes the
2103 address of the subprogram that will be called. The DWARF expression should
2104 not use register or memory locations that might be clobbered by the call.
2107 The call site entry may have a
2108 \DWATcalltargetclobberedNAME{}
2109 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2110 which is a DWARF expression. For indirect calls or jumps where the
2111 address is not computable without use of registers or memory locations that
2112 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2113 attribute is used instead of the \DWATcalltarget{} attribute.
2115 The call site entry may have a \DWATtypeNAME{}
2116 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2117 referencing a debugging information entry for the type of the called function.
2119 \textit{When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.}
2121 The call site entry may have
2122 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2123 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2124 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2125 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2126 each of whose value is an integer constant.
2127 These attributes represent the source file, source line number, and source
2128 column number, respectively, of the first character of the call statement or
2129 expression. The call file, call line, and call column attributes are
2130 interpreted in the same way as the declaration file, declaration
2131 line, and declaration column attributes, respectively
2132 (see Section \refersec{chap:declarationcoordinates}).
2134 \textit{The call file, call line and call column coordinates do not describe the
2135 coordinates of the subroutine declaration that was called, rather they describe
2136 the coordinates of the call.}
2139 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2140 entries\index{call site parameter entry} representing the parameters passed to the call.
2141 Each such entry has a \DWATlocation{} attribute which is a location expression.
2142 This location expression describes where the parameter is passed
2143 (usually either some register, or a memory location expressible as the
2144 contents of the stack register plus some offset).
2146 Each \DWTAGcallsiteparameter{} entry may have a
2147 \DWATcallvalueNAME{}
2148 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2149 which is a DWARF expression. This expression computes the value
2150 passed for that parameter. The expression should not use registers or memory
2151 locations that might be clobbered by the call, as it might be evaluated after
2152 unwinding from the called function back to the caller. If it is not
2153 possible to avoid registers or memory locations that might be clobbered by
2154 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2157 \textit{The reason for the restriction is that the value of the parameter may be
2158 needed in the middle of the callee, where the call clobbered registers or
2159 memory might be already clobbered, and if the consumer was not assured by
2160 the producer it can safely use those values, the consumer could not safely
2161 use the values at all.}
2163 For parameters passed by reference, where the code passes a pointer to
2164 a location which contains the parameter, or for reference type parameters
2165 the \DWTAGcallsiteparameter{} entry may also have
2166 \DWATcalldatalocationNAME{}
2167 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2168 whose value is a location expression and a
2169 \DWATcalldatavalueNAME{}
2170 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2171 whose value is a DWARF expression. The \DWATcalldatalocationNAME{} attribute
2172 describes where the referenced value lives during the call. If it is just
2173 \DWOPpushobjectaddress{}, it may be left out. The
2174 \DWATcalldatavalueNAME{} attribute describes the value in that location.
2175 The expression should not use registers or memory
2176 locations that might be clobbered by the call, as it might be evaluated after
2177 unwinding from the called function back to the caller.
2180 Each call site parameter entry may also have a
2181 \DWATcallparameter{}
2182 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2183 which contains a reference to a \DWTAGformalparameter{} entry,
2184 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2185 attribute describing the parameter's name.
2189 \section{Lexical Block Entries}
2190 \label{chap:lexicalblockentries}
2193 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2195 \addtoindexx{lexical block}
2196 a bracketed sequence of source statements
2197 that may contain any number of declarations. In some languages
2198 (including \addtoindex{C} and \addtoindex{C++}),
2199 \nolink{blocks} can be nested within other
2200 \nolink{blocks} to any depth.}
2202 % We do not need to link to the preceding paragraph.
2203 A lexical \nolink{block} is represented by a debugging information
2205 tag \DWTAGlexicalblockTARG.
2207 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2209 either a \DWATlowpc{} and
2210 \DWAThighpc{} pair of
2212 \addtoindexx{high PC attribute}
2214 \addtoindexx{low PC attribute}
2216 \DWATranges{} attribute
2217 \addtoindexx{ranges attribute}
2218 whose values encode the contiguous or non-contiguous address
2219 ranges, respectively, of the machine instructions generated
2220 for the lexical \nolink{block}
2221 (see Section \refersec{chap:codeaddressesandranges}).
2224 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2225 lexical block entry may also have
2226 \addtoindexx{entry PC attribute!for lexical block}
2228 \DWATentrypc{} attribute
2229 whose value is the address of the first executable instruction
2230 of the lexical block (see
2231 Section \refersec{chap:entryaddress}).
2233 If a name has been given to the
2234 lexical \nolink{block}
2236 program, then the corresponding
2237 lexical \nolink{block} entry has a
2238 \DWATname{} attribute whose
2239 \addtoindexx{name attribute}
2240 value is a null\dash terminated string
2241 containing the name of the lexical \nolink{block}
2245 \textit{This is not the same as a \addtoindex{C} or
2246 \addtoindex{C++} label (see below).}
2248 The lexical \nolink{block} entry owns
2249 debugging information entries that
2250 describe the declarations within that lexical \nolink{block}.
2252 one such debugging information entry for each local declaration
2253 of an identifier or inner lexical \nolink{block}.
2256 \section{Label Entries}
2257 \label{chap:labelentries}
2258 \textit{A label is a way of identifying a source statement. A labeled
2259 statement is usually the target of one or more \doublequote{go to}
2264 A label is represented by a debugging information entry with
2265 \addtoindexx{label entry}
2267 tag \DWTAGlabelTARG.
2268 The entry for a label should be owned by
2269 the debugging information entry representing the scope within
2270 which the name of the label could be legally referenced within
2273 The label entry has a \DWATlowpc{} attribute whose value
2274 is the relocated address of the first machine instruction
2275 generated for the statement identified by the label in
2276 the source program. The label entry also has a
2277 \DWATname{} attribute
2278 \addtoindexx{name attribute}
2279 whose value is a null-terminated string containing
2280 the name of the label as it appears in the source program.
2283 \section{With Statement Entries}
2284 \label{chap:withstatemententries}
2286 \textit{Both \addtoindex{Pascal} and
2287 \addtoindexx{Modula-2}
2288 Modula\dash 2 support the concept of a \doublequote{with}
2289 statement. The with statement specifies a sequence of
2290 executable statements within which the fields of a record
2291 variable may be referenced, unqualified by the name of the
2294 A with statement is represented by a
2295 \addtoindexi{debugging information entry}{with statement entry}
2296 with the tag \DWTAGwithstmtTARG.
2298 A with statement entry may have either a
2300 \DWAThighpc{} pair of attributes
2301 \addtoindexx{high PC attribute}
2303 \addtoindexx{low PC attribute}
2304 a \DWATranges{} attribute
2305 \addtoindexx{ranges attribute}
2306 whose values encode the contiguous or non\dash contiguous address
2307 ranges, respectively, of the machine instructions generated
2308 for the with statement
2309 (see Section \refersec{chap:codeaddressesandranges}).
2312 \hypertarget{chap:DWATentrypcofwithstmt}{}
2313 with statement entry may also have
2314 \addtoindexx{entry PC attribute!for with statement}
2316 \DWATentrypc{} attribute
2317 whose value is the address of the first executable instruction
2318 of the with statement (see
2319 Section \refersec{chap:entryaddress}).
2322 The with statement entry has
2323 \addtoindexx{type attribute}
2324 a \DWATtype{} attribute, denoting
2325 the type of record whose fields may be referenced without full
2326 qualification within the body of the statement. It also has
2327 \addtoindexx{location attribute}
2328 a \DWATlocation{} attribute, describing how to find the base
2329 address of the record object referenced within the body of
2333 \section{Try and Catch Block Entries}
2334 \label{chap:tryandcatchblockentries}
2335 \livetargi{chap:tryandcatchblockentries}{}
2336 \textit{In \addtoindex{C++}, a \livelink{chap:lexicalblock}{lexical block} may be
2337 designated as a \doublequote{catch \nolink{block}.}
2338 A catch \nolink{block} is an exception handler that
2339 handles exceptions thrown by an immediately preceding
2340 \doublequote{try \nolink{block}.}
2341 A catch \nolink{block}
2342 designates the type of the exception that it can handle.}
2344 A \livetargi{chap:tryblock}{try block}{try block} is represented
2345 by a debugging information entry
2346 \addtoindexx{try block entry}
2347 with the tag \DWTAGtryblockTARG.
2348 A \livetargi{chap:catchblock}{catch block} is represented by
2349 a debugging information entry
2350 \addtoindexx{catch block entry}
2351 with the tag \DWTAGcatchblockTARG.
2353 % nolink as we have links just above and do not have a combo link for both
2354 Both try and catch \nolink{block} entries may have either a
2356 \DWAThighpc{} pair of attributes
2357 \addtoindexx{high PC attribute}
2359 \addtoindexx{low PC attribute}
2361 \DWATranges{} attribute
2362 \addtoindexx{ranges attribute}
2363 whose values encode the contiguous
2364 or non\dash contiguous address ranges, respectively, of the
2365 machine instructions generated for the \nolink{block}
2366 (see Section \refersec{chap:codeaddressesandranges}).
2368 \hypertarget{chap:DWATentrypcoftryblock}{}
2369 \hypertarget{chap:DWATentrypcofcatchblock}{}
2370 A try or catch block entry may also have
2371 \addtoindexx{entry PC attribute!for try block}
2372 \addtoindexx{entry PC attribute!for catch block}
2374 \DWATentrypc{} attribute
2375 whose value is the address of the first executable instruction
2376 of the try or catch block
2377 (see Section \refersec{chap:entryaddress}).
2380 Catch \nolink{block} entries have at least one child entry,
2381 an entry representing the type of exception accepted by
2382 that catch \nolink{block}.
2383 This child entry has one of the tags
2384 \DWTAGformalparameter{}\addtoindexx{formal parameter entry!in catch block}
2386 \DWTAGunspecifiedparameters,\addtoindexx{unspecified parameters entry!in catch block}
2387 and will have the same form as other parameter entries.
2389 The siblings immediately following a try \nolink{block}
2390 entry are its corresponding catch \nolink{block} entries.