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.
48 In a simple normal compilation, a single compilation unit with
50 \DWTAGcompileunit{} represents a complete object file
52 \DWTAGpartialunit{} is not used.
54 employing the DWARF space compression and duplicate elimination
56 Appendix \refersec{app:usingcompilationunits},
57 multiple compilation units using
59 \DWTAGcompileunit{} and/or
60 \DWTAGpartialunit{} are
61 used to represent portions of an object file.
63 \textit{A normal compilation unit typically represents the text and
64 data contributed to an executable by a single relocatable
65 object file. It may be derived from several source files,
66 including pre\dash processed \doublequote{include files.}
67 A \addtoindex{partial compilation unit} typically represents a part of the text
68 and data of a relocatable object file, in a manner that can
69 potentially be shared with the results of other compilations
70 to save space. It may be derived from an \doublequote{include file,}
71 template instantiation, or other implementation\dash dependent
72 portion of a compilation. A normal compilation unit can also
73 function in a manner similar to a partial compilation unit
76 A compilation unit entry owns debugging information
77 entries that represent all or part of the declarations
78 made in the corresponding compilation. In the case of a
79 partial compilation unit, the containing scope of its owned
80 declarations is indicated by imported unit entries in one
81 or more other compilation unit entries that refer to that
82 partial compilation unit (see
83 Section \refersec{chap:importedunitentries}).
86 Compilation unit entries may have the following
88 \begin{enumerate}[1. ]
89 \item Either a \DWATlowpc{} and
91 \addtoindexx{high PC attribute}
93 \addtoindexx{low PC attribute}
95 \addtoindexx{ranges attribute}
97 \DWATranges{} attribute
98 \addtoindexx{ranges attribute}
100 \addtoindexx{discontiguous address ranges|see{non-contiguous address ranges}}
103 non\dash contiguous address ranges, respectively,
104 of the machine instructions generated for the compilation
105 unit (see Section \refersec{chap:codeaddressesandranges}).
107 A \DWATlowpc{} attribute
111 \addtoindexx{ranges attribute}
113 \DWATranges{} to specify the
114 \addtoindexx{ranges attribute}
115 default base address for use in
116 \addtoindexx{location list}
117 location lists (see Section
118 \refersec{chap:locationlists}) and range lists
119 \addtoindexx{range list}
120 (see Section \refersec{chap:noncontiguousaddressranges}).
122 \item A \DWATname{} attribute
123 \addtoindexx{name attribute}
124 whose value is a null\dash terminated
126 \hypertarget{chap:DWATnamepathnameofcompilationsource}{}
127 containing the full or relative path name of the primary
128 source file from which the compilation unit was derived.
130 \item A \DWATlanguage{} attribute
131 \addtoindexx{language attribute}
132 whose constant value is an
133 \hypertarget{chap:DWATlanguageprogramminglanguage}{}
135 \addtoindexx{language attribute}
136 indicating the source language of the compilation
137 unit. The set of language names and their meanings are given
138 in Table \refersec{tab:languagenames}.
141 \setlength{\extrarowheight}{0.1cm}
142 \begin{longtable}{l|l}
143 \caption{Language names} \label{tab:languagenames} \\
144 \hline \bfseries Language name & \bfseries Meaning \\ \hline
146 \bfseries Language name & \bfseries Meaning \\ \hline
148 \hline \emph{Continued on next page}
151 \addtoindexx{ISO-defined language names}
152 \DWLANGAdaeightythreeTARG{} \dag & ISO Ada:1983 \addtoindexx{Ada:1983 (ISO)} \\
153 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada:1995 (ISO)} \\
154 \DWLANGCTARG & Non-standardized C, such as K\&R \addtoindexx{C!non-standard}\\
155 \DWLANGCeightynineTARG & ISO C:1989 \addtoindexx{C:1989 (ISO)} \\
156 \DWLANGCninetynineTARG & ISO C:1999 \addtoindexx{C:1999 (ISO)} \\
157 \DWLANGCelevenTARG & ISO C:2011 \addtoindexx{C:2011 (ISO)} \\
158 \DWLANGCplusplusTARG & ISO C++:1998 \addtoindexx{C++:1998 (ISO)} \\
159 \DWLANGCpluspluszerothreeTARG & ISO C++:2003 \addtoindexx{C++:2003 (ISO)} \\
160 \DWLANGCpluspluselevenTARG & ISO C++:2011 \addtoindexx{C++:2011 (ISO)} \\
161 \DWLANGCplusplusfourteenTARG & ISO C++:2014 \addtoindexx{C++:2014 (ISO)} \\
162 \DWLANGCobolseventyfourTARG & ISO COBOL:1974 \addtoindexx{COBOL:1974 (ISO)} \\
163 \DWLANGCoboleightyfiveTARG & ISO COBOL:1985 \addtoindexx{COBOL:1985 (ISO)} \\
164 \DWLANGDTARG{}~\dag & D \addtoindexx{D language} \\
165 \DWLANGDylanTARG~\dag & Dylan \addtoindexx{Dylan} \\
166 \DWLANGFortranseventysevenTARG & ISO FORTRAN:1977 \addtoindexx{FORTRAN:1977 (ISO)} \\
167 \DWLANGFortranninetyTARG & ISO Fortran:1990 \addtoindexx{Fortran:1990 (ISO)} \\
168 \DWLANGFortranninetyfiveTARG & ISO Fortran:1995 \addtoindexx{Fortran:1995 (ISO)} \\
169 \DWLANGFortranzerothreeTARG & ISO Fortran:2004 \addtoindexx{Fortran:2004 (ISO)} \\
170 \DWLANGFortranzeroeightTARG & ISO Fortran:2010 \addtoindexx{Fortran:2010 (ISO)} \\
171 \DWLANGGoTARG{}~\dag & \addtoindex{Go} \\
172 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell} \\
173 \DWLANGJavaTARG{} & \addtoindex{Java}\\
174 \DWLANGJuliaTARG{}~\dag & \addtoindex{Julia} \\
175 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
176 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
177 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
178 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
179 \DWLANGOCamlTARG{}~\dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
180 \DWLANGOpenCLTARG{}~\dag & \addtoindex{OpenCL} \\
181 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
182 \DWLANGPLITARG{}~\dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
183 \DWLANGPythonTARG{}~\dag & \addtoindex{Python} \\
184 \DWLANGRustTARG{}~\dag & \addtoindex{Rust} \\
185 \DWLANGSwiftTARG{}~\dag & \addtoindex{Swift} \\
186 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
187 \index{Unified Parallel C|see{UPC}} \\
189 \dag \ \ \textit{Support for these languages is limited}& \\
194 \item A \DWATstmtlist{}\hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
195 attribute whose value is
196 \addtoindexx{statement list attribute}
198 \addtoindexx{section offset!in statement list attribute}
199 section offset to the line number information for this compilation
202 This information is placed in a separate object file
203 section from the debugging information entries themselves. The
204 value of the statement list attribute is the offset in the
205 \dotdebugline{} section of the first byte of the line number
206 information for this compilation unit
207 (see Section \refersec{chap:linenumberinformation}).
209 \item A \DWATmacros{}\hypertarget{chap:DWATmacrosmacroinformation}{}
211 \addtoindexx{macro information attribute}
213 \addtoindexx{section offset!in macro information attribute}
214 section offset to the macro information for this compilation unit.
216 This information is placed in a separate object file section
217 from the debugging information entries themselves. The
218 value of the macro information attribute is the offset in
219 the \dotdebugmacro{} section of the first byte of the macro
220 information for this compilation unit
221 (see Section \refersec{chap:macroinformation}).
223 \textit{The \DWATmacros{} attribute is new in \DWARFVersionV,
225 \DWATmacroinfo{} attribute of earlier DWARF versions.
226 \livetarg{chap:DWATmacroinfomacroinformation}{}
227 While \DWATmacros{} and \DWATmacroinfo{} attributes cannot both occur in the same
228 compilation unit, both may be found in the set of units that make up an executable
229 or shared object. The two attributes have distinct encodings to facilitate such
236 \hypertarget{chap:DWATcompdircompilationdirectory}{}
238 null\dash terminated string containing the current working directory
239 of the compilation command that produced this compilation
240 unit in whatever form makes sense for the host system.
242 \item A \DWATproducer{} attribute
243 \addtoindexx{producer attribute}
244 whose value is a null\dash
245 terminated string containing information about the compiler
246 \hypertarget{chap:DWATproducercompileridentification}{}
247 that produced the compilation unit. The actual contents of
248 the string will be specific to each producer, but should
249 begin with the name of the compiler vendor or some other
250 identifying character sequence that should avoid confusion
251 with other producer values.
254 \item A \DWATidentifiercase{}
256 \addtoindexx{identifier case attribute}
258 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
259 constant value is a code describing the treatment
260 of identifiers within this compilation unit. The
261 set of identifier case codes is given in
262 Table \refersec{tab:identifiercasecodes}.
264 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
265 \DWIDcasesensitive{} \\
268 \DWIDcaseinsensitive{} \\
269 \end{simplenametable}
271 \DWIDcasesensitiveTARG{} is the default for all compilation units
272 that do not have this attribute. It indicates that names given
273 as the values of \DWATname{} attributes
274 \addtoindexx{name attribute}
275 in debugging information
276 entries for the compilation unit reflect the names as they
277 appear in the source program. The debugger should be sensitive
278 to the case of \addtoindex{identifier names} when doing identifier
282 \DWIDupcaseTARG{} means that the
283 producer of the debugging
284 information for this compilation unit converted all source
285 names to upper case. The values of the name attributes may not
286 reflect the names as they appear in the source program. The
287 debugger should convert all names to upper case when doing
290 \DWIDdowncaseTARG{} means that
291 the producer of the debugging
292 information for this compilation unit converted all source
293 names to lower case. The values of the name attributes may not
294 reflect the names as they appear in the source program. The
295 debugger should convert all names to lower case when doing
299 \DWIDcaseinsensitiveTARG{} means that the values of the name
300 attributes reflect the names as they appear in the source
301 program but that a case insensitive lookup should be used to
305 \item A \DWATbasetypes{} attribute whose value is a
306 \livelink{chap:classreference}{reference}.
309 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
311 \addtoindexx{base types attribute}
312 points to a debugging information entry
313 representing another compilation unit. It may be used
314 to specify the compilation unit containing the base type
315 entries used by entries in the current compilation unit
316 (see Section \refersec{chap:basetypeentries}).
319 This attribute provides a consumer a way to find the definition
320 of base types for a compilation unit that does not itself
321 contain such definitions. This allows a consumer, for example,
322 to interpret a type conversion to a base type
323 % getting this link target at the right spot is tricky.
324 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
327 \item A \DWATuseUTFeight{} attribute,
328 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
329 which is a \livelink{chap:classflag}{flag} whose
330 presence indicates that all strings (such as the names of
331 declared entities in the source program, or filenames in the line number table)
332 are represented using the UTF\dash 8 representation.
335 \item A \DWATmainsubprogram{} attribute, which is a \livelink{chap:classflag}{flag}
336 \addtoindexx{main subprogram attribute}
337 whose presence indicates
338 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
339 that the compilation unit contains a
340 subprogram that has been identified as the starting function
341 of the program. If more than one compilation unit contains
342 this \nolink{flag}, any one of them may contain the starting function.
344 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
346 to specify and provide a user\dash specified name for the main
347 subroutine of a program.
348 \addtoindex{C} uses the name \doublequote{main} to identify
349 the main subprogram of a program. Some other languages provide
350 similar or other means to identify the main subprogram of
351 a program. The \DWATmainsubprogram{} attribute may also be used to
352 identify such subprograms (see
353 Section \refersec{chap:generalsubroutineandentrypointinformation}).}
355 \item A \DWATentrypc{} attribute whose value is the address of the first
356 \hypertarget{chap:DWATentrypcofcompileunit}{}
357 \hypertarget{chap:DWATentrypcofpartialunit}{}
358 \addtoindexx{entry pc attribute!for normal compilation unit}
359 \addtoindexx{entry pc attribute!for partial compilation unit}
360 executable instruction of the unit (see
361 Section \refersec{chap:entryaddress}).
363 \item A \DWATstroffsetsbaseNAME\addtoindexx{string offset base attribute}
364 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
365 attribute, whose value is a reference.
366 This attribute points to the first string
367 offset of the compilation unit's contribution to the
368 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
369 Indirect string references
370 (using \DWFORMstrx) within the compilation unit are
371 interpreted as indices relative to this base.
374 \item A \DWATaddrbaseNAME\addtoindexx{address table base attribute}
375 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
376 attribute, whose value is a reference.
377 This attribute points to the beginning of the compilation
378 unit's contribution to the \dotdebugaddr{} section.
379 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
380 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
381 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
382 interpreted as indices relative to this base.
385 \item A \DWATrangesbaseNAME\addtoindexx{ranges table base attribute}
386 \hypertarget{chap:DWATrangesbaseforrangelists}{}
387 attribute, whose value is a reference.
388 This attribute points to the beginning of the compilation
389 unit's contribution to the \dotdebugranges{} section.
390 References to range lists (using \DWFORMsecoffset)
391 within the compilation unit are
392 interpreted as offsets relative to this base.
396 The base address of a compilation unit is defined as the
397 value of the \DWATlowpc{} attribute, if present; otherwise,
398 it is undefined. If the base address is undefined, then any
399 DWARF entry or structure defined in terms of the base address
400 of that compilation unit is not valid.
402 \subsection{Skeleton Compilation Unit Entries}
403 \label{chap:skeletoncompilationunitentries}
404 \addtoindexx{compilation unit!skeleton}
405 \addtoindexx{skeleton compilation unit}
406 When generating a split DWARF object (see
407 Section \refersec{datarep:splitdwarfobjects}), the
408 compilation unit in the \dotdebuginfo{} section is a "skeleton"
409 compilation unit, which contains only a subset of the
410 attributes of a full normal or partial compilation unit. In general,
411 it contains those attributes that are necessary for the consumer
412 to locate the DWARF object where the full compilation unit
413 can be found, and for the consumer to interpret references to
414 addresses in the program.
416 A skeleton compilation unit has no
417 children, and may have the following attributes
418 (including at least \DWATdwoname{} and \DWATdwoid{}):
419 \begin{enumerate}[1. ]
422 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
423 or a \DWATranges{} attribute (the same as for regular
424 compilation unit entries).
427 A \DWATstmtlist{} attribute (the same as for regular
428 compilation unit entries).
431 A \DWATcompdir{} attribute (the same as for regular
432 compilation unit entries).
435 \livetarg{chap:DWATdwonameforunit}{}
436 A \DWATdwonameNAME{} attribute whose value is a
437 null-terminated string containing the full or relative
438 path name of the DWARF object file that contains the full
442 \livetarg{chap:DWATdwoidforunit}{}
443 A \DWATdwoidNAME{} attribute whose value is an 8-byte
444 unsigned hash of the full compilation unit. This hash
445 value is computed by the method described in
446 Section \refersec{datarep:typesignaturecomputation}.
450 A \DWATuseUTFeight{} attribute (the same as for regular compilation unit
453 \textit{This attribute applies to strings referred to by the skeleton
454 compilation unit entry itself, and strings in the associated line
456 The representation for strings in the DWARF object file is determined
457 by the presence of a \DWATuseUTFeight{} attribute in the full compilation
461 A \DWATstroffsetsbase{} attribute, for indirect strings references
462 from the skeleton compilation unit (the same as for regular
463 compilation unit entries).
466 A \DWATaddrbase{} attribute (the same as for regular
467 compilation unit entries).
470 A \DWATrangesbase{} attribute (the same as for regular
471 compilation unit entries).
475 All other attributes of a compilation unit entry (described
476 in Section \refersec{chap:normalandpartialcompilationunitentries})
477 should be placed in the full compilation
478 unit entry in the \dotdebuginfodwo{} section of the split DWARF
479 object. The attributes provided by the skeleton compilation
480 unit entry do not need to be repeated in the full compilation
481 unit entry, except for \DWATdwoid, which should appear in
482 both entries so that the consumer can verify that it has
483 found the correct DWARF object.
486 \subsection{Type Unit Entries}
487 \label{chap:typeunitentries}
488 \addtoindexx{type unit}
489 \addtoindexx{type unit|see{\textit{also} compilation unit}}
490 \addtoindexx{compilation unit!\textit{see also} type unit}
491 An object file may contain any number of separate type
492 unit entries, each representing a single complete type
494 Each \addtoindex{type unit} must be uniquely identified by
495 a 64-bit signature, stored as part of the type unit, which
496 can be used to reference the type definition from debugging
497 information entries in other compilation units and type units.
499 A type unit is represented by a debugging information entry
500 with the tag \DWTAGtypeunitTARG.
501 A \addtoindex{type unit entry} owns debugging
502 information entries that represent the definition of a single
503 type, plus additional debugging information entries that may
504 be necessary to include as part of the definition of the type.
506 A type unit entry may have the following attributes:
507 \begin{enumerate}[1. ]
510 \DWATlanguage{} attribute,
512 \addtoindexx{language attribute}
513 constant value is an integer code indicating the source
514 language used to define the type. The set of language names
515 and their meanings are given in Table \refersec{tab:languagenames}.
518 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
519 attribute, whose value is a reference. This attribute points
520 to the first string offset of the type unit's contribution to
521 the \dotdebugstroffsets{} section. Indirect string references
522 (using \DWFORMstrx) within the type unit must be interpreted
523 as indices relative to this base.
525 \item A \DWATstmtlist{} attribute, whose
526 value is a section offset to a line number table for this
527 type unit. Because type units do not describe any code, they
528 do not actually need a line number table, but the line number
529 tables also contain a list of directories and file names that
530 may be referenced by the \DWATdeclfile{} attribute. In a
531 normal object file with a regular compilation unit entry, the
532 type unit entries can simply refer to the line number table
533 used by the compilation unit. In a split DWARF object file, where
534 the type units are located in a separate DWARF object file,
535 the \DWATstmtlist{} attribute refers to a "specialized"
536 line number table in the \dotdebuglinedwo{} section, which
537 contains only the list of directories and file names. All
538 type unit entries in a split DWARF object may (but are not
539 required to) refer to the same \addtoindex{specialized line number table}.
541 \item A \DWATuseUTFeight{} attribute, which is a flag
542 whose presence indicates that all strings referred to by this type
543 unit entry, its children, and its associated
544 \addtoindex{specialized line number table},
545 are represented using the UTF-8 representation.
549 A \addtoindex{type unit} entry for a given type T owns a debugging
550 information entry that represents a defining declaration
551 of type T. If the type is nested within enclosing types or
552 namespaces, the debugging information entry for T is nested
553 within debugging information entries describing its containers;
554 otherwise, T is a direct child of the type unit entry.
556 A type unit entry may also own additional debugging information
557 entries that represent declarations of additional types that
558 are referenced by type T and have not themselves been placed in
559 separate type units. Like T, if an additional type U is nested
560 within enclosing types or namespaces, the debugging information
561 entry for U is nested within entries describing its containers;
562 otherwise, U is a direct child of the type unit entry.
564 The containing entries for types T and U are declarations,
565 and the outermost containing entry for any given type T or
566 U is a direct child of the type unit entry. The containing
567 entries may be shared among the additional types and between
568 T and the additional types.
570 \textit{Types are not required to be placed in type units. In general,
571 only large types such as structure, class, enumeration, and
572 union types included from header files should be considered
573 for separate type units. Base types and other small types
574 are not usually worth the overhead of placement in separate
575 type units. Types that are unlikely to be replicated, such
576 as those defined in the main source file, are also better
577 left in the main compilation unit.}F
579 \section{Module, Namespace and Importing Entries}
580 \textit{Modules and namespaces provide a means to collect related
581 entities into a single entity and to manage the names of
584 \subsection{Module Entries}
585 \label{chap:moduleentries}
586 \textit{Several languages have the concept of a \doublequote{module.}
587 \addtoindexx{Modula-2}
588 A Modula\dash 2 definition module
589 \addtoindexx{Modula-2!definition module}
590 may be represented by a module
592 \addtoindex{declaration attribute}
593 (\DWATdeclaration). A
594 \addtoindex{Fortran 90} module
595 \addtoindexx{Fortran!module (Fortran 90)}
596 may also be represented by a module entry
597 (but no declaration attribute is warranted because \addtoindex{Fortran}
598 has no concept of a corresponding module body).}
600 A module is represented by a debugging information entry
602 tag \DWTAGmoduleTARG.
603 Module entries may own other
604 debugging information entries describing program entities
605 whose declaration scopes end at the end of the module itself.
607 If the module has a name, the module entry has a
608 \DWATname{} attribute
609 \addtoindexx{name attribute}
610 whose value is a null\dash terminated string containing
611 the module name as it appears in the source program.
613 The \addtoindex{module entry} may have either a
617 \addtoindexx{high PC attribute}
619 \addtoindexx{low PC attribute}
621 \DWATranges{} attribute
622 \addtoindexx{ranges attribute}
623 whose values encode the contiguous or non\dash contiguous address
624 ranges, respectively, of the machine instructions generated for
625 the module initialization code
626 (see Section \refersec{chap:codeaddressesandranges}).
627 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
629 \addtoindexx{entry pc attribute!for module initialization}
631 \DWATentrypc{} attribute whose value is the address of
632 the first executable instruction of that initialization code
633 (see Section \refersec{chap:entryaddress}).
636 \hypertarget{chap:DWATprioritymodulepriority}{}
637 the module has been assigned a priority, it may have
638 \addtoindexx{priority attribute}
640 \DWATpriority{} attribute.
641 The value of this attribute is a
642 reference to another debugging information entry describing
643 a variable with a constant value. The value of this variable
644 is the actual constant value of the module\textquoteright s priority,
645 represented as it would be on the target architecture.
647 \subsection{Namespace Entries}
648 \label{chap:namespaceentries}
649 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
650 \addtoindexx{namespace (C++)}
651 implement name hiding, so that names of unrelated things
652 do not accidentally clash in the
653 \addtoindex{global namespace} when an
654 application is linked together.}
656 A namespace is represented by a debugging information entry
658 tag \DWTAGnamespaceTARG.
659 A namespace extension is
660 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
662 \DWTAGnamespace{} entry
664 \addtoindexx{extension attribute}
667 attribute referring to the previous extension, or if there
668 is no previous extension, to the original
670 entry. A namespace extension entry does not need to duplicate
671 information in a previous extension entry of the namespace
672 nor need it duplicate information in the original namespace
673 entry. (Thus, for a namespace with a name,
674 a \DWATname{} attribute
675 \addtoindexx{name attribute}
676 need only be attached directly to the original
677 \DWTAGnamespace{} entry.)
680 Namespace and namespace extension entries may own
681 \addtoindexx{namespace extension entry}
683 \addtoindexx{namespace declaration entry}
684 debugging information entries describing program entities
685 whose declarations occur in the namespace.
687 \textit{For \addtoindex{C++}, such
688 owned program entities may be declarations,
689 including certain declarations that are also object or
690 function definitions.}
692 A namespace may have a
693 \DWATexportsymbolsNAME{}\livetarg{chap:DWATexportsymbolsofnamespace}{}
694 attribute\addtoindexx{export symbols attribute}
695 \addtoindexx{inline namespace|see{\textit{also} export symbols attribute}}
696 which indicates that all member names defined within the
697 namespace may be referenced as if they were defined within
698 the containing namespace.
700 \textit{This may be used to describe an \addtoindex{inline namespace} in \addtoindex{C++}}.
702 If a type, variable, or function declared in a namespace is
703 defined outside of the body of the namespace declaration,
704 that type, variable, or function definition entry has a
705 \DWATspecification{} attribute
706 \addtoindexx{specification attribute}
707 whose value is a \livelink{chap:classreference}{reference} to the
708 debugging information entry representing the declaration of
709 the type, variable or function. Type, variable, or function
711 \DWATspecification{} attribute
712 \addtoindexx{specification attribute}
714 to duplicate information provided by the declaration entry
715 referenced by the specification attribute.
717 \textit{The \addtoindex{C++} \addtoindex{global namespace}
719 \addtoindexx{global namespace|see{namespace (C++), global}}
721 \addtoindexx{namespace (C++)!global}
723 \texttt{::f}, for example) is not explicitly represented in
724 DWARF with a namespace entry (thus mirroring the situation
725 in \addtoindex{C++} source).
726 Global items may be simply declared with no
727 reference to a namespace.}
729 \textit{The \addtoindex{C++}
730 compilation unit specific \doublequote{unnamed namespace} may
731 \addtoindexx{namespace (C++)!unnamed}
732 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
733 be represented by a namespace entry with no name attribute in
734 the original namespace declaration entry (and therefore no name
735 attribute in any namespace extension entry of this namespace).
738 \textit{A compiler emitting namespace information may choose to
739 explicitly represent namespace extensions, or to represent the
740 final namespace declaration of a compilation unit; this is a
741 quality\dash of\dash implementation issue and no specific requirements
742 are given here. If only the final namespace is represented,
743 \addtoindexx{namespace (C++)!using declaration}
744 it is impossible for a debugger to interpret using declaration
745 references in exactly the manner defined by the
746 \addtoindex{C++} language.
749 \textit{Emitting all namespace declaration information in all
750 compilation units can result in a significant increase in the
751 size of the debug information and significant duplication of
752 information across compilation units.
753 The \addtoindex{C++} namespace std,
755 \addtoindexx{namespace (C++)!std}
756 is large and will probably be referenced in
757 every \addtoindex{C++} compilation unit.
760 \textit{For \addtoindex{C++} namespace examples,
761 see Appendix \refersec{app:namespaceexamples}.
766 \subsection{Imported (or Renamed) Declaration Entries}
767 \label{chap:importedorrenameddeclarationentries}
768 \textit{Some languages support the concept of importing into or making
769 accessible in a given unit declarations made in a different
770 module or scope. An imported declaration may sometimes be
775 imported declaration is represented by one or
776 \addtoindexx{imported declaration entry}
777 more debugging information entries with the
778 tag \DWTAGimporteddeclarationTARG.
780 \hypertarget{chap:DWATimportimporteddeclaration}{}
782 is imported, there is one imported declaration entry for
784 \addtoindexx{import attribute}
785 Each imported declaration entry has a
786 \DWATimport{} attribute,
787 whose value is a \livelink{chap:classreference}{reference} to the
788 debugging information entry representing the declaration that
791 An imported declaration may also have a
794 \addtoindexx{name attribute}
795 whose value is a null\dash terminated string containing the
796 name, as it appears in the source program, by which the
797 imported entity is to be known in the context of the imported
798 declaration entry (which may be different than the name of
799 the entity being imported). If no name is present, then the
800 name by which the entity is to be known is the same as the
801 name of the entity being imported.
803 An imported declaration entry with a name attribute may be
804 used as a general means to rename or provide an alias for
805 \addtoindexx{alias declaration|see{imported declaration entry}}
806 an entity, regardless of the context in which the importing
807 declaration or the imported entity occurs.
809 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
810 \hypertarget{chap:DWATimportnamespacealias}{}
812 \addtoindexx{namespace (C++)!alias}
813 with a name attribute whose value is
814 a null\dash terminated string containing the alias name as it
815 appears in the source program and an import attribute whose
816 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
817 namespace extension entry.
820 \textit{A \addtoindex{C++} using declaration may be represented by one or more
821 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
823 \addtoindexx{namespace (C++)!using declaration}
824 declaration entries. When the using declaration
825 refers to an overloaded function, there is one imported
826 declaration entry corresponding to each overloading. Each
827 imported declaration entry has no name attribute but it does
828 have an import attribute that refers to the entry for the
829 entity being imported. (\addtoindex{C++}
830 provides no means to \doublequote{rename}
831 an imported entity, other than a namespace).
834 \textit{A \addtoindex{Fortran} use statement
835 \addtoindexx{Fortran!use statement}
836 \addtoindexx{use statement|see {Fortran, use statement}}
837 with an \doublequote{only list} may be
838 represented by a series of imported declaration entries,
839 one (or more) for each entity that is imported. An entity
840 \addtoindexx{renamed declaration|see{imported declaration entry}}
841 that is renamed in the importing context may be represented
842 by an imported declaration entry with a name attribute that
843 specifies the new local name.
846 \subsection{Imported Module Entries}
847 \label{chap:importedmoduleentries}
849 \textit{Some languages support the concept of importing into or making
850 accessible in a given unit all of the declarations contained
851 within a separate module or namespace.
854 An imported module declaration is represented by a debugging
855 information entry with
856 \addtoindexx{imported module attribute}
858 \addtoindexx{imported module entry}
859 tag \DWTAGimportedmoduleTARG.
861 imported module entry contains a
862 \DWATimport{} attribute
863 \addtoindexx{import attribute}
864 whose value is a \livelink{chap:classreference}{reference}
865 to the module or namespace entry
866 containing the definition and/or declaration entries for
867 the entities that are to be imported into the context of the
868 imported module entry.
870 An imported module declaration may own a set of imported
871 declaration entries, each of which refers to an entry in the
872 module whose corresponding entity is to be known in the context
873 of the imported module declaration by a name other than its
874 name in that module. Any entity in the module that is not
875 renamed in this way is known in the context of the imported
876 module entry by the same name as it is declared in the module.
878 \textit{A \addtoindex{C++} using directive
879 \addtoindexx{namespace (C++)!using directive}
880 \addtoindexx{using directive|see {namespace (C++), using directive}}
881 may be represented by an imported module
882 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
883 entry, with an import attribute referring to the namespace
884 entry of the appropriate extension of the namespace (which
885 might be the original namespace entry) and no owned entries.
888 \textit{A \addtoindex{Fortran} use statement
889 \addtoindexx{Fortran!use statement}
890 with a \doublequote{rename list} may be
891 represented by an imported module entry with an import
892 attribute referring to the module and owned entries
893 corresponding to those entities that are renamed as part of
897 \textit{A \addtoindex{Fortran} use statement
898 \addtoindexx{Fortran!use statement}
899 with neither a \doublequote{rename list} nor
900 an \doublequote{only list} may be represented by an imported module
901 entry with an import attribute referring to the module and
902 no owned child entries.
905 \textit{A use statement with an \doublequote{only list} is represented by a
906 series of individual imported declaration entries as described
907 in Section \refersec{chap:importedorrenameddeclarationentries}.
910 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
911 \addtoindexx{Fortran!use statement}
912 itself imported by a use statement without an explicit mention
913 may be represented by an imported declaration entry that refers
914 to the original debugging information entry. For example, given
931 \textit{the imported declaration entry for Q within module C refers
932 directly to the variable declaration entry for X in module A
933 because there is no explicit representation for X in module B.
936 \textit{A similar situation arises for a \addtoindex{C++} using declaration
937 \addtoindexx{namespace (C++)!using declaration}
938 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
939 that imports an entity in terms of a namespace alias. See
940 Appendix \refersec{app:namespaceexamples}
944 \subsection{Imported Unit Entries}
945 \label{chap:importedunitentries}
947 \hypertarget{chap:DWATimportimportedunit}{}
948 place where a normal or partial unit is imported is
949 represented by a debugging information entry with the
950 \addtoindexx{imported unit entry}
951 tag \DWTAGimportedunitTARG.
952 An imported unit entry contains
953 \addtoindexx{import attribute}
955 \DWATimport{} attribute
956 whose value is a \livelink{chap:classreference}{reference} to the
957 normal or partial compilation unit whose declarations logically
958 belong at the place of the imported unit entry.
960 \textit{An imported unit entry does not necessarily correspond to
961 any entity or construct in the source program. It is merely
962 \doublequote{glue} used to relate a partial unit, or a compilation
963 unit used as a partial unit, to a place in some other
966 \section{Subroutine and Entry Point Entries}
967 \label{chap:subroutineandentrypointentries}
969 The following tags exist to describe
970 debugging information entries
971 \addtoindexx{function entry|see{subroutine entry}}
973 \addtoindexx{subroutine entry}
975 \addtoindexx{subprogram entry}
977 % FIXME: is entry point entry the right index 'entry'?
978 \addtoindexx{entry point entry}
981 \begin{tabular}{lp{9.0cm}}
982 \DWTAGsubprogramTARG{} & A subroutine or function \\
983 \DWTAGinlinedsubroutine{} & A particular inlined
984 \addtoindexx{inlined subprogram entry}
985 instance of a subroutine or function \\
986 \DWTAGentrypointTARG{} & An alternate entry point \\
991 \subsection{General Subroutine and Entry Point Information}
992 \label{chap:generalsubroutineandentrypointinformation}
993 The subroutine or entry point entry has a \DWATname{}
994 attribute whose value is a null-terminated string containing the
995 subroutine or entry point name as it appears in the source program.
996 It may also have a \DWATlinkagename{} attribute as
997 described in Section \refersec{chap:linkagenames}.
999 If the name of the subroutine described by an entry with the
1000 \addtoindexx{subprogram entry}
1001 tag \DWTAGsubprogram{}
1002 is visible outside of its containing
1003 \hypertarget{chap:DWATexternalexternalsubroutine}{}
1004 compilation unit, that entry has
1005 \addtoindexx{external attribute}
1007 \DWATexternalNAME{} attribute,
1008 which is a \livelink{chap:classflag}{flag}.
1010 \textit{Additional attributes for functions that are members of a
1011 class or structure are described in
1012 Section \refersec{chap:memberfunctionentries}.
1016 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
1019 \DWATmainsubprogramNAME{}
1021 \addtoindexx{main subprogram attribute}
1023 a \CLASSflag{} whose presence indicates that the
1024 subroutine has been identified as the starting function of
1025 the program. If more than one subprogram contains this
1027 any one of them may be the starting subroutine of the program.
1029 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1030 which is used to specify
1031 and provide a user\dash supplied name for the main subroutine of
1035 \textit{A common debugger feature is to allow the debugger user to call
1036 a subroutine within the subject program. In certain cases,
1037 however, the generated code for a subroutine will not obey
1038 the standard calling conventions for the target architecture
1039 and will therefore not be safe to call from within a debugger.
1042 A subroutine entry may
1043 \hypertarget{chap:DWATcallingconventionforsubprograms}{}
1045 \DWATcallingconventionNAME{}
1046 \addtoindexx{calling convention attribute}
1047 attribute, whose value is an
1048 \livelink{chap:classconstant}{integer constant}. The set of
1049 \addtoindexi{calling convention codes for subroutines}{calling convention codes!for subroutines}
1050 is given in Table \refersec{tab:callingconventioncodesforsubroutines}.
1052 \begin{simplenametable}[1.4in]{Calling convention codes for subroutines}{tab:callingconventioncodesforsubroutines}
1056 \end{simplenametable}
1058 If this attribute is not present, or its value is the constant
1059 \DWCCnormalTARG, then the subroutine may be safely called by
1060 obeying the \doublequote{standard} calling conventions of the target
1061 architecture. If the value of the calling convention attribute
1062 is the constant \DWCCnocallTARG, the subroutine does not obey
1063 standard calling conventions, and it may not be safe for the
1064 debugger to call this subroutine.
1066 \textit{Note that \DWCCnormal{} is also used as a calling convention
1067 code for certain types
1068 (see Table \refersec{tab:callingconventioncodesfortypes}).}
1070 If the semantics of the language of the compilation unit
1071 containing the subroutine entry distinguishes between ordinary
1072 subroutines and subroutines that can serve as the \doublequote{main
1073 program,} that is, subroutines that cannot be called
1074 directly according to the ordinary calling conventions,
1075 then the debugging information entry for such a subroutine
1076 may have a calling convention attribute whose value is the
1077 constant \DWCCprogramTARG.
1079 \textit{The \DWCCprogram{}
1080 value is intended to support \addtoindex{Fortran} main
1081 \addtoindexx{Fortran!main program}
1082 programs which in some implementations may not be callable
1083 or which must be invoked in a special way. It is not intended
1084 as a way of finding the entry address for the program.
1087 \textit{In \addtoindex{C}
1088 there is a difference between the types of functions
1089 declared using function prototype style declarations and
1090 those declared using non\dash prototype declarations.
1093 A subroutine entry declared with a function prototype style
1094 declaration may have
1095 \addtoindexx{prototyped attribute}
1097 \DWATprototypedNAME{} attribute, which is
1100 \textit{The \addtoindex{Fortran}
1101 language allows the keywords \texttt{elemental}, \texttt{pure}
1102 and \texttt{recursive} to be included as part of the declaration of
1103 a subroutine; these attributes reflect that usage. These
1104 attributes are not relevant for languages that do not support
1105 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1106 attribute is neither needed nor appropriate in languages such
1108 where functions support recursion by default.
1112 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1114 \addtoindexx{elemental attribute}
1116 \DWATelementalNAME{} attribute, which
1117 is a \livelink{chap:classflag}{flag}.
1118 The attribute indicates whether the subroutine
1119 or entry point was declared with the \doublequote{elemental} keyword
1123 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1124 subprogram entry may have
1125 \addtoindexx{pure attribute}
1127 \DWATpureNAME{} attribute, which is
1128 a \livelink{chap:classflag}{flag}.
1129 The attribute indicates whether the subroutine was
1130 declared with the \doublequote{pure} keyword or property.
1133 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1134 subprogram entry may have a
1135 \DWATrecursiveNAME{} attribute, which
1136 is a \livelink{chap:classflag}{flag}.
1137 The attribute indicates whether the subroutine
1138 or entry point was declared with the \doublequote{recursive} keyword
1141 A subprogram entry may have a
1143 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1144 which is a \CLASSflag. The attribute
1145 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1146 indicating that the subprogram can be called, but will never return to its caller.
1148 \subsubsection{Call Site-Related Attributes}
1149 A subroutine entry may have \DWATcallalltailcalls, \DWATcallallcalls{}
1150 and/or \DWATcallallsourcecalls{} attributes, each of which is a
1151 \livelink{chap:classflag}{flag}.
1152 These flags indicate the completeness of the call site information
1153 within the subprogram.
1155 The \DWATcallalltailcallsNAME{}
1156 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1157 indicates that every tail call
1158 that occurs in the code for the subprogram is described by a
1159 \DWTAGcallsite{} entry.
1160 (There may or may not be other non-tail calls to some of the same
1161 target subprograms.)
1163 The \DWATcallallcallsNAME{}
1164 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1165 indicates that every non-inlined call
1166 (either a tail call or a normal call) that occurs in the code for the subprogram
1167 is described by a \DWTAGcallsite{} entry.
1169 The \DWATcallallsourcecallsNAME{}
1170 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1171 indicates that every call that occurs in the
1172 code for the subprogram, including every call inlined into it, is described by either a
1173 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1174 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1175 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1177 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1178 information format consumers that analyse call graphs.}
1180 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1181 \DWATcallallcalls{} and \DWATcallalltailcalls{} attributes are necessarily also true, and
1182 those attributes need not be present. Similarly, if the value of the
1183 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1184 attribute is also true and the latter attribute need not be present.
1187 \subsection{Subroutine and Entry Point Return Types}
1188 \label{chap:subroutineandentrypointreturntypes}
1191 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1192 the subroutine or entry point
1193 \addtoindexx{return type of subroutine}
1194 is a function that returns a
1195 value, then its debugging information entry has
1196 \addtoindexx{type attribute}
1197 a \DWATtype{} attribute
1198 to denote the type returned by that function.
1200 \textit{Debugging information entries for
1201 \addtoindex{C} void functions should
1202 not have an attribute for the return type. }
1204 \textit{Debugging information entries for declarations of \addtoindex{C++}
1205 member functions with an
1206 \autoreturntype{} specifier should use an unspecified type entry (see
1207 Section \refersec{chap:unspecifiedtypeentries}).
1208 The debugging information entry for the corresponding definition
1209 should provide the deduced return type. This practice causes the description of
1210 the containing class to be consistent across compilation units, allowing the class
1211 declaration to be placed into a separate type unit if desired.}
1214 \subsection{Subroutine and Entry Point Locations}
1215 \label{chap:subroutineandentrypointlocations}
1217 A subroutine entry may have either a \DWATlowpc{} and
1218 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1219 \addtoindexx{ranges attribute}
1221 \addtoindexx{high PC attribute}
1223 \addtoindexx{low PC attribute}
1224 encode the contiguous or non\dash contiguous address
1225 ranges, respectively, of the machine instructions generated
1226 for the subroutine (see
1227 Section \refersec{chap:codeaddressesandranges}).
1230 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1231 subroutine entry may also have
1232 \addtoindexx{entry pc attribute!for subroutine}
1234 \DWATentrypc{} attribute
1235 whose value is the address of the first executable instruction
1236 of the subroutine (see
1237 Section \refersec{chap:entryaddress}).
1239 An entry point has a \DWATlowpc{} attribute whose value is the
1240 relocated address of the first machine instruction generated
1241 for the entry point.
1244 \DWATentrypc{} attribute
1245 \addtoindexx{entry pc attribute!for subroutine}
1247 also seem appropriate
1248 for this purpose, historically the
1249 \DWATlowpc{} attribute
1251 \DWATentrypc{} was introduced (in
1252 \addtoindex{DWARF Version 3}).
1253 There is insufficient reason to change this.}
1259 \addtoindexx{address class attribute}
1261 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1265 \DWATaddressclass{} attributes,
1266 as appropriate, to specify
1267 which segments the code for the subroutine resides in and
1268 the addressing mode to be used in calling that subroutine.
1270 A subroutine entry representing a subroutine declaration
1271 that is not also a definition does not have code address or
1275 \subsection{Declarations Owned by Subroutines and Entry Points}
1276 \label{chap:declarationsownedbysubroutinesandentrypoints}
1278 The declarations enclosed by a subroutine or entry point are
1279 represented by debugging information entries that are owned
1280 by the subroutine or entry point entry. Entries representing
1281 \addtoindexx{formal parameter}
1282 the formal parameters of the subroutine or entry point appear
1283 in the same order as the corresponding declarations in the
1287 \textit{There is no ordering requirement for entries for declarations
1288 that are children of subroutine or entry point entries but
1289 that do not represent formal parameters. The formal parameter
1290 entries may be interspersed with other entries used by formal
1291 parameter entries, such as type entries.}
1293 The unspecified parameters of a variable parameter list are
1294 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1296 \DWTAGunspecifiedparametersTARG.
1299 The entry for a subroutine that includes a
1300 \addtoindex{Fortran}
1301 \addtoindexx{Fortran!common block}
1302 \livelink{chap:fortrancommonblock}{common}
1303 \livelink{chap:commonblockentry}{block}
1304 \addtoindexx{common block|see{Fortran common block}}
1305 has a child entry with the
1306 tag \DWTAGcommoninclusionTARG.
1308 \hypertarget{chap:commonreferencecommonblockusage}{}
1309 common inclusion entry has a
1310 \DWATcommonreference{} attribute
1311 whose value is a \livelink{chap:classreference}{reference}
1312 to the debugging information entry
1313 for the common \nolink{block} being included
1314 (see Section \refersec{chap:commonblockentries}).
1316 \subsection{Low-Level Information}
1317 \label{chap:lowlevelinformation}
1320 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1321 subroutine or entry point entry may have
1322 \addtoindexx{return address attribute}
1325 attribute, whose value is a location description. The location
1326 calculated is the place where the return address for the
1327 subroutine or entry point is stored.
1330 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1331 subroutine or entry point entry may also have
1332 \addtoindexx{frame base attribute}
1334 \DWATframebase{} attribute, whose value is a location
1335 description that computes the \doublequote{frame base} for the
1336 subroutine or entry point. If the location description is
1337 a simple register location description, the given register
1338 contains the frame base address. If the location description is
1339 a DWARF expression, the result of evaluating that expression
1340 is the frame base address. Finally, for a
1341 \addtoindex{location list},
1342 this interpretation applies to each location description
1343 contained in the list of \addtoindex{location list} entries.
1345 \textit{The use of one of the \DWOPregn{}
1347 context is equivalent to using
1350 compact. However, these are not equivalent in general.}
1353 \textit{The frame base for a subprogram is typically an address fixed
1354 relative to the first unit of storage allocated for the
1355 subprogram\textquoteright s stack frame. The \DWATframebase{} attribute
1356 can be used in several ways:}
1357 \begin{enumerate}[1. ]
1358 \item \textit{In subprograms that need
1359 \addtoindexx{location list}
1360 location lists to locate local
1361 variables, the \DWATframebase{} can hold the needed location
1362 list, while all variables\textquoteright\ location descriptions can be
1363 simpler ones involving the frame base.}
1365 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1366 within nested routines.
1367 (See also \DWATstaticlink, below)}
1371 \textit{Some languages support nested subroutines. In such languages,
1372 it is possible to reference the local variables of an
1373 outer subroutine from within an inner subroutine. The
1374 \DWATstaticlink{} and \DWATframebase{} attributes allow
1375 debuggers to support this same kind of referencing.}
1378 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1380 \addtoindexx{address!uplevel|see {static link attribute}}
1381 \addtoindexx{uplevel address|see {static link attribute}}
1382 subroutine or entry point is nested, it may have a
1384 attribute, whose value is a location
1385 description that computes the frame base of the relevant
1386 instance of the subroutine that immediately encloses the
1387 subroutine or entry point.
1389 In the context of supporting nested subroutines, the
1390 \DWATframebase{} attribute value should obey the following
1393 \begin{enumerate}[1. ]
1394 \item It should compute a value that does not change during the
1395 life of the subprogram, and
1397 \item The computed value should be unique among instances of
1398 the same subroutine. (For typical \DWATframebase{} use, this
1399 means that a recursive subroutine\textquoteright s stack frame must have
1400 non\dash zero size.)
1403 \textit{If a debugger is attempting to resolve an up\dash level reference
1404 to a variable, it uses the nesting structure of DWARF to
1405 determine which subroutine is the lexical parent and the
1406 \DWATstaticlink{} value to identify the appropriate active
1407 frame of the parent. It can then attempt to find the reference
1408 within the context of the parent.}
1412 \subsection{Types Thrown by Exceptions}
1413 \label{chap:typesthrownbyexceptions}
1415 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1416 it may validly throw.}
1418 If a subroutine explicitly declares that it may throw
1419 \addtoindexx{exception thrown|see{thrown type entry}}
1421 \addtoindexx{thrown exception|see{thrown type entry}}
1422 exception of one or more types, each such type is
1423 represented by a debugging information entry with
1424 \addtoindexx{thrown type entry}
1426 \DWTAGthrowntypeTARG.
1427 Each such entry is a child of the entry
1428 representing the subroutine that may throw this type. Each
1429 thrown type entry contains
1430 \addtoindexx{type attribute}
1431 a \DWATtype{} attribute, whose
1432 value is a \livelink{chap:classreference}{reference}
1433 to an entry describing the type of the
1434 exception that may be thrown.
1436 \subsection{Function Template Instantiations}
1437 \label{chap:functiontemplateinstantiations}
1439 \textit{In \addtoindex{C++}, a function template is a generic definition of
1440 a function that is instantiated differently for calls with
1441 values of different types. DWARF does not represent the generic
1442 template definition, but does represent each instantiation.}
1445 A \addtoindex{function template instantiation}\addtoindexx{template instantiation!function}
1446 is represented by a debugging information entry with the
1447 \addtoindexx{subprogram entry!use for template instantiation}
1448 tag \DWTAGsubprogram.
1450 exceptions, such an entry will contain the same attributes and
1451 will have the same types of child entries as would an entry
1452 for a subroutine defined explicitly using the instantiation
1453 types and values. The exceptions are:
1455 \begin{enumerate}[1. ]
1456 \item Template parameters are described and referenced as specified in
1457 Section \refersec{chap:templateparameters}.
1460 \item If the compiler has generated a special compilation unit
1461 to hold the template instantiation and that compilation unit
1462 has a different name from the compilation unit containing
1463 the template definition, the name attribute for the debugging
1464 information entry representing that compilation unit is empty
1467 \item If the subprogram entry representing the template
1468 instantiation or any of its child entries contain declaration
1469 coordinate attributes, those attributes refer to the source
1470 for the template definition, not to any source generated
1471 artificially by the compiler for this instantiation.
1476 \subsection{Inlinable and Inlined Subroutines}
1477 \label{chap:inlinedsubroutines}
1478 A declaration or a definition of an inlinable subroutine
1479 is represented by a debugging information entry with the
1483 \addtoindexx{subprogram entry!use in inlined subprogram}
1485 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1486 explicitly declared to be available for inline expansion or
1487 that was expanded inline implicitly by the compiler has
1488 \addtoindexx{inline attribute}
1490 \DWATinline{} attribute whose value is an
1491 \livelink{chap:classconstant}{integer constant}. The
1492 set of values for the \DWATinline{} attribute is given in
1493 Table \refersec{tab:inlinecodes}.
1497 \caption{Inline codes}
1498 \label{tab:inlinecodes}
1499 \begin{tabular}{l|p{8cm}}
1501 Name&Meaning\\ \hline
1502 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1503 \mbox{compiler} (equivalent to the absence of the
1504 containing \DWATinline{} attribute) \\
1505 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1506 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1507 not inlined by the \mbox{compiler} \\
1508 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1514 \textit{In \addtoindex{C++}, a function or a constructor declared with
1515 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1516 instance (see below) is represented by a debugging information
1517 entry with the tag \DWTAGsubprogram. Such an entry has a
1518 \DWATinline{} attribute whose value is \DWINLinlined.}
1521 \subsubsection{Abstract Instances}
1522 \label{chap:abstractinstances}
1523 Any subroutine entry that contains a
1524 \DWATinline{} attribute\addtoindexx{inline attribute}
1525 whose value is other than
1528 \doublequote{abstract instance root.}\addtoindexx{abstract instance!root}
1529 \hypertarget{chap:DWATinlineabstracttinstance}{}
1530 Any debugging information entry that is owned (either
1531 directly or indirectly) by an abstract instance root
1533 \doublequote{abstract instance entry.}\addtoindexx{abstract instance!entry}
1534 Any set of abstract instance entries that are all
1535 children (either directly or indirectly) of some abstract
1536 instance root, together with the root itself, is known as an
1537 \doublequote{abstract instance tree.}\addtoindexx{abstract instance!tree}
1538 However, in the case where an abstract instance tree is
1539 nested within another abstract instance tree, the entries in the
1540 \addtoindex{nested abstract instance}
1541 tree are not considered to be entries in the outer abstract
1544 Each abstract instance root is either part of a larger
1545 \addtoindexx{abstract instance!root}
1546 tree (which gives a context for the root) or
1547 \addtoindexx{specification attribute}
1549 \DWATspecification{}
1550 to refer to the declaration in context.
1552 \textit{For example, in \addtoindex{C++} the context might be a namespace
1553 declaration or a class declaration.}
1555 \textit{Abstract instance trees are defined so that no entry is part
1556 of more than one abstract instance tree. This simplifies the
1557 following descriptions.}
1559 A debugging information entry that is a member of an abstract
1560 instance tree should not contain any attributes which describe
1561 aspects of the subroutine which vary between distinct inlined
1562 expansions or distinct out\dash of\dash line expansions. For example,
1563 \addtoindexx{entry pc attribute!and abstract instance}
1574 \addtoindexx{location attribute!and abstract instance}
1576 \addtoindexx{ranges attribute!and abstract instance}
1578 \addtoindexx{high PC attribute!and abstract instance}
1580 \addtoindexx{low PC attribute!and abstract instance}
1582 \addtoindexx{segment attribute!and abstract instance}
1584 \addtoindexx{return address attribute!and abstract instance}
1586 \addtoindexx{segment attribute!and abstract instance}
1588 \addtoindexx{start scope attribute!and abstract instance}
1592 \textit{It would not make sense normally to put these attributes into
1593 abstract instance entries since such entries do not represent
1594 actual (concrete) instances and thus do not actually exist at
1595 run\dash time. However,
1596 see Appendix \refersec{app:inlineouteronenormalinner}
1597 for a contrary example.}
1599 The rules for the relative location of entries belonging to
1600 abstract instance trees are exactly the same as for other
1601 similar types of entries that are not abstract. Specifically,
1602 the rule that requires that an entry representing a declaration
1603 be a direct child of the entry representing the scope of the
1604 declaration applies equally to both abstract and non\dash abstract
1605 entries. Also, the ordering rules for formal parameter entries,
1606 member entries, and so on, all apply regardless of whether
1607 or not a given entry is abstract.
1610 \subsubsection{Concrete Inlined Instances}
1611 \label{chap:concreteinlinedinstances}
1613 Each inline expansion of a subroutine is represented
1614 by a debugging information entry with the
1615 tag \DWTAGinlinedsubroutineTARG.
1616 Each such entry should be a direct
1617 child of the entry that represents the scope within which
1618 the inlining occurs.
1621 Each inlined subroutine entry may have either a
1623 and \DWAThighpc{} pair
1625 \addtoindexx{high PC attribute}
1627 \addtoindexx{low PC attribute}
1629 \addtoindexx{ranges attribute}
1632 attribute whose values encode the contiguous or non\dash contiguous
1633 address ranges, respectively, of the machine instructions
1634 generated for the inlined subroutine (see
1635 Section \referfol{chap:codeaddressesandranges}).
1637 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1638 inlined subroutine entry may
1639 \addtoindexx{inlined subprogram entry!in concrete instance}
1641 \addtoindexx{inlined subprogram entry}
1643 \addtoindexx{entry pc attribute!for inlined subprogram}
1646 attribute, representing the first executable instruction of
1647 the inline expansion (see
1648 Section \refersec{chap:entryaddress}).
1650 % Positions of the 3 targets here is a bit arbitrary.
1652 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1654 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1656 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1657 may also have \DWATcallfile,
1658 \DWATcallline{} and \DWATcallcolumn{} attributes,
1660 value is an \livelink{chap:classconstant}{integer constant}.
1661 These attributes represent the
1662 source file, source line number, and source column number,
1663 respectively, of the first character of the statement or
1664 expression that caused the inline expansion. The call file,
1665 call line, and call column attributes are interpreted in
1666 the same way as the declaration file, declaration line, and
1667 declaration column attributes, respectively (see
1668 Section \refersec{chap:declarationcoordinates}).
1670 \textit{The call file, call line and call column coordinates do not
1671 describe the coordinates of the subroutine declaration that
1672 was inlined, rather they describe the coordinates of the call.
1675 An inlined subroutine entry
1676 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1679 attribute, which is a \livelink{chap:classflag}{flag}
1680 whose presence indicates that the
1681 subroutine has been evaluated as a compile\dash time constant. Such
1682 an entry may also have a \DWATconstvalue{} attribute,
1683 whose value may be of any form that is appropriate for the
1684 representation of the subroutine's return value. The value of
1685 this attribute is the actual return value of the subroutine,
1686 represented as it would be on the target architecture.
1688 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1689 \addttindex{constexpr}
1690 is called with constant expressions, then the corresponding
1691 concrete inlined instance has a
1692 \DWATconstexpr{} attribute,
1693 as well as a \DWATconstvalue{} attribute whose value represents
1694 the actual return value of the concrete inlined instance.}
1696 Any debugging information entry that is owned (either
1697 directly or indirectly) by a debugging information entry
1698 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1699 \doublequote{concrete inlined instance entry.} Any entry that has
1701 \DWTAGinlinedsubroutine{}
1702 is known as a \doublequote{concrete inlined instance root.}
1703 Any set of concrete inlined instance
1704 entries that are all children (either directly or indirectly)
1705 of some concrete inlined instance root, together with the root
1706 itself, is known as a \doublequote{concrete inlined instance tree.}
1707 However, in the case where a concrete inlined instance tree
1708 is nested within another concrete instance tree, the entries
1709 in the \addtoindex{nested concrete inline instance} tree
1710 are not considered to
1711 be entries in the outer concrete instance tree.
1714 \textit{Concrete inlined instance trees are defined so that no entry
1715 is part of more than one concrete inlined instance tree. This
1716 simplifies later descriptions.}
1718 Each concrete inlined instance tree is uniquely associated
1719 with one (and only one) abstract instance tree.
1721 \textit{Note, however, that the reverse is not true. Any given abstract
1722 instance tree may be associated with several different concrete
1723 inlined instance trees, or may even be associated with zero
1724 concrete inlined instance trees.}
1726 Concrete inlined instance entries may omit attributes that
1727 are not specific to the concrete instance (but present in
1728 the abstract instance) and need include only attributes that
1729 are specific to the concrete instance (but omitted in the
1730 abstract instance). In place of these omitted attributes, each
1731 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1732 concrete inlined instance entry
1733 \addtoindexx{abstract origin attribute}
1735 \DWATabstractorigin{}
1736 attribute that may be used to obtain the missing information
1737 (indirectly) from the associated abstract instance entry. The
1738 value of the abstract origin attribute is a reference to the
1739 associated abstract instance entry.
1741 If an entry within a concrete inlined instance tree contains
1742 attributes describing the
1743 \addtoindexx{declaration coordinates!in concrete instance}
1744 \livelink{chap:declarationcoordinates}{declaration coordinates}
1745 of that entry, then those attributes should refer to the file, line
1746 and column of the original declaration of the subroutine,
1747 not to the point at which it was inlined. As a consequence,
1748 they may usually be omitted from any entry that has an abstract
1752 For each pair of entries that are associated via a
1753 \addtoindexx{abstract origin attribute}
1754 \DWATabstractorigin{} attribute, both members of the pair
1755 have the same tag. So, for example, an entry with the tag
1756 \DWTAGvariable{} can only be associated with another entry
1757 that also has the tag \DWTAGvariable. The only exception
1758 to this rule is that the root of a concrete instance tree
1759 (which must always have the tag \DWTAGinlinedsubroutine)
1760 can only be associated with the root of its associated abstract
1761 instance tree (which must have the tag \DWTAGsubprogram).
1764 In general, the structure and content of any given concrete
1765 inlined instance tree will be closely analogous to the
1766 structure and content of its associated abstract instance
1767 tree. There are a few exceptions:
1769 \begin{enumerate}[1. ]
1770 \item An entry in the concrete instance tree may be omitted if
1772 \addtoindexx{abstract origin attribute}
1773 \DWATabstractorigin{} attribute and either
1774 has no children, or its children are omitted. Such entries
1775 would provide no useful information. In C\dash like languages,
1776 such entries frequently include types, including structure,
1777 union, class, and interface types; and members of types. If any
1778 entry within a concrete inlined instance tree needs to refer
1779 to an entity declared within the scope of the relevant inlined
1780 subroutine and for which no concrete instance entry exists,
1781 the reference should refer to the abstract instance entry.
1784 \item Entries in the concrete instance tree which are associated
1785 with entries in the abstract instance tree such that neither
1786 has a \DWATname{} attribute,
1787 \addtoindexx{name attribute}
1788 and neither is referenced by
1789 any other debugging information entry, may be omitted. This
1790 may happen for debugging information entries in the abstract
1791 instance trees that became unnecessary in the concrete instance
1792 tree because of additional information available there. For
1793 example, an anonymous variable might have been created and
1794 described in the abstract instance tree, but because of
1795 the actual parameters for a particular inlined expansion,
1796 it could be described as a constant value without the need
1797 for that separate debugging information entry.
1800 \item A concrete instance tree may contain entries which do
1801 not correspond to entries in the abstract instance tree
1802 to describe new entities that are specific to a particular
1803 inlined expansion. In that case, they will not have associated
1804 entries in the abstract instance tree, should not contain
1805 \addtoindexx{abstract origin attribute}
1806 \DWATabstractorigin{} attributes, and must contain all their
1807 own attributes directly. This allows an abstract instance tree
1808 to omit debugging information entries for anonymous entities
1809 that are unlikely to be needed in most inlined expansions. In
1810 any expansion which deviates from that expectation, the
1811 entries can be described in its concrete inlined instance tree.
1815 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1816 \label{chap:outoflineinstancesofinlinedsubroutines}
1817 Under some conditions, compilers may need to generate concrete
1818 executable instances of inlined subroutines other than at
1819 points where those subroutines are actually called. Such
1820 concrete instances of inlined subroutines are referred to as
1821 \doublequote{concrete out\dash of\dash line instances.}
1823 \textit{In \addtoindex{C++}, for example,
1824 taking the address of a function declared
1825 to be inline can necessitate the generation of a concrete
1826 out\dash of\dash line instance of the given function.}
1828 The DWARF representation of a concrete out\dash of\dash line instance
1829 of an inlined subroutine is essentially the same as for a
1830 concrete inlined instance of that subroutine (as described in
1831 the preceding section). The representation of such a concrete
1832 % It is critical that the hypertarget and livelink be
1833 % separated to avoid problems with latex.
1834 out\dash of\dash line
1835 \addtoindexx{abstract origin attribute}
1837 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1839 \DWATabstractorigin{}
1840 attributes in exactly the same way as they are used for
1841 a concrete inlined instance (that is, as references to
1842 corresponding entries within the associated abstract instance
1845 The differences between the DWARF representation of a
1846 concrete out\dash of\dash line instance of a given subroutine and the
1847 representation of a concrete inlined instance of that same
1848 subroutine are as follows:
1849 \begin{enumerate}[1. ]
1850 \item The root entry for a concrete out\dash of\dash line instance
1851 of a given inlined subroutine has the same tag as does its
1852 associated (abstract) inlined subroutine entry (that is, tag
1853 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1855 \item The root entry for a concrete out\dash of\dash line instance tree
1856 is normally owned by the same parent entry that also owns
1857 the root entry of the associated abstract instance. However,
1858 it is not required that the abstract and out\dash of\dash line instance
1859 trees be owned by the same parent entry.
1863 \subsubsection{Nested Inlined Subroutines}
1864 \label{nestedinlinedsubroutines}
1865 Some languages and compilers may permit the logical nesting of
1866 a subroutine within another subroutine, and may permit either
1867 the outer or the nested subroutine, or both, to be inlined.
1869 For a non\dash inlined subroutine nested within an inlined
1870 subroutine, the nested subroutine is described normally in
1871 both the abstract and concrete inlined instance trees for
1872 the outer subroutine. All rules pertaining to the abstract
1873 and concrete instance trees for the outer subroutine apply
1874 also to the abstract and concrete instance entries for the
1878 For an inlined subroutine nested within another inlined
1879 subroutine, the following rules apply to their abstract and
1880 \addtoindexx{abstract instance!nested}
1881 \addtoindexx{concrete instance!nested}
1882 concrete instance trees:
1884 \begin{enumerate}[1. ]
1885 \item The abstract instance tree for the nested subroutine is
1886 described within the abstract instance tree for the outer
1887 subroutine according to the rules in
1888 Section \refersec{chap:abstractinstances}, and
1889 without regard to the fact that it is within an outer abstract
1892 \item Any abstract instance tree for a nested subroutine is
1893 always omitted within the concrete instance tree for an
1896 \item A concrete instance tree for a nested subroutine is
1897 always omitted within the abstract instance tree for an
1900 \item The concrete instance tree for any inlined or
1901 \addtoindexx{out-of-line instance}
1903 \addtoindexx{out-of-line instance|see{\textit{also} concrete out-of-line instance}}
1904 expansion of the nested subroutine is described within a
1905 concrete instance tree for the outer subroutine according
1907 Sections \refersec{chap:concreteinlinedinstances} or
1908 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1910 and without regard to the fact that it is within an outer
1911 concrete instance tree.
1914 See Appendix \refersec{app:inliningexamples}
1915 for discussion and examples.
1917 \subsection{Trampolines}
1918 \label{chap:trampolines}
1920 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1921 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1922 an intermediary in making a call to another subroutine. It may
1923 adjust parameters and/or the result (if any) as appropriate
1924 to the combined calling and called execution contexts.}
1926 A trampoline is represented by a debugging information entry
1927 \addtoindexx{trampoline (subprogram) entry}
1928 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1930 \addtoindexx{trampoline attribute}
1931 a \DWATtrampoline{} attribute.
1933 attribute indicates the target subroutine of the trampoline,
1934 that is, the subroutine to which the trampoline passes
1935 control. (A trampoline entry may but need not also have a
1936 \DWATartificial{} attribute.)
1939 The value of the trampoline attribute may be represented
1940 using any of the following forms, which are listed in order
1944 \item If the value is of class \CLASSreference{}, then the value
1945 specifies the debugging information entry of the target
1948 \item If the value is of class \CLASSaddress{}, then the value is
1949 the relocated address of the target subprogram.
1952 \item If the value is of class \CLASSstring{}, then the value is the
1953 (possibly mangled) \addtoindexx{mangled names}
1954 name of the target subprogram.
1956 \item If the value is of class \CLASSflag, then the value true
1957 indicates that the containing subroutine is a trampoline but
1958 that the target subroutine is not known.
1962 The target subprogram may itself be a trampoline. (A sequence
1963 of trampolines necessarily ends with a non\dash trampoline
1966 \textit{In \addtoindex{C++}, trampolines may be used to implement
1967 derived virtual member functions; such trampolines typically
1969 \texttt{this} parameter\index{this parameter@\texttt{this} parameter}
1970 in the course of passing control.
1971 Other languages and environments may use trampolines in a manner
1972 sometimes known as transfer functions or transfer vectors.}
1974 \textit{Trampolines may sometimes pass control to the target
1975 subprogram using a branch or jump instruction instead of a
1976 call instruction, thereby leaving no trace of their existence
1977 in the subsequent execution context. }
1979 \textit{This attribute helps make it feasible for a debugger to arrange
1980 that stepping into a trampoline or setting a breakpoint in
1981 a trampoline will result in stepping into or setting the
1982 breakpoint in the target subroutine instead. This helps to
1983 hide the compiler generated subprogram from the user. }
1985 \textit{If the target subroutine is not known, a debugger may choose
1986 to repeatedly step until control arrives in a new subroutine
1987 which can be assumed to be the target subroutine. }
1989 \subsection{Call Site Entries}
1990 \label{chap:callsiteentries}
1992 A call site entry provides a way to represent the static or dynamic
1993 call graph of a program in the debugging information. It also provides
1994 information about how parameters are passed so that they may be more
1995 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
1996 call site entries can be also useful for computing values of variables
1997 and expressions where some value is no longer present in the current
1998 subroutine's registers or local stack frame, but it is known that the
1999 values are equal to some parameter passed to the function.
2000 The consumer can then use unwind
2001 information to find the caller and in the call site information sometimes
2002 find how to compute the value passed in a particular parameter.}
2004 A call site is represented by a debugging information entry with the tag
2005 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
2006 debugging information entry representing the scope within which the
2007 call is present in the source program.
2009 \textit{A scope entry (for example, for a lexical block) that would not
2010 otherwise be present in the debugging information of a subroutine
2011 need not be introduced solely to represent the immediately containing scope
2012 of a call. The call site entry is owned by the innermost scope entry that
2015 A source call can be compiled into different types of machine code:
2018 A \textit{normal call} uses a call-like instruction which transfers control to the start
2019 of some subprogram and leaves the call site location address somewhere where
2020 unwind information can find it.
2022 A \textit{tail call} uses a jump-like instruction which
2023 transfers control to the start of some subprogram, but the call site location
2024 address is not preserved (and thus not available using the unwind information).
2026 A \textit{tail recursion call} is a call
2027 to the current subroutine which is compiled as a loop into the middle of the
2031 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2032 where at least one instruction has the location of the inlined subprogram
2033 or any of its blocks or inlined subprograms.
2037 There are also different types of \doublequote{optimized out} calls:
2040 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2041 has not been emitted (such as, for example, the call to \texttt{foo} in
2042 \texttt{if (0) foo();}).
2044 An \textit{optimized out inline call}
2045 is a call to an inlined subprogram which either did not expand to any instructions
2046 or only parts of instructions belong to it and for debug information purposes those
2047 instructions are given a location in the caller.
2050 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2051 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2052 (see Section \refersec{chap:inlinedsubroutines}).
2054 The call site entry has a
2055 \DWATcallreturnpcNAME{}
2056 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2057 which is the return address after the call.
2058 The value of this attribute corresponds to the return address computed by
2059 call frame information in the called subprogram
2060 (see Section \refersec{datarep:callframeinformation}).
2062 \textit{On many architectures the return address is the address immediately following the
2063 call instruction, but on architectures with delay slots it might
2064 be an address after the delay slot of the call.}
2066 The call site entry may have a
2068 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2069 address of the call instruction.
2071 If the call site entry corresponds to a tail call, it has the
2072 \DWATcalltailcallNAME{}
2073 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2074 which is a \CLASSflag.
2076 The call site entry may have a
2077 \DWATcalloriginNAME{}
2078 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2079 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2080 known it is a reference to the called subprogram's debugging
2081 information entry. For indirect calls it may be a reference to a
2082 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2083 the subroutine pointer that is called.
2086 The call site may have a
2087 \DWATcalltargetNAME{}
2088 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2089 a DWARF expression. For indirect calls or jumps where it is unknown at
2090 compile time which subprogram will be called the expression computes the
2091 address of the subprogram that will be called. The DWARF expression should
2092 not use register or memory locations that might be clobbered by the call.
2095 The call site entry may have a
2096 \DWATcalltargetclobberedNAME{}
2097 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2098 which is a DWARF expression. For indirect calls or jumps where the
2099 address is not computable without use of registers or memory locations that
2100 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2101 attribute is used instead of the \DWATcalltarget{} attribute.
2103 The call site entry may have a \DWATtypeNAME{}
2104 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2105 referencing a debugging information entry for the type of the called function.
2106 When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.
2108 The call site entry may have
2109 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2110 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2111 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2112 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2113 each of whose value is an integer constant.
2114 These attributes represent the source file, source line number, and source
2115 column number, respectively, of the first character of the call statement or
2116 expression. The call file, call line, and call column attributes are
2117 interpreted in the same way as the declaration file, declaration
2118 line, and declaration column attributes, respectively
2119 (see Section \refersec{chap:declarationcoordinates}).
2121 \textit{The call file, call line and call column coordinates do not describe the
2122 coordinates of the subroutine declaration that was called, rather they describe
2123 the coordinates of the call.}
2126 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2127 entries\index{call site parameter entry} representing the parameters passed to the call.
2128 Each such entry has a \DWATlocation{} attribute which is a location expression.
2129 This location expression describes where the parameter is passed
2130 (usually either some register, or a memory location expressible as the
2131 contents of the stack register plus some offset).
2133 Each \DWTAGcallsiteparameter{} entry may have a
2134 \DWATcallvalueNAME{}
2135 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2136 which is a DWARF expression. This expression computes the value
2137 passed for that parameter. The expression should not use registers or memory
2138 locations that might be clobbered by the call, as it might be evaluated after
2139 unwinding from the called function back to the caller. If it is not
2140 possible to avoid registers or memory locations that might be clobbered by
2141 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2144 \textit{The reason for the restriction is that the value of the parameter may be
2145 needed in the middle of the callee, where the call clobbered registers or
2146 memory might be already clobbered, and if the consumer was not assured by
2147 the producer it can safely use those values, the consumer could not safely
2148 use the values at all.}
2150 For parameters passed by reference, where the code passes a pointer to
2151 a location which contains the parameter, or for reference type parameters
2152 the \DWTAGcallsiteparameter{} entry may also have
2153 \DWATcalldatalocationNAME{}
2154 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2155 whose value is a location expression and a
2156 \DWATcalldatavalueNAME{}
2157 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2158 whose value is a DWARF expression. The \DWATcalldatalocationNAME{} attribute
2159 describes where the referenced value lives during the call. If it is just
2160 \DWOPpushobjectaddress{}, it may be left out. The
2161 \DWATcalldatavalueNAME{} attribute describes the value in that location.
2162 The expression should not use registers or memory
2163 locations that might be clobbered by the call, as it might be evaluated after
2164 unwinding from the called function back to the caller.
2167 Each call site parameter entry may also have a
2168 \DWATcallparameter{}
2169 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2170 which contains a reference to a \DWTAGformalparameter{} entry,
2171 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2172 attribute describing the parameter's name.
2176 \section{Lexical Block Entries}
2177 \label{chap:lexicalblockentries}
2180 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2182 \addtoindexx{lexical block}
2183 a bracketed sequence of source statements
2184 that may contain any number of declarations. In some languages
2185 (including \addtoindex{C} and \addtoindex{C++}),
2186 \nolink{blocks} can be nested within other
2187 \nolink{blocks} to any depth.}
2189 % We do not need to link to the preceding paragraph.
2190 A lexical \nolink{block} is represented by a debugging information
2192 tag \DWTAGlexicalblockTARG.
2194 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2196 either a \DWATlowpc{} and
2197 \DWAThighpc{} pair of
2199 \addtoindexx{high PC attribute}
2201 \addtoindexx{low PC attribute}
2203 \DWATranges{} attribute
2204 \addtoindexx{ranges attribute}
2205 whose values encode the contiguous or non-contiguous address
2206 ranges, respectively, of the machine instructions generated
2207 for the lexical \nolink{block}
2208 (see Section \refersec{chap:codeaddressesandranges}).
2211 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2212 lexical block entry may also have
2213 \addtoindexx{entry pc attribute!for lexical block}
2215 \DWATentrypc{} attribute
2216 whose value is the address of the first executable instruction
2217 of the lexical block (see
2218 Section \refersec{chap:entryaddress}).
2220 If a name has been given to the
2221 lexical \nolink{block}
2223 program, then the corresponding
2224 lexical \nolink{block} entry has a
2225 \DWATname{} attribute whose
2226 \addtoindexx{name attribute}
2227 value is a null\dash terminated string
2228 containing the name of the lexical \nolink{block}
2232 \textit{This is not the same as a \addtoindex{C} or
2233 \addtoindex{C++} label (see below).}
2235 The lexical \nolink{block} entry owns
2236 debugging information entries that
2237 describe the declarations within that lexical \nolink{block}.
2239 one such debugging information entry for each local declaration
2240 of an identifier or inner lexical \nolink{block}.
2243 \section{Label Entries}
2244 \label{chap:labelentries}
2245 \textit{A label is a way of identifying a source statement. A labeled
2246 statement is usually the target of one or more \doublequote{go to}
2251 A label is represented by a debugging information entry with
2252 \addtoindexx{label entry}
2254 tag \DWTAGlabelTARG.
2255 The entry for a label should be owned by
2256 the debugging information entry representing the scope within
2257 which the name of the label could be legally referenced within
2260 The label entry has a \DWATlowpc{} attribute whose value
2261 is the relocated address of the first machine instruction
2262 generated for the statement identified by the label in
2263 the source program. The label entry also has a
2264 \DWATname{} attribute
2265 \addtoindexx{name attribute}
2266 whose value is a null-terminated string containing
2267 the name of the label as it appears in the source program.
2270 \section{With Statement Entries}
2271 \label{chap:withstatemententries}
2273 \textit{Both \addtoindex{Pascal} and
2274 \addtoindexx{Modula-2}
2275 Modula\dash 2 support the concept of a \doublequote{with}
2276 statement. The with statement specifies a sequence of
2277 executable statements within which the fields of a record
2278 variable may be referenced, unqualified by the name of the
2281 A with statement is represented by a
2282 \addtoindexi{debugging information entry}{with statement entry}
2283 with the tag \DWTAGwithstmtTARG.
2285 A with statement entry may have either a
2287 \DWAThighpc{} pair of attributes
2288 \addtoindexx{high PC attribute}
2290 \addtoindexx{low PC attribute}
2291 a \DWATranges{} attribute
2292 \addtoindexx{ranges attribute}
2293 whose values encode the contiguous or non\dash contiguous address
2294 ranges, respectively, of the machine instructions generated
2295 for the with statement
2296 (see Section \refersec{chap:codeaddressesandranges}).
2299 \hypertarget{chap:DWATentrypcofwithstmt}{}
2300 with statement entry may also have
2301 \addtoindexx{entry pc attribute!for with statement}
2303 \DWATentrypc{} attribute
2304 whose value is the address of the first executable instruction
2305 of the with statement (see
2306 Section \refersec{chap:entryaddress}).
2309 The with statement entry has
2310 \addtoindexx{type attribute}
2311 a \DWATtype{} attribute, denoting
2312 the type of record whose fields may be referenced without full
2313 qualification within the body of the statement. It also has
2314 \addtoindexx{location attribute}
2315 a \DWATlocation{} attribute, describing how to find the base
2316 address of the record object referenced within the body of
2320 \section{Try and Catch Block Entries}
2321 \label{chap:tryandcatchblockentries}
2322 \livetargi{chap:tryandcatchblockentries}{}
2323 \textit{In \addtoindex{C++}, a \livelink{chap:lexicalblock}{lexical block} may be
2324 designated as a \doublequote{catch \nolink{block}.}
2325 A catch \nolink{block} is an exception handler that
2326 handles exceptions thrown by an immediately preceding
2327 \doublequote{try \nolink{block}.}
2328 A catch \nolink{block}
2329 designates the type of the exception that it can handle.}
2331 A \livetargi{chap:tryblock}{try block}{try block} is represented
2332 by a debugging information entry
2333 \addtoindexx{try block entry}
2334 with the tag \DWTAGtryblockTARG.
2335 A \livetargi{chap:catchblock}{catch block} is represented by
2336 a debugging information entry
2337 \addtoindexx{catch block entry}
2338 with the tag \DWTAGcatchblockTARG.
2340 % nolink as we have links just above and do not have a combo link for both
2341 Both try and catch \nolink{block} entries may have either a
2343 \DWAThighpc{} pair of attributes
2344 \addtoindexx{high PC attribute}
2346 \addtoindexx{low PC attribute}
2348 \DWATranges{} attribute
2349 \addtoindexx{ranges attribute}
2350 whose values encode the contiguous
2351 or non\dash contiguous address ranges, respectively, of the
2352 machine instructions generated for the \nolink{block}
2353 (see Section \refersec{chap:codeaddressesandranges}).
2355 \hypertarget{chap:DWATentrypcoftryblock}{}
2356 \hypertarget{chap:DWATentrypcofcatchblock}{}
2357 A try or catch block entry may also have
2358 \addtoindexx{entry pc attribute!for try block}
2359 \addtoindexx{entry pc attribute!for catch block}
2361 \DWATentrypc{} attribute
2362 whose value is the address of the first executable instruction
2363 of the try or catch block
2364 (see Section \refersec{chap:entryaddress}).
2367 Catch \nolink{block} entries have at least one child entry,
2368 an entry representing the type of exception accepted by
2369 that catch \nolink{block}.
2370 This child entry has one of the tags
2371 \DWTAGformalparameter{}\addtoindexx{formal parameter entry!in catch block}
2373 \DWTAGunspecifiedparameters,\addtoindexx{unspecified parameters entry!in catch block}
2374 and will have the same form as other parameter entries.
2376 The siblings immediately following a try \nolink{block}
2377 entry are its corresponding catch \nolink{block} entries.