1 \chapter{Program Scope Entries}
2 \label{chap:programscopeentries}
3 This section describes debugging information entries that
4 relate to different levels of program scope: compilation,
5 module, subprogram, and so on. Except for separate type
6 entries (see Section \refersec{chap:typeunitentries}),
7 these entries may be thought of
8 as bounded by ranges of text addresses within the program.
10 \section{Unit Entries}
11 An object file may contain one or more compilation units,
13 \addtoindexx{unit|see {compilation unit}}
14 \addtoindexx{compilation unit}
16 normal compilation units,
17 partial compilation units,
18 type units,\addtoindexx{type unit} and
20 \addtoindex{partial compilation unit}
21 is related to one or more other compilation units that
23 A skeleton unit contains only a subset of the attributes of
24 a full normal or partial compilation unit plus two attributes
25 used to locate the DWARF object file where the full
26 compilation unit can be found.
27 A \addtoindex{type unit} represents a single complete type
28 in a compilation unit of its own.
29 Either a normal compilation unit or a
30 \addtoindex{partial compilation unit}
31 may be logically incorporated into another
32 compilation unit using an
33 \addtoindex{imported unit entry}
34 (see Section \refersec{chap:importedunitentries}).
37 \subsection[Normal and Partial CU Entries]{Normal and Partial Compilation Unit Entries}
38 \label{chap:normalandpartialcompilationunitentries}
40 A \addtoindex{normal compilation unit}\addtoindexx{compilation unit!normal}
41 is represented by a debugging information entry with the tag
42 \DWTAGcompileunitTARG.
43 A \addtoindex{partial compilation unit}\addtoindexx{compilation unit!partial}
44 is represented by a debugging information entry with the tag
45 \DWTAGpartialunitTARG.
47 In a simple normal compilation, a single compilation unit with
49 \DWTAGcompileunit{} represents a complete object file
51 \DWTAGpartialunit{} is not used.
53 employing the DWARF space compression and duplicate elimination
55 Appendix \refersec{app:usingcompilationunits},
56 multiple compilation units using
58 \DWTAGcompileunit{} and/or
59 \DWTAGpartialunit{} are
60 used to represent portions of an object file.
62 \textit{A normal compilation unit typically represents the text and
63 data contributed to an executable by a single relocatable
64 object file. It may be derived from several source files,
65 including pre\dash processed \doublequote{include files.}
66 A \addtoindex{partial compilation unit} typically represents a part of the text
67 and data of a relocatable object file, in a manner that can
68 potentially be shared with the results of other compilations
69 to save space. It may be derived from an \doublequote{include file,}
70 template instantiation, or other implementation\dash dependent
71 portion of a compilation. A normal compilation unit can also
72 function in a manner similar to a partial compilation unit
75 A compilation unit entry owns debugging information
76 entries that represent all or part of the declarations
77 made in the corresponding compilation. In the case of a
78 partial compilation unit, the containing scope of its owned
79 declarations is indicated by imported unit entries in one
80 or more other compilation unit entries that refer to that
81 partial compilation unit (see
82 Section \refersec{chap:importedunitentries}).
85 Compilation unit entries may have the following
87 \begin{enumerate}[1. ]
88 \item Either a \DWATlowpc{} and
90 \addtoindexx{high PC attribute}
92 \addtoindexx{low PC attribute}
94 \addtoindexx{ranges attribute}
96 \DWATranges{} attribute
97 \addtoindexx{ranges attribute}
99 \addtoindexx{discontiguous address ranges|see{non-contiguous address ranges}}
102 non\dash contiguous address ranges, respectively,
103 of the machine instructions generated for the compilation
104 unit (see Section \refersec{chap:codeaddressesandranges}).
106 A \DWATlowpc{} attribute
110 \addtoindexx{ranges attribute}
112 \DWATranges{} to specify the
113 \addtoindexx{ranges attribute}
114 default base address for use in
115 \addtoindexx{location list}
116 location lists (see Section
117 \refersec{chap:locationlists}) and range lists
118 \addtoindexx{range list}
119 (see Section \refersec{chap:noncontiguousaddressranges}).
121 \item A \DWATname{} attribute
122 \addtoindexx{name attribute}
123 whose value is a null\dash terminated
125 \hypertarget{chap:DWATnamepathnameofcompilationsource}{}
126 containing the full or relative path name of the primary
127 source file from which the compilation unit was derived.
129 \item A \DWATlanguage{} attribute
130 \addtoindexx{language attribute}
131 whose constant value is an
132 \hypertarget{chap:DWATlanguageprogramminglanguage}{}
134 \addtoindexx{language attribute}
135 indicating the source language of the compilation
136 unit. The set of language names and their meanings are given
137 in Table \refersec{tab:languagenames}.
140 \setlength{\extrarowheight}{0.1cm}
141 \begin{longtable}{l|l}
142 \caption{Language names} \label{tab:languagenames} \\
143 \hline \bfseries Language name & \bfseries Meaning \\ \hline
145 \bfseries Language name & \bfseries Meaning \\ \hline
147 \hline \emph{Continued on next page}
150 \addtoindexx{ISO-defined language names}
151 \DWLANGAdaeightythreeTARG{} \dag & ISO Ada:1983 \addtoindexx{Ada:1983 (ISO)} \\
152 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada:1995 (ISO)} \\
153 \DWLANGCTARG & Non-standardized C, such as K\&R \addtoindexx{C!non-standard}\\
154 \DWLANGCeightynineTARG & ISO C:1989 \addtoindexx{C:1989 (ISO)} \\
155 \DWLANGCninetynineTARG & ISO C:1999 \addtoindexx{C:1999 (ISO)} \\
156 \DWLANGCelevenTARG & ISO C:2011 \addtoindexx{C:2011 (ISO)} \\
157 \DWLANGCplusplusTARG & ISO C++:1998 \addtoindexx{C++:1998 (ISO)} \\
158 \DWLANGCpluspluszerothreeTARG & ISO C++:2003 \addtoindexx{C++:2003 (ISO)} \\
159 \DWLANGCpluspluselevenTARG & ISO C++:2011 \addtoindexx{C++:2011 (ISO)} \\
160 \DWLANGCplusplusfourteenTARG & ISO C++:2014 \addtoindexx{C++:2014 (ISO)} \\
161 \DWLANGCobolseventyfourTARG & ISO COBOL:1974 \addtoindexx{COBOL:1974 (ISO)} \\
162 \DWLANGCoboleightyfiveTARG & ISO COBOL:1985 \addtoindexx{COBOL:1985 (ISO)} \\
163 \DWLANGDTARG{}~\dag & D \addtoindexx{D language} \\
164 \DWLANGDylanTARG~\dag & Dylan \addtoindexx{Dylan} \\
165 \DWLANGFortranseventysevenTARG & ISO FORTRAN:1977 \addtoindexx{FORTRAN:1977 (ISO)} \\
166 \DWLANGFortranninetyTARG & ISO Fortran:1990 \addtoindexx{Fortran:1990 (ISO)} \\
167 \DWLANGFortranninetyfiveTARG & ISO Fortran:1995 \addtoindexx{Fortran:1995 (ISO)} \\
168 \DWLANGFortranzerothreeTARG & ISO Fortran:2004 \addtoindexx{Fortran:2004 (ISO)} \\
169 \DWLANGFortranzeroeightTARG & ISO Fortran:2010 \addtoindexx{Fortran:2010 (ISO)} \\
170 \DWLANGGoTARG{}~\dag & \addtoindex{Go} \\
171 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell} \\
172 \DWLANGJavaTARG{} & \addtoindex{Java}\\
173 \DWLANGJuliaTARG{}~\dag & \addtoindex{Julia} \\
174 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
175 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
176 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
177 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
178 \DWLANGOCamlTARG{}~\dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
179 \DWLANGOpenCLTARG{}~\dag & \addtoindex{OpenCL} \\
180 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
181 \DWLANGPLITARG{}~\dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
182 \DWLANGPythonTARG{}~\dag & \addtoindex{Python} \\
183 \DWLANGRustTARG{}~\dag & \addtoindex{Rust} \\
184 \DWLANGSwiftTARG{}~\dag & \addtoindex{Swift} \\
185 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
186 \index{Unified Parallel C|see{UPC}} \\
188 \dag \ \ \textit{Support for these languages is limited}& \\
193 \item A \DWATstmtlist{}\hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
194 attribute whose value is
195 \addtoindexx{statement list attribute}
197 \addtoindexx{section offset!in statement list attribute}
198 section offset to the line number information for this compilation
201 This information is placed in a separate object file
202 section from the debugging information entries themselves. The
203 value of the statement list attribute is the offset in the
204 \dotdebugline{} section of the first byte of the line number
205 information for this compilation unit
206 (see Section \refersec{chap:linenumberinformation}).
208 \item A \DWATmacros{}\hypertarget{chap:DWATmacrosmacroinformation}{}
210 \addtoindexx{macro information attribute}
212 \addtoindexx{section offset!in macro information attribute}
213 section offset to the macro information for this compilation unit.
215 This information is placed in a separate object file section
216 from the debugging information entries themselves. The
217 value of the macro information attribute is the offset in
218 the \dotdebugmacro{} section of the first byte of the macro
219 information for this compilation unit
220 (see Section \refersec{chap:macroinformation}).
222 \textit{The \DWATmacros{} attribute is new in \DWARFVersionV,
224 \DWATmacroinfo{} attribute of earlier DWARF versions.
225 \livetarg{chap:DWATmacroinfomacroinformation}{}
226 While \DWATmacros{} and \DWATmacroinfo{} attributes cannot both occur in the same
227 compilation unit, both may be found in the set of units that make up an executable
228 or shared object. The two attributes have distinct encodings to facilitate such
235 \hypertarget{chap:DWATcompdircompilationdirectory}{}
237 null\dash terminated string containing the current working directory
238 of the compilation command that produced this compilation
239 unit in whatever form makes sense for the host system.
241 \item A \DWATproducer{} attribute
242 \addtoindexx{producer attribute}
243 whose value is a null\dash
244 terminated string containing information about the compiler
245 \hypertarget{chap:DWATproducercompileridentification}{}
246 that produced the compilation unit. The actual contents of
247 the string will be specific to each producer, but should
248 begin with the name of the compiler vendor or some other
249 identifying character sequence that should avoid confusion
250 with other producer values.
253 \item A \DWATidentifiercase{}
255 \addtoindexx{identifier case attribute}
257 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
258 constant value is a code describing the treatment
259 of identifiers within this compilation unit. The
260 set of identifier case codes is given in
261 Table \refersec{tab:identifiercasecodes}.
263 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
264 \DWIDcasesensitive{} \\
267 \DWIDcaseinsensitive{} \\
268 \end{simplenametable}
270 \DWIDcasesensitiveTARG{} is the default for all compilation units
271 that do not have this attribute. It indicates that names given
272 as the values of \DWATname{} attributes
273 \addtoindexx{name attribute}
274 in debugging information
275 entries for the compilation unit reflect the names as they
276 appear in the source program. The debugger should be sensitive
277 to the case of identifier names when doing identifier lookups.
280 \DWIDupcaseTARG{} means that the
281 producer of the debugging
282 information for this compilation unit converted all source
283 names to upper case. The values of the name attributes may not
284 reflect the names as they appear in the source program. The
285 debugger should convert all names to upper case when doing
288 \DWIDdowncaseTARG{} means that
289 the producer of the debugging
290 information for this compilation unit converted all source
291 names to lower case. The values of the name attributes may not
292 reflect the names as they appear in the source program. The
293 debugger should convert all names to lower case when doing
297 \DWIDcaseinsensitiveTARG{} means that the values of the name
298 attributes reflect the names as they appear in the source
299 program but that a case insensitive lookup should be used to
303 \item A \DWATbasetypes{} attribute whose value is a
304 \livelink{chap:classreference}{reference}.
307 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
309 \addtoindexx{base types attribute}
310 points to a debugging information entry
311 representing another compilation unit. It may be used
312 to specify the compilation unit containing the base type
313 entries used by entries in the current compilation unit
314 (see Section \refersec{chap:basetypeentries}).
317 This attribute provides a consumer a way to find the definition
318 of base types for a compilation unit that does not itself
319 contain such definitions. This allows a consumer, for example,
320 to interpret a type conversion to a base type
321 % getting this link target at the right spot is tricky.
322 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
325 \item A \DWATuseUTFeight{} attribute,
326 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
327 which is a \livelink{chap:classflag}{flag} whose
328 presence indicates that all strings (such as the names of
329 declared entities in the source program, or filenames in the line number table)
330 are represented using the UTF\dash 8 representation.
333 \item A \DWATmainsubprogram{} attribute, which is a \livelink{chap:classflag}{flag}
334 \addtoindexx{main subprogram attribute}
335 whose presence indicates
336 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
337 that the compilation unit contains a
338 subprogram that has been identified as the starting function
339 of the program. If more than one compilation unit contains
340 this \nolink{flag}, any one of them may contain the starting function.
342 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
344 to specify and provide a user\dash specified name for the main
345 subroutine of a program.
346 \addtoindex{C} uses the name \doublequote{main} to identify
347 the main subprogram of a program. Some other languages provide
348 similar or other means to identify the main subprogram of
351 \item A \DWATentrypc{} attribute whose value is the address of the first
352 \hypertarget{chap:DWATentrypcofcompileunit}{}
353 \hypertarget{chap:DWATentrypcofpartialunit}{}
354 \addtoindexx{entry pc attribute!for normal compilation unit}
355 \addtoindexx{entry pc attribute!for partial compilation unit}
356 executable instruction of the unit (see
357 Section \refersec{chap:entryaddress}).
359 \item A \DWATstroffsetsbaseNAME\addtoindexx{string offset base attribute}
360 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
361 attribute, whose value is a reference.
362 This attribute points to the first string
363 offset of the compilation unit's contribution to the
364 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
365 Indirect string references
366 (using \DWFORMstrx) within the compilation unit are
367 interpreted as indices relative to this base.
370 \item A \DWATaddrbaseNAME\addtoindexx{address table base attribute}
371 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
372 attribute, whose value is a reference.
373 This attribute points to the beginning of the compilation
374 unit's contribution to the \dotdebugaddr{} section.
375 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
376 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
377 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
378 interpreted as indices relative to this base.
381 \item A \DWATrangesbaseNAME\addtoindexx{ranges table base attribute}
382 \hypertarget{chap:DWATrangesbaseforrangelists}{}
383 attribute, whose value is a reference.
384 This attribute points to the beginning of the compilation
385 unit's contribution to the \dotdebugranges{} section.
386 References to range lists (using \DWFORMsecoffset)
387 within the compilation unit are
388 interpreted as offsets relative to this base.
392 The base address of a compilation unit is defined as the
393 value of the \DWATlowpc{} attribute, if present; otherwise,
394 it is undefined. If the base address is undefined, then any
395 DWARF entry or structure defined in terms of the base address
396 of that compilation unit is not valid.
398 \subsection{Skeleton Compilation Unit Entries}
399 \label{chap:skeletoncompilationunitentries}
400 \addtoindexx{compilation unit!skeleton}
401 \addtoindexx{skeleton compilation unit}
402 When generating a split DWARF object (see
403 Section \refersec{datarep:splitdwarfobjects}), the
404 compilation unit in the \dotdebuginfo{} section is a "skeleton"
405 compilation unit, which contains only a subset of the
406 attributes of a full normal or partial compilation unit. In general,
407 it contains those attributes that are necessary for the consumer
408 to locate the DWARF object where the full compilation unit
409 can be found, and for the consumer to interpret references to
410 addresses in the program.
412 A skeleton compilation unit has no
413 children, and may have the following attributes
414 (including at least \DWATdwoname{} and \DWATdwoid{}):
415 \begin{enumerate}[1. ]
418 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
419 or a \DWATranges{} attribute (the same as for regular
420 compilation unit entries).
423 A \DWATstmtlist{} attribute (the same as for regular
424 compilation unit entries).
427 A \DWATcompdir{} attribute (the same as for regular
428 compilation unit entries).
431 \livetarg{chap:DWATdwonameforunit}{}
432 A \DWATdwonameNAME{} attribute whose value is a
433 null-terminated string containing the full or relative
434 path name of the DWARF object file that contains the full
438 \livetarg{chap:DWATdwoidforunit}{}
439 A \DWATdwoidNAME{} attribute whose value is an 8-byte
440 unsigned hash of the full compilation unit. This hash
441 value is computed by the method described in
442 Section \refersec{datarep:typesignaturecomputation}.
446 A \DWATuseUTFeight{} attribute (the same as for regular compilation unit
449 \textit{This attribute applies to strings referred to by the skeleton
450 compilation unit entry itself, and strings in the associated line
452 The representation for strings in the DWARF object file is determined
453 by the presence of a \DWATuseUTFeight{} attribute in the full compilation
457 A \DWATstroffsetsbase{} attribute, for indirect strings references
458 from the skeleton compilation unit (the same as for regular
459 compilation unit entries).
462 A \DWATaddrbase{} attribute (the same as for regular
463 compilation unit entries).
466 A \DWATrangesbase{} attribute (the same as for regular
467 compilation unit entries).
471 All other attributes of a compilation unit entry (described
472 in Section \refersec{chap:normalandpartialcompilationunitentries})
473 should be placed in the full compilation
474 unit entry in the \dotdebuginfodwo{} section of the split DWARF
475 object. The attributes provided by the skeleton compilation
476 unit entry do not need to be repeated in the full compilation
477 unit entry, except for \DWATdwoid, which should appear in
478 both entries so that the consumer can verify that it has
479 found the correct DWARF object.
482 \subsection{Type Unit Entries}
483 \label{chap:typeunitentries}
484 \addtoindexx{type unit}
485 \addtoindexx{type unit|see{\textit{also} compilation unit}}
486 \addtoindexx{compilation unit!\textit{see also} type unit}
487 An object file may contain any number of separate type
488 unit entries, each representing a single complete type
490 Each \addtoindex{type unit} must be uniquely identified by
491 a 64\dash bit signature, stored as part of the type unit, which
492 can be used to reference the type definition from debugging
493 information entries in other compilation units and type units.
495 A type unit is represented by a debugging information entry
496 with the tag \DWTAGtypeunitTARG.
497 A \addtoindex{type unit entry} owns debugging
498 information entries that represent the definition of a single
499 type, plus additional debugging information entries that may
500 be necessary to include as part of the definition of the type.
502 A type unit entry may have the following attributes:
503 \begin{enumerate}[1. ]
506 \DWATlanguage{} attribute,
508 \addtoindexx{language attribute}
509 constant value is an integer code indicating the source
510 language used to define the type. The set of language names
511 and their meanings are given in Table \refersec{tab:languagenames}.
514 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
515 attribute, whose value is a reference. This attribute points
516 to the first string offset of the type unit's contribution to
517 the \dotdebugstroffsets{} section. Indirect string references
518 (using \DWFORMstrx) within the type unit must be interpreted
519 as indices relative to this base.
521 \item A \DWATstmtlist{} attribute, whose
522 value is a section offset to a line number table for this
523 type unit. Because type units do not describe any code, they
524 do not actually need a line number table, but the line number
525 tables also contain a list of directories and file names that
526 may be referenced by the \DWATdeclfile{} attribute. In a
527 normal object file with a regular compilation unit entry, the
528 type unit entries can simply refer to the line number table
529 used by the compilation unit. In a split DWARF object file, where
530 the type units are located in a separate DWARF object file,
531 the \DWATstmtlist{} attribute refers to a "skeleton"
532 line number table in the \dotdebuglinedwo{} section, which
533 contains only the list of directories and file names. All
534 type unit entries in a split DWARF object may (but are not
535 required to) refer to the same skeleton line number table.
537 \item A \DWATuseUTFeight{} attribute, which is a flag
538 whose presence indicates that all strings referred to by this type
539 unit entry, its children, and the skeleton line number table, are
540 represented using the UTF-8 representation.
544 A \addtoindex{type unit} entry for a given type T owns a debugging
545 information entry that represents a defining declaration
546 of type T. If the type is nested within enclosing types or
547 namespaces, the debugging information entry for T is nested
548 within debugging information entries describing its containers;
549 otherwise, T is a direct child of the type unit entry.
551 A type unit entry may also own additional debugging information
552 entries that represent declarations of additional types that
553 are referenced by type T and have not themselves been placed in
554 separate type units. Like T, if an additional type U is nested
555 within enclosing types or namespaces, the debugging information
556 entry for U is nested within entries describing its containers;
557 otherwise, U is a direct child of the type unit entry.
559 The containing entries for types T and U are declarations,
560 and the outermost containing entry for any given type T or
561 U is a direct child of the type unit entry. The containing
562 entries may be shared among the additional types and between
563 T and the additional types.
565 \textit{Types are not required to be placed in type units. In general,
566 only large types such as structure, class, enumeration, and
567 union types included from header files should be considered
568 for separate type units. Base types and other small types
569 are not usually worth the overhead of placement in separate
570 type units. Types that are unlikely to be replicated, such
571 as those defined in the main source file, are also better
572 left in the main compilation unit.}F
574 \section{Module, Namespace and Importing Entries}
575 \textit{Modules and namespaces provide a means to collect related
576 entities into a single entity and to manage the names of
579 \subsection{Module Entries}
580 \label{chap:moduleentries}
581 \textit{Several languages have the concept of a \doublequote{module.}
582 \addtoindexx{Modula-2}
583 A Modula\dash 2 definition module
584 \addtoindexx{Modula-2!definition module}
585 may be represented by a module
587 \addtoindex{declaration attribute}
588 (\DWATdeclaration). A
589 \addtoindex{Fortran 90} module
590 \addtoindexx{Fortran!module (Fortran 90)}
591 may also be represented by a module entry
592 (but no declaration attribute is warranted because \addtoindex{Fortran}
593 has no concept of a corresponding module body).}
595 A module is represented by a debugging information entry
597 tag \DWTAGmoduleTARG.
598 Module entries may own other
599 debugging information entries describing program entities
600 whose declaration scopes end at the end of the module itself.
602 If the module has a name, the module entry has a
603 \DWATname{} attribute
604 \addtoindexx{name attribute}
605 whose value is a null\dash terminated string containing
606 the module name as it appears in the source program.
608 The \addtoindex{module entry} may have either a
612 \addtoindexx{high PC attribute}
614 \addtoindexx{low PC attribute}
616 \DWATranges{} attribute
617 \addtoindexx{ranges attribute}
618 whose values encode the contiguous or non\dash contiguous address
619 ranges, respectively, of the machine instructions generated for
620 the module initialization code
621 (see Section \refersec{chap:codeaddressesandranges}).
622 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
624 \addtoindexx{entry pc attribute!for module initialization}
626 \DWATentrypc{} attribute whose value is the address of
627 the first executable instruction of that initialization code
628 (see Section \refersec{chap:entryaddress}).
631 \hypertarget{chap:DWATprioritymodulepriority}{}
632 the module has been assigned a priority, it may have
633 \addtoindexx{priority attribute}
635 \DWATpriority{} attribute.
636 The value of this attribute is a
637 reference to another debugging information entry describing
638 a variable with a constant value. The value of this variable
639 is the actual constant value of the module\textquoteright s priority,
640 represented as it would be on the target architecture.
642 \subsection{Namespace Entries}
643 \label{chap:namespaceentries}
644 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
645 \addtoindexx{namespace (C++)}
646 implement name hiding, so that names of unrelated things
647 do not accidentally clash in the
648 \addtoindex{global namespace} when an
649 application is linked together.}
651 A namespace is represented by a debugging information entry
653 tag \DWTAGnamespaceTARG.
654 A namespace extension is
655 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
657 \DWTAGnamespace{} entry
659 \addtoindexx{extension attribute}
662 attribute referring to the previous extension, or if there
663 is no previous extension, to the original
665 entry. A namespace extension entry does not need to duplicate
666 information in a previous extension entry of the namespace
667 nor need it duplicate information in the original namespace
668 entry. (Thus, for a namespace with a name,
669 a \DWATname{} attribute
670 \addtoindexx{name attribute}
671 need only be attached directly to the original
672 \DWTAGnamespace{} entry.)
675 Namespace and namespace extension entries may own
676 \addtoindexx{namespace extension entry}
678 \addtoindexx{namespace declaration entry}
679 debugging information entries describing program entities
680 whose declarations occur in the namespace.
682 \textit{For \addtoindex{C++}, such
683 owned program entities may be declarations,
684 including certain declarations that are also object or
685 function definitions.}
687 A namespace may have a
688 \DWATexportsymbolsNAME{}\livetarg{chap:DWATexportsymbolsofnamespace}{}
689 attribute\addtoindexx{export symbols attribute}
690 \addtoindexx{inline namespace|see{\textit{also} export symbols attribute}}
691 which indicates that all member names defined within the
692 namespace may be referenced as if they were defined within
693 the containing namespace.
695 \textit{This may be used to describe an \addtoindex{inline namespace} in \addtoindex{C++}}.
697 If a type, variable, or function declared in a namespace is
698 defined outside of the body of the namespace declaration,
699 that type, variable, or function definition entry has a
700 \DWATspecification{} attribute
701 \addtoindexx{specification attribute}
702 whose value is a \livelink{chap:classreference}{reference} to the
703 debugging information entry representing the declaration of
704 the type, variable or function. Type, variable, or function
706 \DWATspecification{} attribute
707 \addtoindexx{specification attribute}
709 to duplicate information provided by the declaration entry
710 referenced by the specification attribute.
712 \textit{The \addtoindex{C++} \addtoindex{global namespace}
714 \addtoindexx{global namespace|see{namespace (C++), global}}
716 \addtoindexx{namespace (C++)!global}
718 \texttt{::f}, for example) is not explicitly represented in
719 DWARF with a namespace entry (thus mirroring the situation
720 in \addtoindex{C++} source).
721 Global items may be simply declared with no
722 reference to a namespace.}
724 \textit{The \addtoindex{C++}
725 compilation unit specific \doublequote{unnamed namespace} may
726 \addtoindexx{namespace (C++)!unnamed}
727 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
728 be represented by a namespace entry with no name attribute in
729 the original namespace declaration entry (and therefore no name
730 attribute in any namespace extension entry of this namespace).
733 \textit{A compiler emitting namespace information may choose to
734 explicitly represent namespace extensions, or to represent the
735 final namespace declaration of a compilation unit; this is a
736 quality\dash of\dash implementation issue and no specific requirements
737 are given here. If only the final namespace is represented,
738 \addtoindexx{namespace (C++)!using declaration}
739 it is impossible for a debugger to interpret using declaration
740 references in exactly the manner defined by the
741 \addtoindex{C++} language.
744 \textit{Emitting all namespace declaration information in all
745 compilation units can result in a significant increase in the
746 size of the debug information and significant duplication of
747 information across compilation units.
748 The \addtoindex{C++} namespace std,
750 \addtoindexx{namespace (C++)!std}
751 is large and will probably be referenced in
752 every \addtoindex{C++} compilation unit.
755 \textit{For \addtoindex{C++} namespace examples,
756 see Appendix \refersec{app:namespaceexamples}.
761 \subsection{Imported (or Renamed) Declaration Entries}
762 \label{chap:importedorrenameddeclarationentries}
763 \textit{Some languages support the concept of importing into or making
764 accessible in a given unit declarations made in a different
765 module or scope. An imported declaration may sometimes be
770 imported declaration is represented by one or
771 \addtoindexx{imported declaration entry}
772 more debugging information entries with the
773 tag \DWTAGimporteddeclarationTARG.
775 \hypertarget{chap:DWATimportimporteddeclaration}{}
777 is imported, there is one imported declaration entry for
779 \addtoindexx{import attribute}
780 Each imported declaration entry has a
781 \DWATimport{} attribute,
782 whose value is a \livelink{chap:classreference}{reference} to the
783 debugging information entry representing the declaration that
786 An imported declaration may also have a
789 \addtoindexx{name attribute}
790 whose value is a null\dash terminated string containing the
791 name, as it appears in the source program, by which the
792 imported entity is to be known in the context of the imported
793 declaration entry (which may be different than the name of
794 the entity being imported). If no name is present, then the
795 name by which the entity is to be known is the same as the
796 name of the entity being imported.
798 An imported declaration entry with a name attribute may be
799 used as a general means to rename or provide an alias for
800 \addtoindexx{alias declaration|see{imported declaration entry}}
801 an entity, regardless of the context in which the importing
802 declaration or the imported entity occurs.
804 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
805 \hypertarget{chap:DWATimportnamespacealias}{}
807 \addtoindexx{namespace (C++)!alias}
808 with a name attribute whose value is
809 a null\dash terminated string containing the alias name as it
810 appears in the source program and an import attribute whose
811 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
812 namespace extension entry.
815 \textit{A \addtoindex{C++} using declaration may be represented by one or more
816 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
818 \addtoindexx{namespace (C++)!using declaration}
819 declaration entries. When the using declaration
820 refers to an overloaded function, there is one imported
821 declaration entry corresponding to each overloading. Each
822 imported declaration entry has no name attribute but it does
823 have an import attribute that refers to the entry for the
824 entity being imported. (\addtoindex{C++}
825 provides no means to \doublequote{rename}
826 an imported entity, other than a namespace).
829 \textit{A \addtoindex{Fortran} use statement
830 \addtoindexx{Fortran!use statement}
831 \addtoindexx{use statement|see {Fortran, use statement}}
832 with an \doublequote{only list} may be
833 represented by a series of imported declaration entries,
834 one (or more) for each entity that is imported. An entity
835 \addtoindexx{renamed declaration|see{imported declaration entry}}
836 that is renamed in the importing context may be represented
837 by an imported declaration entry with a name attribute that
838 specifies the new local name.
841 \subsection{Imported Module Entries}
842 \label{chap:importedmoduleentries}
844 \textit{Some languages support the concept of importing into or making
845 accessible in a given unit all of the declarations contained
846 within a separate module or namespace.
849 An imported module declaration is represented by a debugging
850 information entry with
851 \addtoindexx{imported module attribute}
853 \addtoindexx{imported module entry}
854 tag \DWTAGimportedmoduleTARG.
856 imported module entry contains a
857 \DWATimport{} attribute
858 \addtoindexx{import attribute}
859 whose value is a \livelink{chap:classreference}{reference}
860 to the module or namespace entry
861 containing the definition and/or declaration entries for
862 the entities that are to be imported into the context of the
863 imported module entry.
865 An imported module declaration may own a set of imported
866 declaration entries, each of which refers to an entry in the
867 module whose corresponding entity is to be known in the context
868 of the imported module declaration by a name other than its
869 name in that module. Any entity in the module that is not
870 renamed in this way is known in the context of the imported
871 module entry by the same name as it is declared in the module.
873 \textit{A \addtoindex{C++} using directive
874 \addtoindexx{namespace (C++)!using directive}
875 \addtoindexx{using directive|see {namespace (C++), using directive}}
876 may be represented by an imported module
877 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
878 entry, with an import attribute referring to the namespace
879 entry of the appropriate extension of the namespace (which
880 might be the original namespace entry) and no owned entries.
883 \textit{A \addtoindex{Fortran} use statement
884 \addtoindexx{Fortran!use statement}
885 with a \doublequote{rename list} may be
886 represented by an imported module entry with an import
887 attribute referring to the module and owned entries
888 corresponding to those entities that are renamed as part of
892 \textit{A \addtoindex{Fortran} use statement
893 \addtoindexx{Fortran!use statement}
894 with neither a \doublequote{rename list} nor
895 an \doublequote{only list} may be represented by an imported module
896 entry with an import attribute referring to the module and
897 no owned child entries.
900 \textit{A use statement with an \doublequote{only list} is represented by a
901 series of individual imported declaration entries as described
902 in Section \refersec{chap:importedorrenameddeclarationentries}.
905 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
906 \addtoindexx{Fortran!use statement}
907 itself imported by a use statement without an explicit mention
908 may be represented by an imported declaration entry that refers
909 to the original debugging information entry. For example, given
926 \textit{the imported declaration entry for Q within module C refers
927 directly to the variable declaration entry for X in module A
928 because there is no explicit representation for X in module B.
931 \textit{A similar situation arises for a \addtoindex{C++} using declaration
932 \addtoindexx{namespace (C++)!using declaration}
933 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
934 that imports an entity in terms of a namespace alias. See
935 Appendix \refersec{app:namespaceexamples}
939 \subsection{Imported Unit Entries}
940 \label{chap:importedunitentries}
942 \hypertarget{chap:DWATimportimportedunit}{}
943 place where a normal or partial unit is imported is
944 represented by a debugging information entry with the
945 \addtoindexx{imported unit entry}
946 tag \DWTAGimportedunitTARG.
947 An imported unit entry contains
948 \addtoindexx{import attribute}
950 \DWATimport{} attribute
951 whose value is a \livelink{chap:classreference}{reference} to the
952 normal or partial compilation unit whose declarations logically
953 belong at the place of the imported unit entry.
955 \textit{An imported unit entry does not necessarily correspond to
956 any entity or construct in the source program. It is merely
957 \doublequote{glue} used to relate a partial unit, or a compilation
958 unit used as a partial unit, to a place in some other
961 \section{Subroutine and Entry Point Entries}
962 \label{chap:subroutineandentrypointentries}
964 The following tags exist to describe
965 debugging information entries
966 \addtoindexx{function entry|see{subroutine entry}}
968 \addtoindexx{subroutine entry}
970 \addtoindexx{subprogram entry}
972 % FIXME: is entry point entry the right index 'entry'?
973 \addtoindexx{entry point entry}
976 \begin{tabular}{lp{9.0cm}}
977 \DWTAGsubprogramTARG{} & A subroutine or function \\
978 \DWTAGinlinedsubroutine{} & A particular inlined
979 \addtoindexx{inlined subprogram entry}
980 instance of a subroutine or function \\
981 \DWTAGentrypointTARG{} & An alternate entry point \\
986 \subsection{General Subroutine and Entry Point Information}
987 \label{chap:generalsubroutineandentrypointinformation}
988 The subroutine or entry point entry has a \DWATname{}
989 attribute whose value is a null-terminated string containing the
990 subroutine or entry point name as it appears in the source program.
991 It may also have a \DWATlinkagename{} attribute as
992 described in Section \refersec{chap:linkagenames}.
994 If the name of the subroutine described by an entry with the
995 \addtoindexx{subprogram entry}
996 tag \DWTAGsubprogram{}
997 is visible outside of its containing
998 \hypertarget{chap:DWATexternalexternalsubroutine}{}
999 compilation unit, that entry has
1000 \addtoindexx{external attribute}
1002 \DWATexternalNAME{} attribute,
1003 which is a \livelink{chap:classflag}{flag}.
1005 \textit{Additional attributes for functions that are members of a
1006 class or structure are described in
1007 Section \refersec{chap:memberfunctionentries}.
1011 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
1014 \DWATmainsubprogramNAME{}
1016 \addtoindexx{main subprogram attribute}
1018 a \CLASSflag{} whose presence indicates that the
1019 subroutine has been identified as the starting function of
1020 the program. If more than one subprogram contains this
1022 any one of them may be the starting subroutine of the program.
1024 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1025 which is used to specify
1026 and provide a user\dash supplied name for the main subroutine of
1030 \textit{A common debugger feature is to allow the debugger user to call
1031 a subroutine within the subject program. In certain cases,
1032 however, the generated code for a subroutine will not obey
1033 the standard calling conventions for the target architecture
1034 and will therefore not be safe to call from within a debugger.
1037 A subroutine entry may
1038 \hypertarget{chap:DWATcallingconventionforsubprograms}{}
1040 \DWATcallingconventionNAME{}
1041 \addtoindexx{calling convention attribute}
1042 attribute, whose value is an
1043 \livelink{chap:classconstant}{integer constant}. The set of
1044 \addtoindexi{calling convention codes for subroutines}{calling convention codes!for subroutines}
1045 is given in Table \refersec{tab:callingconventioncodesforsubroutines}.
1047 \begin{simplenametable}[1.4in]{Calling convention codes for subroutines}{tab:callingconventioncodesforsubroutines}
1051 \end{simplenametable}
1053 If this attribute is not present, or its value is the constant
1054 \DWCCnormalTARG, then the subroutine may be safely called by
1055 obeying the \doublequote{standard} calling conventions of the target
1056 architecture. If the value of the calling convention attribute
1057 is the constant \DWCCnocallTARG, the subroutine does not obey
1058 standard calling conventions, and it may not be safe for the
1059 debugger to call this subroutine.
1061 \textit{Note that \DWCCnormal{} is also used as a calling convention
1062 code for certain types
1063 (see Table \refersec{tab:callingconventioncodesfortypes}).}
1065 If the semantics of the language of the compilation unit
1066 containing the subroutine entry distinguishes between ordinary
1067 subroutines and subroutines that can serve as the \doublequote{main
1068 program,} that is, subroutines that cannot be called
1069 directly according to the ordinary calling conventions,
1070 then the debugging information entry for such a subroutine
1071 may have a calling convention attribute whose value is the
1072 constant \DWCCprogramTARG.
1074 \textit{The \DWCCprogram{}
1075 value is intended to support \addtoindex{Fortran} main
1076 \addtoindexx{Fortran!main program}
1077 programs which in some implementations may not be callable
1078 or which must be invoked in a special way. It is not intended
1079 as a way of finding the entry address for the program.
1082 \textit{In \addtoindex{C}
1083 there is a difference between the types of functions
1084 declared using function prototype style declarations and
1085 those declared using non\dash prototype declarations.
1088 A subroutine entry declared with a function prototype style
1089 declaration may have
1090 \addtoindexx{prototyped attribute}
1092 \DWATprototypedNAME{} attribute, which is
1095 \textit{The \addtoindex{Fortran}
1096 language allows the keywords \texttt{elemental}, \texttt{pure}
1097 and \texttt{recursive} to be included as part of the declaration of
1098 a subroutine; these attributes reflect that usage. These
1099 attributes are not relevant for languages that do not support
1100 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1101 attribute is neither needed nor appropriate in languages such
1103 where functions support recursion by default.
1107 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1109 \addtoindexx{elemental attribute}
1111 \DWATelementalNAME{} attribute, which
1112 is a \livelink{chap:classflag}{flag}.
1113 The attribute indicates whether the subroutine
1114 or entry point was declared with the \doublequote{elemental} keyword
1118 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1119 subprogram entry may have
1120 \addtoindexx{pure attribute}
1122 \DWATpureNAME{} attribute, which is
1123 a \livelink{chap:classflag}{flag}.
1124 The attribute indicates whether the subroutine was
1125 declared with the \doublequote{pure} keyword or property.
1128 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1129 subprogram entry may have a
1130 \DWATrecursiveNAME{} attribute, which
1131 is a \livelink{chap:classflag}{flag}.
1132 The attribute indicates whether the subroutine
1133 or entry point was declared with the \doublequote{recursive} keyword
1136 A subprogram entry may have a
1138 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1139 which is a \CLASSflag. The attribute
1140 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1141 indicating that the subprogram can be called, but will never return to its caller.
1143 \subsubsection{Call Site-Related Attributes}
1144 A subroutine entry may have \DWATcallalltailcalls, \DWATcallallcalls{}
1145 and/or \DWATcallallsourcecalls{} attributes, each of which is a
1146 \livelink{chap:classflag}{flag}.
1147 These flags indicate the completeness of the call site information
1148 within the subprogram.
1150 The \DWATcallalltailcallsNAME{}
1151 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1152 indicates that every tail call
1153 that occurs in the code for the subprogram is described by a
1154 \DWTAGcallsite{} entry.
1155 (There may or may not be other non-tail calls to some of the same
1156 target subprograms.)
1158 The \DWATcallallcallsNAME{}
1159 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1160 indicates that every non-inlined call
1161 (either a tail call or a normal call) that occurs in the code for the subprogram
1162 is described by a \DWTAGcallsite{} entry.
1164 The \DWATcallallsourcecallsNAME{}
1165 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1166 indicates that every call that occurs in the
1167 code for the subprogram, including every call inlined into it, is described by either a
1168 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1169 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1170 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1172 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1173 information format consumers that analyse call graphs.}
1175 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1176 \DWATcallallcalls{} and \DWATcallalltailcalls{} attributes are necessarily also true, and
1177 those attributes need not be present. Similarly, if the value of the
1178 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1179 attribute is also true and the latter attribute need not be present.
1182 \subsection{Subroutine and Entry Point Return Types}
1183 \label{chap:subroutineandentrypointreturntypes}
1186 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1187 the subroutine or entry point
1188 \addtoindexx{return type of subroutine}
1189 is a function that returns a
1190 value, then its debugging information entry has
1191 \addtoindexx{type attribute}
1192 a \DWATtype{} attribute
1193 to denote the type returned by that function.
1195 \textit{Debugging information entries for
1196 \addtoindex{C} void functions should
1197 not have an attribute for the return type. }
1199 \textit{Debugging information entries for declarations of \addtoindex{C++}
1200 member functions with an
1201 \autoreturntype{} specifier should use an unspecified type entry (see
1202 Section \refersec{chap:unspecifiedtypeentries}).
1203 The debugging information entry for the corresponding definition
1204 should provide the deduced return type. This practice causes the description of
1205 the containing class to be consistent across compilation units, allowing the class
1206 declaration to be placed into a separate type unit if desired.}
1209 \subsection{Subroutine and Entry Point Locations}
1210 \label{chap:subroutineandentrypointlocations}
1212 A subroutine entry may have either a \DWATlowpc{} and
1213 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1214 \addtoindexx{ranges attribute}
1216 \addtoindexx{high PC attribute}
1218 \addtoindexx{low PC attribute}
1219 encode the contiguous or non\dash contiguous address
1220 ranges, respectively, of the machine instructions generated
1221 for the subroutine (see
1222 Section \refersec{chap:codeaddressesandranges}).
1225 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1226 subroutine entry may also have
1227 \addtoindexx{entry pc attribute!for subroutine}
1229 \DWATentrypc{} attribute
1230 whose value is the address of the first executable instruction
1231 of the subroutine (see
1232 Section \refersec{chap:entryaddress}).
1234 An entry point has a \DWATlowpc{} attribute whose value is the
1235 relocated address of the first machine instruction generated
1236 for the entry point.
1239 \DWATentrypc{} attribute
1240 \addtoindexx{entry pc attribute!for subroutine}
1242 also seem appropriate
1243 for this purpose, historically the
1244 \DWATlowpc{} attribute
1246 \DWATentrypc{} was introduced (in
1247 \addtoindex{DWARF Version 3}).
1248 There is insufficient reason to change this.}
1254 \addtoindexx{address class attribute}
1256 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1260 \DWATaddressclass{} attributes,
1261 as appropriate, to specify
1262 which segments the code for the subroutine resides in and
1263 the addressing mode to be used in calling that subroutine.
1265 A subroutine entry representing a subroutine declaration
1266 that is not also a definition does not have code address or
1270 \subsection{Declarations Owned by Subroutines and Entry Points}
1271 \label{chap:declarationsownedbysubroutinesandentrypoints}
1273 The declarations enclosed by a subroutine or entry point are
1274 represented by debugging information entries that are owned
1275 by the subroutine or entry point entry. Entries representing
1276 \addtoindexx{formal parameter}
1277 the formal parameters of the subroutine or entry point appear
1278 in the same order as the corresponding declarations in the
1282 \textit{There is no ordering requirement for entries for declarations
1283 that are children of subroutine or entry point entries but
1284 that do not represent formal parameters. The formal parameter
1285 entries may be interspersed with other entries used by formal
1286 parameter entries, such as type entries.}
1288 The unspecified parameters of a variable parameter list are
1289 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1291 \DWTAGunspecifiedparametersTARG.
1294 The entry for a subroutine that includes a
1295 \addtoindex{Fortran}
1296 \addtoindexx{Fortran!common block}
1297 \livelink{chap:fortrancommonblock}{common}
1298 \livelink{chap:commonblockentry}{block}
1299 \addtoindexx{common block|see{Fortran common block}}
1300 has a child entry with the
1301 tag \DWTAGcommoninclusionTARG.
1303 \hypertarget{chap:commonreferencecommonblockusage}{}
1304 common inclusion entry has a
1305 \DWATcommonreference{} attribute
1306 whose value is a \livelink{chap:classreference}{reference}
1307 to the debugging information entry
1308 for the common \nolink{block} being included
1309 (see Section \refersec{chap:commonblockentries}).
1311 \subsection{Low-Level Information}
1312 \label{chap:lowlevelinformation}
1315 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1316 subroutine or entry point entry may have
1317 \addtoindexx{return address attribute}
1320 attribute, whose value is a location description. The location
1321 calculated is the place where the return address for the
1322 subroutine or entry point is stored.
1325 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1326 subroutine or entry point entry may also have
1327 \addtoindexx{frame base attribute}
1329 \DWATframebase{} attribute, whose value is a location
1330 description that computes the \doublequote{frame base} for the
1331 subroutine or entry point. If the location description is
1332 a simple register location description, the given register
1333 contains the frame base address. If the location description is
1334 a DWARF expression, the result of evaluating that expression
1335 is the frame base address. Finally, for a
1336 \addtoindex{location list},
1337 this interpretation applies to each location description
1338 contained in the list of \addtoindex{location list} entries.
1340 \textit{The use of one of the \DWOPregn{}
1342 context is equivalent to using
1345 compact. However, these are not equivalent in general.}
1348 \textit{The frame base for a subprogram is typically an address fixed
1349 relative to the first unit of storage allocated for the
1350 subprogram\textquoteright s stack frame. The \DWATframebase{} attribute
1351 can be used in several ways:}
1352 \begin{enumerate}[1. ]
1353 \item \textit{In subprograms that need
1354 \addtoindexx{location list}
1355 location lists to locate local
1356 variables, the \DWATframebase{} can hold the needed location
1357 list, while all variables\textquoteright\ location descriptions can be
1358 simpler ones involving the frame base.}
1360 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1361 within nested routines.
1362 (See also \DWATstaticlink, below)}
1366 \textit{Some languages support nested subroutines. In such languages,
1367 it is possible to reference the local variables of an
1368 outer subroutine from within an inner subroutine. The
1369 \DWATstaticlink{} and \DWATframebase{} attributes allow
1370 debuggers to support this same kind of referencing.}
1373 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1375 \addtoindexx{address!uplevel|see {static link attribute}}
1376 \addtoindexx{uplevel address|see {static link attribute}}
1377 subroutine or entry point is nested, it may have a
1379 attribute, whose value is a location
1380 description that computes the frame base of the relevant
1381 instance of the subroutine that immediately encloses the
1382 subroutine or entry point.
1384 In the context of supporting nested subroutines, the
1385 \DWATframebase{} attribute value should obey the following
1388 \begin{enumerate}[1. ]
1389 \item It should compute a value that does not change during the
1390 life of the subprogram, and
1392 \item The computed value should be unique among instances of
1393 the same subroutine. (For typical \DWATframebase{} use, this
1394 means that a recursive subroutine\textquoteright s stack frame must have
1395 non\dash zero size.)
1398 \textit{If a debugger is attempting to resolve an up\dash level reference
1399 to a variable, it uses the nesting structure of DWARF to
1400 determine which subroutine is the lexical parent and the
1401 \DWATstaticlink{} value to identify the appropriate active
1402 frame of the parent. It can then attempt to find the reference
1403 within the context of the parent.}
1407 \subsection{Types Thrown by Exceptions}
1408 \label{chap:typesthrownbyexceptions}
1410 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1411 it may validly throw.}
1413 If a subroutine explicitly declares that it may throw
1414 \addtoindexx{exception thrown|see{thrown type entry}}
1416 \addtoindexx{thrown exception|see{thrown type entry}}
1417 exception of one or more types, each such type is
1418 represented by a debugging information entry with
1419 \addtoindexx{thrown type entry}
1421 \DWTAGthrowntypeTARG.
1422 Each such entry is a child of the entry
1423 representing the subroutine that may throw this type. Each
1424 thrown type entry contains
1425 \addtoindexx{type attribute}
1426 a \DWATtype{} attribute, whose
1427 value is a \livelink{chap:classreference}{reference}
1428 to an entry describing the type of the
1429 exception that may be thrown.
1431 \subsection{Function Template Instantiations}
1432 \label{chap:functiontemplateinstantiations}
1434 \textit{In \addtoindex{C++}, a function template is a generic definition of
1435 a function that is instantiated differently for calls with
1436 values of different types. DWARF does not represent the generic
1437 template definition, but does represent each instantiation.}
1440 A \addtoindex{function template instantiation}\addtoindexx{template instantiation!function}
1441 is represented by a debugging information entry with the
1442 \addtoindexx{subprogram entry!use for template instantiation}
1443 tag \DWTAGsubprogram.
1445 exceptions, such an entry will contain the same attributes and
1446 will have the same types of child entries as would an entry
1447 for a subroutine defined explicitly using the instantiation
1448 types and values. The exceptions are:
1450 \begin{enumerate}[1. ]
1451 \item Template parameters are described and referenced as specified in
1452 Section \refersec{chap:templateparameters}.
1455 \item If the compiler has generated a special compilation unit
1456 to hold the template instantiation and that compilation unit
1457 has a different name from the compilation unit containing
1458 the template definition, the name attribute for the debugging
1459 information entry representing that compilation unit is empty
1462 \item If the subprogram entry representing the template
1463 instantiation or any of its child entries contain declaration
1464 coordinate attributes, those attributes refer to the source
1465 for the template definition, not to any source generated
1466 artificially by the compiler for this instantiation.
1471 \subsection{Inlinable and Inlined Subroutines}
1472 \label{chap:inlinedsubroutines}
1473 A declaration or a definition of an inlinable subroutine
1474 is represented by a debugging information entry with the
1478 \addtoindexx{subprogram entry!use in inlined subprogram}
1480 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1481 explicitly declared to be available for inline expansion or
1482 that was expanded inline implicitly by the compiler has
1483 \addtoindexx{inline attribute}
1485 \DWATinline{} attribute whose value is an
1486 \livelink{chap:classconstant}{integer constant}. The
1487 set of values for the \DWATinline{} attribute is given in
1488 Table \refersec{tab:inlinecodes}.
1492 \caption{Inline codes}
1493 \label{tab:inlinecodes}
1494 \begin{tabular}{l|p{8cm}}
1496 Name&Meaning\\ \hline
1497 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1498 \mbox{compiler} (equivalent to the absence of the
1499 containing \DWATinline{} attribute) \\
1500 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1501 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1502 not inlined by the \mbox{compiler} \\
1503 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1509 \textit{In \addtoindex{C++}, a function or a constructor declared with
1510 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1511 instance (see below) is represented by a debugging information
1512 entry with the tag \DWTAGsubprogram. Such an entry has a
1513 \DWATinline{} attribute whose value is \DWINLinlined.}
1516 \subsubsection{Abstract Instances}
1517 \label{chap:abstractinstances}
1518 Any subroutine entry that contains a
1519 \DWATinline{} attribute\addtoindexx{inline attribute}
1520 whose value is other than
1523 \doublequote{abstract instance root.}\addtoindexx{abstract instance!root}
1524 \hypertarget{chap:DWATinlineabstracttinstance}{}
1525 Any debugging information entry that is owned (either
1526 directly or indirectly) by an abstract instance root
1528 \doublequote{abstract instance entry.}\addtoindexx{abstract instance!entry}
1529 Any set of abstract instance entries that are all
1530 children (either directly or indirectly) of some abstract
1531 instance root, together with the root itself, is known as an
1532 \doublequote{abstract instance tree.}\addtoindexx{abstract instance!tree}
1533 However, in the case where an abstract instance tree is
1534 nested within another abstract instance tree, the entries in the
1535 \addtoindex{nested abstract instance}
1536 tree are not considered to be entries in the outer abstract
1539 Each abstract instance root is either part of a larger
1540 \addtoindexx{abstract instance!root}
1541 tree (which gives a context for the root) or
1542 \addtoindexx{specification attribute}
1544 \DWATspecification{}
1545 to refer to the declaration in context.
1547 \textit{For example, in \addtoindex{C++} the context might be a namespace
1548 declaration or a class declaration.}
1550 \textit{Abstract instance trees are defined so that no entry is part
1551 of more than one abstract instance tree. This simplifies the
1552 following descriptions.}
1554 A debugging information entry that is a member of an abstract
1555 instance tree should not contain any attributes which describe
1556 aspects of the subroutine which vary between distinct inlined
1557 expansions or distinct out\dash of\dash line expansions. For example,
1558 \addtoindexx{entry pc attribute!and abstract instance}
1569 \addtoindexx{location attribute!and abstract instance}
1571 \addtoindexx{ranges attribute!and abstract instance}
1573 \addtoindexx{high PC attribute!and abstract instance}
1575 \addtoindexx{low PC attribute!and abstract instance}
1577 \addtoindexx{segment attribute!and abstract instance}
1579 \addtoindexx{return address attribute!and abstract instance}
1581 \addtoindexx{segment attribute!and abstract instance}
1583 \addtoindexx{start scope attribute!and abstract instance}
1587 \textit{It would not make sense normally to put these attributes into
1588 abstract instance entries since such entries do not represent
1589 actual (concrete) instances and thus do not actually exist at
1590 run\dash time. However,
1591 see Appendix \refersec{app:inlineouteronenormalinner}
1592 for a contrary example.}
1594 The rules for the relative location of entries belonging to
1595 abstract instance trees are exactly the same as for other
1596 similar types of entries that are not abstract. Specifically,
1597 the rule that requires that an entry representing a declaration
1598 be a direct child of the entry representing the scope of the
1599 declaration applies equally to both abstract and non\dash abstract
1600 entries. Also, the ordering rules for formal parameter entries,
1601 member entries, and so on, all apply regardless of whether
1602 or not a given entry is abstract.
1605 \subsubsection{Concrete Inlined Instances}
1606 \label{chap:concreteinlinedinstances}
1608 Each inline expansion of a subroutine is represented
1609 by a debugging information entry with the
1610 tag \DWTAGinlinedsubroutineTARG.
1611 Each such entry should be a direct
1612 child of the entry that represents the scope within which
1613 the inlining occurs.
1616 Each inlined subroutine entry may have either a
1618 and \DWAThighpc{} pair
1620 \addtoindexx{high PC attribute}
1622 \addtoindexx{low PC attribute}
1624 \addtoindexx{ranges attribute}
1627 attribute whose values encode the contiguous or non\dash contiguous
1628 address ranges, respectively, of the machine instructions
1629 generated for the inlined subroutine (see
1630 Section \referfol{chap:codeaddressesandranges}).
1632 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1633 inlined subroutine entry may
1634 \addtoindexx{inlined subprogram entry!in concrete instance}
1636 \addtoindexx{inlined subprogram entry}
1638 \addtoindexx{entry pc attribute!for inlined subprogram}
1641 attribute, representing the first executable instruction of
1642 the inline expansion (see
1643 Section \refersec{chap:entryaddress}).
1645 % Positions of the 3 targets here is a bit arbitrary.
1647 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1649 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1651 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1652 may also have \DWATcallfile,
1653 \DWATcallline{} and \DWATcallcolumn{} attributes,
1655 value is an \livelink{chap:classconstant}{integer constant}.
1656 These attributes represent the
1657 source file, source line number, and source column number,
1658 respectively, of the first character of the statement or
1659 expression that caused the inline expansion. The call file,
1660 call line, and call column attributes are interpreted in
1661 the same way as the declaration file, declaration line, and
1662 declaration column attributes, respectively (see
1663 Section \refersec{chap:declarationcoordinates}).
1665 \textit{The call file, call line and call column coordinates do not
1666 describe the coordinates of the subroutine declaration that
1667 was inlined, rather they describe the coordinates of the call.
1670 An inlined subroutine entry
1671 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1674 attribute, which is a \livelink{chap:classflag}{flag}
1675 whose presence indicates that the
1676 subroutine has been evaluated as a compile\dash time constant. Such
1677 an entry may also have a \DWATconstvalue{} attribute,
1678 whose value may be of any form that is appropriate for the
1679 representation of the subroutine's return value. The value of
1680 this attribute is the actual return value of the subroutine,
1681 represented as it would be on the target architecture.
1683 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1684 \addttindex{constexpr}
1685 is called with constant expressions, then the corresponding
1686 concrete inlined instance has a
1687 \DWATconstexpr{} attribute,
1688 as well as a \DWATconstvalue{} attribute whose value represents
1689 the actual return value of the concrete inlined instance.}
1691 Any debugging information entry that is owned (either
1692 directly or indirectly) by a debugging information entry
1693 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1694 \doublequote{concrete inlined instance entry.} Any entry that has
1696 \DWTAGinlinedsubroutine{}
1697 is known as a \doublequote{concrete inlined instance root.}
1698 Any set of concrete inlined instance
1699 entries that are all children (either directly or indirectly)
1700 of some concrete inlined instance root, together with the root
1701 itself, is known as a \doublequote{concrete inlined instance tree.}
1702 However, in the case where a concrete inlined instance tree
1703 is nested within another concrete instance tree, the entries
1704 in the \addtoindex{nested concrete inline instance} tree
1705 are not considered to
1706 be entries in the outer concrete instance tree.
1709 \textit{Concrete inlined instance trees are defined so that no entry
1710 is part of more than one concrete inlined instance tree. This
1711 simplifies later descriptions.}
1713 Each concrete inlined instance tree is uniquely associated
1714 with one (and only one) abstract instance tree.
1716 \textit{Note, however, that the reverse is not true. Any given abstract
1717 instance tree may be associated with several different concrete
1718 inlined instance trees, or may even be associated with zero
1719 concrete inlined instance trees.}
1721 Concrete inlined instance entries may omit attributes that
1722 are not specific to the concrete instance (but present in
1723 the abstract instance) and need include only attributes that
1724 are specific to the concrete instance (but omitted in the
1725 abstract instance). In place of these omitted attributes, each
1726 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1727 concrete inlined instance entry
1728 \addtoindexx{abstract origin attribute}
1730 \DWATabstractorigin{}
1731 attribute that may be used to obtain the missing information
1732 (indirectly) from the associated abstract instance entry. The
1733 value of the abstract origin attribute is a reference to the
1734 associated abstract instance entry.
1736 If an entry within a concrete inlined instance tree contains
1737 attributes describing the
1738 \addtoindexx{declaration coordinates!in concrete instance}
1739 \livelink{chap:declarationcoordinates}{declaration coordinates}
1740 of that entry, then those attributes should refer to the file, line
1741 and column of the original declaration of the subroutine,
1742 not to the point at which it was inlined. As a consequence,
1743 they may usually be omitted from any entry that has an abstract
1747 For each pair of entries that are associated via a
1748 \addtoindexx{abstract origin attribute}
1749 \DWATabstractorigin{} attribute, both members of the pair
1750 have the same tag. So, for example, an entry with the tag
1751 \DWTAGvariable{} can only be associated with another entry
1752 that also has the tag \DWTAGvariable. The only exception
1753 to this rule is that the root of a concrete instance tree
1754 (which must always have the tag \DWTAGinlinedsubroutine)
1755 can only be associated with the root of its associated abstract
1756 instance tree (which must have the tag \DWTAGsubprogram).
1759 In general, the structure and content of any given concrete
1760 inlined instance tree will be closely analogous to the
1761 structure and content of its associated abstract instance
1762 tree. There are a few exceptions:
1764 \begin{enumerate}[1. ]
1765 \item An entry in the concrete instance tree may be omitted if
1767 \addtoindexx{abstract origin attribute}
1768 \DWATabstractorigin{} attribute and either
1769 has no children, or its children are omitted. Such entries
1770 would provide no useful information. In C\dash like languages,
1771 such entries frequently include types, including structure,
1772 union, class, and interface types; and members of types. If any
1773 entry within a concrete inlined instance tree needs to refer
1774 to an entity declared within the scope of the relevant inlined
1775 subroutine and for which no concrete instance entry exists,
1776 the reference should refer to the abstract instance entry.
1779 \item Entries in the concrete instance tree which are associated
1780 with entries in the abstract instance tree such that neither
1781 has a \DWATname{} attribute,
1782 \addtoindexx{name attribute}
1783 and neither is referenced by
1784 any other debugging information entry, may be omitted. This
1785 may happen for debugging information entries in the abstract
1786 instance trees that became unnecessary in the concrete instance
1787 tree because of additional information available there. For
1788 example, an anonymous variable might have been created and
1789 described in the abstract instance tree, but because of
1790 the actual parameters for a particular inlined expansion,
1791 it could be described as a constant value without the need
1792 for that separate debugging information entry.
1794 \item A concrete instance tree may contain entries which do
1795 not correspond to entries in the abstract instance tree
1796 to describe new entities that are specific to a particular
1797 inlined expansion. In that case, they will not have associated
1798 entries in the abstract instance tree, should not contain
1799 \addtoindexx{abstract origin attribute}
1800 \DWATabstractorigin{} attributes, and must contain all their
1801 own attributes directly. This allows an abstract instance tree
1802 to omit debugging information entries for anonymous entities
1803 that are unlikely to be needed in most inlined expansions. In
1804 any expansion which deviates from that expectation, the
1805 entries can be described in its concrete inlined instance tree.
1809 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1810 \label{chap:outoflineinstancesofinlinedsubroutines}
1811 Under some conditions, compilers may need to generate concrete
1812 executable instances of inlined subroutines other than at
1813 points where those subroutines are actually called. Such
1814 concrete instances of inlined subroutines are referred to as
1815 \doublequote{concrete out\dash of\dash line instances.}
1817 \textit{In \addtoindex{C++}, for example,
1818 taking the address of a function declared
1819 to be inline can necessitate the generation of a concrete
1820 out\dash of\dash line instance of the given function.}
1822 The DWARF representation of a concrete out\dash of\dash line instance
1823 of an inlined subroutine is essentially the same as for a
1824 concrete inlined instance of that subroutine (as described in
1825 the preceding section). The representation of such a concrete
1826 % It is critical that the hypertarget and livelink be
1827 % separated to avoid problems with latex.
1828 out\dash of\dash line
1829 \addtoindexx{abstract origin attribute}
1831 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1833 \DWATabstractorigin{}
1834 attributes in exactly the same way as they are used for
1835 a concrete inlined instance (that is, as references to
1836 corresponding entries within the associated abstract instance
1840 The differences between the DWARF representation of a
1841 concrete out\dash of\dash line instance of a given subroutine and the
1842 representation of a concrete inlined instance of that same
1843 subroutine are as follows:
1845 \begin{enumerate}[1. ]
1846 \item The root entry for a concrete out\dash of\dash line instance
1847 of a given inlined subroutine has the same tag as does its
1848 associated (abstract) inlined subroutine entry (that is, tag
1849 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1851 \item The root entry for a concrete out\dash of\dash line instance tree
1852 is normally owned by the same parent entry that also owns
1853 the root entry of the associated abstract instance. However,
1854 it is not required that the abstract and out\dash of\dash line instance
1855 trees be owned by the same parent entry.
1859 \subsubsection{Nested Inlined Subroutines}
1860 \label{nestedinlinedsubroutines}
1861 Some languages and compilers may permit the logical nesting of
1862 a subroutine within another subroutine, and may permit either
1863 the outer or the nested subroutine, or both, to be inlined.
1865 For a non\dash inlined subroutine nested within an inlined
1866 subroutine, the nested subroutine is described normally in
1867 both the abstract and concrete inlined instance trees for
1868 the outer subroutine. All rules pertaining to the abstract
1869 and concrete instance trees for the outer subroutine apply
1870 also to the abstract and concrete instance entries for the
1874 For an inlined subroutine nested within another inlined
1875 subroutine, the following rules apply to their abstract and
1876 \addtoindexx{abstract instance!nested}
1877 \addtoindexx{concrete instance!nested}
1878 concrete instance trees:
1880 \begin{enumerate}[1. ]
1881 \item The abstract instance tree for the nested subroutine is
1882 described within the abstract instance tree for the outer
1883 subroutine according to the rules in
1884 Section \refersec{chap:abstractinstances}, and
1885 without regard to the fact that it is within an outer abstract
1888 \item Any abstract instance tree for a nested subroutine is
1889 always omitted within the concrete instance tree for an
1892 \item A concrete instance tree for a nested subroutine is
1893 always omitted within the abstract instance tree for an
1896 \item The concrete instance tree for any inlined or
1897 \addtoindexx{out-of-line instance}
1899 \addtoindexx{out-of-line instance|see{\textit{also} concrete out-of-line instance}}
1900 expansion of the nested subroutine is described within a
1901 concrete instance tree for the outer subroutine according
1903 Sections \refersec{chap:concreteinlinedinstances} or
1904 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1906 and without regard to the fact that it is within an outer
1907 concrete instance tree.
1910 See Appendix \refersec{app:inliningexamples}
1911 for discussion and examples.
1913 \subsection{Trampolines}
1914 \label{chap:trampolines}
1916 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1917 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1918 an intermediary in making a call to another subroutine. It may
1919 adjust parameters and/or the result (if any) as appropriate
1920 to the combined calling and called execution contexts.}
1922 A trampoline is represented by a debugging information entry
1923 \addtoindexx{trampoline (subprogram) entry}
1924 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1926 \addtoindexx{trampoline attribute}
1927 a \DWATtrampoline{} attribute.
1929 attribute indicates the target subroutine of the trampoline,
1930 that is, the subroutine to which the trampoline passes
1931 control. (A trampoline entry may but need not also have a
1932 \DWATartificial{} attribute.)
1935 The value of the trampoline attribute may be represented
1936 using any of the following forms, which are listed in order
1940 \item If the value is of class \CLASSreference{}, then the value
1941 specifies the debugging information entry of the target
1944 \item If the value is of class \CLASSaddress{}, then the value is
1945 the relocated address of the target subprogram.
1948 \item If the value is of class \CLASSstring{}, then the value is the
1949 (possibly mangled) \addtoindexx{mangled names}
1950 name of the target subprogram.
1952 \item If the value is of class \CLASSflag, then the value true
1953 indicates that the containing subroutine is a trampoline but
1954 that the target subroutine is not known.
1958 The target subprogram may itself be a trampoline. (A sequence
1959 of trampolines necessarily ends with a non\dash trampoline
1962 \textit{In \addtoindex{C++}, trampolines may be used to implement
1963 derived virtual member functions; such trampolines typically
1965 \texttt{this} parameter\index{this parameter@\texttt{this} parameter}
1966 in the course of passing control.
1967 Other languages and environments may use trampolines in a manner
1968 sometimes known as transfer functions or transfer vectors.}
1970 \textit{Trampolines may sometimes pass control to the target
1971 subprogram using a branch or jump instruction instead of a
1972 call instruction, thereby leaving no trace of their existence
1973 in the subsequent execution context. }
1975 \textit{This attribute helps make it feasible for a debugger to arrange
1976 that stepping into a trampoline or setting a breakpoint in
1977 a trampoline will result in stepping into or setting the
1978 breakpoint in the target subroutine instead. This helps to
1979 hide the compiler generated subprogram from the user. }
1981 \textit{If the target subroutine is not known, a debugger may choose
1982 to repeatedly step until control arrives in a new subroutine
1983 which can be assumed to be the target subroutine. }
1985 \subsection{Call Site Entries}
1986 \label{chap:callsiteentries}
1988 A call site entry provides a way to represent the static or dynamic
1989 call graph of a program in the debugging information. It also provides
1990 information about how parameters are passed so that they may be more
1991 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
1992 call site entries can be also useful for computing values of variables
1993 and expressions where some value is no longer present in the current
1994 subroutine's registers or local stack frame, but it is known that the
1995 values are equal to some parameter passed to the function.
1996 The consumer can then use unwind
1997 information to find the caller and in the call site information sometimes
1998 find how to compute the value passed in a particular parameter.}
2000 A call site is represented by a debugging information entry with the tag
2001 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
2002 debugging information entry representing the scope within which the
2003 call is present in the source program.
2005 \textit{A scope entry (for example, for a lexical block) that would not
2006 otherwise be present in the debugging information of a subroutine
2007 need not be introduced solely to represent the immediately containing scope
2008 of a call. The call site entry is owned by the innermost scope entry that
2011 A source call can be compiled into different types of machine code:
2014 A \textit{normal call} uses a call-like instruction which transfers control to the start
2015 of some subprogram and leaves the call site location address somewhere where
2016 unwind information can find it.
2018 A \textit{tail call} uses a jump-like instruction which
2019 transfers control to the start of some subprogram, but the call site location
2020 address is not preserved (and thus not available using the unwind information).
2022 A \textit{tail recursion call} is a call
2023 to the current subroutine which is compiled as a loop into the middle of the
2027 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2028 where at least one instruction has the location of the inlined subprogram
2029 or any of its blocks or inlined subprograms.
2033 There are also different types of \doublequote{optimized out} calls:
2036 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2037 has not been emitted (such as, for example, the call to \texttt{foo} in
2038 \texttt{if (0) foo();}).
2040 An \textit{optimized out inline call}
2041 is a call to an inlined subprogram which either did not expand to any instructions
2042 or only parts of instructions belong to it and for debug information purposes those
2043 instructions are given a location in the caller.
2046 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2047 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2048 (see Section \refersec{chap:inlinedsubroutines}).
2050 The call site entry has a
2051 \DWATcallreturnpcNAME{}
2052 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2053 which is the return address after the call.
2054 The value of this attribute corresponds to the return address computed by
2055 call frame information in the called subprogram
2056 (see Section \refersec{datarep:callframeinformation}).
2058 \textit{On many architectures the return address is the address immediately following the
2059 call instruction, but on architectures with delay slots it might
2060 be an address after the delay slot of the call.}
2062 The call site entry may have a
2064 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2065 address of the call instruction.
2067 If the call site entry corresponds to a tail call, it has the
2068 \DWATcalltailcallNAME{}
2069 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2070 which is a \CLASSflag.
2072 The call site entry may have a
2073 \DWATcalloriginNAME{}
2074 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2075 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2076 known it is a reference to the called subprogram's debugging
2077 information entry. For indirect calls it may be a reference to a
2078 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2079 the subroutine pointer that is called.
2082 The call site may have a
2083 \DWATcalltargetNAME{}
2084 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2085 a DWARF expression. For indirect calls or jumps where it is unknown at
2086 compile time which subprogram will be called the expression computes the
2087 address of the subprogram that will be called. The DWARF expression should
2088 not use register or memory locations that might be clobbered by the call.
2091 The call site entry may have a
2092 \DWATcalltargetclobberedNAME{}
2093 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2094 which is a DWARF expression. For indirect calls or jumps where the
2095 address is not computable without use of registers or memory locations that
2096 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2097 attribute is used instead of the \DWATcalltarget{} attribute.
2099 The call site entry may have a \DWATtypeNAME{}
2100 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2101 referencing a debugging information entry for the type of the called function.
2102 When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.
2104 The call site entry may have
2105 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2106 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2107 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2108 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2109 each of whose value is an integer constant.
2110 These attributes represent the source file, source line number, and source
2111 column number, respectively, of the first character of the call statement or
2112 expression. The call file, call line, and call column attributes are
2113 interpreted in the same way as the declaration file, declaration
2114 line, and declaration column attributes, respectively
2115 (see Section \refersec{chap:declarationcoordinates}).
2117 \textit{The call file, call line and call column coordinates do not describe the
2118 coordinates of the subroutine declaration that was called, rather they describe
2119 the coordinates of the call.}
2121 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2122 entries\index{call site parameter entry} representing the parameters passed to the call.
2123 Each such entry has a \DWATlocation{} attribute which is a location expression.
2124 This location expression describes where the parameter is passed
2125 (usually either some register, or a memory location expressible as the
2126 contents of the stack register plus some offset).
2128 Each \DWTAGcallsiteparameter{} entry may have a
2129 \DWATcallvalueNAME{}
2130 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2131 which is a DWARF expression. This expression computes the value
2132 passed for that parameter. The expression should not use registers or memory
2133 locations that might be clobbered by the call, as it might be evaluated after
2134 unwinding from the called function back to the caller. If it is not
2135 possible to avoid registers or memory locations that might be clobbered by
2136 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2139 \textit{The reason for the restriction is that the value of the parameter may be
2140 needed in the middle of the callee, where the call clobbered registers or
2141 memory might be already clobbered, and if the consumer was not assured by
2142 the producer it can safely use those values, the consumer could not safely
2143 use the values at all.}
2145 For parameters passed by reference, where the code passes a pointer to
2146 a location which contains the parameter, or for reference type parameters
2147 the \DWTAGcallsiteparameter{} entry may also have
2148 \DWATcalldatalocationNAME{}
2149 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2150 whose value is a location expression and a
2151 \DWATcalldatavalueNAME{}
2152 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2153 whose value is a DWARF expression. The \DWATcalldatalocationNAME{} attribute
2154 describes where the referenced value lives during the call. If it is just
2155 \DWOPpushobjectaddress{}, it may be left out. The
2156 \DWATcalldatavalueNAME{} attribute describes the value in that location.
2157 The expression should not use registers or memory
2158 locations that might be clobbered by the call, as it might be evaluated after
2159 unwinding from the called function back to the caller.
2162 Each call site parameter entry may also have a
2163 \DWATcallparameter{}
2164 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2165 which contains a reference to a \DWTAGformalparameter{} entry,
2166 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2167 attribute describing the parameter's name.
2171 \section{Lexical Block Entries}
2172 \label{chap:lexicalblockentries}
2175 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2177 \addtoindexx{lexical block}
2178 a bracketed sequence of source statements
2179 that may contain any number of declarations. In some languages
2180 (including \addtoindex{C} and \addtoindex{C++}),
2181 \nolink{blocks} can be nested within other
2182 \nolink{blocks} to any depth.}
2184 % We do not need to link to the preceding paragraph.
2185 A lexical \nolink{block} is represented by a debugging information
2187 tag \DWTAGlexicalblockTARG.
2189 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2191 either a \DWATlowpc{} and
2192 \DWAThighpc{} pair of
2194 \addtoindexx{high PC attribute}
2196 \addtoindexx{low PC attribute}
2198 \DWATranges{} attribute
2199 \addtoindexx{ranges attribute}
2200 whose values encode the contiguous or non-contiguous address
2201 ranges, respectively, of the machine instructions generated
2202 for the lexical \nolink{block}
2203 (see Section \refersec{chap:codeaddressesandranges}).
2206 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2207 lexical block entry may also have
2208 \addtoindexx{entry pc attribute!for lexical block}
2210 \DWATentrypc{} attribute
2211 whose value is the address of the first executable instruction
2212 of the lexical block (see
2213 Section \refersec{chap:entryaddress}).
2215 If a name has been given to the
2216 lexical \nolink{block}
2218 program, then the corresponding
2219 lexical \nolink{block} entry has a
2220 \DWATname{} attribute whose
2221 \addtoindexx{name attribute}
2222 value is a null\dash terminated string
2223 containing the name of the lexical \nolink{block}
2227 \textit{This is not the same as a \addtoindex{C} or
2228 \addtoindex{C++} label (see below).}
2230 The lexical \nolink{block} entry owns
2231 debugging information entries that
2232 describe the declarations within that lexical \nolink{block}.
2234 one such debugging information entry for each local declaration
2235 of an identifier or inner lexical \nolink{block}.
2238 \section{Label Entries}
2239 \label{chap:labelentries}
2240 \textit{A label is a way of identifying a source statement. A labeled
2241 statement is usually the target of one or more \doublequote{go to}
2246 A label is represented by a debugging information entry with
2247 \addtoindexx{label entry}
2249 tag \DWTAGlabelTARG.
2250 The entry for a label should be owned by
2251 the debugging information entry representing the scope within
2252 which the name of the label could be legally referenced within
2255 The label entry has a \DWATlowpc{} attribute whose value
2256 is the relocated address of the first machine instruction
2257 generated for the statement identified by the label in
2258 the source program. The label entry also has a
2259 \DWATname{} attribute
2260 \addtoindexx{name attribute}
2261 whose value is a null-terminated string containing
2262 the name of the label as it appears in the source program.
2265 \section{With Statement Entries}
2266 \label{chap:withstatemententries}
2268 \textit{Both \addtoindex{Pascal} and
2269 \addtoindexx{Modula-2}
2270 Modula\dash 2 support the concept of a \doublequote{with}
2271 statement. The with statement specifies a sequence of
2272 executable statements within which the fields of a record
2273 variable may be referenced, unqualified by the name of the
2276 A with statement is represented by a
2277 \addtoindexi{debugging information entry}{with statement entry}
2278 with the tag \DWTAGwithstmtTARG.
2280 A with statement entry may have either a
2282 \DWAThighpc{} pair of attributes
2283 \addtoindexx{high PC attribute}
2285 \addtoindexx{low PC attribute}
2286 a \DWATranges{} attribute
2287 \addtoindexx{ranges attribute}
2288 whose values encode the contiguous or non\dash contiguous address
2289 ranges, respectively, of the machine instructions generated
2290 for the with statement
2291 (see Section \refersec{chap:codeaddressesandranges}).
2294 \hypertarget{chap:DWATentrypcofwithstmt}{}
2295 with statement entry may also have
2296 \addtoindexx{entry pc attribute!for with statement}
2298 \DWATentrypc{} attribute
2299 whose value is the address of the first executable instruction
2300 of the with statement (see
2301 Section \refersec{chap:entryaddress}).
2304 The with statement entry has
2305 \addtoindexx{type attribute}
2306 a \DWATtype{} attribute, denoting
2307 the type of record whose fields may be referenced without full
2308 qualification within the body of the statement. It also has
2309 \addtoindexx{location attribute}
2310 a \DWATlocation{} attribute, describing how to find the base
2311 address of the record object referenced within the body of
2315 \section{Try and Catch Block Entries}
2316 \label{chap:tryandcatchblockentries}
2317 \livetargi{chap:tryandcatchblockentries}{}
2318 \textit{In \addtoindex{C++}, a \livelink{chap:lexicalblock}{lexical block} may be
2319 designated as a \doublequote{catch \nolink{block}.}
2320 A catch \nolink{block} is an exception handler that
2321 handles exceptions thrown by an immediately preceding
2322 \doublequote{try \nolink{block}.}
2323 A catch \nolink{block}
2324 designates the type of the exception that it can handle.}
2326 A \livetargi{chap:tryblock}{try block}{try block} is represented
2327 by a debugging information entry
2328 \addtoindexx{try block entry}
2329 with the tag \DWTAGtryblockTARG.
2330 A \livetargi{chap:catchblock}{catch block} is represented by
2331 a debugging information entry
2332 \addtoindexx{catch block entry}
2333 with the tag \DWTAGcatchblockTARG.
2335 % nolink as we have links just above and do not have a combo link for both
2336 Both try and catch \nolink{block} entries may have either a
2338 \DWAThighpc{} pair of attributes
2339 \addtoindexx{high PC attribute}
2341 \addtoindexx{low PC attribute}
2343 \DWATranges{} attribute
2344 \addtoindexx{ranges attribute}
2345 whose values encode the contiguous
2346 or non\dash contiguous address ranges, respectively, of the
2347 machine instructions generated for the \nolink{block}
2348 (see Section \refersec{chap:codeaddressesandranges}).
2350 \hypertarget{chap:DWATentrypcoftryblock}{}
2351 \hypertarget{chap:DWATentrypcofcatchblock}{}
2352 A try or catch block entry may also have
2353 \addtoindexx{entry pc attribute!for try block}
2354 \addtoindexx{entry pc attribute!for catch block}
2356 \DWATentrypc{} attribute
2357 whose value is the address of the first executable instruction
2358 of the try or catch block
2359 (see Section \refersec{chap:entryaddress}).
2361 Catch \nolink{block} entries have at least one child entry,
2362 an entry representing the type of exception accepted by
2363 that catch \nolink{block}.
2364 This child entry has one of the tags
2365 \DWTAGformalparameter{}\addtoindexx{formal parameter entry!in catch block}
2367 \DWTAGunspecifiedparameters,\addtoindexx{unspecified parameters entry!in catch block}
2368 and will have the same form as other parameter entries.
2370 The siblings immediately following a try \nolink{block}
2371 entry are its corresponding catch \nolink{block} entries.