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:separatetypeunitentries}),
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, partial unit \textit{or} type unit}}
14 \addtoindexx{compilation unit}
16 \addtoindexx{normal compilation unit}
17 \addtoindexx{normal compilation unit|see {compilation unit}}
18 normal compilation units,
19 partial compilation units and
20 \addtoindexx{type unit}
22 \addtoindex{partial compilation unit}
23 is related to one or more other compilation units that
25 \addtoindex{type unit} represents
26 a single complete type in a
27 separate unit. Either a normal compilation unit or a
28 \addtoindex{partial compilation unit}
29 may be logically incorporated into another
30 compilation unit using an
31 \addtoindex{imported unit entry}.
34 \subsection[Normal and Partial CU Entries]{Normal and Partial Compilation Unit Entries}
35 \label{chap:normalandpartialcompilationunitentries}
37 A \addtoindex{normal compilation unit} is represented by a debugging
38 information entry with the
39 tag \DWTAGcompileunitTARG.
40 A \addtoindex{partial compilation unit} is represented by a debugging information
42 tag \DWTAGpartialunitTARG.
44 In a simple normal compilation, a single compilation unit with
46 \DWTAGcompileunit{} represents a complete object file
48 \DWTAGpartialunit{} is not used.
50 employing the DWARF space compression and duplicate elimination
52 Appendix \refersec{app:usingcompilationunits},
53 multiple compilation units using
55 \DWTAGcompileunit{} and/or
56 \DWTAGpartialunit{} are
57 used to represent portions of an object file.
59 \textit{A normal compilation unit typically represents the text and
60 data contributed to an executable by a single relocatable
61 object file. It may be derived from several source files,
62 including pre\dash processed \doublequote{include files.}
63 A \addtoindex{partial compilation unit} typically represents a part of the text
64 and data of a relocatable object file, in a manner that can
65 potentially be shared with the results of other compilations
66 to save space. It may be derived from an \doublequote{include file,}
67 template instantiation, or other implementation\dash dependent
68 portion of a compilation. A normal compilation unit can also
69 function in a manner similar to a partial compilation unit
72 A compilation unit entry owns debugging information
73 entries that represent all or part of the declarations
74 made in the corresponding compilation. In the case of a
75 partial compilation unit, the containing scope of its owned
76 declarations is indicated by imported unit entries in one
77 or more other compilation unit entries that refer to that
78 partial compilation unit (see
79 Section \refersec{chap:importedunitentries}).
82 Compilation unit entries may have the following
84 \begin{enumerate}[1. ]
85 \item Either a \DWATlowpc{} and
87 \addtoindexx{high PC attribute}
89 \addtoindexx{low PC attribute}
91 \addtoindexx{ranges attribute}
93 \DWATranges{} attribute
94 \addtoindexx{ranges attribute}
96 \addtoindexx{discontiguous address ranges|see{non-contiguous address ranges}}
99 non\dash contiguous address ranges, respectively,
100 of the machine instructions generated for the compilation
101 unit (see Section \refersec{chap:codeaddressesandranges}).
103 A \DWATlowpc{} attribute
107 \addtoindexx{ranges attribute}
109 \DWATranges{} to specify the
110 \addtoindexx{ranges attribute}
111 default base address for use in
112 \addtoindexx{location list}
113 location lists (see Section
114 \refersec{chap:locationlists}) and range lists
115 \addtoindexx{range list}
116 (see Section \refersec{chap:noncontiguousaddressranges}).
118 \item A \DWATname{} attribute
119 \addtoindexx{name attribute}
120 whose value is a null\dash terminated
122 \hypertarget{chap:DWATnamepathnameofcompilationsource}{}
123 containing the full or relative path name of the primary
124 source file from which the compilation unit was derived.
126 \item A \DWATlanguage{} attribute
127 \addtoindexx{language attribute}
128 whose constant value is an
129 \hypertarget{chap:DWATlanguageprogramminglanguage}{}
131 \addtoindexx{language attribute}
132 indicating the source language of the compilation
133 unit. The set of language names and their meanings are given
134 in Table \refersec{tab:languagenames}.
137 \setlength{\extrarowheight}{0.1cm}
138 \begin{longtable}{l|l}
139 \caption{Language names} \label{tab:languagenames} \\
140 \hline \bfseries Language name & \bfseries Meaning \\ \hline
142 \bfseries Language name & \bfseries Meaning \\ \hline
144 \hline \emph{Continued on next page}
147 \addtoindexx{ISO-defined language names}
148 \DWLANGAdaeightythreeTARG{} \dag & ISO Ada:1983 \addtoindexx{Ada:1983 (ISO)} \\
149 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada:1995 (ISO)} \\
150 \DWLANGCTARG & Non-standardized C, such as K\&R \addtoindexx{C!non-standard}\\
151 \DWLANGCeightynineTARG & ISO C:1989 \addtoindexx{C:1989 (ISO)} \\
152 \DWLANGCninetynineTARG & ISO C:1999 \addtoindexx{C:1999 (ISO)} \\
153 \DWLANGCelevenTARG & ISO C:2011 \addtoindexx{C:2011 (ISO)} \\
154 \DWLANGCplusplusTARG & ISO C++:1998 \addtoindexx{C++:1998 (ISO)} \\
155 \DWLANGCpluspluszerothreeTARG & ISO C++:2003 \addtoindexx{C++:2003 (ISO)} \\
156 \DWLANGCpluspluselevenTARG & ISO C++:2011 \addtoindexx{C++:2011 (ISO)} \\
157 \DWLANGCplusplusfourteenTARG & ISO C++:2014 \addtoindexx{C++:2014 (ISO)} \\
158 \DWLANGCobolseventyfourTARG & ISO COBOL:1974 \addtoindexx{COBOL:1974 (ISO)} \\
159 \DWLANGCoboleightyfiveTARG & ISO COBOL:1985 \addtoindexx{COBOL:1985 (ISO)} \\
160 \DWLANGDTARG{}~\dag & D \addtoindexx{D language} \\
161 \DWLANGDylanTARG~\dag & Dylan \addtoindexx{Dylan} \\
162 \DWLANGFortranseventysevenTARG & ISO FORTRAN:1977 \addtoindexx{FORTRAN:1977 (ISO)} \\
163 \DWLANGFortranninetyTARG & ISO Fortran:1990 \addtoindexx{Fortran:1990 (ISO)} \\
164 \DWLANGFortranninetyfiveTARG & ISO Fortran:1995 \addtoindexx{Fortran:1995 (ISO)} \\
165 \DWLANGGoTARG{}~\dag & \addtoindex{Go} \\
166 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell} \\
167 \DWLANGJavaTARG{} & \addtoindex{Java}\\
168 \DWLANGJuliaTARG{}~\dag & \addtoindex{Julia} \\
169 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
170 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
171 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
172 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
173 \DWLANGOCamlTARG{}~\dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
174 \DWLANGOpenCLTARG{}~\dag & \addtoindex{OpenCL} \\
175 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
176 \DWLANGPLITARG{}~\dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
177 \DWLANGPythonTARG{}~\dag & \addtoindex{Python} \\
178 \DWLANGRustTARG{}~\dag & \addtoindex{Rust} \\
179 \DWLANGSwiftTARG{}~\dag & \addtoindex{Swift} \\
180 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
181 \index{Unified Parallel C|see{UPC}} \\
183 \dag \ \ \textit{Support for these languages is limited}& \\
188 \item A \DWATstmtlist{}
189 attribute whose value is
190 \addtoindexx{statement list attribute}
192 \addtoindexx{section offset!in statement list attribute}
194 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
195 offset to the line number information for this compilation
198 This information is placed in a separate object file
199 section from the debugging information entries themselves. The
200 value of the statement list attribute is the offset in the
201 \dotdebugline{} section of the first byte of the line number
202 information for this compilation unit
203 (see Section \refersec{chap:linenumberinformation}).
205 \item A \DWATmacros{} attribute
206 \addtoindexx{macro information attribute}
208 \addtoindexx{section offset!in macro information attribute}
210 \hypertarget{chap:DWATmacrosmacroinformation}{}
211 offset to the macro information for this compilation unit.
213 This information is placed in a separate object file section
214 from the debugging information entries themselves. The
215 value of the macro information attribute is the offset in
216 the \dotdebugmacro{} section of the first byte of the macro
217 information for this compilation unit
218 (see Section \refersec{chap:macroinformation}).
220 \textit{The \DWATmacros{} attribute is new in \DWARFVersionV,
222 \DWATmacroinfo{} attribute of earlier DWARF versions.
223 \livetarg{chap:DWATmacroinfomacroinformation}{}
224 While \DWATmacros{} and \DWATmacroinfo{} attributes cannot both occur in the same
225 compilation unit, both may be found in the set of units that make up an executable
226 or shared object. The two attributes have distinct encodings to facilitate such
233 \hypertarget{chap:DWATcompdircompilationdirectory}{}
235 null\dash terminated string containing the current working directory
236 of the compilation command that produced this compilation
237 unit in whatever form makes sense for the host system.
239 \item A \DWATproducer{} attribute
240 \addtoindexx{producer attribute}
241 whose value is a null\dash
242 terminated string containing information about the compiler
243 \hypertarget{chap:DWATproducercompileridentification}{}
244 that produced the compilation unit. The actual contents of
245 the string will be specific to each producer, but should
246 begin with the name of the compiler vendor or some other
247 identifying character sequence that should avoid confusion
248 with other producer values.
251 \item A \DWATidentifiercase{}
253 \addtoindexx{identifier case attribute}
255 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
256 constant value is a code describing the treatment
257 of identifiers within this compilation unit. The
258 set of identifier case codes is given in
259 Table \refersec{tab:identifiercasecodes}.
261 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
262 \DWIDcasesensitive{} \\
265 \DWIDcaseinsensitive{} \\
266 \end{simplenametable}
268 \DWIDcasesensitiveTARG{} is the default for all compilation units
269 that do not have this attribute. It indicates that names given
270 as the values of \DWATname{} attributes
271 \addtoindexx{name attribute}
272 in debugging information
273 entries for the compilation unit reflect the names as they
274 appear in the source program. The debugger should be sensitive
275 to the case of identifier names when doing identifier lookups.
278 \DWIDupcaseTARG{} means that the
279 producer of the debugging
280 information for this compilation unit converted all source
281 names to upper case. The values of the name attributes may not
282 reflect the names as they appear in the source program. The
283 debugger should convert all names to upper case when doing
286 \DWIDdowncaseTARG{} means that
287 the producer of the debugging
288 information for this compilation unit converted all source
289 names to lower case. The values of the name attributes may not
290 reflect the names as they appear in the source program. The
291 debugger should convert all names to lower case when doing
295 \DWIDcaseinsensitiveTARG{} means that the values of the name
296 attributes reflect the names as they appear in the source
297 program but that a case insensitive lookup should be used to
301 \item A \DWATbasetypes{} attribute whose value is a
302 \livelink{chap:classreference}{reference}.
305 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
307 \addtoindexx{base types attribute}
308 points to a debugging information entry
309 representing another compilation unit. It may be used
310 to specify the compilation unit containing the base type
311 entries used by entries in the current compilation unit
312 (see Section \refersec{chap:basetypeentries}).
315 This attribute provides a consumer a way to find the definition
316 of base types for a compilation unit that does not itself
317 contain such definitions. This allows a consumer, for example,
318 to interpret a type conversion to a base type
319 % getting this link target at the right spot is tricky.
320 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
323 \item A \DWATuseUTFeight{} attribute,
324 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
325 which is a \livelink{chap:classflag}{flag} whose
326 presence indicates that all strings (such as the names of
327 declared entities in the source program, or filenames in the line number table)
328 are represented using the UTF\dash 8 representation.
331 \item A \DWATmainsubprogram{} attribute, which is a \livelink{chap:classflag}{flag}
332 \addtoindexx{main subprogram attribute}
333 whose presence indicates
334 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
335 that the compilation unit contains a
336 subprogram that has been identified as the starting function
337 of the program. If more than one compilation unit contains
338 this \nolink{flag}, any one of them may contain the starting function.
340 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
342 to specify and provide a user\dash specified name for the main
343 subroutine of a program.
344 \addtoindex{C} uses the name \doublequote{main} to identify
345 the main subprogram of a program. Some other languages provide
346 similar or other means to identify the main subprogram of
349 \item A \DWATentrypc{} attribute whose value is the address of the first
350 \hypertarget{chap:DWATentrypcofcompileunit}{}
351 \hypertarget{chap:DWATentrypcofpartialunit}{}
352 \addtoindexx{entry pc attribute!for normal compilation unit}
353 \addtoindexx{entry pc attribute!for partial compilation unit}
354 executable instruction of the unit (see
355 Section \refersec{chap:entryaddress}).
357 \item A \DWATstroffsetsbaseNAME\addtoindexx{string offset base attribute}
358 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
359 attribute, whose value is a reference.
360 This attribute points to the first string
361 offset of the compilation unit's contribution to the
362 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
363 Indirect string references
364 (using \DWFORMstrx) within the compilation unit are
365 interpreted as indices relative to this base.
368 \item A \DWATaddrbaseNAME\addtoindexx{address table base attribute}
369 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
370 attribute, whose value is a reference.
371 This attribute points to the beginning of the compilation
372 unit's contribution to the \dotdebugaddr{} section.
373 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
374 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
375 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
376 interpreted as indices relative to this base.
379 \item A \DWATrangesbaseNAME\addtoindexx{ranges table base attribute}
380 \hypertarget{chap:DWATrangesbaseforrangelists}{}
381 attribute, whose value is a reference.
382 This attribute points to the beginning of the compilation
383 unit's contribution to the \dotdebugranges{} section.
384 References to range lists (using \DWFORMsecoffset)
385 within the compilation unit are
386 interpreted as offsets relative to this base.
391 The base address of a compilation unit is defined as the
392 value of the \DWATlowpc{} attribute, if present; otherwise,
393 it is undefined. If the base address is undefined, then any
394 DWARF entry or structure defined in terms of the base address
395 of that compilation unit is not valid.
397 \subsection{Skeleton Compilation Unit Entries}
398 \label{chap:skeletoncompilationunitentries}
399 When generating a split DWARF object (see
400 Section \refersec{datarep:splitdwarfobjects}), the
401 compilation unit in the \dotdebuginfo{} section is a "skeleton"
402 compilation unit, which contains only a subset of the
403 attributes of the full compilation unit. In general, it
404 contains those attributes that are necessary for the consumer
405 to locate the DWARF object where the full compilation unit
406 can be found, and for the consumer to interpret references to
407 addresses in the program.
409 A skeleton compilation unit has no
410 children, and may have the following attributes:
411 \begin{enumerate}[1. ]
414 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
415 or a \DWATranges{} attribute (the same as for regular
416 compilation unit entries).
419 A \DWATstmtlist{} attribute (the same as for regular
420 compilation unit entries).
423 A \DWATcompdir{} attribute (the same as for regular
424 compilation unit entries).
427 \livetarg{chap:DWATdwonameforunit}{}
428 A \DWATdwonameNAME{} attribute whose value is a
429 null-terminated string containing the full or relative
430 path name of the DWARF object file that contains the full
434 \livetarg{chap:DWATdwoidforunit}{}
435 A \DWATdwoidNAME{} attribute whose value is an 8-byte
436 unsigned hash of the full compilation unit. This hash
437 value is computed by the method described in
438 Section \refersec{datarep:typesignaturecomputation}.
442 A \DWATuseUTFeight{} attribute (the same as for regular compilation unit
445 \textit{This attribute applies to strings referred to by the skeleton
446 compilation unit entry itself, and strings in the associated line
448 The representation for strings in the DWARF object file is determined
449 by the presence of a \DWATuseUTFeight{} attribute in the full compilation
453 A \DWATstroffsetsbase{} attribute, for indirect strings references
454 from the skeleton compilation unit (the same as for regular
455 compilation unit entries).
458 A \DWATaddrbase{} attribute (the same as for regular
459 compilation unit entries).
462 A \DWATrangesbase{} attribute (the same as for regular
463 compilation unit entries).
467 All other attributes of a compilation unit entry (described
468 in Section \refersec{chap:normalandpartialcompilationunitentries})
469 should be placed in the full compilation
470 unit entry in the \dotdebuginfodwo{} section of the split DWARF
471 object. The attributes provided by the skeleton compilation
472 unit entry do not need to be repeated in the full compilation
473 unit entry, except for \DWATdwoid, which should appear in
474 both entries so that the consumer can verify that it has
475 found the correct DWARF object.
478 \subsection{Imported Unit Entries}
479 \label{chap:importedunitentries}
481 \hypertarget{chap:DWATimportimportedunit}{}
482 place where a normal or partial unit is imported is
483 represented by a debugging information entry with the
484 \addtoindexx{imported unit entry}
485 tag \DWTAGimportedunitTARG.
486 An imported unit entry contains
487 \addtoindexx{import attribute}
489 \DWATimport{} attribute
490 whose value is a \livelink{chap:classreference}{reference} to the
491 normal or partial compilation unit whose declarations logically
492 belong at the place of the imported unit entry.
494 \textit{An imported unit entry does not necessarily correspond to
495 any entity or construct in the source program. It is merely
496 \doublequote{glue} used to relate a partial unit, or a compilation
497 unit used as a partial unit, to a place in some other
501 \subsection{Separate Type Unit Entries}
502 \label{chap:separatetypeunitentries}
503 An object file may contain any number of separate type
504 unit entries, each representing a single complete type
506 Each \addtoindex{type unit} must be uniquely identified by
507 a 64\dash bit signature, stored as part of the type unit, which
508 can be used to reference the type definition from debugging
509 information entries in other compilation units and type units.
511 A type unit is represented by a debugging information entry
512 with the tag \DWTAGtypeunitTARG.
513 A \addtoindex{type unit entry} owns debugging
514 information entries that represent the definition of a single
515 type, plus additional debugging information entries that may
516 be necessary to include as part of the definition of the type.
518 A type unit entry may have a
519 \DWATlanguage{} attribute,
521 \addtoindexx{language attribute}
522 constant value is an integer code indicating the source
523 language used to define the type. The set of language names
524 and their meanings are given in Table \refersec{tab:languagenames}.
526 A type unit entry may have a
527 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
528 attribute, whose value is a reference. This attribute points
529 to the first string offset of the type unit's contribution to
530 the \dotdebugstroffsets{} section. Indirect string references
531 (using \DWFORMstrx) within the type unit must be interpreted
532 as indices relative to this base.
534 A type unit entry may have a \DWATstmtlist{} attribute, whose
535 value is a section offset to a line number table for this
536 type unit. Because type units do not describe any code, they
537 do not actually need a line number table, but the line number
538 tables also contain a list of directories and file names that
539 may be referenced by the \DWATdeclfile{} attribute. In a
540 normal object file with a regular compilation unit entry, the
541 type unit entries can simply refer to the line number table
542 used by the compilation unit. In a split DWARF object, where
543 the type units are located in a separate DWARF object file,
544 the \DWATstmtlist{} attribute refers to a "skeleton"
545 line number table in the \dotdebuglinedwo{} section, which
546 contains only the list of directories and file names. All
547 type unit entries in a split DWARF object may (but are not
548 required to) refer to the same skeleton line number table.
550 A type unit entry may have a \DWATuseUTFeight{} attribute, which is a flag
551 whose presence indicates that all strings referred to by this type
552 unit entry, its children, and the skeleton line number table, are
553 represented using the UTF-8 representation.
556 A \addtoindex{type unit} entry for a given type T owns a debugging
557 information entry that represents a defining declaration
558 of type T. If the type is nested within enclosing types or
559 namespaces, the debugging information entry for T is nested
560 within debugging information entries describing its containers;
561 otherwise, T is a direct child of the type unit entry.
563 A type unit entry may also own additional debugging information
564 entries that represent declarations of additional types that
565 are referenced by type T and have not themselves been placed in
566 separate type units. Like T, if an additional type U is nested
567 within enclosing types or namespaces, the debugging information
568 entry for U is nested within entries describing its containers;
569 otherwise, U is a direct child of the type unit entry.
571 The containing entries for types T and U are declarations,
572 and the outermost containing entry for any given type T or
573 U is a direct child of the type unit entry. The containing
574 entries may be shared among the additional types and between
575 T and the additional types.
577 \textit{Types are not required to be placed in type units. In general,
578 only large types such as structure, class, enumeration, and
579 union types included from header files should be considered
580 for separate type units. Base types and other small types
581 are not usually worth the overhead of placement in separate
582 type units. Types that are unlikely to be replicated, such
583 as those defined in the main source file, are also better
584 left in the main compilation unit.}
586 \section{Module, Namespace and Importing Entries}
587 \textit{Modules and namespaces provide a means to collect related
588 entities into a single entity and to manage the names of
591 \subsection{Module Entries}
592 \label{chap:moduleentries}
593 \textit{Several languages have the concept of a \doublequote{module.}
594 \addtoindexx{Modula-2}
595 A Modula\dash 2 definition module
596 \addtoindexx{Modula-2!definition module}
597 may be represented by a module
599 \addtoindex{declaration attribute}
600 (\DWATdeclaration). A
601 \addtoindex{Fortran 90} module
602 \addtoindexx{Fortran!module (Fortran 90)}
603 may also be represented by a module entry
604 (but no declaration attribute is warranted because \addtoindex{Fortran}
605 has no concept of a corresponding module body).}
607 A module is represented by a debugging information entry
609 tag \DWTAGmoduleTARG.
610 Module entries may own other
611 debugging information entries describing program entities
612 whose declaration scopes end at the end of the module itself.
614 If the module has a name, the module entry has a
615 \DWATname{} attribute
616 \addtoindexx{name attribute}
617 whose value is a null\dash terminated string containing
618 the module name as it appears in the source program.
620 The \addtoindex{module entry} may have either a
624 \addtoindexx{high PC attribute}
626 \addtoindexx{low PC attribute}
628 \DWATranges{} attribute
629 \addtoindexx{ranges attribute}
630 whose values encode the contiguous or non\dash contiguous address
631 ranges, respectively, of the machine instructions generated for
632 the module initialization code
633 (see Section \refersec{chap:codeaddressesandranges}).
634 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
636 \addtoindexx{entry pc attribute!for module initialization}
638 \DWATentrypc{} attribute whose value is the address of
639 the first executable instruction of that initialization code
640 (see Section \refersec{chap:entryaddress}).
643 \hypertarget{chap:DWATprioritymodulepriority}{}
644 the module has been assigned a priority, it may have
645 \addtoindexx{priority attribute}
647 \DWATpriority{} attribute.
648 The value of this attribute is a
649 reference to another debugging information entry describing
650 a variable with a constant value. The value of this variable
651 is the actual constant value of the module\textquoteright s priority,
652 represented as it would be on the target architecture.
654 \subsection{Namespace Entries}
655 \label{chap:namespaceentries}
656 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
657 \addtoindexx{namespace (C++)}
658 implement name hiding, so that names of unrelated things
659 do not accidentally clash in the
660 \addtoindex{global namespace} when an
661 application is linked together.}
663 A namespace is represented by a debugging information entry
665 tag \DWTAGnamespaceTARG.
666 A namespace extension is
667 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
669 \DWTAGnamespace{} entry
671 \addtoindexx{extension attribute}
674 attribute referring to the previous extension, or if there
675 is no previous extension, to the original
677 entry. A namespace extension entry does not need to duplicate
678 information in a previous extension entry of the namespace
679 nor need it duplicate information in the original namespace
680 entry. (Thus, for a namespace with a name,
681 a \DWATname{} attribute
682 \addtoindexx{name attribute}
683 need only be attached directly to the original
684 \DWTAGnamespace{} entry.)
687 Namespace and namespace extension entries may own
688 \addtoindexx{namespace extension entry}
690 \addtoindexx{namespace declaration entry}
691 debugging information entries describing program entities
692 whose declarations occur in the namespace.
694 \textit{For \addtoindex{C++}, such
695 owned program entities may be declarations,
696 including certain declarations that are also object or
697 function definitions.}
699 If a type, variable, or function declared in a namespace is
700 defined outside of the body of the namespace declaration,
701 that type, variable, or function definition entry has a
702 \DWATspecification{} attribute
703 \addtoindexx{specification attribute}
704 whose value is a \livelink{chap:classreference}{reference} to the
705 debugging information entry representing the declaration of
706 the type, variable or function. Type, variable, or function
708 \DWATspecification{} attribute
709 \addtoindexx{specification attribute}
711 to duplicate information provided by the declaration entry
712 referenced by the specification attribute.
714 \textit{The \addtoindex{C++} \addtoindex{global namespace}
716 \addtoindexx{global namespace|see{namespace (C++), global}}
718 \addtoindexx{namespace (C++)!global}
720 \texttt{::f}, for example) is not explicitly represented in
721 DWARF with a namespace entry (thus mirroring the situation
722 in \addtoindex{C++} source).
723 Global items may be simply declared with no
724 reference to a namespace.}
726 \textit{The \addtoindex{C++}
727 compilation unit specific \doublequote{unnamed namespace} may
728 \addtoindexx{namespace (C++)!unnamed}
729 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
730 be represented by a namespace entry with no name attribute in
731 the original namespace declaration entry (and therefore no name
732 attribute in any namespace extension entry of this namespace).
735 \textit{A compiler emitting namespace information may choose to
736 explicitly represent namespace extensions, or to represent the
737 final namespace declaration of a compilation unit; this is a
738 quality\dash of\dash implementation issue and no specific requirements
739 are given here. If only the final namespace is represented,
740 \addtoindexx{namespace (C++)!using declaration}
741 it is impossible for a debugger to interpret using declaration
742 references in exactly the manner defined by the
743 \addtoindex{C++} language.
746 \textit{Emitting all namespace declaration information in all
747 compilation units can result in a significant increase in the
748 size of the debug information and significant duplication of
749 information across compilation units.
750 The \addtoindex{C++} namespace std,
752 \addtoindexx{namespace (C++)!std}
753 is large and will probably be referenced in
754 every \addtoindex{C++} compilation unit.
757 \textit{For a \addtoindex{C++} namespace example,
758 see Appendix \refersec{app:namespaceexample}.
763 \subsection{Imported (or Renamed) Declaration Entries}
764 \label{chap:importedorrenameddeclarationentries}
765 \textit{Some languages support the concept of importing into or making
766 accessible in a given unit declarations made in a different
767 module or scope. An imported declaration may sometimes be
772 imported declaration is represented by one or
773 \addtoindexx{imported declaration entry}
774 more debugging information entries with the
775 tag \DWTAGimporteddeclarationTARG.
777 \hypertarget{chap:DWATimportimporteddeclaration}{}
779 is imported, there is one imported declaration entry for
781 \addtoindexx{import attribute}
782 Each imported declaration entry has a
783 \DWATimport{} attribute,
784 whose value is a \livelink{chap:classreference}{reference} to the
785 debugging information entry representing the declaration that
788 An imported declaration may also have a
791 \addtoindexx{name attribute}
792 whose value is a null\dash terminated string containing the
793 name, as it appears in the source program, by which the
794 imported entity is to be known in the context of the imported
795 declaration entry (which may be different than the name of
796 the entity being imported). If no name is present, then the
797 name by which the entity is to be known is the same as the
798 name of the entity being imported.
800 An imported declaration entry with a name attribute may be
801 used as a general means to rename or provide an alias for
802 \addtoindexx{alias declaration|see{imported declaration entry}}
803 an entity, regardless of the context in which the importing
804 declaration or the imported entity occurs.
806 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
807 \hypertarget{chap:DWATimportnamespacealias}{}
809 \addtoindexx{namespace (C++)!alias}
810 with a name attribute whose value is
811 a null\dash terminated string containing the alias name as it
812 appears in the source program and an import attribute whose
813 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
814 namespace extension entry.
817 \textit{A \addtoindex{C++} using declaration may be represented by one or more
818 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
820 \addtoindexx{namespace (C++)!using declaration}
821 declaration entries. When the using declaration
822 refers to an overloaded function, there is one imported
823 declaration entry corresponding to each overloading. Each
824 imported declaration entry has no name attribute but it does
825 have an import attribute that refers to the entry for the
826 entity being imported. (\addtoindex{C++}
827 provides no means to \doublequote{rename}
828 an imported entity, other than a namespace).
831 \textit{A \addtoindex{Fortran} use statement
832 \addtoindexx{Fortran!use statement}
833 \addtoindexx{use statement|see {Fortran, use statement}}
834 with an \doublequote{only list} may be
835 represented by a series of imported declaration entries,
836 one (or more) for each entity that is imported. An entity
837 \addtoindexx{renamed declaration|see{imported declaration entry}}
838 that is renamed in the importing context may be represented
839 by an imported declaration entry with a name attribute that
840 specifies the new local name.
843 \subsection{Imported Module Entries}
844 \label{chap:importedmoduleentries}
846 \textit{Some languages support the concept of importing into or making
847 accessible in a given unit all of the declarations contained
848 within a separate module or namespace.
851 An imported module declaration is represented by a debugging
852 information entry with
853 \addtoindexx{imported module attribute}
855 \addtoindexx{imported module entry}
856 tag \DWTAGimportedmoduleTARG.
858 imported module entry contains a
859 \DWATimport{} attribute
860 \addtoindexx{import attribute}
861 whose value is a \livelink{chap:classreference}{reference}
862 to the module or namespace entry
863 containing the definition and/or declaration entries for
864 the entities that are to be imported into the context of the
865 imported module entry.
867 An imported module declaration may own a set of imported
868 declaration entries, each of which refers to an entry in the
869 module whose corresponding entity is to be known in the context
870 of the imported module declaration by a name other than its
871 name in that module. Any entity in the module that is not
872 renamed in this way is known in the context of the imported
873 module entry by the same name as it is declared in the module.
875 \textit{A \addtoindex{C++} using directive
876 \addtoindexx{namespace (C++)!using directive}
877 \addtoindexx{using directive|see {namespace (C++), using directive}}
878 may be represented by an imported module
879 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
880 entry, with an import attribute referring to the namespace
881 entry of the appropriate extension of the namespace (which
882 might be the original namespace entry) and no owned entries.
885 \textit{A \addtoindex{Fortran} use statement
886 \addtoindexx{Fortran!use statement}
887 with a \doublequote{rename list} may be
888 represented by an imported module entry with an import
889 attribute referring to the module and owned entries
890 corresponding to those entities that are renamed as part of
894 \textit{A \addtoindex{Fortran} use statement
895 \addtoindexx{Fortran!use statement}
896 with neither a \doublequote{rename list} nor
897 an \doublequote{only list} may be represented by an imported module
898 entry with an import attribute referring to the module and
899 no owned child entries.
902 \textit{A use statement with an \doublequote{only list} is represented by a
903 series of individual imported declaration entries as described
904 in Section \refersec{chap:importedorrenameddeclarationentries}.
907 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
908 \addtoindexx{Fortran!use statement}
909 itself imported by a use statement without an explicit mention
910 may be represented by an imported declaration entry that refers
911 to the original debugging information entry. For example, given
928 \textit{the imported declaration entry for Q within module C refers
929 directly to the variable declaration entry for X in module A
930 because there is no explicit representation for X in module B.
933 \textit{A similar situation arises for a \addtoindex{C++} using declaration
934 \addtoindexx{namespace (C++)!using declaration}
935 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
936 that imports an entity in terms of a namespace alias. See
937 Appendix \refersec{app:namespaceexample}
941 \section{Subroutine and Entry Point Entries}
942 \label{chap:subroutineandentrypointentries}
944 The following tags exist to describe
945 debugging information entries
946 \addtoindexx{function entry|see{subroutine entry}}
948 \addtoindexx{subroutine entry}
950 \addtoindexx{subprogram entry}
952 % FIXME: is entry point entry the right index 'entry'?
953 \addtoindexx{entry point entry}
956 \begin{tabular}{lp{9.0cm}}
957 \DWTAGsubprogramTARG{} & A subroutine or function \\
958 \DWTAGinlinedsubroutine{} & A particular inlined
959 \addtoindexx{inlined subprogram entry}
960 instance of a subroutine or function \\
961 \DWTAGentrypointTARG{} & An alternate entry point \\
966 \subsection{General Subroutine and Entry Point Information}
967 \label{chap:generalsubroutineandentrypointinformation}
968 The subroutine or entry point entry has a \DWATname{}
969 attribute whose value is a null-terminated string containing the
970 subroutine or entry point name as it appears in the source program.
971 It may also have a \DWATlinkagename{} attribute as
972 described in Section \refersec{chap:linkagenames}.
974 If the name of the subroutine described by an entry with the
975 \addtoindexx{subprogram entry}
976 tag \DWTAGsubprogram{}
977 is visible outside of its containing
978 \hypertarget{chap:DWATexternalexternalsubroutine}{}
979 compilation unit, that entry has
980 \addtoindexx{external attribute}
982 \DWATexternalNAME{} attribute,
983 which is a \livelink{chap:classflag}{flag}.
985 \textit{Additional attributes for functions that are members of a
986 class or structure are described in
987 Section \refersec{chap:memberfunctionentries}.
991 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
994 \DWATmainsubprogramNAME{}
996 \addtoindexx{main subprogram attribute}
998 a \CLASSflag whose presence indicates that the
999 subroutine has been identified as the starting function of
1000 the program. If more than one subprogram contains this
1002 any one of them may be the starting subroutine of the program.
1004 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1005 which is used to specify
1006 and provide a user\dash supplied name for the main subroutine of
1010 \textit{A common debugger feature is to allow the debugger user to call
1011 a subroutine within the subject program. In certain cases,
1012 however, the generated code for a subroutine will not obey
1013 the standard calling conventions for the target architecture
1014 and will therefore not be safe to call from within a debugger.
1017 A subroutine entry may
1018 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}{}
1020 \DWATcallingconventionNAME{}
1021 attribute, whose value is an
1022 \livelink{chap:classconstant}{integer constant}. The set of
1023 calling convention codes is given in
1024 Table \refersec{tab:callingconventioncodes}.
1026 \begin{simplenametable}[1.4in]{Calling convention codes}{tab:callingconventioncodes}
1030 \end{simplenametable}
1032 If this attribute is not present, or its value is the constant
1033 \DWCCnormalTARG, then the subroutine may be safely called by
1034 obeying the \doublequote{standard} calling conventions of the target
1035 architecture. If the value of the calling convention attribute
1036 is the constant \DWCCnocallTARG, the subroutine does not obey
1037 standard calling conventions, and it may not be safe for the
1038 debugger to call this subroutine.
1040 If the semantics of the language of the compilation unit
1041 containing the subroutine entry distinguishes between ordinary
1042 subroutines and subroutines that can serve as the \doublequote{main
1043 program,} that is, subroutines that cannot be called
1044 directly according to the ordinary calling conventions,
1045 then the debugging information entry for such a subroutine
1046 may have a calling convention attribute whose value is the
1047 constant \DWCCprogramTARG.
1049 \textit{The \DWCCprogram{}
1050 value is intended to support \addtoindex{Fortran} main
1051 \addtoindexx{Fortran!main program}
1052 programs which in some implementations may not be callable
1053 or which must be invoked in a special way. It is not intended
1054 as a way of finding the entry address for the program.
1057 \textit{In \addtoindex{C}
1058 there is a difference between the types of functions
1059 declared using function prototype style declarations and
1060 those declared using non\dash prototype declarations.
1063 A subroutine entry declared with a function prototype style
1064 declaration may have
1065 \addtoindexx{prototyped attribute}
1067 \DWATprototypedNAME{} attribute, which is
1070 \textit{The \addtoindex{Fortran}
1071 language allows the keywords \texttt{elemental}, \texttt{pure}
1072 and \texttt{recursive} to be included as part of the declaration of
1073 a subroutine; these attributes reflect that usage. These
1074 attributes are not relevant for languages that do not support
1075 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1076 attribute is neither needed nor appropriate in languages such
1078 where functions support recursion by default.
1082 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1084 \addtoindexx{elemental attribute}
1086 \DWATelementalNAME{} attribute, which
1087 is a \livelink{chap:classflag}{flag}.
1088 The attribute indicates whether the subroutine
1089 or entry point was declared with the \doublequote{elemental} keyword
1093 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1094 subprogram entry may have
1095 \addtoindexx{pure attribute}
1097 \DWATpureNAME{} attribute, which is
1098 a \livelink{chap:classflag}{flag}.
1099 The attribute indicates whether the subroutine was
1100 declared with the \doublequote{pure} keyword or property.
1103 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1104 subprogram entry may have a
1105 \DWATrecursiveNAME{} attribute, which
1106 is a \livelink{chap:classflag}{flag}.
1107 The attribute indicates whether the subroutine
1108 or entry point was declared with the \doublequote{recursive} keyword
1111 A subprogram entry may have a
1113 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1114 which is a \CLASSflag. The attribute
1115 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1116 indicating that the subprogram can be called, but will never return to its caller.
1118 \subsubsection{Call Site-Related Attributes}
1119 A subroutine entry may have \DWATcallalltailcalls, \DWATcallallcalls{}
1120 and/or \DWATcallallsourcecalls{} attributes, each of which is a
1121 \livelink{chap:classflag}{flag}.
1122 These flags indicate the completeness of the call site information
1123 within the subprogram.
1125 The \DWATcallalltailcallsNAME{}
1126 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1127 indicates that every tail call
1128 that occurs in the code for the subprogram is described by a
1129 \DWTAGcallsite{} entry.
1130 (There may or may not be other non-tail calls to some of the same
1131 target subprograms.)
1133 The \DWATcallallcallsNAME{}
1134 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1135 indicates that every non-inlined call
1136 (either a tail call or a normal call) that occurs in the code for the subprogram
1137 is described by a \DWTAGcallsite{} entry.
1139 The \DWATcallallsourcecallsNAME{}
1140 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1141 indicates that every call that occurs in the
1142 code for the subprogram, including every call inlined into it, is described by either a
1143 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1144 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1145 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1147 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1148 information format consumers that analyse call graphs.}
1150 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1151 \DWATcallallcalls{} and \DWATcallallcalls{} attributes are necessarily also true, and
1152 those attributes need not be present. Similarly, if the value of the
1153 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1154 attribute is also true and the latter attribute need not be present.
1156 \subsection{Subroutine and Entry Point Return Types}
1157 \label{chap:subroutineandentrypointreturntypes}
1160 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1161 the subroutine or entry point
1162 \addtoindexx{return type of subroutine}
1163 is a function that returns a
1164 value, then its debugging information entry has
1165 \addtoindexx{type attribute}
1166 a \DWATtype{} attribute
1167 to denote the type returned by that function.
1169 \textit{Debugging information entries for
1170 \addtoindex{C} void functions should
1171 not have an attribute for the return type. }
1173 \textit{Debugging information entries for declarations of \addtoindex{C++}
1174 member functions with an
1175 \autoreturntype{} specifier should use an unspecified type entry (see
1176 Section \refersec{chap:unspecifiedtypeentries}).
1177 The debugging information entry for the corresponding definition
1178 should provide the deduced return type. This practice causes the description of
1179 the containing class to be consistent across compilation units, allowing the class
1180 declaration to be placed into a separate type unit if desired.}
1183 \subsection{Subroutine and Entry Point Locations}
1184 \label{chap:subroutineandentrypointlocations}
1186 A subroutine entry may have either a \DWATlowpc{} and
1187 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1188 \addtoindexx{ranges attribute}
1190 \addtoindexx{high PC attribute}
1192 \addtoindexx{low PC attribute}
1193 encode the contiguous or non\dash contiguous address
1194 ranges, respectively, of the machine instructions generated
1195 for the subroutine (see
1196 Section \refersec{chap:codeaddressesandranges}).
1199 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1200 subroutine entry may also have
1201 \addtoindexx{entry pc attribute!for subroutine}
1203 \DWATentrypc{} attribute
1204 whose value is the address of the first executable instruction
1205 of the subroutine (see
1206 Section \refersec{chap:entryaddress}).
1208 An entry point has a \DWATlowpc{} attribute whose value is the
1209 relocated address of the first machine instruction generated
1210 for the entry point.
1213 \DWATentrypc{} attribute
1214 \addtoindexx{entry pc attribute!for subroutine}
1216 also seem appropriate
1217 for this purpose, historically the
1218 \DWATlowpc{} attribute
1220 \DWATentrypc{} was introduced (in
1221 \addtoindex{DWARF Version 3}).
1222 There is insufficient reason to change this.}
1228 \addtoindexx{address class attribute}
1230 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1234 \DWATaddressclass{} attributes,
1235 as appropriate, to specify
1236 which segments the code for the subroutine resides in and
1237 the addressing mode to be used in calling that subroutine.
1239 A subroutine entry representing a subroutine declaration
1240 that is not also a definition does not have code address or
1244 \subsection{Declarations Owned by Subroutines and Entry Points}
1245 \label{chap:declarationsownedbysubroutinesandentrypoints}
1247 The declarations enclosed by a subroutine or entry point are
1248 represented by debugging information entries that are owned
1249 by the subroutine or entry point entry. Entries representing
1250 \addtoindexx{formal parameter}
1251 the formal parameters of the subroutine or entry point appear
1252 in the same order as the corresponding declarations in the
1256 \textit{There is no ordering requirement for entries for declarations
1257 that are children of subroutine or entry point entries but
1258 that do not represent formal parameters. The formal parameter
1259 entries may be interspersed with other entries used by formal
1260 parameter entries, such as type entries.}
1262 The unspecified parameters of a variable parameter list are
1263 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1265 \DWTAGunspecifiedparametersTARG.
1268 The entry for a subroutine that includes a
1269 \addtoindex{Fortran}
1270 \addtoindexx{Fortran!common block}
1271 \livelink{chap:fortrancommonblock}{common}
1272 \livelink{chap:commonblockentry}{block}
1273 \addtoindexx{common block|see{Fortran common block}}
1274 has a child entry with the
1275 tag \DWTAGcommoninclusionTARG.
1277 \hypertarget{chap:commonreferencecommonblockusage}{}
1278 common inclusion entry has a
1279 \DWATcommonreference{} attribute
1280 whose value is a \livelink{chap:classreference}{reference}
1281 to the debugging information entry
1282 for the common \nolink{block} being included
1283 (see Section \refersec{chap:commonblockentries}).
1285 \subsection{Low-Level Information}
1286 \label{chap:lowlevelinformation}
1289 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1290 subroutine or entry point entry may have
1291 \addtoindexx{return address attribute}
1294 attribute, whose value is a location description. The location
1295 calculated is the place where the return address for the
1296 subroutine or entry point is stored.
1299 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1300 subroutine or entry point entry may also have
1301 \addtoindexx{frame base attribute}
1303 \DWATframebase{} attribute, whose value is a location
1304 description that computes the \doublequote{frame base} for the
1305 subroutine or entry point. If the location description is
1306 a simple register location description, the given register
1307 contains the frame base address. If the location description is
1308 a DWARF expression, the result of evaluating that expression
1309 is the frame base address. Finally, for a
1310 \addtoindex{location list},
1311 this interpretation applies to each location description
1312 contained in the list of \addtoindex{location list} entries.
1314 \textit{The use of one of the \DWOPregn{}
1316 context is equivalent to using
1319 compact. However, these are not equivalent in general.}
1322 \textit{The frame base for a subprogram is typically an address fixed
1323 relative to the first unit of storage allocated for the
1324 subprogram\textquoteright s stack frame. The \DWATframebase{} attribute
1325 can be used in several ways:}
1326 \begin{enumerate}[1. ]
1327 \item \textit{In subprograms that need
1328 \addtoindexx{location list}
1329 location lists to locate local
1330 variables, the \DWATframebase{} can hold the needed location
1331 list, while all variables\textquoteright\ location descriptions can be
1332 simpler ones involving the frame base.}
1334 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1335 within nested routines.
1336 (See also \DWATstaticlink, below)}
1340 \textit{Some languages support nested subroutines. In such languages,
1341 it is possible to reference the local variables of an
1342 outer subroutine from within an inner subroutine. The
1343 \DWATstaticlink{} and \DWATframebase{} attributes allow
1344 debuggers to support this same kind of referencing.}
1347 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1349 \addtoindexx{address!uplevel|see {static link attribute}}
1350 \addtoindexx{uplevel address|see {static link attribute}}
1351 subroutine or entry point is nested, it may have a
1353 attribute, whose value is a location
1354 description that computes the frame base of the relevant
1355 instance of the subroutine that immediately encloses the
1356 subroutine or entry point.
1358 In the context of supporting nested subroutines, the
1359 \DWATframebase{} attribute value should obey the following
1362 \begin{enumerate}[1. ]
1363 \item It should compute a value that does not change during the
1364 life of the subprogram, and
1366 \item The computed value should be unique among instances of
1367 the same subroutine. (For typical \DWATframebase{} use, this
1368 means that a recursive subroutine\textquoteright s stack frame must have
1369 non\dash zero size.)
1372 \textit{If a debugger is attempting to resolve an up\dash level reference
1373 to a variable, it uses the nesting structure of DWARF to
1374 determine which subroutine is the lexical parent and the
1375 \DWATstaticlink{} value to identify the appropriate active
1376 frame of the parent. It can then attempt to find the reference
1377 within the context of the parent.}
1381 \subsection{Types Thrown by Exceptions}
1382 \label{chap:typesthrownbyexceptions}
1384 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1385 it may validly throw.}
1387 If a subroutine explicitly declares that it may throw
1388 \addtoindexx{exception thrown|see{thrown type entry}}
1390 \addtoindexx{thrown exception|see{thrown type entry}}
1391 exception of one or more types, each such type is
1392 represented by a debugging information entry with
1393 \addtoindexx{thrown type entry}
1395 \DWTAGthrowntypeTARG.
1396 Each such entry is a child of the entry
1397 representing the subroutine that may throw this type. Each
1398 thrown type entry contains
1399 \addtoindexx{type attribute}
1400 a \DWATtype{} attribute, whose
1401 value is a \livelink{chap:classreference}{reference}
1402 to an entry describing the type of the
1403 exception that may be thrown.
1405 \subsection{Function Template Instantiations}
1406 \label{chap:functiontemplateinstantiations}
1408 \textit{In \addtoindex{C++}, a function template is a generic definition of
1409 a function that is instantiated differently for calls with
1410 values of different types. DWARF does not represent the generic
1411 template definition, but does represent each instantiation.}
1414 A \addtoindex{template instantiation} is represented by a debugging
1415 information entry with the
1416 \addtoindexx{subprogram entry!use for template instantiation}
1417 tag \DWTAGsubprogram.
1419 exceptions, such an entry will contain the same attributes and
1420 will have the same types of child entries as would an entry
1421 for a subroutine defined explicitly using the instantiation
1422 types and values. The exceptions are:
1424 \begin{enumerate}[1. ]
1425 \item Template parameters are described and referenced as specified in
1426 Section \refersec{chap:templateparameters}.
1429 \item If the compiler has generated a special compilation unit
1430 to hold the template instantiation and that compilation unit
1431 has a different name from the compilation unit containing
1432 the template definition, the name attribute for the debugging
1433 information entry representing that compilation unit is empty
1436 \item If the subprogram entry representing the template
1437 instantiation or any of its child entries contain declaration
1438 coordinate attributes, those attributes refer to the source
1439 for the template definition, not to any source generated
1440 artificially by the compiler for this instantiation.
1445 \subsection{Inlinable and Inlined Subroutines}
1446 \label{chap:inlinedsubroutines}
1447 A declaration or a definition of an inlinable subroutine
1448 is represented by a debugging information entry with the
1452 \addtoindexx{subprogram entry!use in inlined subprogram}
1454 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1455 explicitly declared to be available for inline expansion or
1456 that was expanded inline implicitly by the compiler has
1457 \addtoindexx{inline attribute}
1459 \DWATinline{} attribute whose value is an
1460 \livelink{chap:classconstant}{integer constant}. The
1461 set of values for the \DWATinline{} attribute is given in
1462 Table \refersec{tab:inlinecodes}.
1466 \caption{Inline codes}
1467 \label{tab:inlinecodes}
1468 \begin{tabular}{l|p{8cm}}
1470 Name&Meaning\\ \hline
1471 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1472 \mbox{compiler} (equivalent to the absence of the
1473 containing \DWATinline{} attribute) \\
1474 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1475 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1476 not inlined by the \mbox{compiler} \\
1477 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1483 \textit{In \addtoindex{C++}, a function or a constructor declared with
1484 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1485 instance (see below) is represented by a debugging information
1486 entry with the tag \DWTAGsubprogram. Such an entry has a
1487 \DWATinline{} attribute whose value is \DWINLinlined.}
1490 \subsubsection{Abstract Instances}
1491 \label{chap:abstractinstances}
1492 Any debugging information entry that is owned (either
1493 \hypertarget{chap:DWATinlineabstracttinstance}{}
1494 directly or indirectly) by a debugging information entry
1496 \DWATinline{} attribute is referred to
1497 \addtoindexx{abstract instance!entry}
1498 as an \doublequote{abstract instance entry.}
1499 Any subroutine entry
1501 \addtoindexx{inline attribute}
1502 a \DWATinline{} attribute whose value is other
1503 than \DWINLnotinlined{}
1505 \addtoindexx{abstract instance!root}
1506 an \doublequote{abstract instance root.}
1507 Any set of abstract instance entries that are all
1508 children (either directly or indirectly) of some abstract
1509 instance root, together with the root itself, is known as
1510 \addtoindexx{abstract instance!tree}
1511 an \doublequote{abstract instance tree.} However, in the case where
1512 an abstract instance tree is nested within another abstract
1513 instance tree, the entries in the
1514 \addtoindex{nested abstract instance}
1515 tree are not considered to be entries in the outer abstract
1518 Each abstract instance root is either part of a larger
1519 \addtoindexx{abstract instance!root}
1520 tree (which gives a context for the root) or
1521 \addtoindexx{specification attribute}
1523 \DWATspecification{}
1524 to refer to the declaration in context.
1526 \textit{For example, in \addtoindex{C++} the context might be a namespace
1527 declaration or a class declaration.}
1529 \textit{Abstract instance trees are defined so that no entry is part
1530 of more than one abstract instance tree. This simplifies the
1531 following descriptions.}
1533 A debugging information entry that is a member of an abstract
1534 instance tree should not contain any attributes which describe
1535 aspects of the subroutine which vary between distinct inlined
1536 expansions or distinct out\dash of\dash line expansions. For example,
1537 \addtoindexx{entry pc attribute!and abstract instance}
1548 \addtoindexx{location attribute!and abstract instance}
1550 \addtoindexx{ranges attribute!and abstract instance}
1552 \addtoindexx{high PC attribute!and abstract instance}
1554 \addtoindexx{low PC attribute!and abstract instance}
1556 \addtoindexx{segment attribute!and abstract instance}
1558 \addtoindexx{return address attribute!and abstract instance}
1560 \addtoindexx{segment attribute!and abstract instance}
1562 \addtoindexx{start scope attribute!and abstract instance}
1566 \textit{It would not make sense normally to put these attributes into
1567 abstract instance entries since such entries do not represent
1568 actual (concrete) instances and thus do not actually exist at
1569 run\dash time. However,
1570 see Appendix \refersec{app:inlineouteronenormalinner}
1571 for a contrary example.}
1573 The rules for the relative location of entries belonging to
1574 abstract instance trees are exactly the same as for other
1575 similar types of entries that are not abstract. Specifically,
1576 the rule that requires that an entry representing a declaration
1577 be a direct child of the entry representing the scope of the
1578 declaration applies equally to both abstract and non\dash abstract
1579 entries. Also, the ordering rules for formal parameter entries,
1580 member entries, and so on, all apply regardless of whether
1581 or not a given entry is abstract.
1584 \subsubsection{Concrete Inlined Instances}
1585 \label{chap:concreteinlinedinstances}
1587 Each inline expansion of a subroutine is represented
1588 by a debugging information entry with the
1589 tag \DWTAGinlinedsubroutineTARG.
1590 Each such entry should be a direct
1591 child of the entry that represents the scope within which
1592 the inlining occurs.
1595 Each inlined subroutine entry may have either a
1597 and \DWAThighpc{} pair
1599 \addtoindexx{high PC attribute}
1601 \addtoindexx{low PC attribute}
1603 \addtoindexx{ranges attribute}
1606 attribute whose values encode the contiguous or non\dash contiguous
1607 address ranges, respectively, of the machine instructions
1608 generated for the inlined subroutine (see
1609 Section \referfol{chap:codeaddressesandranges}).
1611 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1612 inlined subroutine entry may
1613 \addtoindexx{inlined subprogram entry!in concrete instance}
1615 \addtoindexx{inlined subprogram entry}
1617 \addtoindexx{entry pc attribute!for inlined subprogram}
1620 attribute, representing the first executable instruction of
1621 the inline expansion (see
1622 Section \refersec{chap:entryaddress}).
1624 % Positions of the 3 targets here is a bit arbitrary.
1626 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1628 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1630 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1631 may also have \DWATcallfile,
1632 \DWATcallline{} and \DWATcallcolumn{} attributes,
1634 value is an \livelink{chap:classconstant}{integer constant}.
1635 These attributes represent the
1636 source file, source line number, and source column number,
1637 respectively, of the first character of the statement or
1638 expression that caused the inline expansion. The call file,
1639 call line, and call column attributes are interpreted in
1640 the same way as the declaration file, declaration line, and
1641 declaration column attributes, respectively (see
1642 Section \refersec{chap:declarationcoordinates}).
1644 \textit{The call file, call line and call column coordinates do not
1645 describe the coordinates of the subroutine declaration that
1646 was inlined, rather they describe the coordinates of the call.
1649 An inlined subroutine entry
1650 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1653 attribute, which is a \livelink{chap:classflag}{flag}
1654 whose presence indicates that the
1655 subroutine has been evaluated as a compile\dash time constant. Such
1656 an entry may also have a \DWATconstvalue{} attribute,
1657 whose value may be of any form that is appropriate for the
1658 representation of the subroutine's return value. The value of
1659 this attribute is the actual return value of the subroutine,
1660 represented as it would be on the target architecture.
1662 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1663 \addttindex{constexpr}
1664 is called with constant expressions, then the corresponding
1665 concrete inlined instance has a
1666 \DWATconstexpr{} attribute,
1667 as well as a \DWATconstvalue{} attribute whose value represents
1668 the actual return value of the concrete inlined instance.}
1670 Any debugging information entry that is owned (either
1671 directly or indirectly) by a debugging information entry
1672 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1673 \doublequote{concrete inlined instance entry.} Any entry that has
1675 \DWTAGinlinedsubroutine{}
1676 is known as a \doublequote{concrete inlined instance root.}
1677 Any set of concrete inlined instance
1678 entries that are all children (either directly or indirectly)
1679 of some concrete inlined instance root, together with the root
1680 itself, is known as a \doublequote{concrete inlined instance tree.}
1681 However, in the case where a concrete inlined instance tree
1682 is nested within another concrete instance tree, the entries
1683 in the \addtoindex{nested concrete inline instance} tree
1684 are not considered to
1685 be entries in the outer concrete instance tree.
1688 \textit{Concrete inlined instance trees are defined so that no entry
1689 is part of more than one concrete inlined instance tree. This
1690 simplifies later descriptions.}
1692 Each concrete inlined instance tree is uniquely associated
1693 with one (and only one) abstract instance tree.
1695 \textit{Note, however, that the reverse is not true. Any given abstract
1696 instance tree may be associated with several different concrete
1697 inlined instance trees, or may even be associated with zero
1698 concrete inlined instance trees.}
1700 Concrete inlined instance entries may omit attributes that
1701 are not specific to the concrete instance (but present in
1702 the abstract instance) and need include only attributes that
1703 are specific to the concrete instance (but omitted in the
1704 abstract instance). In place of these omitted attributes, each
1705 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1706 concrete inlined instance entry
1707 \addtoindexx{abstract origin attribute}
1709 \DWATabstractorigin{}
1710 attribute that may be used to obtain the missing information
1711 (indirectly) from the associated abstract instance entry. The
1712 value of the abstract origin attribute is a reference to the
1713 associated abstract instance entry.
1715 If an entry within a concrete inlined instance tree contains
1716 attributes describing the
1717 \addtoindexx{declaration coordinates!in concrete instance}
1718 \livelink{chap:declarationcoordinates}{declaration coordinates}
1719 of that entry, then those attributes should refer to the file, line
1720 and column of the original declaration of the subroutine,
1721 not to the point at which it was inlined. As a consequence,
1722 they may usually be omitted from any entry that has an abstract
1726 For each pair of entries that are associated via a
1727 \addtoindexx{abstract origin attribute}
1728 \DWATabstractorigin{} attribute, both members of the pair
1729 have the same tag. So, for example, an entry with the tag
1730 \DWTAGvariable{} can only be associated with another entry
1731 that also has the tag \DWTAGvariable. The only exception
1732 to this rule is that the root of a concrete instance tree
1733 (which must always have the tag \DWTAGinlinedsubroutine)
1734 can only be associated with the root of its associated abstract
1735 instance tree (which must have the tag \DWTAGsubprogram).
1738 In general, the structure and content of any given concrete
1739 inlined instance tree will be closely analogous to the
1740 structure and content of its associated abstract instance
1741 tree. There are a few exceptions:
1743 \begin{enumerate}[1. ]
1744 \item An entry in the concrete instance tree may be omitted if
1746 \addtoindexx{abstract origin attribute}
1747 \DWATabstractorigin{} attribute and either
1748 has no children, or its children are omitted. Such entries
1749 would provide no useful information. In C\dash like languages,
1750 such entries frequently include types, including structure,
1751 union, class, and interface types; and members of types. If any
1752 entry within a concrete inlined instance tree needs to refer
1753 to an entity declared within the scope of the relevant inlined
1754 subroutine and for which no concrete instance entry exists,
1755 the reference should refer to the abstract instance entry.
1758 \item Entries in the concrete instance tree which are associated
1759 with entries in the abstract instance tree such that neither
1760 has a \DWATname{} attribute,
1761 \addtoindexx{name attribute}
1762 and neither is referenced by
1763 any other debugging information entry, may be omitted. This
1764 may happen for debugging information entries in the abstract
1765 instance trees that became unnecessary in the concrete instance
1766 tree because of additional information available there. For
1767 example, an anonymous variable might have been created and
1768 described in the abstract instance tree, but because of
1769 the actual parameters for a particular inlined expansion,
1770 it could be described as a constant value without the need
1771 for that separate debugging information entry.
1773 \item A concrete instance tree may contain entries which do
1774 not correspond to entries in the abstract instance tree
1775 to describe new entities that are specific to a particular
1776 inlined expansion. In that case, they will not have associated
1777 entries in the abstract instance tree, should not contain
1778 \addtoindexx{abstract origin attribute}
1779 \DWATabstractorigin{} attributes, and must contain all their
1780 own attributes directly. This allows an abstract instance tree
1781 to omit debugging information entries for anonymous entities
1782 that are unlikely to be needed in most inlined expansions. In
1783 any expansion which deviates from that expectation, the
1784 entries can be described in its concrete inlined instance tree.
1788 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1789 \label{chap:outoflineinstancesofinlinedsubroutines}
1790 Under some conditions, compilers may need to generate concrete
1791 executable instances of inlined subroutines other than at
1792 points where those subroutines are actually called. Such
1793 concrete instances of inlined subroutines are referred to as
1794 \doublequote{concrete out\dash of\dash line instances.}
1796 \textit{In \addtoindex{C++}, for example,
1797 taking the address of a function declared
1798 to be inline can necessitate the generation of a concrete
1799 out\dash of\dash line instance of the given function.}
1801 The DWARF representation of a concrete out\dash of\dash line instance
1802 of an inlined subroutine is essentially the same as for a
1803 concrete inlined instance of that subroutine (as described in
1804 the preceding section). The representation of such a concrete
1805 % It is critical that the hypertarget and livelink be
1806 % separated to avoid problems with latex.
1807 out\dash of\dash line
1808 \addtoindexx{abstract origin attribute}
1810 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1812 \DWATabstractorigin{}
1813 attributes in exactly the same way as they are used for
1814 a concrete inlined instance (that is, as references to
1815 corresponding entries within the associated abstract instance
1819 The differences between the DWARF representation of a
1820 concrete out\dash of\dash line instance of a given subroutine and the
1821 representation of a concrete inlined instance of that same
1822 subroutine are as follows:
1824 \begin{enumerate}[1. ]
1825 \item The root entry for a concrete out\dash of\dash line instance
1826 of a given inlined subroutine has the same tag as does its
1827 associated (abstract) inlined subroutine entry (that is, tag
1828 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1830 \item The root entry for a concrete out\dash of\dash line instance tree
1831 is normally owned by the same parent entry that also owns
1832 the root entry of the associated abstract instance. However,
1833 it is not required that the abstract and out\dash of\dash line instance
1834 trees be owned by the same parent entry.
1838 \subsubsection{Nested Inlined Subroutines}
1839 \label{nestedinlinedsubroutines}
1840 Some languages and compilers may permit the logical nesting of
1841 a subroutine within another subroutine, and may permit either
1842 the outer or the nested subroutine, or both, to be inlined.
1844 For a non\dash inlined subroutine nested within an inlined
1845 subroutine, the nested subroutine is described normally in
1846 both the abstract and concrete inlined instance trees for
1847 the outer subroutine. All rules pertaining to the abstract
1848 and concrete instance trees for the outer subroutine apply
1849 also to the abstract and concrete instance entries for the
1853 For an inlined subroutine nested within another inlined
1854 subroutine, the following rules apply to their abstract and
1855 \addtoindexx{abstract instance!nested}
1856 \addtoindexx{concrete instance!nested}
1857 concrete instance trees:
1859 \begin{enumerate}[1. ]
1860 \item The abstract instance tree for the nested subroutine is
1861 described within the abstract instance tree for the outer
1862 subroutine according to the rules in
1863 Section \refersec{chap:abstractinstances}, and
1864 without regard to the fact that it is within an outer abstract
1867 \item Any abstract instance tree for a nested subroutine is
1868 always omitted within the concrete instance tree for an
1871 \item A concrete instance tree for a nested subroutine is
1872 always omitted within the abstract instance tree for an
1875 \item The concrete instance tree for any inlined or
1876 \addtoindexx{out-of-line instance}
1878 \addtoindexx{out-of-line instance|see{\textit{also} concrete out-of-line instance}}
1879 expansion of the nested subroutine is described within a
1880 concrete instance tree for the outer subroutine according
1882 Sections \refersec{chap:concreteinlinedinstances} or
1883 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1885 and without regard to the fact that it is within an outer
1886 concrete instance tree.
1889 See Appendix \refersec{app:inliningexamples}
1890 for discussion and examples.
1892 \subsection{Trampolines}
1893 \label{chap:trampolines}
1895 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1896 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1897 an intermediary in making a call to another subroutine. It may
1898 adjust parameters and/or the result (if any) as appropriate
1899 to the combined calling and called execution contexts.}
1901 A trampoline is represented by a debugging information entry
1902 \addtoindexx{trampoline (subprogram) entry}
1903 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1905 \addtoindexx{trampoline attribute}
1906 a \DWATtrampoline{} attribute.
1908 attribute indicates the target subroutine of the trampoline,
1909 that is, the subroutine to which the trampoline passes
1910 control. (A trampoline entry may but need not also have a
1911 \DWATartificial{} attribute.)
1914 The value of the trampoline attribute may be represented
1915 using any of the following forms, which are listed in order
1919 \item If the value is of class reference, then the value
1920 specifies the debugging information entry of the target
1923 \item If the value is of class address, then the value is
1924 the relocated address of the target subprogram.
1926 \item If the value is of class string, then the value is the
1927 (possibly mangled) \addtoindexx{mangled names}
1928 name of the target subprogram.
1930 \item If the value is of class \livelink{chap:classflag}{flag}, then the value true
1931 indicates that the containing subroutine is a trampoline but
1932 that the target subroutine is not known.
1936 The target subprogram may itself be a trampoline. (A sequence
1937 of trampolines necessarily ends with a non\dash trampoline
1940 \textit{In \addtoindex{C++}, trampolines may be used
1941 to implement derived virtual
1942 member functions; such trampolines typically adjust the
1943 \addtoindexx{this parameter}
1944 implicit this pointer parameter in the course of passing
1946 Other languages and environments may use trampolines
1947 in a manner sometimes known as transfer functions or transfer
1950 \textit{Trampolines may sometimes pass control to the target
1951 subprogram using a branch or jump instruction instead of a
1952 call instruction, thereby leaving no trace of their existence
1953 in the subsequent execution context. }
1955 \textit{This attribute helps make it feasible for a debugger to arrange
1956 that stepping into a trampoline or setting a breakpoint in
1957 a trampoline will result in stepping into or setting the
1958 breakpoint in the target subroutine instead. This helps to
1959 hide the compiler generated subprogram from the user. }
1961 \textit{If the target subroutine is not known, a debugger may choose
1962 to repeatedly step until control arrives in a new subroutine
1963 which can be assumed to be the target subroutine. }
1965 \subsection{Call Site Entries}
1966 \label{chap:callsiteentries}
1968 A call site entry provides a way to represent the static or dynamic
1969 call graph of a program in the debugging information. It also provides
1970 information about how parameters are passed so that they may be more
1971 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
1972 call site entries can be also useful for computing values of variables
1973 and expressions where some value is no longer present in the current
1974 subroutine's registers or local stack frame, but it is known that the
1975 values are equal to some parameter passed to the function.
1976 The consumer can then use unwind
1977 information to find the caller and in the call site information sometimes
1978 find how to compute the value passed in a particular parameter.}
1980 A call site is represented by a debugging information entry with the tag
1981 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
1982 debugging information entry representing the scope within which the
1983 call is present in the source program.
1985 \textit{A scope entry (for example, for a lexical block) that would not
1986 otherwise be present in the debugging information of a subroutine
1987 need not be introduced solely to represent the immediately containing scope
1988 of a call. The call site entry is owned by the innermost scope entry that
1991 A source call can be compiled into different types of machine code:
1994 A \textit{normal call} uses a call-like instruction which transfers control to the start
1995 of some subprogram and leaves the call site location address somewhere where
1996 unwind information can find it.
1998 A \textit{tail call} uses a jump-like instruction which
1999 transfers control to the start of some subprogram, but the call site location
2000 address is not preserved (and thus not available using the unwind information).
2002 A \textit{tail recursion call} is a call
2003 to the current subroutine which is compiled as a loop into the middle of the
2007 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2008 where at least one instruction has the location of the inlined subprogram
2009 or any of its blocks or inlined subprograms.
2013 There are also different types of \doublequote{optimized out} calls:
2016 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2017 has not been emitted (such as, for example, the call to \texttt{foo} in
2018 \texttt{if (0) foo();}).
2020 An \textit{optimized out inline call}
2021 is a call to an inlined subprogram which either did not expand to any instructions
2022 or only parts of instructions belong to it and for debug information purposes those
2023 instructions are given a location in the caller.
2026 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2027 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2028 (see Section \refersec{chap:inlinedsubroutines}).
2030 The call site entry has a
2031 \DWATcallreturnpcNAME{}
2032 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2033 which is the return address after the call.
2034 The value of this attribute corresponds to the return address computed by
2035 call frame information in the called subprogram
2036 (see Section \refersec{datarep:callframeinformation}).
2038 \textit{On many architectures the return address is the address immediately following the
2039 call instruction, but on architectures with delay slots it might
2040 be an address after the delay slot of the call.}
2042 The call site entry may have a
2044 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2045 address of the call instruction.
2047 If the call site entry corresponds to a tail call, it has the
2048 \DWATcalltailcallNAME{}
2049 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2050 which is a \CLASSflag.
2052 The call site entry may have a
2053 \DWATcalloriginNAME{}
2054 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2055 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2056 known it is a reference to the called subprogram's debugging
2057 information entry. For indirect calls it may be a reference to a
2058 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2059 the subroutine pointer that is called.
2062 The call site may have a
2063 \DWATcalltargetNAME{}
2064 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2065 a DWARF expression. For indirect calls or jumps where it is unknown at
2066 compile time which subprogram will be called the expression computes the
2067 address of the subprogram that will be called. The DWARF expression should
2068 not use register or memory locations that might be clobbered by the call.
2071 The call site entry may have a
2072 \DWATcalltargetclobberedNAME{}
2073 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2074 which is a DWARF expression. For indirect calls or jumps where the
2075 address is not computable without use of registers or memory locations that
2076 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2077 attribute is used instead of the \DWATcalltarget{} attribute.
2079 The call site entry may have a \DWATtypeNAME{}
2080 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2081 referencing a debugging information entry for the type of the called function.
2082 When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.
2084 The call site entry may have
2085 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2086 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2087 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2088 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2089 each of whose value is an integer constant.
2090 These attributes represent the source file, source line number, and source
2091 column number, respectively, of the first character of the call statement or
2092 expression. The call file, call line, and call column attributes are
2093 interpreted in the same way as the declaration file, declaration
2094 line, and declaration column attributes, respectively
2095 (see Section \refersec{chap:declarationcoordinates}).
2097 \textit{The call file, call line and call column coordinates do not describe the
2098 coordinates of the subroutine declaration that was inlined, rather they describe
2099 the coordinates of the call.}
2101 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2102 entries\index{call site parameter entry} representing the parameters passed to the call.
2103 Each such entry has a \DWATlocation{} attribute which is a location expression.
2104 This location expression describes where the parameter is passed
2105 (usually either some register, or a memory location expressible as the
2106 contents of the stack register plus some offset).
2108 Each \DWTAGcallsiteparameter{} entry may have a
2109 \DWATcallvalueNAME{}
2110 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2111 which is a DWARF expression. This expression computes the value
2112 passed for that parameter. The expression should not use registers or memory
2113 locations that might be clobbered by the call, as it might be evaluated after
2114 unwinding from the called function back to the caller. If it is not
2115 possible to avoid registers or memory locations that might be clobbered by
2116 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2119 \textit{The reason for the restriction is that the value of the parameter may be
2120 needed in the middle of the callee, where the call clobbered registers or
2121 memory might be already clobbered, and if the consumer was not assured by
2122 the producer it can safely use those values, the consumer could not safely
2123 use the values at all.}
2125 For parameters passed by reference, where the code passes a pointer to
2126 a location which contains the parameter, or for reference type parameters
2127 the \DWTAGcallsiteparameter{} entry may also have
2128 \DWATcalldatalocationNAME{}
2129 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2130 whose value is a location expression and a
2131 \DWATcalldatavalueNAME{}
2132 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2133 whose value is a DWARF expression. The \DWATcalldatalocationNAME{} attribute
2134 describes where the referenced value lives during the call. If it is just
2135 \DWOPpushobjectaddress{}, it may be left out. The
2136 \DWATcalldatavalueNAME{} attribute describes the value in that location.
2137 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.
2142 Each call site parameter entry may also have a
2143 \DWATcallparameter{}
2144 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2145 which contains a reference to a \DWTAGformalparameter{} entry,
2146 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2147 attribute describing the parameter's name.
2151 \section{Lexical Block Entries}
2152 \label{chap:lexicalblockentries}
2155 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2157 \addtoindexx{lexical block}
2158 a bracketed sequence of source statements
2159 that may contain any number of declarations. In some languages
2160 (including \addtoindex{C} and \addtoindex{C++}),
2161 \nolink{blocks} can be nested within other
2162 \nolink{blocks} to any depth.}
2164 % We do not need to link to the preceding paragraph.
2165 A lexical \nolink{block} is represented by a debugging information
2167 tag \DWTAGlexicalblockTARG.
2169 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2171 either a \DWATlowpc{} and
2172 \DWAThighpc{} pair of
2174 \addtoindexx{high PC attribute}
2176 \addtoindexx{low PC attribute}
2178 \DWATranges{} attribute
2179 \addtoindexx{ranges attribute}
2180 whose values encode the contiguous or non-contiguous address
2181 ranges, respectively, of the machine instructions generated
2182 for the lexical \nolink{block}
2183 (see Section \refersec{chap:codeaddressesandranges}).
2186 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2187 lexical block entry may also have
2188 \addtoindexx{entry pc attribute!for lexical block}
2190 \DWATentrypc{} attribute
2191 whose value is the address of the first executable instruction
2192 of the lexical block (see
2193 Section \refersec{chap:entryaddress}).
2195 If a name has been given to the
2196 lexical \nolink{block}
2198 program, then the corresponding
2199 lexical \nolink{block} entry has a
2200 \DWATname{} attribute whose
2201 \addtoindexx{name attribute}
2202 value is a null\dash terminated string
2203 containing the name of the lexical \nolink{block}
2207 \textit{This is not the same as a \addtoindex{C} or
2208 \addtoindex{C++} label (see below).}
2210 The lexical \nolink{block} entry owns
2211 debugging information entries that
2212 describe the declarations within that lexical \nolink{block}.
2214 one such debugging information entry for each local declaration
2215 of an identifier or inner lexical \nolink{block}.
2218 \section{Label Entries}
2219 \label{chap:labelentries}
2220 \textit{A label is a way of identifying a source statement. A labeled
2221 statement is usually the target of one or more \doublequote{go to}
2226 A label is represented by a debugging information entry with
2227 \addtoindexx{label entry}
2229 tag \DWTAGlabelTARG.
2230 The entry for a label should be owned by
2231 the debugging information entry representing the scope within
2232 which the name of the label could be legally referenced within
2235 The label entry has a \DWATlowpc{} attribute whose value
2236 is the relocated address of the first machine instruction
2237 generated for the statement identified by the label in
2238 the source program. The label entry also has a
2239 \DWATname{} attribute
2240 \addtoindexx{name attribute}
2241 whose value is a null-terminated string containing
2242 the name of the label as it appears in the source program.
2245 \section{With Statement Entries}
2246 \label{chap:withstatemententries}
2248 \textit{Both \addtoindex{Pascal} and
2249 \addtoindexx{Modula-2}
2250 Modula\dash 2 support the concept of a \doublequote{with}
2251 statement. The with statement specifies a sequence of
2252 executable statements within which the fields of a record
2253 variable may be referenced, unqualified by the name of the
2256 A with statement is represented by a
2257 \addtoindexi{debugging information entry}{with statement entry}
2258 with the tag \DWTAGwithstmtTARG.
2260 A with statement entry may have either a
2262 \DWAThighpc{} pair of attributes
2263 \addtoindexx{high PC attribute}
2265 \addtoindexx{low PC attribute}
2266 a \DWATranges{} attribute
2267 \addtoindexx{ranges attribute}
2268 whose values encode the contiguous or non\dash contiguous address
2269 ranges, respectively, of the machine instructions generated
2270 for the with statement
2271 (see Section \refersec{chap:codeaddressesandranges}).
2274 \hypertarget{chap:DWATentrypcofwithstmt}{}
2275 with statement entry may also have
2276 \addtoindexx{entry pc attribute!for with statement}
2278 \DWATentrypc{} attribute
2279 whose value is the address of the first executable instruction
2280 of the with statement (see
2281 Section \refersec{chap:entryaddress}).
2284 The with statement entry has
2285 \addtoindexx{type attribute}
2286 a \DWATtype{} attribute, denoting
2287 the type of record whose fields may be referenced without full
2288 qualification within the body of the statement. It also has
2289 \addtoindexx{location attribute}
2290 a \DWATlocation{} attribute, describing how to find the base
2291 address of the record object referenced within the body of
2295 \section{Try and Catch Block Entries}
2296 \label{chap:tryandcatchblockentries}
2298 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
2299 designated as a \doublequote{catch \nolink{block}.}
2300 A catch \livetargi{chap:catchblock}{block}{catch block} is an
2301 exception handler that handles
2302 exceptions thrown by an immediately
2303 preceding \doublequote{try \livelink{chap:tryblock}{block}.}
2304 A catch \livelink{chap:catchblock}{block}
2305 designates the type of the exception that it
2308 A try \livetargi{chap:tryblock}{block}{try block} is represented
2309 by a debugging information entry
2310 \addtoindexx{try block entry}
2311 with the tag \DWTAGtryblockTARG.
2312 A catch \livelink{chap:catchblock}{block} is represented by
2313 a debugging information entry with
2314 \addtoindexx{catch block entry}
2315 the tag \DWTAGcatchblockTARG.
2317 % nolink as we have links just above and do not have a combo link for both
2318 Both try and catch \nolink{block} entries may have either a
2320 \DWAThighpc{} pair of attributes
2321 \addtoindexx{high PC attribute}
2323 \addtoindexx{low PC attribute}
2325 \DWATranges{} attribute
2326 \addtoindexx{ranges attribute}
2327 whose values encode the contiguous
2328 or non\dash contiguous address ranges, respectively, of the
2329 machine instructions generated for the \livelink{chap:lexicalblock}{block}
2331 \refersec{chap:codeaddressesandranges}).
2334 \hypertarget{chap:DWATentrypcoftryblock}{}
2335 \hypertarget{chap:DWATentrypcofcatchblock}{}
2336 try or catch block entry may also have
2337 \addtoindexx{entry pc attribute!for try block}
2338 \addtoindexx{entry pc attribute!for catch block}
2340 \DWATentrypc{} attribute
2341 whose value is the address of the first executable instruction
2342 of the try or catch block (see
2343 Section \refersec{chap:entryaddress}).
2345 Catch \livelink{chap:catchblock}{block} entries have at
2346 least one child entry, an
2347 entry representing the type of exception accepted by
2348 that catch \livelink{chap:catchblock}{block}.
2349 This child entry has one of
2350 \addtoindexx{formal parameter entry!in catch block}
2352 \addtoindexx{unspecified parameters entry!in catch block}
2354 \DWTAGformalparameter{} or
2355 \DWTAGunspecifiedparameters,
2356 and will have the same form as other parameter entries.
2358 The siblings immediately following
2359 a try \livelink{chap:tryblock}{block} entry are its
2360 corresponding catch \livelink{chap:catchblock}{block} entries.