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 as
8 \bb\eb ranges of text addresses within the program.
10 \section{Unit Entries}
11 \label{chap:unitentries}
13 A DWARF object file is an object file that contains one or more
14 DWARF compilation units, of which there are these kinds:
15 \addtoindexx{unit|see {compilation unit}}
16 \addtoindexx{compilation unit}
18 \item A \definition{full compilation unit} describes
19 a complete compilation, possibly in combination with
20 related partial compilation units and/or type units.
22 \item A \definition{partial compilation unit} describes
23 a part of a compilation (generally corresponding to an
24 imported module) which is imported into one or more
25 related full compilation units.
27 \item A \definition{type unit} is a specialized unit
28 (similar to a compilation unit) that represents a type
29 whose description may be usefully shared by multiple
33 \index{conventional compilation unit|see{
34 full compilation unit, partial compilation unit, type unit}}
36 \textit{These first three kinds of compilation unit are
37 sometimes called \doublequote{conventional} compilation
38 units--they are kinds of compilation units that were
39 defined prior to \DWARFVersionV. Conventional compilation units
40 are part of the same object file as the compiled code and
41 data (whether relocatable, executable, shared and so on).
42 The word \doublequote{conventional} is usually
43 omitted in these names, unless needed to distinguish them
44 from the similar split compilation units below.}
48 \item A \definition{skeleton compilation unit} represents
49 the DWARF debugging information for a compilation using a
50 minimal description that identifies a separate split
51 compilation unit that provides the remainder (and most)
55 \textit{A skeleton compilation acts as a minimal conventional full
56 compilation (see above) that identifies and is paired with a
57 corresponding split full compilation (as described below). Like
58 the conventional compilation units, a skeleton compilation unit
59 is part of the same object file as the compiled code and data.}
63 \definition{split compilation unit} describes
64 a complete compilation, possibly in combination with
65 related type compilation units. It corresponds
66 to a specific skeleton compilation unit.
68 \item A \definition{split type unit} is a specialized
69 compilation unit that represents a type whose description may
70 be usefully shared by multiple other units.
74 \textit{Split compilation units and split type units may be
75 contained in object files separate from those containing the
76 program code and data.
78 These object files are not processed by a linker; thus,
79 split units do not depend on underlying object file relocations.
82 \textit{Either a full compilation unit or a partial compilation
83 unit may be logically incorporated into another compilation unit
84 using an \addtoindex{imported unit entry}
85 (see Section \refersec{chap:importedunitentries}).}
88 combined split and partial
89 compilation unit kind is not defined.}
91 \textit{In the remainder of this document, the word
92 \doublequote{compilation} in the phrase \doublequote{compilation unit}
93 is generally omitted, unless it is deemed needed for clarity
96 \subsection{Full and Partial Compilation Unit Entries}
97 \label{chap:fullandpartialcompilationunitentries}
98 A \addtoindex{full compilation unit}\addtoindexx{compilation unit!full}
99 is represented by a debugging information entry with the tag
100 \DWTAGcompileunitTARG.
101 A \addtoindex{partial compilation unit}\addtoindexx{compilation unit!partial}
102 is represented by a debugging information entry with the tag
103 \DWTAGpartialunitTARG.
106 In a simple compilation, a single compilation unit with
108 \DWTAGcompileunit{} represents a complete object file
110 \DWTAGpartialunit{} (as well as tag \DWTAGtypeunit) is not used.
112 employing the DWARF space compression and duplicate elimination
114 Appendix \refersec{app:usingcompilationunits},
115 multiple compilation units using
118 \DWTAGpartialunit{} and/or
120 are used to represent portions of an object file.
122 \textit{A full compilation unit typically represents the text and
123 data contributed to an executable by a single relocatable
124 object file. It may be derived from several source files,
125 including pre-processed header files.
126 A \addtoindex{partial compilation unit} typically represents a part of the text
127 and data of a relocatable object file, in a manner that can
128 potentially be shared with the results of other compilations
129 to save space. It may be derived from an \doublequote{include file,}
130 template instantiation, or other implementation-dependent
131 portion of a compilation. A full compilation unit can also
132 function in a manner similar to a partial compilation unit
135 A compilation unit entry owns debugging information
136 entries that represent all or part of the declarations
137 made in the corresponding compilation. In the case of a
138 partial compilation unit, the containing scope of its owned
139 declarations is indicated by imported unit entries in one
140 or more other compilation unit entries that refer to that
141 partial compilation unit (see
142 Section \refersec{chap:importedunitentries}).
144 Compilation unit entries may have the following
146 \begin{enumerate}[1. ]
147 \item Either a \DWATlowpc{} and
148 \DWAThighpc{} pair of
149 \addtoindexx{high PC attribute}
151 \addtoindexx{low PC attribute}
153 \addtoindexx{ranges attribute}
155 \DWATranges{} attribute
156 \addtoindexx{ranges attribute}
158 \addtoindexx{discontiguous address ranges|see{non-contiguous address ranges}}
161 non\dash contiguous address ranges, respectively,
162 of the machine instructions generated for the compilation
163 unit (see Section \refersec{chap:codeaddressesandranges}).
165 A \DWATlowpc{} attribute
166 may also be specified in combination
167 \addtoindexx{ranges attribute}
169 \DWATranges{} to specify the
170 \addtoindexx{ranges attribute}
171 default base address for use in
172 \addtoindexx{location list}
173 location lists (see Section
174 \refersec{chap:locationlists}) and range lists
175 \addtoindexx{range list}
176 (see Section \refersec{chap:noncontiguousaddressranges}).
178 \item A \DWATnameDEFN{} attribute
179 \addtoindexx{name attribute}
180 whose value is a null-terminated string
181 \hypertarget{chap:DWATnamepathnameofcompilationsource}{}
182 containing the full or relative path name of the primary
183 source file from which the compilation unit was derived.
185 \item A \DWATlanguageDEFN{} attribute
186 \addtoindexx{language attribute}
187 whose constant value is an
188 \hypertarget{chap:DWATlanguageprogramminglanguage}{}
190 \addtoindexx{language attribute}
191 indicating the source language of the compilation
192 unit. The set of language names and their meanings are given
193 in Table \refersec{tab:languagenames}.
196 \setlength{\extrarowheight}{0.1cm}
197 \begin{longtable}{l|l}
198 \caption{Language names} \label{tab:languagenames} \\
199 \hline \bfseries Language name & \bfseries Meaning \\ \hline
201 \bfseries Language name & \bfseries Meaning \\ \hline
203 \hline \emph{Continued on next page}
206 \addtoindexx{ISO-defined language names}
207 \DWLANGAdaeightythreeTARG{} \dag & ISO Ada:1983 \addtoindexx{Ada:1983 (ISO)} \\
208 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada:1995 (ISO)} \\
209 \DWLANGCTARG & Non-standardized C, such as K\&R \addtoindexx{C!non-standard}\\
210 \DWLANGCeightynineTARG & ISO C:1989 \addtoindexx{C:1989 (ISO)} \\
211 \DWLANGCninetynineTARG & ISO C:1999 \addtoindexx{C:1999 (ISO)} \\
212 \DWLANGCelevenTARG & ISO C:2011 \addtoindexx{C:2011 (ISO)} \\
213 \DWLANGCplusplusTARG & ISO C++:1998 \addtoindexx{C++:1998 (ISO)} \\
214 \DWLANGCpluspluszerothreeTARG & ISO C++:2003 \addtoindexx{C++:2003 (ISO)} \\
215 \DWLANGCpluspluselevenTARG & ISO C++:2011 \addtoindexx{C++:2011 (ISO)} \\
216 \DWLANGCplusplusfourteenTARG & ISO C++:2014 \addtoindexx{C++:2014 (ISO)} \\
217 \DWLANGCobolseventyfourTARG & ISO COBOL:1974 \addtoindexx{COBOL:1974 (ISO)} \\
218 \DWLANGCoboleightyfiveTARG & ISO COBOL:1985 \addtoindexx{COBOL:1985 (ISO)} \\
219 \DWLANGDTARG{}~\dag & D \addtoindexx{D language} \\
220 \DWLANGDylanTARG~\dag & Dylan \addtoindexx{Dylan} \\
221 \DWLANGFortranseventysevenTARG & ISO FORTRAN:1977 \addtoindexx{FORTRAN:1977 (ISO)} \\
222 \DWLANGFortranninetyTARG & ISO Fortran:1990 \addtoindexx{Fortran:1990 (ISO)} \\
223 \DWLANGFortranninetyfiveTARG & ISO Fortran:1995 \addtoindexx{Fortran:1995 (ISO)} \\
224 \DWLANGFortranzerothreeTARG & ISO Fortran:2004 \addtoindexx{Fortran:2004 (ISO)} \\
225 \DWLANGFortranzeroeightTARG & ISO Fortran:2010 \addtoindexx{Fortran:2010 (ISO)} \\
226 \DWLANGGoTARG{}~\dag & \addtoindex{Go} \\
227 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell} \\
228 \DWLANGJavaTARG{} & \addtoindex{Java}\\
229 \DWLANGJuliaTARG{}~\dag & \addtoindex{Julia} \\
230 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
231 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
232 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
233 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
234 \DWLANGOCamlTARG{}~\dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
235 \DWLANGOpenCLTARG{}~\dag & \addtoindex{OpenCL} \\
236 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
237 \DWLANGPLITARG{}~\dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
238 \DWLANGPythonTARG{}~\dag & \addtoindex{Python} \\
239 \DWLANGRustTARG{}~\dag & \addtoindex{Rust} \\
240 \DWLANGSwiftTARG{}~\dag & \addtoindex{Swift} \\
241 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
242 \index{Unified Parallel C|see{UPC}} \\
244 \dag \ \ \textit{Support for these languages is limited}& \\
249 \item A \DWATstmtlistDEFN{}
250 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
251 \addtoindexx{statement list attribute}
252 attribute whose value is a
253 \addtoindexx{section offset!in statement list attribute}
254 section offset to the line number information for this compilation
257 This information is placed in a separate object file
258 section from the debugging information entries themselves. The
259 value of the statement list attribute is the offset in the
260 \dotdebugline{} section of the first byte of the line number
261 information for this compilation unit
262 (see Section \refersec{chap:linenumberinformation}).
264 \item A \DWATmacrosDEFN{}\hypertarget{chap:DWATmacrosmacroinformation}{}
266 \addtoindexx{macro information attribute}
268 \addtoindexx{section offset!in macro information attribute}
269 section offset to the macro information for this compilation unit.
271 This information is placed in a separate object file section
272 from the debugging information entries themselves. The
273 value of the macro information attribute is the offset in
274 the \dotdebugmacro{} section of the first byte of the macro
275 information for this compilation unit
276 (see Section \refersec{chap:macroinformation}).
278 \textit{The \DWATmacrosNAME{} attribute is new in \DWARFVersionV,
280 \DWATmacroinfoDEFN{} attribute of earlier DWARF versions.
281 \livetarg{chap:DWATmacroinfomacroinformation}{}
282 While \DWATmacrosNAME{} and \DWATmacroinfoNAME{} attributes cannot both occur in the same
283 compilation unit, both may be found in the set of units that make up an executable
284 or shared object file. The two attributes have distinct encodings to facilitate such
289 \DWATcompdirDEFN{} attribute\addtoindexx{compilation directory attribute}
290 \hypertarget{chap:DWATcompdircompilationdirectory}{}
292 null-terminated string containing the current working directory
293 of the compilation command that produced this compilation
294 unit in whatever form makes sense for the host system.
296 \item A \DWATproducerDEFN{} attribute
297 \addtoindexx{producer attribute}
298 whose value is a null-terminated string containing
299 information about the compiler
300 \hypertarget{chap:DWATproducercompileridentification}{}
301 that produced the compilation unit. The actual contents of
302 the string will be specific to each producer, but should
303 begin with the name of the compiler vendor or some other
304 identifying character sequence that should avoid confusion
305 with other producer values.
308 \item A \DWATidentifiercaseDEFN{}
310 \addtoindexx{identifier case attribute}
312 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
313 constant value is a code describing the treatment
314 of identifiers within this compilation unit. The
315 set of identifier case codes is given in
316 Table \refersec{tab:identifiercasecodes}.
318 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
319 \DWIDcasesensitive{} \\
322 \DWIDcaseinsensitive{} \\
323 \end{simplenametable}
325 \DWIDcasesensitiveTARG{} is the default for all compilation units
326 that do not have this attribute. It indicates that names given
327 as the values of \DWATname{} attributes
328 \addtoindexx{name attribute}
329 in debugging information
330 entries for the compilation unit reflect the names as they
331 appear in the source program. The debugger should be sensitive
332 to the case of \addtoindex{identifier names} when doing identifier
336 \DWIDupcaseTARG{} means that the
337 producer of the debugging
338 information for this compilation unit converted all source
339 names to upper case. The values of the name attributes may not
340 reflect the names as they appear in the source program. The
341 debugger should convert all names to upper case when doing
344 \DWIDdowncaseTARG{} means that
345 the producer of the debugging
346 information for this compilation unit converted all source
347 names to lower case. The values of the name attributes may not
348 reflect the names as they appear in the source program. The
349 debugger should convert all names to lower case when doing
353 \DWIDcaseinsensitiveTARG{} means that the values of the name
354 attributes reflect the names as they appear in the source
355 program but that a case insensitive lookup should be used to
359 \item A \DWATbasetypesDEFN{} attribute whose value is a
360 \livelink{chap:classreference}{reference}. This
361 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
363 \addtoindexx{base types attribute}
364 points to a debugging information entry
365 representing another compilation unit. It may be used
366 to specify the compilation unit containing the base type
367 entries used by entries in the current compilation unit
368 (see Section \refersec{chap:basetypeentries}).
371 \textit{This attribute provides a consumer a way to find the definition
372 of base types for a compilation unit that does not itself
373 contain such definitions. This allows a consumer, for example,
374 to interpret a type conversion to a base type
375 % getting this link target at the right spot is tricky.
376 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
379 \item A \DWATuseUTFeightDEFN{} attribute,
380 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
381 which is a \livelink{chap:classflag}{flag} whose
382 presence indicates that all strings (such as the names of
383 declared entities in the source program, or filenames in the line number table)
384 are represented using the UTF\dash 8 representation.
387 \item A \DWATmainsubprogramDEFN{} attribute, which is a
388 \livelink{chap:classflag}{flag}
389 \addtoindexx{main subprogram attribute}
390 whose presence indicates
391 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
392 that the compilation unit contains a
393 subprogram that has been identified as the starting function
394 of the program. If more than one compilation unit contains
395 this \nolink{flag}, any one of them may contain the starting function.
397 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
399 to specify and provide a user\dash specified name for the main
400 subroutine of a program.
401 \addtoindex{C} uses the name \doublequote{main} to identify
402 the main subprogram of a program. Some other languages provide
403 similar or other means to identify the main subprogram of
404 a program. The \DWATmainsubprogram{} attribute may also be used to
405 identify such subprograms (see
406 Section \refersec{chap:generalsubroutineandentrypointinformation}).}
408 \item A \DWATentrypc{} attribute whose value is the address of the first
409 \hypertarget{chap:DWATentrypcofcompileunit}{}
410 \hypertarget{chap:DWATentrypcofpartialunit}{}
411 \addtoindexx{entry pc attribute}
412 executable instruction of the unit (see
413 Section \refersec{chap:entryaddress}).
416 \item A \DWATstroffsetsbaseDEFN\addtoindexx{string offset base attribute}
417 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
418 attribute, whose value is of class \CLASSstroffsetsptr.
419 This attribute points to the first string
420 offset of the compilation unit's contribution to the
421 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
422 Indirect string references
423 (using \DWFORMstrx) within the compilation unit are
424 interpreted as indices relative to this base.
427 \item A \DWATaddrbaseDEFN\addtoindexx{address table base attribute}
428 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
429 attribute, whose value is of class \CLASSaddrptr.
430 This attribute points to the beginning of the compilation
431 unit's contribution to the \dotdebugaddr{} section.
432 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
433 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
434 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
435 interpreted as indices relative to this base.
438 \item A \DWATrangesbaseDEFN\addtoindexx{ranges table base attribute}
439 \hypertarget{chap:DWATrangesbaseforrangelists}{}
440 attribute, whose value is of class \CLASSrangelistptr.
441 This attribute points to the beginning of the compilation
442 unit's contribution to the \dotdebugranges{} section.
443 References to range lists (using \DWFORMsecoffset)
444 within the compilation unit are
445 interpreted as offsets relative to this base.
449 The base address of a compilation unit is defined as the
450 value of the \DWATlowpc{} attribute, if present; otherwise,
451 it is undefined. If the base address is undefined, then any
452 DWARF entry or structure defined in terms of the base address
453 of that compilation unit is not valid.
456 \subsection{Skeleton Compilation Unit Entries}
457 \label{chap:skeletoncompilationunitentries}
458 \addtoindexx{compilation unit!skeleton}
459 \addtoindexx{skeleton compilation unit}
460 When generating a \splitDWARFobjectfile{} (see
461 Section \refersec{datarep:splitdwarfobjectfiles}), the
462 compilation unit in the \dotdebuginfo{} section is a "skeleton"
463 compilation unit with the tag \DWTAGcompileunit, which contains
464 \DWATdwoname{} and \DWATdwoid{} attributes as well as a subset of the
465 attributes of a full or partial compilation unit. In general,
466 it contains those attributes that are necessary for the consumer
467 to locate the object file where the split full compilation unit
468 can be found, and for the consumer to interpret references to
469 addresses in the program.
472 A skeleton compilation unit has no children.
474 A skeleton compilation unit has \DWATdwoname{} and
475 \DWATdwoid{} attributes:
477 \begin{enumerate}[1. ]
480 \livetarg{chap:DWATdwonameforunit}{}
481 A \DWATdwonameDEFN{} attribute
482 \addtoindexx{split DWARF object file name attribute}
484 null-terminated string containing the full or relative
485 path name of the object file that contains the full
489 \livetarg{chap:DWATdwoidforunit}{}
490 A \DWATdwoidDEFN{} attribute\addtoindexx{unit identification attribute}
491 whose implementation-defined integer constant value,
492 known as the \CUsignature,
493 provides unique identification of this compilation unit
494 as well as the associated split compilation unit in the
495 object file named in the \DWATdwoname{}
496 attribute. For simplicity, the \DWATdwoidNAME{} attributes
497 in the skeleton compilation unit and the corresponding
498 split full compilation unit
499 (see Section \refersec{chap:splitfullcompilationunitentries})
500 must use the same form to encode this identification value.
502 \textit{The means of determining a \CUsignature{} does not
503 need to be similar or related to the means of determining a
508 A skeleton compilation unit may have additional
509 attributes from among the following:
511 \begin{enumerate}[1. ]
512 \addtocounter{enumi}{2}
514 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
515 or a \DWATranges{} attribute (the same as for conventional
516 compilation unit entries).
519 A \DWATstmtlist{} attribute (the same as for conventional
520 compilation unit entries).
523 A \DWATcompdir{} attribute (the same as for conventional
524 compilation unit entries).
528 A \DWATuseUTFeight{} attribute (the same as for conventional
529 compilation unit entries).
531 \textit{This attribute applies to strings referred to by the skeleton
532 compilation unit entry itself, and strings in the associated line
534 The representation for strings in the object file referenced
535 by the \DWATdwoname{} attribute is determined by the presence
536 of a \DWATuseUTFeight{} attribute in the skeleton compilation unit.}
539 A \DWATstroffsetsbase{} attribute, for indirect strings references
540 from the skeleton compilation unit (the same as for conventional
541 compilation unit entries).
544 A \DWATaddrbase{} attribute (the same as for conventional
545 compilation unit entries).
548 A \DWATrangesbase{} attribute (the same as for conventional
549 compilation unit entries).
553 All other attributes of a compilation unit entry (described
554 in Section \refersec{chap:fullandpartialcompilationunitentries})
555 should be placed in the split full compilation unit
556 (see \refersec{chap:splitfullcompilationunitentries}).
557 The attributes provided by the skeleton compilation
558 unit entry do not need to be repeated in the full compilation
559 unit entry, except for \DWATdwoid, which should appear in
560 both entries so that the consumer can verify that it has
561 found the correct object file.
563 \textit{The \DWATaddrbase{}, \DWATrangesbase{} and
564 \DWATstroffsetsbase{} attributes provide context that may be
565 necessary to interpret the contents
566 of the corresponding \splitDWARFobjectfile.}
568 \textit{The \DWATbasetypes{} attribute is not defined for a
569 skeleton compilation unit.}
572 \subsection{Split Full Compilation Unit Entries}
573 \label{chap:splitfullcompilationunitentries}
574 A \definition{split full compilation unit} is represented by a
575 debugging information entry with tag \DWTAGcompileunit.
576 It is very similar to a conventional full compilation unit but
577 is logically paired with a specific skeleton compilation unit while
578 being physically separate.
580 A split full compilation unit has a \DWATdwoid{} attribute:
581 \begin{enumerate}[1. ]
583 A \DWATdwoidDEFN{} attribute\addtoindexx{unit identification attribute}
584 whose implementation-defined integer constant value,
585 known as the \CUsignature,
586 provides unique identification of this compilation unit
587 as well as the associated skeleton compilation unit.
588 For simplicity, the \DWATdwoidNAME{} attributes in the
589 split compilation unit and the associated skeleton
590 compilation unit must use the same form to encode the
591 identification value.
593 \textit{The means of determining a \CUsignature{} does not
594 need to be similar or related to the means of determining a
599 A split full compilation unit may also have additional
600 attributes from among the following:
601 \begin{enumerate}[1. ]
602 \addtocounter{enumi}{1}
603 \item A \DWATname{} attribute (the same as for conventional
604 compilation unit entries).
606 \item A \DWATlanguage{} attribute (the same as for conventional
607 compilation unit entries)
609 \item A \DWATmacros{} attribute (the same as for conventional
610 compilation unit entries).
612 \textit{The offset in the value of class \CLASSmacptr{} is
613 relative to the \dotdebugmacrodwo{} section.}
615 \item A \DWATproducer{} attribute (the same as for conventional
616 compilation unit entries).
618 \item A \DWATidentifiercase{} attribute (the same as for
619 conventional compilation unit entries).
621 \item A \DWATmainsubprogram{} attribute (the same as for
622 conventional compilation unit entries).
624 \item A \DWATentrypc{} attribute (the same as for conventional
625 compilation unit entries).
629 \textit{The following attributes are not part of a
630 split full compilation unit entry but instead are inherited
631 (if present) from the corresponding skeleton compilation unit:
632 \DWATlowpc, \DWAThighpc, \DWATranges, \DWATstmtlist, \DWATcompdir,
633 \DWATuseUTFeight, \DWATstroffsetsbase, \DWATaddrbase{} and
636 \textit{The \DWATbasetypes{} attribute is not defined for a
637 split full compilation unit.}
641 \subsection{Type Unit Entries}
642 \label{chap:typeunitentries}
643 \addtoindexx{type unit}
644 \addtoindexx{type unit|see{\textit{also} compilation unit}}
645 \addtoindexx{compilation unit!\textit{see also} type unit}
646 An object file may contain any number of separate type
647 unit entries, each representing a single complete type
649 Each \addtoindex{type unit} must be uniquely identified by
650 an 8-byte signature, stored as part of the type unit, which
651 can be used to reference the type definition from debugging
652 information entries in other compilation units and type units.
654 Conventional and split type units are identical except for
655 the sections in which they are represented
656 (see \refersec{datarep:splitdwarfobjectfiles} for details).
657 \addtoindexx{conventional type unit}
658 \addtoindexx{split type unit}
660 A type unit is represented by a debugging information entry
661 with the tag \DWTAGtypeunitTARG.
662 A \addtoindex{type unit entry} owns debugging
663 information entries that represent the definition of a single
664 type, plus additional debugging information entries that may
665 be necessary to include as part of the definition of the type.
668 A type unit entry may have the following attributes:
669 \begin{enumerate}[1. ]
672 \DWATlanguage{} attribute,
674 \addtoindexx{language attribute}
675 constant value is an integer code indicating the source
676 language used to define the type. The set of language names
677 and their meanings are given in Table \refersec{tab:languagenames}.
680 \item A \DWATstmtlist{} attribute\addtoindexx{statement list attribute}
681 whose value of class \CLASSlineptr{} points to the line number
682 information for this type unit.
684 \textit{Because type units do not describe any code, they
685 do not actually need a line number table, but the line number
686 headers contain a list of directories and file names that
687 may be referenced by the \DWATdeclfile{} attribute of the
688 type or part of its description.}
690 \textit{In an object file with a conventional compilation
691 unit entry, the type unit entries may refer to (share) the
692 line number table used by the compilation unit. In a type
693 unit located in a split compilation unit, the
694 \DWATstmtlistNAME{} attribute refers to a \doublequote{specialized}
695 line number table in the \dotdebuglinedwo{} section, which
696 contains only the list of directories and file names.}
698 \textit{All type unit entries in a \splitDWARFobjectfile{} may
699 (but are not required to) refer to the same
700 \addtoindex{specialized line number table}.}
702 \item A \DWATuseUTFeight{} attribute, which is a flag
703 whose presence indicates that all strings referred to by this type
704 unit entry, its children, and its associated
705 \addtoindex{specialized line number table},
706 are represented using the UTF-8 representation.
709 \DWATstroffsetsbase\addtoindexx{string offsets base attribute}
710 attribute, whose value is of class \CLASSstroffsetsptr.
711 This attribute points
712 to the first string offset of the type unit's contribution to
713 the \dotdebugstroffsets{} section. Indirect string references
714 (using \DWFORMstrx) within the type unit are interpreted
715 as indices relative to this base.
719 A \addtoindex{type unit} entry for a given type T owns a debugging
720 information entry that represents a defining declaration
721 of type T. If the type is nested within enclosing types or
722 namespaces, the debugging information entry for T is nested
723 within debugging information entries describing its containers;
724 otherwise, T is a direct child of the type unit entry.
726 A type unit entry may also own additional debugging information
727 entries that represent declarations of additional types that
728 are referenced by type T and have not themselves been placed in
729 separate type units. Like T, if an additional type U is nested
730 within enclosing types or namespaces, the debugging information
731 entry for U is nested within entries describing its containers;
732 otherwise, U is a direct child of the type unit entry.
734 The containing entries for types T and U are declarations,
735 and the outermost containing entry for any given type T or
736 U is a direct child of the type unit entry. The containing
737 entries may be shared among the additional types and between
738 T and the additional types.
741 \textit{Types are not required to be placed in type units. In general,
742 only large types such as structure, class, enumeration, and
743 union types included from header files should be considered
744 for separate type units. Base types and other small types
745 are not usually worth the overhead of placement in separate
746 type units. Types that are unlikely to be replicated, such
747 as those defined in the main source file, are also better
748 left in the main compilation unit.}
750 \section{Module, Namespace and Importing Entries}
751 \textit{Modules and namespaces provide a means to collect related
752 entities into a single entity and to manage the names of
755 \subsection{Module Entries}
756 \label{chap:moduleentries}
757 \textit{Several languages have the concept of a \doublequote{module.}
758 \addtoindexx{Modula-2}
759 A Modula\dash 2 definition module
760 \addtoindexx{Modula-2!definition module}
761 may be represented by a module
763 \addtoindex{declaration attribute}
764 (\DWATdeclaration). A
765 \addtoindex{Fortran 90} module
766 \addtoindexx{Fortran!module (Fortran 90)}
767 may also be represented by a module entry
768 (but no declaration attribute is warranted because \addtoindex{Fortran}
769 has no concept of a corresponding module body).}
771 A module is represented by a debugging information entry
773 tag \DWTAGmoduleTARG.
774 Module entries may own other
775 debugging information entries describing program entities
776 whose declaration scopes end at the end of the module itself.
778 If the module has a name, the module entry has a
779 \DWATname{} attribute
780 \addtoindexx{name attribute}
781 whose value is a null\dash terminated string containing
782 the module name as it appears in the source program.
784 The \addtoindex{module entry} may have either a
788 \addtoindexx{high PC attribute}
790 \addtoindexx{low PC attribute}
792 \DWATranges{} attribute
793 \addtoindexx{ranges attribute}
794 whose values encode the contiguous or non\dash contiguous address
795 ranges, respectively, of the machine instructions generated for
796 the module initialization code
797 (see Section \refersec{chap:codeaddressesandranges}).
798 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
800 \addtoindexx{entry PC attribute!for module initialization}
802 \DWATentrypc{} attribute whose value is the address of
803 the first executable instruction of that initialization code
804 (see Section \refersec{chap:entryaddress}).
807 If\hypertarget{chap:DWATprioritymodulepriority}{}
808 the module has been assigned a priority, it may have a
809 \addtoindexx{priority attribute}
810 \DWATpriorityDEFN{} attribute.
811 The value of this attribute is a
812 reference to another debugging information entry describing
813 a variable with a constant value. The value of this variable
814 is the actual constant value of the module\textquoteright s priority,
815 represented as it would be on the target architecture.
817 \subsection{Namespace Entries}
818 \label{chap:namespaceentries}
819 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
820 \addtoindexx{namespace (C++)}
821 implement name hiding, so that names of unrelated things
822 do not accidentally clash in the
823 \addtoindex{global namespace} when an
824 application is linked together.}
826 A namespace is represented by a debugging information entry
828 tag \DWTAGnamespaceTARG.
829 A namespace extension is
830 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
832 \DWTAGnamespaceNAME{} entry
834 \addtoindexx{extension attribute}
837 attribute referring to the previous extension, or if there
838 is no previous extension, to the original
839 \DWTAGnamespaceNAME{}
840 entry. A namespace extension entry does not need to duplicate
841 information in a previous extension entry of the namespace
842 nor need it duplicate information in the original namespace
843 entry. (Thus, for a namespace with a name,
844 a \DWATname{} attribute
845 \addtoindexx{name attribute}
846 need only be attached directly to the original
847 \DWTAGnamespaceNAME{} entry.)
850 Namespace and namespace extension entries may own
851 \addtoindexx{namespace extension entry}
853 \addtoindexx{namespace declaration entry}
854 debugging information entries describing program entities
855 whose declarations occur in the namespace.
857 \textit{For \addtoindex{C++}, such
858 owned program entities may be declarations,
859 including certain declarations that are also object or
860 function definitions.}
862 A namespace may have a
863 \DWATexportsymbolsDEFN{}\livetarg{chap:DWATexportsymbolsofnamespace}{}
864 attribute\addtoindexx{export symbols attribute}
865 \addtoindexx{inline namespace|see{\textit{also} export symbols attribute}}
866 which indicates that all member names defined within the
867 namespace may be referenced as if they were defined within
868 the containing namespace.
870 \textit{This may be used to describe an \addtoindex{inline namespace} in \addtoindex{C++}}.
872 If a type, variable, or function declared in a namespace is
873 defined outside of the body of the namespace declaration,
874 that type, variable, or function definition entry has a
875 \DWATspecification{} attribute
876 \addtoindexx{specification attribute}
877 whose value is a \livelink{chap:classreference}{reference} to the
878 debugging information entry representing the declaration of
879 the type, variable or function. Type, variable, or function
881 \DWATspecification{} attribute
882 \addtoindexx{specification attribute}
884 to duplicate information provided by the declaration entry
885 referenced by the specification attribute.
887 \textit{The \addtoindex{C++} \addtoindex{global namespace}
889 \addtoindexx{global namespace|see{namespace (C++), global}}
891 \addtoindexx{namespace (C++)!global}
893 \texttt{::f}, for example) is not explicitly represented in
894 DWARF with a namespace entry (thus mirroring the situation
895 in \addtoindex{C++} source).
896 Global items may be simply declared with no
897 reference to a namespace.}
899 \textit{The \addtoindex{C++}
900 compilation unit specific \doublequote{unnamed namespace} may
901 \addtoindexx{namespace (C++)!unnamed}
902 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
903 be represented by a namespace entry with no name attribute in
904 the original namespace declaration entry (and therefore no name
905 attribute in any namespace extension entry of this namespace).
908 \textit{A compiler emitting namespace information may choose to
909 explicitly represent namespace extensions, or to represent the
910 final namespace declaration of a compilation unit; this is a
911 quality-of-implementation issue and no specific requirements
912 are given here. If only the final namespace is represented,
913 \addtoindexx{namespace (C++)!using declaration}
914 it is impossible for a debugger to interpret using declaration
915 references in exactly the manner defined by the
916 \addtoindex{C++} language.
919 \textit{Emitting all namespace declaration information in all
920 compilation units can result in a significant increase in the
921 size of the debug information and significant duplication of
922 information across compilation units.
923 The \addtoindex{C++} namespace std,
925 \addtoindexx{namespace (C++)!std}
926 is large and will probably be referenced in
927 every \addtoindex{C++} compilation unit.
930 \textit{For \addtoindex{C++} namespace examples,
931 see Appendix \refersec{app:namespaceexamples}.
936 \subsection{Imported (or Renamed) Declaration Entries}
937 \label{chap:importedorrenameddeclarationentries}
938 \textit{Some languages support the concept of importing into or making
939 accessible in a given unit declarations made in a different
940 module or scope. An imported declaration may sometimes be
944 An imported declaration is represented by one or
945 \addtoindexx{imported declaration entry}
946 more debugging information entries with the
947 tag \DWTAGimporteddeclarationTARG.
949 \hypertarget{chap:DWATimportimporteddeclaration}{}
951 is imported, there is one imported declaration entry for
953 \addtoindexx{import attribute}
954 Each imported declaration entry has a
955 \DWATimportDEFN{} attribute,
956 whose value is a \livelink{chap:classreference}{reference} to the
957 debugging information entry representing the declaration that
960 An imported declaration may also have a
963 \addtoindexx{name attribute}
964 whose value is a null-terminated string containing the
965 name, as it appears in the source program, by which the
966 imported entity is to be known in the context of the imported
967 declaration entry (which may be different than the name of
968 the entity being imported). If no name is present, then the
969 name by which the entity is to be known is the same as the
970 name of the entity being imported.
972 An imported declaration entry with a name attribute may be
973 used as a general means to rename or provide an alias for
974 \addtoindexx{alias declaration|see{imported declaration entry}}
975 an entity, regardless of the context in which the importing
976 declaration or the imported entity occurs.
978 \textit{A \addtoindex{C++} namespace alias may be represented
980 \hypertarget{chap:DWATimportnamespacealias}{}
982 \addtoindexx{namespace (C++)!alias}
983 with a name attribute whose value is
984 a null-terminated string containing the alias name as it
985 appears in the source program and a \DWATimportDEFN{} attribute
986 whose value is a \livelink{chap:classreference}{reference} to the
987 applicable original namespace or namespace extension entry.
990 \textit{A \addtoindex{C++} using declaration may be represented
992 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
994 \addtoindexx{namespace (C++)!using declaration}
995 declaration entries. When the using declaration
996 refers to an overloaded function, there is one imported
997 declaration entry corresponding to each overloading. Each
998 imported declaration entry has no name attribute but it does
999 have a \DWATimportDEFN{} attribute that refers to the entry for the
1000 entity being imported. (\addtoindex{C++}
1001 provides no means to \doublequote{rename}
1002 an imported entity, other than a namespace).}
1005 \textit{A \addtoindex{Fortran} use statement
1006 \addtoindexx{Fortran!use statement}
1007 \addtoindexx{use statement|see {Fortran, use statement}}
1008 with an \doublequote{only list} may be
1009 represented by a series of imported declaration entries,
1010 one (or more) for each entity that is imported. An entity
1011 \addtoindexx{renamed declaration|see{imported declaration entry}}
1012 that is renamed in the importing context may be represented
1013 by an imported declaration entry with a name attribute that
1014 specifies the new local name.
1017 \subsection{Imported Module Entries}
1018 \label{chap:importedmoduleentries}
1020 \textit{Some languages support the concept of importing into or making
1021 accessible in a given unit all of the declarations contained
1022 within a separate module or namespace.
1025 An imported module declaration is represented by a debugging
1026 information entry with
1027 \addtoindexx{imported module attribute}
1029 \addtoindexx{imported module entry}
1030 tag \DWTAGimportedmoduleTARG.
1032 imported module entry contains a
1033 \DWATimport{} attribute
1034 \addtoindexx{import attribute}
1035 whose value is a \livelink{chap:classreference}{reference}
1036 to the module or namespace entry
1037 containing the definition and/or declaration entries for
1038 the entities that are to be imported into the context of the
1039 imported module entry.
1041 An imported module declaration may own a set of imported
1042 declaration entries, each of which refers to an entry in the
1043 module whose corresponding entity is to be known in the context
1044 of the imported module declaration by a name other than its
1045 name in that module. Any entity in the module that is not
1046 renamed in this way is known in the context of the imported
1047 module entry by the same name as it is declared in the module.
1049 \textit{A \addtoindex{C++} using directive
1050 \addtoindexx{namespace (C++)!using directive}
1051 \addtoindexx{using directive|see {namespace (C++), using directive}}
1052 may be represented by an imported module
1053 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
1054 entry, with a \DWATimportDEFN{} attribute referring to the namespace
1055 entry of the appropriate extension of the namespace (which
1056 might be the original namespace entry) and no owned entries.
1059 \textit{A \addtoindex{Fortran} use statement
1060 \addtoindexx{Fortran!use statement}
1061 with a \doublequote{rename list} may be
1062 represented by an imported module entry with an import
1063 attribute referring to the module and owned entries
1064 corresponding to those entities that are renamed as part of
1068 \textit{A \addtoindex{Fortran} use statement
1069 \addtoindexx{Fortran!use statement}
1070 with neither a \doublequote{rename list} nor
1071 an \doublequote{only list} may be represented by an imported module
1072 entry with an import attribute referring to the module and
1073 no owned child entries.
1076 \textit{A use statement with an \doublequote{only list} is represented by a
1077 series of individual imported declaration entries as described
1078 in Section \refersec{chap:importedorrenameddeclarationentries}.
1082 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
1083 \addtoindexx{Fortran!use statement}
1084 itself imported by a use statement without an explicit mention
1085 may be represented by an imported declaration entry that refers
1086 to the original debugging information entry. For example, given
1103 \textit{the imported declaration entry for Q within module C refers
1104 directly to the variable declaration entry for X in module A
1105 because there is no explicit representation for X in module B.
1108 \textit{A similar situation arises for a \addtoindex{C++} using declaration
1109 \addtoindexx{namespace (C++)!using declaration}
1110 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
1111 that imports an entity in terms of a namespace alias. See
1112 Appendix \refersec{app:namespaceexamples}
1116 \subsection{Imported Unit Entries}
1117 \label{chap:importedunitentries}
1119 \hypertarget{chap:DWATimportimportedunit}{}
1120 place where a normal or partial compilation unit is imported is
1121 represented by a debugging information entry with the
1122 \addtoindexx{imported unit entry}
1123 tag \DWTAGimportedunitTARG.
1124 An imported unit entry contains
1125 \addtoindexx{import attribute}
1127 \DWATimportDEFN{} attribute
1128 whose value is a \livelink{chap:classreference}{reference} to the
1129 normal or partial compilation unit whose declarations logically
1130 belong at the place of the imported unit entry.
1132 \textit{An imported unit entry does not necessarily correspond to
1133 any entity or construct in the source program. It is merely
1134 \doublequote{glue} used to relate a partial unit, or a compilation
1135 unit used as a partial unit, to a place in some other
1138 \section{Subroutine and Entry Point Entries}
1139 \label{chap:subroutineandentrypointentries}
1141 The following tags exist to describe
1142 debugging information entries
1143 \addtoindexx{function entry|see{subroutine entry}}
1145 \addtoindexx{subroutine entry}
1147 \addtoindexx{subprogram entry}
1149 % FIXME: is entry point entry the right index 'entry'?
1150 \addtoindexx{entry point entry}
1153 \begin{tabular}{lp{9.0cm}}
1154 \DWTAGsubprogramTARG{} & A subroutine or function \\
1155 \DWTAGinlinedsubroutine{} & A particular inlined
1156 \addtoindexx{inlined subprogram entry}
1157 instance of a subroutine or function \\
1158 \DWTAGentrypointTARG{} & An alternate entry point \\
1163 \subsection{General Subroutine and Entry Point Information}
1164 \label{chap:generalsubroutineandentrypointinformation}
1165 The subroutine or entry point entry has a \DWATname{}
1166 attribute whose value is a null-terminated string containing the
1167 subroutine or entry point name as it appears in the source program.
1168 It may also have a \DWATlinkagename{} attribute as
1169 described in Section \refersec{chap:linkagenames}.
1171 If the name of the subroutine described by an entry with the
1172 \addtoindexx{subprogram entry}
1173 tag \DWTAGsubprogram{}
1174 is visible outside of its containing
1175 \hypertarget{chap:DWATexternalexternalsubroutine}{}
1176 compilation unit, that entry has
1177 \addtoindexx{external attribute}
1179 \DWATexternalDEFN{} attribute,
1180 which is a \livelink{chap:classflag}{flag}.
1182 \textit{Additional attributes for functions that are members of a
1183 class or structure are described in
1184 Section \refersec{chap:memberfunctionentries}.
1188 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
1191 \DWATmainsubprogramDEFN{}
1193 \addtoindexx{main subprogram attribute}
1195 a \CLASSflag{} whose presence indicates that the
1196 subroutine has been identified as the starting function of
1197 the program. If more than one subprogram contains this
1199 any one of them may be the starting subroutine of the program.
1201 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1202 which is used to specify
1203 and provide a user\dash supplied name for the main subroutine of
1207 \subsubsection{Calling Convention Information}
1208 A subroutine entry may
1209 \hypertarget{chap:DWATcallingconventionforsubprograms}{}
1211 \DWATcallingconventionDEFN{}
1212 \addtoindexx{calling convention attribute!for subprogram}
1213 attribute, whose value is an
1214 \livelink{chap:classconstant}{integer constant}. The set of
1215 \addtoindexi{calling convention codes for subroutines}{calling convention codes!for subroutines}
1216 is given in Table \refersec{tab:callingconventioncodesforsubroutines}.
1218 \begin{simplenametable}[1.4in]{Calling convention codes for subroutines}{tab:callingconventioncodesforsubroutines}
1222 \end{simplenametable}
1224 If this attribute is not present, or its value is the constant
1225 \DWCCnormalTARG, then the subroutine may be safely called by
1226 obeying the \doublequote{standard} calling conventions of the target
1227 architecture. If the value of the calling convention attribute
1228 is the constant \DWCCnocallTARG, the subroutine does not obey
1229 standard calling conventions, and it may not be safe for the
1230 debugger to call this subroutine.
1232 \textit{Note that \DWCCnormal{} is also used as a calling convention
1233 code for certain types
1234 (see Table \refersec{tab:callingconventioncodesfortypes}).}
1236 If the semantics of the language of the compilation unit
1237 containing the subroutine entry distinguishes between ordinary
1238 subroutines and subroutines that can serve as the \doublequote{main
1239 program,} that is, subroutines that cannot be called
1240 directly according to the ordinary calling conventions,
1241 then the debugging information entry for such a subroutine
1242 may have a calling convention attribute whose value is the
1243 constant \DWCCprogramTARG.
1245 \textit{A common debugger feature is to allow the debugger user to call
1246 a subroutine within the subject program. In certain cases,
1247 however, the generated code for a subroutine will not obey
1248 the standard calling conventions for the target architecture
1249 and will therefore not be safe to call from within a debugger.}
1251 \textit{The \DWCCprogram{}
1252 value is intended to support \addtoindex{Fortran} main
1253 \addtoindexx{Fortran!main program}
1254 programs which in some implementations may not be callable
1255 or which must be invoked in a special way. It is not intended
1256 as a way of finding the entry address for the program.}
1259 \subsubsection{Miscellaneous Subprogram Properties}
1260 \textit{In \addtoindex{C}
1261 there is a difference between the types of functions
1262 declared using function prototype style declarations and
1263 those declared using non\dash prototype declarations.}
1265 A subroutine entry declared with a function prototype style
1266 declaration may have
1267 \addtoindexx{prototyped attribute}
1269 \DWATprototypedNAME{} attribute, which is
1272 \textit{The \addtoindex{Fortran}
1273 language allows the keywords \texttt{elemental}, \texttt{pure}
1274 and \texttt{recursive} to be included as part of the declaration of
1275 a subroutine; these attributes reflect that usage. These
1276 attributes are not relevant for languages that do not support
1277 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1278 attribute is neither needed nor appropriate in languages such
1280 where functions support recursion by default.
1283 A subprogram entry may have a
1284 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1285 \DWATelementalDEFN{} attribute,\addtoindexx{elemental attribute}
1286 which is a \livelink{chap:classflag}{flag}.
1287 The attribute indicates whether the subroutine
1288 or entry point was declared with the \doublequote{elemental} keyword
1292 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1293 subprogram entry may have
1294 \addtoindexx{pure attribute}
1296 \DWATpureDEFN{} attribute, which is
1297 a \livelink{chap:classflag}{flag}.
1298 The attribute indicates whether the subroutine was
1299 declared with the \doublequote{pure} keyword or property.
1302 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1303 subprogram entry may have a
1304 \DWATrecursiveDEFN{} attribute, which
1305 is a \livelink{chap:classflag}{flag}.
1306 The attribute indicates whether the subroutine
1307 or entry point was declared with the \doublequote{recursive} keyword
1310 A subprogram entry may have a
1312 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1313 which is a \CLASSflag. The attribute
1314 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1315 indicating that the subprogram can be called, but will never return to its caller.
1317 \subsubsection{Call Site-Related Attributes}
1318 \textit{While subprogram attributes in the pervious section provide
1319 information about the subprogram and it's entry point(s) as a whole,
1320 the following attributes provide summary information about the calls
1321 that occur within a subprogram.}
1323 A subroutine entry may have \DWATcallalltailcallsNAME,
1324 \DWATcallallcallsNAME{} and/or \DWATcallallsourcecallsNAME{}
1325 attributes, each of which is a
1326 \livelink{chap:classflag}{flag}.
1327 \addtoindexx{call site summary information}
1328 \addtoindexx{subroutine call site summary attributes}
1329 These flags indicate the completeness of the call site
1330 information provided by call site entries (see
1331 Section \refersec{chap:callsiteentries}) within the subprogram.
1333 The \DWATcallalltailcallsDEFN{}
1334 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1335 indicates that every tail call
1336 that occurs in the code for the subprogram is described by a
1337 \DWTAGcallsite{} entry.
1338 (There may or may not be other non-tail calls to some of the same
1339 target subprograms.)
1341 The \DWATcallallcallsDEFN{}
1342 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1343 indicates that every non-inlined call
1344 (either a tail call or a normal call) that occurs in the code for the subprogram
1345 is described by a \DWTAGcallsite{} entry.
1347 The \DWATcallallsourcecallsDEFN{}
1348 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1349 indicates that every call that occurs in the
1350 code for the subprogram, including every call inlined into it, is described by either a
1351 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1352 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1353 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1355 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1356 information format consumers that analyse call graphs.}
1358 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1359 \DWATcallallcalls{} and \DWATcallalltailcalls{} attributes are necessarily also true, and
1360 those attributes need not be present. Similarly, if the value of the
1361 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1362 attribute is also true and the latter attribute need not be present.
1365 \subsection{Subroutine and Entry Point Return Types}
1366 \label{chap:subroutineandentrypointreturntypes}
1369 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1370 the subroutine or entry point
1371 \addtoindexx{return type of subroutine}
1372 is a function that returns a
1373 value, then its debugging information entry has
1374 \addtoindexx{type attribute}
1375 a \DWATtypeDEFN{} attribute
1376 to denote the type returned by that function.
1378 \textit{Debugging information entries for
1379 \addtoindex{C} void functions should
1380 not have an attribute for the return type. }
1382 \textit{Debugging information entries for declarations of \addtoindex{C++}
1383 member functions with an
1384 \autoreturntype{} specifier should use an unspecified type entry (see
1385 Section \refersec{chap:unspecifiedtypeentries}).
1386 The debugging information entry for the corresponding definition
1387 should provide the deduced return type. This practice causes the description of
1388 the containing class to be consistent across compilation units, allowing the class
1389 declaration to be placed into a separate type unit if desired.}
1392 \subsection{Subroutine and Entry Point Locations}
1393 \label{chap:subroutineandentrypointlocations}
1395 A subroutine entry may have either a \DWATlowpc{} and
1396 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1397 \addtoindexx{ranges attribute}
1399 \addtoindexx{high PC attribute}
1401 \addtoindexx{low PC attribute}
1402 encode the contiguous or non\dash contiguous address
1403 ranges, respectively, of the machine instructions generated
1404 for the subroutine (see
1405 Section \refersec{chap:codeaddressesandranges}).
1408 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1409 subroutine entry may also have
1410 \addtoindexx{entry PC attribute!for subroutine}
1412 \DWATentrypc{} attribute
1413 whose value is the address of the first executable instruction
1414 of the subroutine (see
1415 Section \refersec{chap:entryaddress}).
1417 An entry point has a \DWATlowpc{} attribute whose value is the
1418 relocated address of the first machine instruction generated
1419 for the entry point.
1422 \DWATentrypc{} attribute
1423 \addtoindexx{entry pc attribute!for subroutine}
1425 also seem appropriate
1426 for this purpose, historically the
1427 \DWATlowpc{} attribute
1429 \DWATentrypc{} was introduced (in
1430 \addtoindex{DWARF Version 3}).
1431 There is insufficient reason to change this.}
1437 \addtoindexx{address class attribute}
1439 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1443 \DWATaddressclassDEFN{} attributes,
1444 as appropriate, to specify
1445 which segments the code for the subroutine resides in and
1446 the addressing mode to be used in calling that subroutine.
1448 A subroutine entry representing a subroutine declaration
1449 that is not also a definition does not have code address or
1453 \subsection{Declarations Owned by Subroutines and Entry Points}
1454 \label{chap:declarationsownedbysubroutinesandentrypoints}
1455 \addtoindexx{subroutine formal parameters}
1456 The declarations enclosed by a subroutine or entry point are
1457 represented by debugging information entries that are owned
1458 by the subroutine or entry point entry. Entries representing
1459 \addtoindexx{formal parameter}
1460 the formal parameters of the subroutine or entry point appear
1461 in the same order as the corresponding declarations in the
1465 \textit{There is no ordering requirement for entries for declarations
1466 other than formal parameters. The formal parameter
1467 entries may be interspersed with other entries used by formal
1468 parameter entries, such as type entries.}
1470 The unspecified (sometimes called \doublequote{varying})
1471 parameters of a subroutine parameter list are
1472 represented by a debugging information
1473 entry\addtoindexx{unspecified parameters entry}
1474 with the tag \DWTAGunspecifiedparametersTARG.
1477 The entry for a subroutine that includes a
1478 \addtoindex{Fortran}
1479 \addtoindexx{Fortran!common block}
1480 \livelink{chap:fortrancommonblock}{common}
1481 \livelink{chap:commonblockentry}{block}
1482 \addtoindexx{common block|see{Fortran common block}}
1483 has a child entry with the
1484 tag \DWTAGcommoninclusionTARG.
1486 \hypertarget{chap:commonreferencecommonblockusage}{}
1487 common inclusion entry has a
1488 \DWATcommonreferenceDEFN{} attribute
1489 \addtoindexx{common block reference attribute}
1490 whose value is a \livelink{chap:classreference}{reference}
1491 to the debugging information entry
1492 for the common \nolink{block} being included
1493 (see Section \refersec{chap:commonblockentries}).
1495 \subsection{Low-Level Information}
1496 \label{chap:lowlevelinformation}
1499 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1500 subroutine or entry point entry may have a
1501 \addtoindexx{return address attribute}
1502 \DWATreturnaddrDEFN{}
1503 attribute, whose value is a location description. The location
1504 specified is the place where the return address for the
1505 subroutine or entry point is stored.
1508 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1509 subroutine or entry point entry may also have
1510 \addtoindexx{frame base attribute}
1512 \DWATframebaseDEFN{} attribute, whose value is a location
1513 description that describes the \doublequote{frame base} for the
1514 subroutine or entry point. If the location description is
1515 a simple register location description, the given register
1516 contains the frame base address. If the location description is
1517 a DWARF expression, the result of evaluating that expression
1518 is the frame base address. Finally, for a
1519 \addtoindex{location list},
1520 this interpretation applies to each location description
1521 contained in the list of \addtoindex{location list} entries.
1523 \textit{The use of one of the \DWOPregn{}
1525 context is equivalent to using
1528 compact. However, these are not equivalent in general.}
1531 \textit{The frame base for a subprogram is typically an address
1532 relative to the first unit of storage allocated for the
1533 subprogram\textquoteright s stack frame. The \DWATframebase{} attribute
1534 can be used in several ways:}
1535 \begin{enumerate}[1. ]
1536 \item \textit{In subprograms that need
1537 \addtoindexx{location list}
1538 location lists to locate local
1539 variables, the \DWATframebase{} can hold the needed location
1540 list, while all variables\textquoteright\ location descriptions can be
1541 simpler ones involving the frame base.}
1543 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1544 within nested routines.
1545 (See also \DWATstaticlink, below)}
1549 \textit{Some languages support nested subroutines. In such languages,
1550 it is possible to reference the local variables of an
1551 outer subroutine from within an inner subroutine. The
1552 \DWATstaticlink{} and \DWATframebase{} attributes allow
1553 debuggers to support this same kind of referencing.}
1556 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1558 \addtoindexx{address!uplevel|see {static link attribute}}
1559 \addtoindexx{uplevel address|see {static link attribute}}
1560 subroutine or entry point is nested, it may have a
1561 \DWATstaticlinkDEFN{}
1562 attribute, whose value is a location
1563 description that computes the frame base of the relevant
1564 instance of the subroutine that immediately encloses the
1565 subroutine or entry point.
1567 In the context of supporting nested subroutines, the
1568 \DWATframebase{} attribute value should obey the following
1571 \begin{enumerate}[1. ]
1572 \item It should compute a value that does not change during the
1573 life of the subprogram, and
1575 \item The computed value should be unique among instances of
1576 the same subroutine. (For typical \DWATframebase{} use, this
1577 means that a recursive subroutine\textquoteright s stack frame must have
1578 non\dash zero size.)
1581 \textit{If a debugger is attempting to resolve an up\dash level reference
1582 to a variable, it uses the nesting structure of DWARF to
1583 determine which subroutine is the lexical parent and the
1584 \DWATstaticlink{} value to identify the appropriate active
1585 frame of the parent. It can then attempt to find the reference
1586 within the context of the parent.}
1590 \subsection{Types Thrown by Exceptions}
1591 \label{chap:typesthrownbyexceptions}
1593 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1594 it may validly throw.}
1596 If a subroutine explicitly declares that it may throw
1597 \addtoindexx{exception thrown|see{thrown type entry}}
1599 \addtoindexx{thrown exception|see{thrown type entry}}
1600 exception of one or more types, each such type is
1601 represented by a debugging information entry with
1602 \addtoindexx{thrown type entry}
1604 \DWTAGthrowntypeTARG.
1605 Each such entry is a child of the entry
1606 representing the subroutine that may throw this type. Each
1607 thrown type entry contains
1608 \addtoindexx{type attribute}
1609 a \DWATtype{} attribute, whose
1610 value is a \livelink{chap:classreference}{reference}
1611 to an entry describing the type of the
1612 exception that may be thrown.
1614 \subsection{Function Template Instantiations}
1615 \label{chap:functiontemplateinstantiations}
1617 \textit{In \addtoindex{C++}, a function template is a generic definition of
1618 a function that is instantiated differently for calls with
1619 values of different types. DWARF does not represent the generic
1620 template definition, but does represent each instantiation.}
1623 A \addtoindex{function template instantiation}\addtoindexx{template instantiation!function}
1624 is represented by a debugging information entry with the
1625 \addtoindexx{subprogram entry!use for template instantiation}
1626 tag \DWTAGsubprogram.
1628 exceptions, such an entry will contain the same attributes and
1629 will have the same types of child entries as would an entry
1630 for a subroutine defined explicitly using the instantiation
1631 types and values. The exceptions are:
1633 \begin{enumerate}[1. ]
1634 \item Template parameters are described and referenced as specified in
1635 Section \refersec{chap:templateparameters}.
1638 \item If the compiler has generated a special compilation unit
1639 to hold the template instantiation and that compilation unit
1640 has a different name from the compilation unit containing
1641 the template definition, the name attribute for the debugging
1642 information entry representing that compilation unit is empty
1645 \item If the subprogram entry representing the template
1646 instantiation or any of its child entries contain declaration
1647 coordinate attributes, those attributes refer to the source
1648 for the template definition, not to any source generated
1649 artificially by the compiler for this instantiation.
1654 \subsection{Inlinable and Inlined Subroutines}
1655 \label{chap:inlinedsubroutines}
1656 A declaration or a definition of an inlinable subroutine
1657 is represented by a debugging information entry with the
1661 \addtoindexx{subprogram entry!use in inlined subprogram}
1663 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1664 explicitly declared to be available for inline expansion or
1665 that was expanded inline implicitly by the compiler has
1666 \addtoindexx{inline attribute}
1668 \DWATinlineDEFN{} attribute whose value is an
1669 \livelink{chap:classconstant}{integer constant}. The
1670 set of values for the \DWATinline{} attribute is given in
1671 Table \refersec{tab:inlinecodes}.
1675 \caption{Inline codes}
1676 \label{tab:inlinecodes}
1677 \begin{tabular}{l|P{8cm}}
1679 Name&Meaning\\ \hline
1680 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1681 \mbox{compiler} (equivalent to the absence of the
1682 containing \DWATinline{} attribute) \\
1683 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1684 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1685 not inlined by the \mbox{compiler} \\
1686 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1692 \textit{In \addtoindex{C++}, a function or a constructor declared with
1693 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1694 instance (see below) is represented by a debugging information
1695 entry with the tag \DWTAGsubprogram. Such an entry has a
1696 \DWATinline{} attribute whose value is \DWINLinlined.}
1699 \subsubsection{Abstract Instances}
1700 \label{chap:abstractinstances}
1701 Any subroutine entry that contains a
1702 \DWATinlineDEFN{} attribute\addtoindexx{inline attribute}
1703 whose value is other than
1706 \doublequote{abstract instance root.}\addtoindexx{abstract instance!root}
1707 \hypertarget{chap:DWATinlineabstracttinstance}{}
1708 Any debugging information entry that is owned (either
1709 directly or indirectly) by an abstract instance root
1711 \doublequote{abstract instance entry.}\addtoindexx{abstract instance!entry}
1712 Any set of abstract instance entries that are all
1713 children (either directly or indirectly) of some abstract
1714 instance root, together with the root itself, is known as an
1715 \doublequote{abstract instance tree.}\addtoindexx{abstract instance!tree}
1716 However, in the case where an abstract instance tree is
1717 nested within another abstract instance tree, the entries in the
1718 \addtoindex{nested abstract instance}
1719 tree are not considered to be entries in the outer abstract
1722 Each abstract instance root is either part of a larger
1723 \addtoindexx{abstract instance!root}
1724 tree (which gives a context for the root) or
1725 \addtoindexx{specification attribute}
1727 \DWATspecification{}
1728 to refer to the declaration in context.
1730 \textit{For example, in \addtoindex{C++} the context might be a namespace
1731 declaration or a class declaration.}
1733 \textit{Abstract instance trees are defined so that no entry is part
1734 of more than one abstract instance tree. This simplifies the
1735 following descriptions.}
1737 A debugging information entry that is a member of an abstract
1738 instance tree should not contain any attributes which describe
1739 aspects of the subroutine which vary between distinct inlined
1740 expansions or distinct out\dash of\dash line expansions. For example,
1741 \addtoindexx{entry pc attribute!and abstract instance}
1752 \addtoindexx{location attribute!and abstract instance}
1754 \addtoindexx{ranges attribute!and abstract instance}
1756 \addtoindexx{high PC attribute!and abstract instance}
1758 \addtoindexx{low PC attribute!and abstract instance}
1760 \addtoindexx{segment attribute!and abstract instance}
1762 \addtoindexx{return address attribute!and abstract instance}
1764 \addtoindexx{segment attribute!and abstract instance}
1766 \addtoindexx{start scope attribute!and abstract instance}
1770 \textit{It would not make sense normally to put these attributes into
1771 abstract instance entries since such entries do not represent
1772 actual (concrete) instances and thus do not actually exist at
1773 run\dash time. However,
1774 see Appendix \refersec{app:inlineouteronenormalinner}
1775 for a contrary example.}
1777 The rules for the relative location of entries belonging to
1778 abstract instance trees are exactly the same as for other
1779 similar types of entries that are not abstract. Specifically,
1780 the rule that requires that an entry representing a declaration
1781 be a direct child of the entry representing the scope of the
1782 declaration applies equally to both abstract and non\dash abstract
1783 entries. Also, the ordering rules for formal parameter entries,
1784 member entries, and so on, all apply regardless of whether
1785 or not a given entry is abstract.
1788 \subsubsection{Concrete Inlined Instances}
1789 \label{chap:concreteinlinedinstances}
1791 Each inline expansion of a subroutine is represented
1792 by a debugging information entry with the
1793 tag \DWTAGinlinedsubroutineTARG.
1794 Each such entry should be a direct
1795 child of the entry that represents the scope within which
1796 the inlining occurs.
1799 Each inlined subroutine entry may have either a
1801 and \DWAThighpc{} pair
1803 \addtoindexx{high PC attribute}
1805 \addtoindexx{low PC attribute}
1807 \addtoindexx{ranges attribute}
1810 attribute whose values encode the contiguous or non\dash contiguous
1811 address ranges, respectively, of the machine instructions
1812 generated for the inlined subroutine (see
1813 Section \referfol{chap:codeaddressesandranges}).
1815 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1816 inlined subroutine entry may
1817 \addtoindexx{inlined subprogram entry!in concrete instance}
1819 \addtoindexx{inlined subprogram entry}
1821 \addtoindexx{entry PC attribute!for inlined subprogram}
1824 attribute, representing the first executable instruction of
1825 the inline expansion (see
1826 Section \refersec{chap:entryaddress}).
1828 % Positions of the 3 targets here is a bit arbitrary.
1830 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1832 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1834 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1835 may also have \DWATcallfileDEFN,
1836 \DWATcalllineDEFN{} and \DWATcallcolumnDEFN{} attributes,
1837 \addtoindexx{inlined call location attributes}
1839 value is an \livelink{chap:classconstant}{integer constant}.
1840 These attributes represent the
1841 source file, source line number, and source column number,
1842 respectively, of the first character of the statement or
1843 expression that caused the inline expansion. The call file,
1844 call line, and call column attributes are interpreted in
1845 the same way as the declaration file, declaration line, and
1846 declaration column attributes, respectively (see
1847 Section \refersec{chap:declarationcoordinates}).
1849 \textit{The call file, call line and call column coordinates do not
1850 describe the coordinates of the subroutine declaration that
1851 was inlined, rather they describe the coordinates of the call.
1854 An inlined subroutine entry
1855 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1857 \DWATconstexprDEFN{} attribute,\addtoindexx{constant expression attribute}
1858 which is a \livelink{chap:classflag}{flag}
1859 whose presence indicates that the
1860 subroutine has been evaluated as a compile\dash time constant. Such
1861 an entry may also have a \DWATconstvalue{} attribute,
1862 whose value may be of any form that is appropriate for the
1863 representation of the subroutine's return value. The value of
1864 this attribute is the actual return value of the subroutine,
1865 represented as it would be on the target architecture.
1867 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1868 \addttindex{constexpr}
1869 is called with constant expressions, then the corresponding
1870 concrete inlined instance has a
1871 \DWATconstexpr{} attribute,
1872 as well as a \DWATconstvalue{} attribute whose value represents
1873 the actual return value of the concrete inlined instance.}
1875 Any debugging information entry that is owned (either
1876 directly or indirectly) by a debugging information entry
1877 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1878 \doublequote{concrete inlined instance entry.} Any entry that has
1880 \DWTAGinlinedsubroutine{}
1881 is known as a \doublequote{concrete inlined instance root.}
1882 Any set of concrete inlined instance
1883 entries that are all children (either directly or indirectly)
1884 of some concrete inlined instance root, together with the root
1885 itself, is known as a \doublequote{concrete inlined instance tree.}
1886 However, in the case where a concrete inlined instance tree
1887 is nested within another concrete instance tree, the entries
1888 in the \addtoindex{nested concrete inline instance} tree
1889 are not considered to
1890 be entries in the outer concrete instance tree.
1893 \textit{Concrete inlined instance trees are defined so that no entry
1894 is part of more than one concrete inlined instance tree. This
1895 simplifies later descriptions.}
1897 Each concrete inlined instance tree is uniquely associated
1898 with one (and only one) abstract instance tree.
1900 \textit{Note, however, that the reverse is not true. Any given abstract
1901 instance tree may be associated with several different concrete
1902 inlined instance trees, or may even be associated with zero
1903 concrete inlined instance trees.}
1905 Concrete inlined instance entries may omit attributes that
1906 are not specific to the concrete instance (but present in
1907 the abstract instance) and need include only attributes that
1908 are specific to the concrete instance (but omitted in the
1909 abstract instance). In place of these omitted attributes, each
1910 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1911 concrete inlined instance entry
1912 \addtoindexx{abstract origin attribute}
1914 \DWATabstractoriginDEFN{}
1915 attribute that may be used to obtain the missing information
1916 (indirectly) from the associated abstract instance entry. The
1917 value of the abstract origin attribute is a reference to the
1918 associated abstract instance entry.
1920 If an entry within a concrete inlined instance tree contains
1921 attributes describing the
1922 \addtoindexx{declaration coordinates!in concrete instance}
1923 \livelink{chap:declarationcoordinates}{declaration coordinates}
1924 of that entry, then those attributes should refer to the file, line
1925 and column of the original declaration of the subroutine,
1926 not to the point at which it was inlined. As a consequence,
1927 they may usually be omitted from any entry that has an abstract
1931 For each pair of entries that are associated via a
1932 \addtoindexx{abstract origin attribute}
1933 \DWATabstractorigin{} attribute, both members of the pair
1934 have the same tag. So, for example, an entry with the tag
1935 \DWTAGvariable{} can only be associated with another entry
1936 that also has the tag \DWTAGvariable. The only exception
1937 to this rule is that the root of a concrete instance tree
1938 (which must always have the tag \DWTAGinlinedsubroutine)
1939 can only be associated with the root of its associated abstract
1940 instance tree (which must have the tag \DWTAGsubprogram).
1943 In general, the structure and content of any given concrete
1944 inlined instance tree will be closely analogous to the
1945 structure and content of its associated abstract instance
1946 tree. There are a few exceptions:
1948 \begin{enumerate}[1. ]
1949 \item An entry in the concrete instance tree may be omitted if
1951 \addtoindexx{abstract origin attribute}
1952 \DWATabstractorigin{} attribute and either
1953 has no children, or its children are omitted. Such entries
1954 would provide no useful information. In C\dash like languages,
1955 such entries frequently include types, including structure,
1956 union, class, and interface types; and members of types. If any
1957 entry within a concrete inlined instance tree needs to refer
1958 to an entity declared within the scope of the relevant inlined
1959 subroutine and for which no concrete instance entry exists,
1960 the reference should refer to the abstract instance entry.
1963 \item Entries in the concrete instance tree which are associated
1964 with entries in the abstract instance tree such that neither
1965 has a \DWATname{} attribute,
1966 \addtoindexx{name attribute}
1967 and neither is referenced by
1968 any other debugging information entry, may be omitted. This
1969 may happen for debugging information entries in the abstract
1970 instance trees that became unnecessary in the concrete instance
1971 tree because of additional information available there. For
1972 example, an anonymous variable might have been created and
1973 described in the abstract instance tree, but because of
1974 the actual parameters for a particular inlined expansion,
1975 it could be described as a constant value without the need
1976 for that separate debugging information entry.
1979 \item A concrete instance tree may contain entries which do
1980 not correspond to entries in the abstract instance tree
1981 to describe new entities that are specific to a particular
1982 inlined expansion. In that case, they will not have associated
1983 entries in the abstract instance tree, should not contain
1984 \addtoindexx{abstract origin attribute}
1985 \DWATabstractorigin{} attributes, and must contain all their
1986 own attributes directly. This allows an abstract instance tree
1987 to omit debugging information entries for anonymous entities
1988 that are unlikely to be needed in most inlined expansions. In
1989 any expansion which deviates from that expectation, the
1990 entries can be described in its concrete inlined instance tree.
1994 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1995 \label{chap:outoflineinstancesofinlinedsubroutines}
1996 Under some conditions, compilers may need to generate concrete
1997 executable instances of inlined subroutines other than at
1998 points where those subroutines are actually called. Such
1999 concrete instances of inlined subroutines are referred to as
2000 \doublequote{concrete out\dash of\dash line instances.}
2002 \textit{In \addtoindex{C++}, for example,
2003 taking the address of a function declared
2004 to be inline can necessitate the generation of a concrete
2005 out\dash of\dash line instance of the given function.}
2007 The DWARF representation of a concrete out-of-line instance
2008 of an inlined subroutine is essentially the same as for a
2009 concrete inlined instance of that subroutine (as described in
2010 the preceding section). The representation of such a concrete
2011 % It is critical that the hypertarget and livelink be
2012 % separated to avoid problems with latex.
2014 \addtoindexx{abstract origin attribute}
2016 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
2018 \DWATabstractoriginDEFN{}
2019 attributes in exactly the same way as they are used for
2020 a concrete inlined instance (that is, as references to
2021 corresponding entries within the associated abstract instance
2024 The differences between the DWARF representation of a
2025 concrete out\dash of\dash line instance of a given subroutine and the
2026 representation of a concrete inlined instance of that same
2027 subroutine are as follows:
2028 \begin{enumerate}[1. ]
2029 \item The root entry for a concrete out\dash of\dash line instance
2030 of a given inlined subroutine has the same tag as does its
2031 associated (abstract) inlined subroutine entry (that is, tag
2032 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
2034 \item The root entry for a concrete out\dash of\dash line instance tree
2035 is normally owned by the same parent entry that also owns
2036 the root entry of the associated abstract instance. However,
2037 it is not required that the abstract and out\dash of\dash line instance
2038 trees be owned by the same parent entry.
2042 \subsubsection{Nested Inlined Subroutines}
2043 \label{nestedinlinedsubroutines}
2044 Some languages and compilers may permit the logical nesting of
2045 a subroutine within another subroutine, and may permit either
2046 the outer or the nested subroutine, or both, to be inlined.
2048 For a non\dash inlined subroutine nested within an inlined
2049 subroutine, the nested subroutine is described normally in
2050 both the abstract and concrete inlined instance trees for
2051 the outer subroutine. All rules pertaining to the abstract
2052 and concrete instance trees for the outer subroutine apply
2053 also to the abstract and concrete instance entries for the
2057 For an inlined subroutine nested within another inlined
2058 subroutine, the following rules apply to their abstract and
2059 \addtoindexx{abstract instance!nested}
2060 \addtoindexx{concrete instance!nested}
2061 concrete instance trees:
2063 \begin{enumerate}[1. ]
2064 \item The abstract instance tree for the nested subroutine is
2065 described within the abstract instance tree for the outer
2066 subroutine according to the rules in
2067 Section \refersec{chap:abstractinstances}, and
2068 without regard to the fact that it is within an outer abstract
2071 \item Any abstract instance tree for a nested subroutine is
2072 always omitted within the concrete instance tree for an
2075 \item A concrete instance tree for a nested subroutine is
2076 always omitted within the abstract instance tree for an
2079 \item The concrete instance tree for any inlined or
2080 \addtoindexx{out-of-line instance}
2082 \addtoindexx{out-of-line instance|see{\textit{also} concrete out-of-line instance}}
2083 expansion of the nested subroutine is described within a
2084 concrete instance tree for the outer subroutine according
2086 Sections \refersec{chap:concreteinlinedinstances} or
2087 \referfol{chap:outoflineinstancesofinlinedsubroutines}
2089 and without regard to the fact that it is within an outer
2090 concrete instance tree.
2093 See Appendix \refersec{app:inliningexamples}
2094 for discussion and examples.
2096 \subsection{Trampolines}
2097 \label{chap:trampolines}
2099 \textit{A trampoline is a compiler\dash generated subroutine that serves as
2100 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
2101 an intermediary in making a call to another subroutine. It may
2102 adjust parameters and/or the result (if any) as appropriate
2103 to the combined calling and called execution contexts.}
2105 A trampoline is represented by a debugging information entry
2106 \addtoindexx{trampoline (subprogram) entry}
2107 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
2109 \addtoindexx{trampoline attribute}
2110 a \DWATtrampolineDEFN{} attribute.
2112 attribute indicates the target subroutine of the trampoline,
2113 that is, the subroutine to which the trampoline passes
2114 control. (A trampoline entry may but need not also have a
2115 \DWATartificial{} attribute.)
2118 The value of the trampoline attribute may be represented
2119 using any of the following forms, which are listed in order
2123 \item If the value is of class \CLASSreference{}, then the value
2124 specifies the debugging information entry of the target
2127 \item If the value is of class \CLASSaddress{}, then the value is
2128 the relocated address of the target subprogram.
2131 \item If the value is of class \CLASSstring{}, then the value is the
2132 (possibly mangled) \addtoindexx{mangled names}
2133 name of the target subprogram.
2135 \item If the value is of class \CLASSflag, then the value true
2136 indicates that the containing subroutine is a trampoline but
2137 that the target subroutine is not known.
2141 The target subprogram may itself be a trampoline. (A sequence
2142 of trampolines necessarily ends with a non\dash trampoline
2145 \textit{In \addtoindex{C++}, trampolines may be used to implement
2146 derived virtual member functions; such trampolines typically
2148 \texttt{this} parameter\index{this parameter@\texttt{this} parameter}
2149 in the course of passing control.
2150 Other languages and environments may use trampolines in a manner
2151 sometimes known as transfer functions or transfer vectors.}
2153 \textit{Trampolines may sometimes pass control to the target
2154 subprogram using a branch or jump instruction instead of a
2155 call instruction, thereby leaving no trace of their existence
2156 in the subsequent execution context. }
2158 \textit{This attribute helps make it feasible for a debugger to arrange
2159 that stepping into a trampoline or setting a breakpoint in
2160 a trampoline will result in stepping into or setting the
2161 breakpoint in the target subroutine instead. This helps to
2162 hide the compiler generated subprogram from the user. }
2164 \textit{If the target subroutine is not known, a debugger may choose
2165 to repeatedly step until control arrives in a new subroutine
2166 which can be assumed to be the target subroutine. }
2168 \subsection{Call Site Entries}
2169 \label{chap:callsiteentries}
2171 A call site entry provides a way to represent the static or dynamic
2172 call graph of a program in the debugging information. It also provides
2173 information about how parameters are passed so that they may be more
2174 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
2175 call site entries can be also useful for computing values of variables
2176 and expressions where some value is no longer present in the current
2177 subroutine's registers or local stack frame, but it is known that the
2178 values are equal to some parameter passed to the function.
2179 The consumer can then use unwind
2180 information to find the caller and it's call site information and then
2181 compute the value passed in a particular parameter.}
2183 A call site is represented by a debugging information entry with the tag
2184 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
2185 debugging information entry representing the scope within which the
2186 call is present in the source program.
2189 \textit{A scope entry (for example, for a lexical block) that would not
2190 otherwise be present in the debugging information of a subroutine
2191 need not be introduced solely to represent the immediately containing scope
2194 A source call can be compiled into different types of machine code:
2197 A \textit{normal call} uses a call-like instruction which transfers
2198 control to the start of some subprogram and leaves the call site
2199 location address somewhere where unwind information can find it.
2201 A \textit{tail call} uses a jump-like instruction which
2202 transfers control to the start of some subprogram, but the call site location
2203 address is not preserved (and thus not available using the unwind information).
2205 A \textit{tail recursion call} is a call
2206 to the current subroutine which is compiled as a jump into the middle of the
2210 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2211 where at least one instruction has the location of the inlined subprogram
2212 or any of its blocks or inlined subprograms.
2216 There are also different types of \doublequote{optimized out} calls:
2219 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2220 has not been emitted (such as, for example, the call to \texttt{foo} in
2221 \texttt{if (0) foo();}).
2223 An \textit{optimized out inline call}
2224 is a call to an inlined subprogram which either did not expand to any instructions
2225 or only parts of instructions belong to it and for debug information purposes those
2226 instructions are given a location in the caller.
2229 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2230 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2231 (see Section \refersec{chap:inlinedsubroutines}).
2233 The call site entry has a
2234 \DWATcallreturnpcDEFN{}
2235 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2236 which is the return address after the call.
2237 The value of this attribute corresponds to the return address computed by
2238 call frame information in the called subprogram
2239 (see Section \refersec{datarep:callframeinformation}).
2241 \textit{On many architectures the return address is the address immediately following the
2242 call instruction, but on architectures with delay slots it might
2243 be an address after the delay slot of the call.}
2245 The call site entry may have a
2247 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2248 address of the call instruction.
2250 If the call site entry corresponds to a tail call, it has the
2251 \DWATcalltailcallDEFN{}
2252 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2253 which is a \CLASSflag.
2255 The call site entry may have a
2256 \DWATcalloriginDEFN{}
2257 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2258 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2259 known it is a reference to the called subprogram's debugging
2260 information entry. For indirect calls it may be a reference to a
2261 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2262 the subroutine pointer that is called.
2265 The call site may have a
2266 \DWATcalltargetDEFN{}
2267 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2268 a DWARF expression. For indirect calls or jumps where it is unknown at
2269 compile time which subprogram will be called the expression computes the
2270 address of the subprogram that will be called. The DWARF expression should
2271 not use register or memory locations that might be clobbered by the call.
2274 The call site entry may have a
2275 \DWATcalltargetclobberedDEFN{}
2276 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2277 which is a DWARF expression. For indirect calls or jumps where the
2278 address is not computable without use of registers or memory locations that
2279 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2280 attribute is used instead of the \DWATcalltarget{} attribute.
2282 The call site entry may have a \DWATtypeDEFN{}
2283 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2284 referencing a debugging information entry for the type of the called function.
2286 \textit{When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.}
2288 The call site entry may have
2289 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2290 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2291 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2292 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2293 each of whose value is an integer constant.
2294 These attributes represent the source file, source line number, and source
2295 column number, respectively, of the first character of the call statement or
2296 expression. The call file, call line, and call column attributes are
2297 interpreted in the same way as the declaration file, declaration
2298 line, and declaration column attributes, respectively
2299 (see Section \refersec{chap:declarationcoordinates}).
2301 \textit{The call file, call line and call column coordinates do not describe the
2302 coordinates of the subroutine declaration that was called, rather they describe
2303 the coordinates of the call.}
2306 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2307 entries\index{call site parameter entry} representing the parameters passed to the call.
2308 Each such entry has a \DWATlocation{} attribute which is a location expression.
2309 This location expression describes where the parameter is passed
2310 (usually either some register, or a memory location expressible as the
2311 contents of the stack register plus some offset).
2314 Each \DWTAGcallsiteparameter{} entry may have a
2315 \DWATcallvalueDEFN{}
2316 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2317 which is a DWARF expression. This expression computes the value
2318 passed for that parameter. The expression should not use registers or memory
2319 locations that might be clobbered by the call, as it might be evaluated after
2320 unwinding from the called function back to the caller. If it is not
2321 possible to avoid registers or memory locations that might be clobbered by
2322 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2325 \textit{The reason for the restriction is that the value of the parameter may be
2326 needed in the middle of the callee, where the call clobbered registers or
2327 memory might be already clobbered, and if the consumer was not assured by
2328 the producer it can safely use those values, the consumer could not safely
2329 use the values at all.}
2331 For parameters passed by reference, where the code passes a pointer to
2332 a location which contains the parameter, or for reference type parameters
2333 the \DWTAGcallsiteparameter{} entry may also have
2334 \DWATcalldatalocationNAME{}
2335 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2336 whose value is a location expression and a
2337 \DWATcalldatavalueNAME{}
2338 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2339 whose value is a DWARF expression. The \DWATcalldatalocationDEFN{} attribute
2340 \addtoindexx{call data location attribute}
2341 describes where the referenced value lives during the call. If it is just
2342 \DWOPpushobjectaddress{}, it may be left out. The
2343 \DWATcalldatavalueNAME{} attribute\addtoindexx{call data value attribute}
2344 describes the value in that location.
2345 The expression should not use registers or memory
2346 locations that might be clobbered by the call, as it might be evaluated after
2347 unwinding from the called function back to the caller.
2350 Each call site parameter entry may also have a
2351 \DWATcallparameterDEFN{}
2352 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2353 which contains a reference to a \DWTAGformalparameter{} entry,
2354 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2355 attribute describing the parameter's name.
2359 \section{Lexical Block Entries}
2360 \label{chap:lexicalblockentries}
2363 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2365 \addtoindexx{lexical block}
2366 a bracketed sequence of source statements
2367 that may contain any number of declarations. In some languages
2368 (including \addtoindex{C} and \addtoindex{C++}),
2369 \nolink{blocks} can be nested within other
2370 \nolink{blocks} to any depth.}
2372 % We do not need to link to the preceding paragraph.
2373 A lexical \nolink{block} is represented by a debugging information
2375 tag \DWTAGlexicalblockTARG.
2377 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2379 either a \DWATlowpc{} and
2380 \DWAThighpc{} pair of
2382 \addtoindexx{high PC attribute}
2384 \addtoindexx{low PC attribute}
2386 \DWATranges{} attribute
2387 \addtoindexx{ranges attribute}
2388 whose values encode the contiguous or non-contiguous address
2389 ranges, respectively, of the machine instructions generated
2390 for the lexical \nolink{block}
2391 (see Section \refersec{chap:codeaddressesandranges}).
2394 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2395 lexical block entry may also have
2396 \addtoindexx{entry PC attribute!for lexical block}
2398 \DWATentrypc{} attribute
2399 whose value is the address of the first executable instruction
2400 of the lexical block (see
2401 Section \refersec{chap:entryaddress}).
2403 If a name has been given to the
2404 lexical \nolink{block}
2406 program, then the corresponding
2407 lexical \nolink{block} entry has a
2408 \DWATname{} attribute whose
2409 \addtoindexx{name attribute}
2410 value is a null\dash terminated string
2411 containing the name of the lexical \nolink{block}
2415 \textit{This is not the same as a \addtoindex{C} or
2416 \addtoindex{C++} label (see below).}
2418 The lexical \nolink{block} entry owns
2419 debugging information entries that
2420 describe the declarations within that lexical \nolink{block}.
2422 one such debugging information entry for each local declaration
2423 of an identifier or inner lexical \nolink{block}.
2426 \section{Label Entries}
2427 \label{chap:labelentries}
2428 \textit{A label is a way of identifying a source statement. A labeled
2429 statement is usually the target of one or more \doublequote{go to}
2434 A label is represented by a debugging information entry with
2435 \addtoindexx{label entry}
2437 tag \DWTAGlabelTARG.
2438 The entry for a label should be owned by
2439 the debugging information entry representing the scope within
2440 which the name of the label could be legally referenced within
2443 The label entry has a \DWATlowpc{} attribute whose value
2444 is the relocated address of the first machine instruction
2445 generated for the statement identified by the label in
2446 the source program. The label entry also has a
2447 \DWATname{} attribute
2448 \addtoindexx{name attribute}
2449 whose value is a null-terminated string containing
2450 the name of the label as it appears in the source program.
2453 \section{With Statement Entries}
2454 \label{chap:withstatemententries}
2456 \textit{Both \addtoindex{Pascal} and
2457 \addtoindexx{Modula-2}
2458 Modula\dash 2 support the concept of a \doublequote{with}
2459 statement. The with statement specifies a sequence of
2460 executable statements within which the fields of a record
2461 variable may be referenced, unqualified by the name of the
2464 A with statement is represented by a
2465 \addtoindexi{debugging information entry}{with statement entry}
2466 with the tag \DWTAGwithstmtTARG.
2468 A with statement entry may have either a
2470 \DWAThighpc{} pair of attributes
2471 \addtoindexx{high PC attribute}
2473 \addtoindexx{low PC attribute}
2474 a \DWATranges{} attribute
2475 \addtoindexx{ranges attribute}
2476 whose values encode the contiguous or non\dash contiguous address
2477 ranges, respectively, of the machine instructions generated
2478 for the with statement
2479 (see Section \refersec{chap:codeaddressesandranges}).
2482 \hypertarget{chap:DWATentrypcofwithstmt}{}
2483 with statement entry may also have
2484 \addtoindexx{entry PC attribute!for with statement}
2486 \DWATentrypc{} attribute
2487 whose value is the address of the first executable instruction
2488 of the with statement (see
2489 Section \refersec{chap:entryaddress}).
2492 The with statement entry has
2493 \addtoindexx{type attribute}
2494 a \DWATtype{} attribute, denoting
2495 the type of record whose fields may be referenced without full
2496 qualification within the body of the statement. It also has
2497 \addtoindexx{location attribute}
2498 a \DWATlocation{} attribute, describing how to find the base
2499 address of the record object referenced within the body of
2503 \section{Try and Catch Block Entries}
2504 \label{chap:tryandcatchblockentries}
2505 \livetarg{chap:tryandcatchblockentries}{}
2506 \textit{In \addtoindex{C++}, a \livelink{chap:lexicalblock}{lexical block} may be
2507 designated as a \doublequote{catch \nolink{block}.}
2508 A catch \nolink{block} is an exception handler that
2509 handles exceptions thrown by an immediately preceding
2510 \doublequote{try \nolink{block}.}
2511 A catch \nolink{block}
2512 designates the type of the exception that it can handle.}
2514 A \livetarg{chap:tryblock}{try block} is represented
2515 by a debugging information entry
2516 \addtoindexx{try block entry}
2517 with the tag \DWTAGtryblockTARG.
2518 A \livetarg{chap:catchblock}{catch block} is represented by
2519 a debugging information entry
2520 \addtoindexx{catch block entry}
2521 with the tag \DWTAGcatchblockTARG.
2523 % nolink as we have links just above and do not have a combo link for both
2524 Both try and catch \nolink{block} entries may have either a
2526 \DWAThighpc{} pair of attributes
2527 \addtoindexx{high PC attribute}
2529 \addtoindexx{low PC attribute}
2531 \DWATranges{} attribute
2532 \addtoindexx{ranges attribute}
2533 whose values encode the contiguous
2534 or non-contiguous address ranges, respectively, of the
2535 machine instructions generated for the \nolink{block}
2536 (see Section \refersec{chap:codeaddressesandranges}).
2538 \hypertarget{chap:DWATentrypcoftryblock}{}
2539 \hypertarget{chap:DWATentrypcofcatchblock}{}
2540 A try or catch block entry may also have
2541 \addtoindexx{entry PC attribute!for try block}
2542 \addtoindexx{entry PC attribute!for catch block}
2544 \DWATentrypc{} attribute
2545 whose value is the address of the first executable instruction
2546 of the try or catch block
2547 (see Section \refersec{chap:entryaddress}).
2550 Catch \nolink{block} entries have at least one child entry,
2551 an entry representing the type of exception accepted by
2552 that catch \nolink{block}.
2553 This child entry has one of the tags
2554 \DWTAGformalparameter{}\addtoindexx{formal parameter entry!in catch block}
2556 \DWTAGunspecifiedparameters{},\addtoindexx{unspecified parameters entry!in catch block}
2557 and will have the same form as other parameter entries.
2559 The siblings immediately following a try \nolink{block}
2560 entry are its corresponding catch \nolink{block} entries.