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}.
138 \caption{Language names}
139 \label{tab:languagenames}
142 Language name & Meaning\\ \hline
143 \addtoindexx{ISO-defined language names}
144 \DWLANGAdaeightythreeTARG{} \dag & ISO Ada:1983 \addtoindexx{Ada:1983 (ISO)} \\
145 \DWLANGAdaninetyfiveTARG{} \dag & ISO Ada:1995 \addtoindexx{Ada:1995 (ISO)} \\
146 \DWLANGCTARG & Non-standardized C, such as K\&R \addtoindexx{C!non-standard}\\
147 \DWLANGCeightynineTARG & ISO C:1989 \addtoindexx{C:1989 (ISO)} \\
148 \DWLANGCninetynineTARG & ISO C:1999 \addtoindexx{C:1999 (ISO)} \\
149 \DWLANGCelevenTARG & ISO C:2011 \addtoindexx{C:2011 (ISO)} \\
150 \DWLANGCplusplusTARG & ISO C++:1998 \addtoindexx{C++:1998 (ISO)} \\
151 \DWLANGCpluspluszerothreeTARG & ISO C++:2003 \addtoindexx{C++:2003 (ISO)} \\
152 \DWLANGCpluspluselevenTARG & ISO C++:2011 \addtoindexx{C++:2011 (ISO)} \\
153 \DWLANGCobolseventyfourTARG & ISO COBOL:1974 \addtoindexx{COBOL:1974 (ISO)} \\
154 \DWLANGCoboleightyfiveTARG & ISO COBOL:1985 \addtoindexx{COBOL:1985 (ISO)} \\
155 \DWLANGDTARG{}~\dag & D \addtoindexx{D language} \\
156 \DWLANGFortranseventysevenTARG & ISO FORTRAN:1977 \addtoindexx{FORTRAN:1977 (ISO)} \\
157 \DWLANGFortranninetyTARG & ISO Fortran:1990 \addtoindexx{Fortran:1990 (ISO)} \\
158 \DWLANGFortranninetyfiveTARG & ISO Fortran:1995 \addtoindexx{Fortran:1995 (ISO)} \\
159 \DWLANGGoTARG{}~\dag & \addtoindex{Go} \\
160 \DWLANGHaskellTARG{} \dag & \addtoindex{Haskell} \\
161 \DWLANGJavaTARG{} & \addtoindex{Java}\\
162 \DWLANGJuliaTARG{}~\dag & \addtoindex{Julia} \\
163 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
164 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
165 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
166 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
167 \DWLANGOCamlTARG{}~\dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
168 \DWLANGOpenCLTARG{}~\dag & \addtoindex{OpenCL} \\
169 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
170 \DWLANGPLITARG{}~\dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
171 \DWLANGPythonTARG{}~\dag & \addtoindex{Python} \\
172 \DWLANGRustTARG{}~\dag & \addtoindex{Rust} \\
173 \DWLANGSwiftTARG{}~\dag & \addtoindex{Swift} \\
174 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
175 \index{Unified Parallel C|see{UPC}} \\
177 \dag \ \ \textit{Support for these languages is limited}& \\
181 \item A \DWATstmtlist{}
182 attribute whose value is
183 \addtoindexx{statement list attribute}
185 \addtoindexx{section offset!in statement list attribute}
187 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
188 offset to the line number information for this compilation
191 This information is placed in a separate object file
192 section from the debugging information entries themselves. The
193 value of the statement list attribute is the offset in the
194 \dotdebugline{} section of the first byte of the line number
195 information for this compilation unit
196 (see Section \refersec{chap:linenumberinformation}).
201 \item A \DWATmacros{} attribute
202 \addtoindexx{macro information attribute}
204 \addtoindexx{section offset!in macro information attribute}
206 \hypertarget{chap:DWATmacrosmacroinformation}{}
207 offset to the macro information for this compilation unit.
209 This information is placed in a separate object file section
210 from the debugging information entries themselves. The
211 value of the macro information attribute is the offset in
212 the \dotdebugmacro{} section of the first byte of the macro
213 information for this compilation unit
214 (see Section \refersec{chap:macroinformation}).
216 \textit{The \DWATmacros{} attribute is new in \DWARFVersionV,
218 \DWATmacroinfo{} attribute of earlier DWARF versions.
219 \livetarg{chap:DWATmacroinfomacroinformation}{}
220 While \DWATmacros{} and \DWATmacroinfo{} attributes cannot both occur in the same
221 compilation unit, both may be found in the set of units that make up an executable
222 or shared object. The two attributes have distinct encodings to facilitate such
229 \hypertarget{chap:DWATcompdircompilationdirectory}{}
231 null\dash terminated string containing the current working directory
232 of the compilation command that produced this compilation
233 unit in whatever form makes sense for the host system.
235 \item A \DWATproducer{} attribute
236 \addtoindexx{producer attribute}
237 whose value is a null\dash
238 terminated string containing information about the compiler
239 \hypertarget{chap:DWATproducercompileridentification}{}
240 that produced the compilation unit. The actual contents of
241 the string will be specific to each producer, but should
242 begin with the name of the compiler vendor or some other
243 identifying character sequence that should avoid confusion
244 with other producer values.
247 \item A \DWATidentifiercase{}
249 \addtoindexx{identifier case attribute}
251 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
252 constant value is a code describing the treatment
253 of identifiers within this compilation unit. The
254 set of identifier case codes is given in
255 Table \refersec{tab:identifiercasecodes}.
257 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
258 \DWIDcasesensitive{} \\
261 \DWIDcaseinsensitive{} \\
262 \end{simplenametable}
264 \DWIDcasesensitiveTARG{} is the default for all compilation units
265 that do not have this attribute. It indicates that names given
266 as the values of \DWATname{} attributes
267 \addtoindexx{name attribute}
268 in debugging information
269 entries for the compilation unit reflect the names as they
270 appear in the source program. The debugger should be sensitive
271 to the case of identifier names when doing identifier lookups.
274 \DWIDupcaseTARG{} means that the
275 producer of the debugging
276 information for this compilation unit converted all source
277 names to upper case. The values of the name attributes may not
278 reflect the names as they appear in the source program. The
279 debugger should convert all names to upper case when doing
282 \DWIDdowncaseTARG{} means that
283 the producer of the debugging
284 information for this compilation unit converted all source
285 names to lower case. The values of the name attributes may not
286 reflect the names as they appear in the source program. The
287 debugger should convert all names to lower case when doing
291 \DWIDcaseinsensitiveTARG{} means that the values of the name
292 attributes reflect the names as they appear in the source
293 program but that a case insensitive lookup should be used to
297 \item A \DWATbasetypes{} attribute whose value is a
298 \livelink{chap:classreference}{reference}.
301 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
303 \addtoindexx{base types attribute}
304 points to a debugging information entry
305 representing another compilation unit. It may be used
306 to specify the compilation unit containing the base type
307 entries used by entries in the current compilation unit
308 (see Section \refersec{chap:basetypeentries}).
311 This attribute provides a consumer a way to find the definition
312 of base types for a compilation unit that does not itself
313 contain such definitions. This allows a consumer, for example,
314 to interpret a type conversion to a base type
315 % getting this link target at the right spot is tricky.
316 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
319 \item A \DWATuseUTFeight{} attribute,
320 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
321 which is a \livelink{chap:classflag}{flag} whose
322 presence indicates that all strings (such as the names of
323 declared entities in the source program, or file names in the line table)
324 are represented using the UTF\dash 8 representation.
326 \item A \DWATmainsubprogram{} attribute, which is a \livelink{chap:classflag}{flag}
327 \addtoindexx{main subprogram attribute}
328 whose presence indicates
329 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
330 that the compilation unit contains a
331 subprogram that has been identified as the starting function
332 of the program. If more than one compilation unit contains
333 this \nolink{flag}, any one of them may contain the starting function.
335 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
337 to specify and provide a user\dash specified name for the main
338 subroutine of a program.
339 \addtoindex{C} uses the name \doublequote{main} to identify
340 the main subprogram of a program. Some other languages provide
341 similar or other means to identify the main subprogram of
344 \item A \DWATentrypc{} attribute whose value is the address of the first
345 \hypertarget{chap:DWATentrypcofcompileunit}{}
346 \hypertarget{chap:DWATentrypcofpartialunit}{}
347 \addtoindexx{entry pc attribute!for normal compilation unit}
348 \addtoindexx{entry pc attribute!for partial compilation unit}
349 executable instruction of the unit (see
350 Section \refersec{chap:entryaddress}).
352 \item A \DWATstroffsetsbaseNAME\addtoindexx{string offset base attribute}
353 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
354 attribute, whose value is a reference.
355 This attribute points to the first string
356 offset of the compilation unit's contribution to the
357 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
358 Indirect string references
359 (using \DWFORMstrx) within the compilation unit are
360 interpreted as indices relative to this base.
363 \item A \DWATaddrbaseNAME\addtoindexx{address table base attribute}
364 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
365 attribute, whose value is a reference.
366 This attribute points to the beginning of the compilation
367 unit's contribution to the \dotdebugaddr{} section.
368 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
369 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
370 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
371 interpreted as indices relative to this base.
374 \item A \DWATrangesbaseNAME\addtoindexx{ranges table base attribute}
375 \hypertarget{chap:DWATrangesbaseforrangelists}{}
376 attribute, whose value is a reference.
377 This attribute points to the beginning of the compilation
378 unit's contribution to the \dotdebugranges{} section.
379 References to range lists (using \DWFORMsecoffset)
380 within the compilation unit are
381 interpreted as offsets relative to this base.
386 The base address of a compilation unit is defined as the
387 value of the \DWATlowpc{} attribute, if present; otherwise,
388 it is undefined. If the base address is undefined, then any
389 DWARF entry or structure defined in terms of the base address
390 of that compilation unit is not valid.
392 \subsection{Skeleton Compilation Unit Entries}
393 \label{chap:skeletoncompilationunitentries}
394 When generating a split DWARF object (see
395 Section \refersec{datarep:splitdwarfobjects}), the
396 compilation unit in the \dotdebuginfo{} section is a "skeleton"
397 compilation unit, which contains only a subset of the
398 attributes of the full compilation unit. In general, it
399 contains those attributes that are necessary for the consumer
400 to locate the DWARF object where the full compilation unit
401 can be found, and for the consumer to interpret references to
402 addresses in the program.
404 A skeleton compilation unit has no
405 children, and may have the following attributes:
406 \begin{enumerate}[1. ]
409 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
410 or a \DWATranges{} attribute (the same as for regular
411 compilation unit entries).
414 A \DWATstmtlist{} attribute (the same as for regular
415 compilation unit entries).
418 A \DWATcompdir{} attribute (the same as for regular
419 compilation unit entries).
422 \livetarg{chap:DWATdwonameforunit}{}
423 A \DWATdwonameNAME{} attribute whose value is a
424 null-terminated string containing the full or relative
425 path name of the DWARF object file that contains the full
429 \livetarg{chap:DWATdwoidforunit}{}
430 A \DWATdwoidNAME{} attribute whose value is an 8-byte
431 unsigned hash of the full compilation unit. This hash
432 value is computed by the method described in
433 Section \refersec{datarep:typesignaturecomputation}.
437 A \DWATuseUTFeight{} attribute (the same as for regular compilation unit
440 \textit{This attribute applies to strings referred to by the skeleton
441 compilation unit entry itself, and strings in the associated line
443 The representation for strings in the DWARF object file is determined
444 by the presence of a \DWATuseUTFeight{} attribute in the full compilation
448 A \DWATstroffsetsbase{} attribute, for indirect strings references
449 from the skeleton compilation unit (the same as for regular
450 compilation unit entries).
453 A \DWATaddrbase{} attribute (the same as for regular
454 compilation unit entries).
457 A \DWATrangesbase{} attribute (the same as for regular
458 compilation unit entries).
462 All other attributes of a compilation unit entry (described
463 in Section \refersec{chap:normalandpartialcompilationunitentries})
464 should be placed in the full compilation
465 unit entry in the \dotdebuginfodwo{} section of the split DWARF
466 object. The attributes provided by the skeleton compilation
467 unit entry do not need to be repeated in the full compilation
468 unit entry, except for \DWATdwoid, which should appear in
469 both entries so that the consumer can verify that it has
470 found the correct DWARF object.
473 \subsection{Imported Unit Entries}
474 \label{chap:importedunitentries}
476 \hypertarget{chap:DWATimportimportedunit}{}
477 place where a normal or partial unit is imported is
478 represented by a debugging information entry with the
479 \addtoindexx{imported unit entry}
480 tag \DWTAGimportedunitTARG.
481 An imported unit entry contains
482 \addtoindexx{import attribute}
484 \DWATimport{} attribute
485 whose value is a \livelink{chap:classreference}{reference} to the
486 normal or partial compilation unit whose declarations logically
487 belong at the place of the imported unit entry.
489 \textit{An imported unit entry does not necessarily correspond to
490 any entity or construct in the source program. It is merely
491 \doublequote{glue} used to relate a partial unit, or a compilation
492 unit used as a partial unit, to a place in some other
496 \subsection{Separate Type Unit Entries}
497 \label{chap:separatetypeunitentries}
498 An object file may contain any number of separate type
499 unit entries, each representing a single complete type
501 Each \addtoindex{type unit} must be uniquely identified by
502 a 64\dash bit signature, stored as part of the type unit, which
503 can be used to reference the type definition from debugging
504 information entries in other compilation units and type units.
506 A type unit is represented by a debugging information entry
507 with the tag \DWTAGtypeunitTARG.
508 A \addtoindex{type unit entry} owns debugging
509 information entries that represent the definition of a single
510 type, plus additional debugging information entries that may
511 be necessary to include as part of the definition of the type.
513 A type unit entry may have a
514 \DWATlanguage{} attribute,
516 \addtoindexx{language attribute}
517 constant value is an integer code indicating the source
518 language used to define the type. The set of language names
519 and their meanings are given in Table \refersec{tab:languagenames}.
521 A type unit entry may have a
522 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
523 attribute, whose value is a reference. This attribute points
524 to the first string offset of the type unit's contribution to
525 the \dotdebugstroffsets{} section. Indirect string references
526 (using \DWFORMstrx) within the type unit must be interpreted
527 as indices relative to this base.
529 A type unit entry may have a \DWATstmtlist{} attribute, whose
530 value is a section offset to a line number table for this
531 type unit. Because type units do not describe any code, they
532 do not actually need a line number table, but the line number
533 tables also contain a list of directories and file names that
534 may be referenced by the \DWATdeclfile{} attribute. In a
535 normal object file with a regular compilation unit entry, the
536 type unit entries can simply refer to the line number table
537 used by the compilation unit. In a split DWARF object, where
538 the type units are located in a separate DWARF object file,
539 the \DWATstmtlist{} attribute refers to a "skeleton"
540 line number table in the \dotdebuglinedwo{} section, which
541 contains only the list of directories and file names. All
542 type unit entries in a split DWARF object may (but are not
543 required to) refer to the same skeleton line number table.
545 A type unit entry may have a \DWATuseUTFeight{} attribute, which is a flag
546 whose presence indicates that all strings referred to by this type
547 unit entry, its children, and the skeleton line number table, are
548 represented using the UTF-8 representation.
551 A \addtoindex{type unit} entry for a given type T owns a debugging
552 information entry that represents a defining declaration
553 of type T. If the type is nested within enclosing types or
554 namespaces, the debugging information entry for T is nested
555 within debugging information entries describing its containers;
556 otherwise, T is a direct child of the type unit entry.
558 A type unit entry may also own additional debugging information
559 entries that represent declarations of additional types that
560 are referenced by type T and have not themselves been placed in
561 separate type units. Like T, if an additional type U is nested
562 within enclosing types or namespaces, the debugging information
563 entry for U is nested within entries describing its containers;
564 otherwise, U is a direct child of the type unit entry.
566 The containing entries for types T and U are declarations,
567 and the outermost containing entry for any given type T or
568 U is a direct child of the type unit entry. The containing
569 entries may be shared among the additional types and between
570 T and the additional types.
572 \textit{Types are not required to be placed in type units. In general,
573 only large types such as structure, class, enumeration, and
574 union types included from header files should be considered
575 for separate type units. Base types and other small types
576 are not usually worth the overhead of placement in separate
577 type units. Types that are unlikely to be replicated, such
578 as those defined in the main source file, are also better
579 left in the main compilation unit.}
581 \section{Module, Namespace and Importing Entries}
582 \textit{Modules and namespaces provide a means to collect related
583 entities into a single entity and to manage the names of
586 \subsection{Module Entries}
587 \label{chap:moduleentries}
588 \textit{Several languages have the concept of a \doublequote{module.}
589 \addtoindexx{Modula-2}
590 A Modula\dash 2 definition module
591 \addtoindexx{Modula-2!definition module}
592 may be represented by a module
594 \addtoindex{declaration attribute}
595 (\DWATdeclaration). A
596 \addtoindex{Fortran 90} module
597 \addtoindexx{Fortran!module (Fortran 90)}
598 may also be represented by a module entry
599 (but no declaration attribute is warranted because \addtoindex{Fortran}
600 has no concept of a corresponding module body).}
602 A module is represented by a debugging information entry
604 tag \DWTAGmoduleTARG.
605 Module entries may own other
606 debugging information entries describing program entities
607 whose declaration scopes end at the end of the module itself.
609 If the module has a name, the module entry has a
610 \DWATname{} attribute
611 \addtoindexx{name attribute}
612 whose value is a null\dash terminated string containing
613 the module name as it appears in the source program.
615 The \addtoindex{module entry} may have either a
619 \addtoindexx{high PC attribute}
621 \addtoindexx{low PC attribute}
623 \DWATranges{} attribute
624 \addtoindexx{ranges attribute}
625 whose values encode the contiguous or non\dash contiguous address
626 ranges, respectively, of the machine instructions generated for
627 the module initialization code
628 (see Section \refersec{chap:codeaddressesandranges}).
629 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
631 \addtoindexx{entry pc attribute!for module initialization}
633 \DWATentrypc{} attribute whose value is the address of
634 the first executable instruction of that initialization code
635 (see Section \refersec{chap:entryaddress}).
638 \hypertarget{chap:DWATprioritymodulepriority}{}
639 the module has been assigned a priority, it may have
640 \addtoindexx{priority attribute}
642 \DWATpriority{} attribute.
643 The value of this attribute is a
644 reference to another debugging information entry describing
645 a variable with a constant value. The value of this variable
646 is the actual constant value of the module\textquoteright s priority,
647 represented as it would be on the target architecture.
649 \subsection{Namespace Entries}
650 \label{chap:namespaceentries}
651 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
652 \addtoindexx{namespace (C++)}
653 implement name hiding, so that names of unrelated things
654 do not accidentally clash in the
655 \addtoindex{global namespace} when an
656 application is linked together.}
658 A namespace is represented by a debugging information entry
660 tag \DWTAGnamespaceTARG.
661 A namespace extension is
662 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
664 \DWTAGnamespace{} entry
666 \addtoindexx{extension attribute}
669 attribute referring to the previous extension, or if there
670 is no previous extension, to the original
672 entry. A namespace extension entry does not need to duplicate
673 information in a previous extension entry of the namespace
674 nor need it duplicate information in the original namespace
675 entry. (Thus, for a namespace with a name,
676 a \DWATname{} attribute
677 \addtoindexx{name attribute}
678 need only be attached directly to the original
679 \DWTAGnamespace{} entry.)
682 Namespace and namespace extension entries may own
683 \addtoindexx{namespace extension entry}
685 \addtoindexx{namespace declaration entry}
686 debugging information entries describing program entities
687 whose declarations occur in the namespace.
689 \textit{For \addtoindex{C++}, such
690 owned program entities may be declarations,
691 including certain declarations that are also object or
692 function definitions.}
694 If a type, variable, or function declared in a namespace is
695 defined outside of the body of the namespace declaration,
696 that type, variable, or function definition entry has a
697 \DWATspecification{} attribute
698 \addtoindexx{specification attribute}
699 whose value is a \livelink{chap:classreference}{reference} to the
700 debugging information entry representing the declaration of
701 the type, variable or function. Type, variable, or function
703 \DWATspecification{} attribute
704 \addtoindexx{specification attribute}
706 to duplicate information provided by the declaration entry
707 referenced by the specification attribute.
709 \textit{The \addtoindex{C++} \addtoindex{global namespace}
711 \addtoindexx{global namespace|see{namespace (C++), global}}
713 \addtoindexx{namespace (C++)!global}
715 \texttt{::f}, for example) is not explicitly represented in
716 DWARF with a namespace entry (thus mirroring the situation
717 in \addtoindex{C++} source).
718 Global items may be simply declared with no
719 reference to a namespace.}
721 \textit{The \addtoindex{C++}
722 compilation unit specific \doublequote{unnamed namespace} may
723 \addtoindexx{namespace (C++)!unnamed}
724 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
725 be represented by a namespace entry with no name attribute in
726 the original namespace declaration entry (and therefore no name
727 attribute in any namespace extension entry of this namespace).
730 \textit{A compiler emitting namespace information may choose to
731 explicitly represent namespace extensions, or to represent the
732 final namespace declaration of a compilation unit; this is a
733 quality\dash of\dash implementation issue and no specific requirements
734 are given here. If only the final namespace is represented,
735 \addtoindexx{namespace (C++)!using declaration}
736 it is impossible for a debugger to interpret using declaration
737 references in exactly the manner defined by the
738 \addtoindex{C++} language.
741 \textit{Emitting all namespace declaration information in all
742 compilation units can result in a significant increase in the
743 size of the debug information and significant duplication of
744 information across compilation units.
745 The \addtoindex{C++} namespace std,
747 \addtoindexx{namespace (C++)!std}
748 is large and will probably be referenced in
749 every \addtoindex{C++} compilation unit.
752 \textit{For a \addtoindex{C++} namespace example,
753 see Appendix \refersec{app:namespaceexample}.
758 \subsection{Imported (or Renamed) Declaration Entries}
759 \label{chap:importedorrenameddeclarationentries}
760 \textit{Some languages support the concept of importing into or making
761 accessible in a given unit declarations made in a different
762 module or scope. An imported declaration may sometimes be
767 imported declaration is represented by one or
768 \addtoindexx{imported declaration entry}
769 more debugging information entries with the
770 tag \DWTAGimporteddeclarationTARG.
772 \hypertarget{chap:DWATimportimporteddeclaration}{}
774 is imported, there is one imported declaration entry for
776 \addtoindexx{import attribute}
777 Each imported declaration entry has a
778 \DWATimport{} attribute,
779 whose value is a \livelink{chap:classreference}{reference} to the
780 debugging information entry representing the declaration that
783 An imported declaration may also have a
786 \addtoindexx{name attribute}
787 whose value is a null\dash terminated string containing the
788 name, as it appears in the source program, by which the
789 imported entity is to be known in the context of the imported
790 declaration entry (which may be different than the name of
791 the entity being imported). If no name is present, then the
792 name by which the entity is to be known is the same as the
793 name of the entity being imported.
795 An imported declaration entry with a name attribute may be
796 used as a general means to rename or provide an alias for
797 \addtoindexx{alias declaration|see{imported declaration entry}}
798 an entity, regardless of the context in which the importing
799 declaration or the imported entity occurs.
801 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
802 \hypertarget{chap:DWATimportnamespacealias}{}
804 \addtoindexx{namespace (C++)!alias}
805 with a name attribute whose value is
806 a null\dash terminated string containing the alias name as it
807 appears in the source program and an import attribute whose
808 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
809 namespace extension entry.
812 \textit{A \addtoindex{C++} using declaration may be represented by one or more
813 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
815 \addtoindexx{namespace (C++)!using declaration}
816 declaration entries. When the using declaration
817 refers to an overloaded function, there is one imported
818 declaration entry corresponding to each overloading. Each
819 imported declaration entry has no name attribute but it does
820 have an import attribute that refers to the entry for the
821 entity being imported. (\addtoindex{C++}
822 provides no means to \doublequote{rename}
823 an imported entity, other than a namespace).
826 \textit{A \addtoindex{Fortran} use statement
827 \addtoindexx{Fortran!use statement}
828 \addtoindexx{use statement|see {Fortran, use statement}}
829 with an \doublequote{only list} may be
830 represented by a series of imported declaration entries,
831 one (or more) for each entity that is imported. An entity
832 \addtoindexx{renamed declaration|see{imported declaration entry}}
833 that is renamed in the importing context may be represented
834 by an imported declaration entry with a name attribute that
835 specifies the new local name.
838 \subsection{Imported Module Entries}
839 \label{chap:importedmoduleentries}
841 \textit{Some languages support the concept of importing into or making
842 accessible in a given unit all of the declarations contained
843 within a separate module or namespace.
846 An imported module declaration is represented by a debugging
847 information entry with
848 \addtoindexx{imported module attribute}
850 \addtoindexx{imported module entry}
851 tag \DWTAGimportedmoduleTARG.
853 imported module entry contains a
854 \DWATimport{} attribute
855 \addtoindexx{import attribute}
856 whose value is a \livelink{chap:classreference}{reference}
857 to the module or namespace entry
858 containing the definition and/or declaration entries for
859 the entities that are to be imported into the context of the
860 imported module entry.
862 An imported module declaration may own a set of imported
863 declaration entries, each of which refers to an entry in the
864 module whose corresponding entity is to be known in the context
865 of the imported module declaration by a name other than its
866 name in that module. Any entity in the module that is not
867 renamed in this way is known in the context of the imported
868 module entry by the same name as it is declared in the module.
870 \textit{A \addtoindex{C++} using directive
871 \addtoindexx{namespace (C++)!using directive}
872 \addtoindexx{using directive|see {namespace (C++), using directive}}
873 may be represented by an imported module
874 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
875 entry, with an import attribute referring to the namespace
876 entry of the appropriate extension of the namespace (which
877 might be the original namespace entry) and no owned entries.
880 \textit{A \addtoindex{Fortran} use statement
881 \addtoindexx{Fortran!use statement}
882 with a \doublequote{rename list} may be
883 represented by an imported module entry with an import
884 attribute referring to the module and owned entries
885 corresponding to those entities that are renamed as part of
889 \textit{A \addtoindex{Fortran} use statement
890 \addtoindexx{Fortran!use statement}
891 with neither a \doublequote{rename list} nor
892 an \doublequote{only list} may be represented by an imported module
893 entry with an import attribute referring to the module and
894 no owned child entries.
897 \textit{A use statement with an \doublequote{only list} is represented by a
898 series of individual imported declaration entries as described
899 in Section \refersec{chap:importedorrenameddeclarationentries}.
902 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
903 \addtoindexx{Fortran!use statement}
904 itself imported by a use statement without an explicit mention
905 may be represented by an imported declaration entry that refers
906 to the original debugging information entry. For example, given
923 \textit{the imported declaration entry for Q within module C refers
924 directly to the variable declaration entry for X in module A
925 because there is no explicit representation for X in module B.
928 \textit{A similar situation arises for a \addtoindex{C++} using declaration
929 \addtoindexx{namespace (C++)!using declaration}
930 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
931 that imports an entity in terms of a namespace alias. See
932 Appendix \refersec{app:namespaceexample}
936 \section{Subroutine and Entry Point Entries}
937 \label{chap:subroutineandentrypointentries}
939 The following tags exist to describe
940 debugging information entries
941 \addtoindexx{function entry|see{subroutine entry}}
943 \addtoindexx{subroutine entry}
945 \addtoindexx{subprogram entry}
947 % FIXME: is entry point entry the right index 'entry'?
948 \addtoindexx{entry point entry}
951 \begin{tabular}{lp{9.0cm}}
952 \DWTAGsubprogramTARG{} & A subroutine or function \\
953 \DWTAGinlinedsubroutine{} & A particular inlined
954 \addtoindexx{inlined subprogram entry}
955 instance of a subroutine or function \\
956 \DWTAGentrypointTARG{} & An alternate entry point \\
961 \subsection{General Subroutine and Entry Point Information}
962 \label{chap:generalsubroutineandentrypointinformation}
963 The subroutine or entry point entry has a \DWATname{}
964 attribute whose value is a null-terminated string containing the
965 subroutine or entry point name as it appears in the source program.
966 It may also have a \DWATlinkagename{} attribute as
967 described in Section \refersec{chap:linkagenames}.
969 If the name of the subroutine described by an entry with the
970 \addtoindexx{subprogram entry}
971 tag \DWTAGsubprogram{}
972 is visible outside of its containing
973 \hypertarget{chap:DWATexternalexternalsubroutine}{}
974 compilation unit, that entry has
975 \addtoindexx{external attribute}
977 \DWATexternalNAME{} attribute,
978 which is a \livelink{chap:classflag}{flag}.
980 \textit{Additional attributes for functions that are members of a
981 class or structure are described in
982 Section \refersec{chap:memberfunctionentries}.
986 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
989 \DWATmainsubprogramNAME{}
991 \addtoindexx{main subprogram attribute}
993 a \CLASSflag whose presence indicates that the
994 subroutine has been identified as the starting function of
995 the program. If more than one subprogram contains this
997 any one of them may be the starting subroutine of the program.
999 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
1000 which is used to specify
1001 and provide a user\dash supplied name for the main subroutine of
1005 \textit{A common debugger feature is to allow the debugger user to call
1006 a subroutine within the subject program. In certain cases,
1007 however, the generated code for a subroutine will not obey
1008 the standard calling conventions for the target architecture
1009 and will therefore not be safe to call from within a debugger.
1012 A subroutine entry may
1013 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}{}
1015 \DWATcallingconventionNAME{}
1016 attribute, whose value is an
1017 \livelink{chap:classconstant}{integer constant}. The set of
1018 calling convention codes is given in
1019 Table \refersec{tab:callingconventioncodes}.
1021 \begin{simplenametable}[1.4in]{Calling convention codes}{tab:callingconventioncodes}
1025 \end{simplenametable}
1027 If this attribute is not present, or its value is the constant
1028 \DWCCnormalTARG, then the subroutine may be safely called by
1029 obeying the \doublequote{standard} calling conventions of the target
1030 architecture. If the value of the calling convention attribute
1031 is the constant \DWCCnocallTARG, the subroutine does not obey
1032 standard calling conventions, and it may not be safe for the
1033 debugger to call this subroutine.
1035 If the semantics of the language of the compilation unit
1036 containing the subroutine entry distinguishes between ordinary
1037 subroutines and subroutines that can serve as the \doublequote{main
1038 program,} that is, subroutines that cannot be called
1039 directly according to the ordinary calling conventions,
1040 then the debugging information entry for such a subroutine
1041 may have a calling convention attribute whose value is the
1042 constant \DWCCprogramTARG.
1044 \textit{The \DWCCprogram{}
1045 value is intended to support \addtoindex{Fortran} main
1046 \addtoindexx{Fortran!main program}
1047 programs which in some implementations may not be callable
1048 or which must be invoked in a special way. It is not intended
1049 as a way of finding the entry address for the program.
1052 \textit{In \addtoindex{C}
1053 there is a difference between the types of functions
1054 declared using function prototype style declarations and
1055 those declared using non\dash prototype declarations.
1058 A subroutine entry declared with a function prototype style
1059 declaration may have
1060 \addtoindexx{prototyped attribute}
1062 \DWATprototypedNAME{} attribute, which is
1065 \textit{The \addtoindex{Fortran}
1066 language allows the keywords \texttt{elemental}, \texttt{pure}
1067 and \texttt{recursive} to be included as part of the declaration of
1068 a subroutine; these attributes reflect that usage. These
1069 attributes are not relevant for languages that do not support
1070 similar keywords or syntax. In particular, the \DWATrecursiveNAME{}
1071 attribute is neither needed nor appropriate in languages such
1073 where functions support recursion by default.
1077 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1079 \addtoindexx{elemental attribute}
1081 \DWATelementalNAME{} attribute, which
1082 is a \livelink{chap:classflag}{flag}.
1083 The attribute indicates whether the subroutine
1084 or entry point was declared with the \doublequote{elemental} keyword
1088 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1089 subprogram entry may have
1090 \addtoindexx{pure attribute}
1092 \DWATpureNAME{} attribute, which is
1093 a \livelink{chap:classflag}{flag}.
1094 The attribute indicates whether the subroutine was
1095 declared with the \doublequote{pure} keyword or property.
1098 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1099 subprogram entry may have a
1100 \DWATrecursiveNAME{} attribute, which
1101 is a \livelink{chap:classflag}{flag}.
1102 The attribute indicates whether the subroutine
1103 or entry point was declared with the \doublequote{recursive} keyword
1106 A subprogram entry may have a
1108 \livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1109 which is a \CLASSflag. The attribute
1110 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1111 indicating that the subprogram can be called, but will never return to its caller.
1113 \subsubsection{Call Site-Related Attributes}
1114 A subroutine entry may have \DWATcallalltailcalls, \DWATcallallcalls{}
1115 and/or \DWATcallallsourcecalls{} attributes, each of which is a
1116 \livelink{chap:classflag}{flag}.
1117 These flags indicate the completeness of the call site information
1118 within the subprogram.
1120 The \DWATcallalltailcallsNAME{}
1121 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1122 indicates that every tail call
1123 that occurs in the code for the subprogram is described by a
1124 \DWTAGcallsite{} entry.
1125 (There may or may not be other non-tail calls to some of the same
1126 target subprograms.)
1128 The \DWATcallallcallsNAME{}
1129 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1130 indicates that every non-inlined call
1131 (either a tail call or a normal call) that occurs in the code for the subprogram
1132 is described by a \DWTAGcallsite{} entry.
1134 The \DWATcallallsourcecallsNAME{}
1135 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1136 indicates that every call that occurs in the
1137 code for the subprogram, including every call inlined into it, is described by either a
1138 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1139 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1140 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1142 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1143 information format consumers that analyse call graphs.}
1145 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1146 \DWATcallallcalls{} and \DWATcallallcalls{} attributes are necessarily also true, and
1147 those attributes need not be present. Similarly, if the value of the
1148 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1149 attribute is also true and the latter attribute need not be present.
1151 \subsection{Subroutine and Entry Point Return Types}
1152 \label{chap:subroutineandentrypointreturntypes}
1155 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1156 the subroutine or entry point
1157 \addtoindexx{return type of subroutine}
1158 is a function that returns a
1159 value, then its debugging information entry has
1160 \addtoindexx{type attribute}
1161 a \DWATtype{} attribute
1162 to denote the type returned by that function.
1164 \textit{Debugging information entries for
1165 \addtoindex{C} void functions should
1166 not have an attribute for the return type. }
1168 \textit{Debugging information entries for declarations of \addtoindex{C++}
1169 member functions with an
1170 \addtoindex{\texttt{auto} return type} specifier should use an unspecified
1172 Section \refersec{chap:unspecifiedtypeentries}).
1173 The debugging information entry for the corresponding definition
1174 should provide the deduced return type. This practice causes the description of
1175 the containing class to be consistent across compilation units, allowing the class
1176 declaration to be placed into a separate type unit if desired.}
1179 \subsection{Subroutine and Entry Point Locations}
1180 \label{chap:subroutineandentrypointlocations}
1182 A subroutine entry may have either a \DWATlowpc{} and
1183 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1184 \addtoindexx{ranges attribute}
1186 \addtoindexx{high PC attribute}
1188 \addtoindexx{low PC attribute}
1189 encode the contiguous or non\dash contiguous address
1190 ranges, respectively, of the machine instructions generated
1191 for the subroutine (see
1192 Section \refersec{chap:codeaddressesandranges}).
1195 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1196 subroutine entry may also have
1197 \addtoindexx{entry pc attribute!for subroutine}
1199 \DWATentrypc{} attribute
1200 whose value is the address of the first executable instruction
1201 of the subroutine (see
1202 Section \refersec{chap:entryaddress}).
1204 An entry point has a \DWATlowpc{} attribute whose value is the
1205 relocated address of the first machine instruction generated
1206 for the entry point.
1209 \DWATentrypc{} attribute
1210 \addtoindexx{entry pc attribute!for subroutine}
1212 also seem appropriate
1213 for this purpose, historically the
1214 \DWATlowpc{} attribute
1216 \DWATentrypc{} was introduced (in
1217 \addtoindex{DWARF Version 3}).
1218 There is insufficient reason to change this.}
1224 \addtoindexx{address class!attribute}
1226 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1230 \DWATaddressclass{} attributes,
1231 as appropriate, to specify
1232 which segments the code for the subroutine resides in and
1233 the addressing mode to be used in calling that subroutine.
1235 A subroutine entry representing a subroutine declaration
1236 that is not also a definition does not have code address or
1240 \subsection{Declarations Owned by Subroutines and Entry Points}
1241 \label{chap:declarationsownedbysubroutinesandentrypoints}
1243 The declarations enclosed by a subroutine or entry point are
1244 represented by debugging information entries that are owned
1245 by the subroutine or entry point entry. Entries representing
1246 \addtoindexx{formal parameter}
1247 the formal parameters of the subroutine or entry point appear
1248 in the same order as the corresponding declarations in the
1252 \textit{There is no ordering requirement for entries for declarations
1253 that are children of subroutine or entry point entries but
1254 that do not represent formal parameters. The formal parameter
1255 entries may be interspersed with other entries used by formal
1256 parameter entries, such as type entries.}
1258 The unspecified parameters of a variable parameter list are
1259 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1261 \DWTAGunspecifiedparametersTARG.
1264 The entry for a subroutine that includes a
1265 \addtoindex{Fortran}
1266 \addtoindexx{Fortran!common block}
1267 \livelink{chap:fortrancommonblock}{common}
1268 \livelink{chap:commonblockentry}{block}
1269 \addtoindexx{common block|see{Fortran common block}}
1270 has a child entry with the
1271 tag \DWTAGcommoninclusionTARG.
1273 \hypertarget{chap:commonreferencecommonblockusage}{}
1274 common inclusion entry has a
1275 \DWATcommonreference{} attribute
1276 whose value is a \livelink{chap:classreference}{reference}
1277 to the debugging information entry
1278 for the common \nolink{block} being included
1279 (see Section \refersec{chap:commonblockentries}).
1281 \subsection{Low-Level Information}
1282 \label{chap:lowlevelinformation}
1285 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1286 subroutine or entry point entry may have
1287 \addtoindexx{return address attribute}
1290 attribute, whose value is a location description. The location
1291 calculated is the place where the return address for the
1292 subroutine or entry point is stored.
1295 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1296 subroutine or entry point entry may also have
1297 \addtoindexx{frame base attribute}
1299 \DWATframebase{} attribute, whose value is a location
1300 description that computes the \doublequote{frame base} for the
1301 subroutine or entry point. If the location description is
1302 a simple register location description, the given register
1303 contains the frame base address. If the location description is
1304 a DWARF expression, the result of evaluating that expression
1305 is the frame base address. Finally, for a
1306 \addtoindex{location list},
1307 this interpretation applies to each location description
1308 contained in the list of \addtoindex{location list} entries.
1310 \textit{The use of one of the \DWOPregn{}
1312 context is equivalent to using
1315 compact. However, these are not equivalent in general.}
1318 \textit{The frame base for a procedure is typically an address fixed
1319 relative to the first unit of storage allocated for the
1320 procedure\textquoteright s stack frame. The \DWATframebase{} attribute
1321 can be used in several ways:}
1322 \begin{enumerate}[1. ]
1323 \item \textit{In procedures that need
1324 \addtoindexx{location list}
1325 location lists to locate local
1326 variables, the \DWATframebase{} can hold the needed location
1327 list, while all variables\textquoteright\ location descriptions can be
1328 simpler ones involving the frame base.}
1330 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1331 within nested routines.
1332 (See also \DWATstaticlink, below)}
1336 \textit{Some languages support nested subroutines. In such languages,
1337 it is possible to reference the local variables of an
1338 outer subroutine from within an inner subroutine. The
1339 \DWATstaticlink{} and \DWATframebase{} attributes allow
1340 debuggers to support this same kind of referencing.}
1343 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1345 \addtoindexx{address!uplevel|see {static link attribute}}
1346 \addtoindexx{uplevel address|see {static link attribute}}
1347 subroutine or entry point is nested, it may have a
1349 attribute, whose value is a location
1350 description that computes the frame base of the relevant
1351 instance of the subroutine that immediately encloses the
1352 subroutine or entry point.
1354 In the context of supporting nested subroutines, the
1355 \DWATframebase{} attribute value should obey the following
1358 \begin{enumerate}[1. ]
1359 \item It should compute a value that does not change during the
1360 life of the procedure, and
1362 \item The computed value should be unique among instances of
1363 the same subroutine. (For typical \DWATframebase{} use, this
1364 means that a recursive subroutine\textquoteright s stack frame must have
1365 non\dash zero size.)
1368 \textit{If a debugger is attempting to resolve an up\dash level reference
1369 to a variable, it uses the nesting structure of DWARF to
1370 determine which subroutine is the lexical parent and the
1371 \DWATstaticlink{} value to identify the appropriate active
1372 frame of the parent. It can then attempt to find the reference
1373 within the context of the parent.}
1377 \subsection{Types Thrown by Exceptions}
1378 \label{chap:typesthrownbyexceptions}
1380 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1381 it may validly throw.}
1383 If a subroutine explicitly declares that it may throw
1384 \addtoindexx{exception thrown|see{thrown type entry}}
1386 \addtoindexx{thrown exception|see{thrown type entry}}
1387 exception of one or more types, each such type is
1388 represented by a debugging information entry with
1389 \addtoindexx{thrown type entry}
1391 \DWTAGthrowntypeTARG.
1392 Each such entry is a child of the entry
1393 representing the subroutine that may throw this type. Each
1394 thrown type entry contains
1395 \addtoindexx{type attribute}
1396 a \DWATtype{} attribute, whose
1397 value is a \livelink{chap:classreference}{reference}
1398 to an entry describing the type of the
1399 exception that may be thrown.
1401 \subsection{Function Template Instantiations}
1402 \label{chap:functiontemplateinstantiations}
1404 \textit{In \addtoindex{C++}, a function template is a generic definition of
1405 a function that is instantiated differently for calls with
1406 values of different types. DWARF does not represent the generic
1407 template definition, but does represent each instantiation.}
1410 A \addtoindex{template instantiation} is represented by a debugging
1411 information entry with the
1412 \addtoindexx{subprogram entry!use for template instantiation}
1413 tag \DWTAGsubprogram.
1415 exceptions, such an entry will contain the same attributes and
1416 will have the same types of child entries as would an entry
1417 for a subroutine defined explicitly using the instantiation
1418 types and values. The exceptions are:
1420 \begin{enumerate}[1. ]
1421 \item Template parameters are described and referenced as specified in
1422 Section \refersec{chap:templateparameters}.
1424 \item If the compiler has generated a special compilation unit
1425 to hold the template instantiation and that compilation unit
1426 has a different name from the compilation unit containing
1427 the template definition, the name attribute for the debugging
1428 information entry representing that compilation unit is empty
1431 \item If the subprogram entry representing the template
1432 instantiation or any of its child entries contain declaration
1433 coordinate attributes, those attributes refer to the source
1434 for the template definition, not to any source generated
1435 artificially by the compiler for this instantiation.
1440 \subsection{Inlinable and Inlined Subroutines}
1441 \label{chap:inlinedsubroutines}
1442 A declaration or a definition of an inlinable subroutine
1443 is represented by a debugging information entry with the
1447 \addtoindexx{subprogram entry!use in inlined subprogram}
1449 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1450 explicitly declared to be available for inline expansion or
1451 that was expanded inline implicitly by the compiler has
1452 \addtoindexx{inline attribute}
1454 \DWATinline{} attribute whose value is an
1455 \livelink{chap:classconstant}{integer constant}. The
1456 set of values for the \DWATinline{} attribute is given in
1457 Table \refersec{tab:inlinecodes}.
1461 \caption{Inline codes}
1462 \label{tab:inlinecodes}
1463 \begin{tabular}{l|p{8cm}}
1465 Name&Meaning\\ \hline
1466 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1467 \mbox{compiler} (equivalent to the absence of the
1468 containing \DWATinline{} attribute) \\
1469 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1470 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1471 not inlined by the \mbox{compiler} \\
1472 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1478 \textit{In \addtoindex{C++}, a function or a constructor declared with
1479 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1480 instance (see below) is represented by a debugging information
1481 entry with the tag \DWTAGsubprogram. Such an entry has a
1482 \DWATinline{} attribute whose value is \DWINLinlined.}
1485 \subsubsection{Abstract Instances}
1486 \label{chap:abstractinstances}
1487 Any debugging information entry that is owned (either
1488 \hypertarget{chap:DWATinlineabstracttinstance}{}
1489 directly or indirectly) by a debugging information entry
1491 \DWATinline{} attribute is referred to
1492 \addtoindexx{abstract instance!entry}
1493 as an \doublequote{abstract instance entry.}
1494 Any subroutine entry
1496 \addtoindexx{inline attribute}
1497 a \DWATinline{} attribute whose value is other
1498 than \DWINLnotinlined{}
1500 \addtoindexx{abstract instance!root}
1501 an \doublequote{abstract instance root.}
1502 Any set of abstract instance entries that are all
1503 children (either directly or indirectly) of some abstract
1504 instance root, together with the root itself, is known as
1505 \addtoindexx{abstract instance!tree}
1506 an \doublequote{abstract instance tree.} However, in the case where
1507 an abstract instance tree is nested within another abstract
1508 instance tree, the entries in the
1509 \addtoindex{nested abstract instance}
1510 tree are not considered to be entries in the outer abstract
1513 Each abstract instance root is either part of a larger
1514 \addtoindexx{abstract instance!root}
1515 tree (which gives a context for the root) or
1516 \addtoindexx{specification attribute}
1518 \DWATspecification{}
1519 to refer to the declaration in context.
1521 \textit{For example, in \addtoindex{C++} the context might be a namespace
1522 declaration or a class declaration.}
1524 \textit{Abstract instance trees are defined so that no entry is part
1525 of more than one abstract instance tree. This simplifies the
1526 following descriptions.}
1528 A debugging information entry that is a member of an abstract
1529 instance tree should not contain any attributes which describe
1530 aspects of the subroutine which vary between distinct inlined
1531 expansions or distinct out\dash of\dash line expansions. For example,
1532 \addtoindexx{entry pc attribute!and abstract instance}
1543 \addtoindexx{location attribute!and abstract instance}
1545 \addtoindexx{ranges attribute!and abstract instance}
1547 \addtoindexx{high PC attribute!and abstract instance}
1549 \addtoindexx{low PC attribute!and abstract instance}
1551 \addtoindexx{segment attribute!and abstract instance}
1553 \addtoindexx{return address attribute!and abstract instance}
1555 \addtoindexx{segment attribute!and abstract instance}
1557 \addtoindexx{start scope attribute!and abstract instance}
1561 \textit{It would not make sense normally to put these attributes into
1562 abstract instance entries since such entries do not represent
1563 actual (concrete) instances and thus do not actually exist at
1564 run\dash time. However,
1565 see Appendix \refersec{app:inlineouteronenormalinner}
1566 for a contrary example.}
1568 The rules for the relative location of entries belonging to
1569 abstract instance trees are exactly the same as for other
1570 similar types of entries that are not abstract. Specifically,
1571 the rule that requires that an entry representing a declaration
1572 be a direct child of the entry representing the scope of the
1573 declaration applies equally to both abstract and non\dash abstract
1574 entries. Also, the ordering rules for formal parameter entries,
1575 member entries, and so on, all apply regardless of whether
1576 or not a given entry is abstract.
1579 \subsubsection{Concrete Inlined Instances}
1580 \label{chap:concreteinlinedinstances}
1582 Each inline expansion of a subroutine is represented
1583 by a debugging information entry with the
1584 tag \DWTAGinlinedsubroutineTARG.
1585 Each such entry should be a direct
1586 child of the entry that represents the scope within which
1587 the inlining occurs.
1589 Each inlined subroutine entry may have either a
1591 and \DWAThighpc{} pair
1593 \addtoindexx{high PC attribute}
1595 \addtoindexx{low PC attribute}
1597 \addtoindexx{ranges attribute}
1600 attribute whose values encode the contiguous or non\dash contiguous
1601 address ranges, respectively, of the machine instructions
1602 generated for the inlined subroutine (see
1603 Section \referfol{chap:codeaddressesandranges}).
1605 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1606 inlined subroutine entry may
1607 \addtoindexx{inlined subprogram entry!in concrete instance}
1609 \addtoindexx{inlined subprogram entry}
1611 \addtoindexx{entry pc attribute!for inlined subprogram}
1614 attribute, representing the first executable instruction of
1615 the inline expansion (see
1616 Section \refersec{chap:entryaddress}).
1618 % Positions of the 3 targets here is a bit arbitrary.
1620 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1622 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1624 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1625 may also have \DWATcallfile,
1626 \DWATcallline{} and \DWATcallcolumn{} attributes,
1628 value is an \livelink{chap:classconstant}{integer constant}.
1629 These attributes represent the
1630 source file, source line number, and source column number,
1631 respectively, of the first character of the statement or
1632 expression that caused the inline expansion. The call file,
1633 call line, and call column attributes are interpreted in
1634 the same way as the declaration file, declaration line, and
1635 declaration column attributes, respectively (see
1636 Section \refersec{chap:declarationcoordinates}).
1638 \textit{The call file, call line and call column coordinates do not
1639 describe the coordinates of the subroutine declaration that
1640 was inlined, rather they describe the coordinates of the call.
1643 An inlined subroutine entry
1644 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1647 attribute, which is a \livelink{chap:classflag}{flag}
1648 whose presence indicates that the
1649 subroutine has been evaluated as a compile\dash time constant. Such
1650 an entry may also have a \DWATconstvalue{} attribute,
1651 whose value may be of any form that is appropriate for the
1652 representation of the subroutine's return value. The value of
1653 this attribute is the actual return value of the subroutine,
1654 represented as it would be on the target architecture.
1656 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1657 \addttindex{constexpr}
1658 is called with constant expressions, then the corresponding
1659 concrete inlined instance has a
1660 \DWATconstexpr{} attribute,
1661 as well as a \DWATconstvalue{} attribute whose value represents
1662 the actual return value of the concrete inlined instance.}
1664 Any debugging information entry that is owned (either
1665 directly or indirectly) by a debugging information entry
1666 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1667 \doublequote{concrete inlined instance entry.} Any entry that has
1669 \DWTAGinlinedsubroutine{}
1670 is known as a \doublequote{concrete inlined instance root.}
1671 Any set of concrete inlined instance
1672 entries that are all children (either directly or indirectly)
1673 of some concrete inlined instance root, together with the root
1674 itself, is known as a \doublequote{concrete inlined instance tree.}
1675 However, in the case where a concrete inlined instance tree
1676 is nested within another concrete instance tree, the entries
1677 in the \addtoindex{nested concrete inline instance} tree
1678 are not considered to
1679 be entries in the outer concrete instance tree.
1681 \textit{Concrete inlined instance trees are defined so that no entry
1682 is part of more than one concrete inlined instance tree. This
1683 simplifies later descriptions.}
1685 Each concrete inlined instance tree is uniquely associated
1686 with one (and only one) abstract instance tree.
1688 \textit{Note, however, that the reverse is not true. Any given abstract
1689 instance tree may be associated with several different concrete
1690 inlined instance trees, or may even be associated with zero
1691 concrete inlined instance trees.}
1693 Concrete inlined instance entries may omit attributes that
1694 are not specific to the concrete instance (but present in
1695 the abstract instance) and need include only attributes that
1696 are specific to the concrete instance (but omitted in the
1697 abstract instance). In place of these omitted attributes, each
1698 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1699 concrete inlined instance entry
1700 \addtoindexx{abstract origin attribute}
1702 \DWATabstractorigin{}
1703 attribute that may be used to obtain the missing information
1704 (indirectly) from the associated abstract instance entry. The
1705 value of the abstract origin attribute is a reference to the
1706 associated abstract instance entry.
1708 If an entry within a concrete inlined instance tree contains
1709 attributes describing the
1710 \addtoindexx{declaration coordinates!in concrete instance}
1711 \livelink{chap:declarationcoordinates}{declaration coordinates}
1712 of that entry, then those attributes should refer to the file, line
1713 and column of the original declaration of the subroutine,
1714 not to the point at which it was inlined. As a consequence,
1715 they may usually be omitted from any entry that has an abstract
1719 For each pair of entries that are associated via a
1720 \addtoindexx{abstract origin attribute}
1721 \DWATabstractorigin{} attribute, both members of the pair
1722 have the same tag. So, for example, an entry with the tag
1723 \DWTAGvariable{} can only be associated with another entry
1724 that also has the tag \DWTAGvariable. The only exception
1725 to this rule is that the root of a concrete instance tree
1726 (which must always have the tag \DWTAGinlinedsubroutine)
1727 can only be associated with the root of its associated abstract
1728 instance tree (which must have the tag \DWTAGsubprogram).
1731 In general, the structure and content of any given concrete
1732 inlined instance tree will be closely analogous to the
1733 structure and content of its associated abstract instance
1734 tree. There are a few exceptions:
1736 \begin{enumerate}[1. ]
1737 \item An entry in the concrete instance tree may be omitted if
1739 \addtoindexx{abstract origin attribute}
1740 \DWATabstractorigin{} attribute and either
1741 has no children, or its children are omitted. Such entries
1742 would provide no useful information. In C\dash like languages,
1743 such entries frequently include types, including structure,
1744 union, class, and interface types; and members of types. If any
1745 entry within a concrete inlined instance tree needs to refer
1746 to an entity declared within the scope of the relevant inlined
1747 subroutine and for which no concrete instance entry exists,
1748 the reference should refer to the abstract instance entry.
1751 \item Entries in the concrete instance tree which are associated
1752 with entries in the abstract instance tree such that neither
1753 has a \DWATname{} attribute,
1754 \addtoindexx{name attribute}
1755 and neither is referenced by
1756 any other debugging information entry, may be omitted. This
1757 may happen for debugging information entries in the abstract
1758 instance trees that became unnecessary in the concrete instance
1759 tree because of additional information available there. For
1760 example, an anonymous variable might have been created and
1761 described in the abstract instance tree, but because of
1762 the actual parameters for a particular inlined expansion,
1763 it could be described as a constant value without the need
1764 for that separate debugging information entry.
1766 \item A concrete instance tree may contain entries which do
1767 not correspond to entries in the abstract instance tree
1768 to describe new entities that are specific to a particular
1769 inlined expansion. In that case, they will not have associated
1770 entries in the abstract instance tree, should not contain
1771 \addtoindexx{abstract origin attribute}
1772 \DWATabstractorigin{} attributes, and must contain all their
1773 own attributes directly. This allows an abstract instance tree
1774 to omit debugging information entries for anonymous entities
1775 that are unlikely to be needed in most inlined expansions. In
1776 any expansion which deviates from that expectation, the
1777 entries can be described in its concrete inlined instance tree.
1781 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1782 \label{chap:outoflineinstancesofinlinedsubroutines}
1783 Under some conditions, compilers may need to generate concrete
1784 executable instances of inlined subroutines other than at
1785 points where those subroutines are actually called. Such
1786 concrete instances of inlined subroutines are referred to as
1787 \doublequote{concrete out\dash of\dash line instances.}
1789 \textit{In \addtoindex{C++}, for example,
1790 taking the address of a function declared
1791 to be inline can necessitate the generation of a concrete
1792 out\dash of\dash line instance of the given function.}
1794 The DWARF representation of a concrete out\dash of\dash line instance
1795 of an inlined subroutine is essentially the same as for a
1796 concrete inlined instance of that subroutine (as described in
1797 the preceding section). The representation of such a concrete
1798 % It is critical that the hypertarget and livelink be
1799 % separated to avoid problems with latex.
1800 out\dash of\dash line
1801 \addtoindexx{abstract origin attribute}
1803 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1805 \DWATabstractorigin{}
1806 attributes in exactly the same way as they are used for
1807 a concrete inlined instance (that is, as references to
1808 corresponding entries within the associated abstract instance
1812 The differences between the DWARF representation of a
1813 concrete out\dash of\dash line instance of a given subroutine and the
1814 representation of a concrete inlined instance of that same
1815 subroutine are as follows:
1817 \begin{enumerate}[1. ]
1818 \item The root entry for a concrete out\dash of\dash line instance
1819 of a given inlined subroutine has the same tag as does its
1820 associated (abstract) inlined subroutine entry (that is, tag
1821 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1823 \item The root entry for a concrete out\dash of\dash line instance tree
1824 is normally owned by the same parent entry that also owns
1825 the root entry of the associated abstract instance. However,
1826 it is not required that the abstract and out\dash of\dash line instance
1827 trees be owned by the same parent entry.
1831 \subsubsection{Nested Inlined Subroutines}
1832 \label{nestedinlinedsubroutines}
1833 Some languages and compilers may permit the logical nesting of
1834 a subroutine within another subroutine, and may permit either
1835 the outer or the nested subroutine, or both, to be inlined.
1837 For a non\dash inlined subroutine nested within an inlined
1838 subroutine, the nested subroutine is described normally in
1839 both the abstract and concrete inlined instance trees for
1840 the outer subroutine. All rules pertaining to the abstract
1841 and concrete instance trees for the outer subroutine apply
1842 also to the abstract and concrete instance entries for the
1846 For an inlined subroutine nested within another inlined
1847 subroutine, the following rules apply to their abstract and
1848 \addtoindexx{abstract instance!nested}
1849 \addtoindexx{concrete instance!nested}
1850 concrete instance trees:
1852 \begin{enumerate}[1. ]
1853 \item The abstract instance tree for the nested subroutine is
1854 described within the abstract instance tree for the outer
1855 subroutine according to the rules in
1856 Section \refersec{chap:abstractinstances}, and
1857 without regard to the fact that it is within an outer abstract
1860 \item Any abstract instance tree for a nested subroutine is
1861 always omitted within the concrete instance tree for an
1864 \item A concrete instance tree for a nested subroutine is
1865 always omitted within the abstract instance tree for an
1868 \item The concrete instance tree for any inlined or
1869 \addtoindexx{out-of-line instance}
1871 \addtoindexx{out-of-line-instance|see{concrete out-of-line-instance}}
1872 expansion of the nested subroutine is described within a
1873 concrete instance tree for the outer subroutine according
1875 Sections \refersec{chap:concreteinlinedinstances} or
1876 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1878 and without regard to the fact that it is within an outer
1879 concrete instance tree.
1882 See Appendix \refersec{app:inliningexamples}
1883 for discussion and examples.
1885 \subsection{Trampolines}
1886 \label{chap:trampolines}
1888 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1889 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1890 an intermediary in making a call to another subroutine. It may
1891 adjust parameters and/or the result (if any) as appropriate
1892 to the combined calling and called execution contexts.}
1894 A trampoline is represented by a debugging information entry
1895 \addtoindexx{trampoline (subprogram) entry}
1896 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1898 \addtoindexx{trampoline attribute}
1899 a \DWATtrampoline{} attribute.
1901 attribute indicates the target subroutine of the trampoline,
1902 that is, the subroutine to which the trampoline passes
1903 control. (A trampoline entry may but need not also have a
1904 \DWATartificial{} attribute.)
1907 The value of the trampoline attribute may be represented
1908 using any of the following forms, which are listed in order
1912 \item If the value is of class reference, then the value
1913 specifies the debugging information entry of the target
1916 \item If the value is of class address, then the value is
1917 the relocated address of the target subprogram.
1919 \item If the value is of class string, then the value is the
1920 (possibly mangled) \addtoindexx{mangled names}
1921 name of the target subprogram.
1923 \item If the value is of class \livelink{chap:classflag}{flag}, then the value true
1924 indicates that the containing subroutine is a trampoline but
1925 that the target subroutine is not known.
1929 The target subprogram may itself be a trampoline. (A sequence
1930 of trampolines necessarily ends with a non\dash trampoline
1933 \textit{In \addtoindex{C++}, trampolines may be used
1934 to implement derived virtual
1935 member functions; such trampolines typically adjust the
1936 \addtoindexx{this parameter}
1937 implicit this pointer parameter in the course of passing
1939 Other languages and environments may use trampolines
1940 in a manner sometimes known as transfer functions or transfer
1943 \textit{Trampolines may sometimes pass control to the target
1944 subprogram using a branch or jump instruction instead of a
1945 call instruction, thereby leaving no trace of their existence
1946 in the subsequent execution context. }
1948 \textit{This attribute helps make it feasible for a debugger to arrange
1949 that stepping into a trampoline or setting a breakpoint in
1950 a trampoline will result in stepping into or setting the
1951 breakpoint in the target subroutine instead. This helps to
1952 hide the compiler generated subprogram from the user. }
1954 \textit{If the target subroutine is not known, a debugger may choose
1955 to repeatedly step until control arrives in a new subroutine
1956 which can be assumed to be the target subroutine. }
1958 \subsection{Call Site Entries}
1959 \label{chap:callsiteentries}
1961 A call site entry provides a way to represent the static or dynamic
1962 call graph of a program in the debugging information. It also provides
1963 information about how parameters are passed so that they may be more
1964 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
1965 call site entries can be also useful for computing values of variables
1966 and expressions where some value is no longer present in the current
1967 subroutine's registers or local stack frame, but it is known that the
1968 values are equal to some parameter passed to the function.
1969 The consumer can then use unwind
1970 information to find the caller and in the call site information sometimes
1971 find how to compute the value passed in a particular parameter.}
1973 A call site is represented by a debugging information entry with the tag
1974 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
1975 debugging information entry representing the scope within which the
1976 call is present in the source program.
1978 \textit{A scope entry (for example, for a lexical block) that would not
1979 otherwise be present in the debugging information of a subroutine
1980 need not be introduced solely to represent the immediately containing scope
1981 of a call. The call site entry is owned by the innermost scope entry that
1984 A source call can be compiled into different types of machine code:
1987 A \textit{normal call} uses a call-like instruction which transfers control to the start
1988 of some subprogram and leaves the call site location address somewhere where
1989 unwind information can find it.
1991 A \textit{tail call} uses a jump-like instruction which
1992 transfers control to the start of some subprogram, but the call site location
1993 address is not preserved (and thus not available using the unwind information).
1995 A \textit{tail recursion call} is a call
1996 to the current subroutine which is compiled as a loop into the middle of the
1999 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
2000 where at least one instruction has the location of the inlined subprogram
2001 or any of its blocks or inlined subprograms.
2004 There are also different types of \doublequote{optimized out} calls:
2007 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2008 has not been emitted (such as, for example, the call to \texttt{foo} in
2009 \texttt{if (0) foo();}).
2011 An \textit{optimized out inline call}
2012 is a call to an inlined subprogram which either did not expand to any instructions
2013 or only parts of instructions belong to it and for debug information purposes those
2014 instructions are given a location in the caller.
2017 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2018 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2019 (see Section \refersec{chap:inlinedsubroutines}).
2021 The call site entry has a
2022 \DWATcallreturnpcNAME{}
2023 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2024 which is the return address after the call.
2025 The value of this attribute corresponds to the return address computed by
2026 call frame information in the called subprogram
2027 (see Section \refersec{datarep:callframeinformation}).
2029 \textit{On many architectures the return address is the address immediately following the
2030 call instruction, but on architectures with delay slots it might
2031 be an address after the delay slot of the call.}
2033 The call site entry may have a
2035 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2036 address of the call instruction.
2038 If the call site entry corresponds to a tail call, it has the
2039 \DWATcalltailcallNAME{}
2040 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2041 which is a \CLASSflag.
2043 The call site entry may have a
2044 \DWATcalloriginNAME{}
2045 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2046 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2047 known it is a reference to the called subprogram's debugging
2048 information entry. For indirect calls it may be a reference to a
2049 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2050 the subroutine pointer that is called.
2052 The call site may have a
2053 \DWATcalltargetNAME{}
2054 \livetargi{chap:DWATcalltargetofcallsite}{attribute}{call target attribute} which is
2055 a DWARF expression. For indirect calls or jumps where it is unknown at
2056 compile time which subprogram will be called the expression computes the
2057 address of the subprogram that will be called. The DWARF expression should
2058 not use register or memory locations that might be clobbered by the call.
2060 The call site entry may have a
2061 \DWATcalltargetclobberedNAME{}
2062 \livetargi{chap:DWATcalltargetclobberedofcallsite}{attribute}{call target clobbered attribute}
2063 which is a DWARF expression. For indirect calls or jumps where the
2064 address is not computable without use of registers or memory locations that
2065 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2066 attribute is used instead of the \DWATcalltarget{} attribute.
2068 The call site entry may have a \DWATtypeNAME{}
2069 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2070 referencing a debugging information entry for the type of the called function.
2071 When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.
2073 The call site entry may have
2074 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2075 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2076 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2077 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2078 each of whose value is an integer constant.
2079 These attributes represent the source file, source line number, and source
2080 column number, respectively, of the first character of the call statement or
2081 expression. The call file, call line, and call column attributes are
2082 interpreted in the same way as the declaration file, declaration
2083 line, and declaration column attributes, respectively
2084 (see Section \refersec{chap:declarationcoordinates}).
2086 \textit{The call file, call line and call column coordinates do not describe the
2087 coordinates of the subroutine declaration that was inlined, rather they describe
2088 the coordinates of the call.}
2090 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2091 entries\index{call site parameter entry} representing the parameters passed to the call.
2092 Each such entry has a \DWATlocation{} attribute which is a location expression.
2093 This location expression describes where the parameter is passed
2094 (usually either some register, or a memory location expressible as the
2095 contents of the stack register plus some offset).
2097 Each \DWTAGcallsiteparameter{} entry may have a
2098 \DWATcallvalueNAME{}
2099 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2100 which is a DWARF expression. This expression computes the value
2101 passed for that parameter. The expression should not use registers or memory
2102 locations that might be clobbered by the call, as it might be evaluated after
2103 unwinding from the called function back to the caller. If it is not
2104 possible to avoid registers or memory locations that might be clobbered by
2105 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2108 \textit{The reason for the restriction is that the value of the parameter may be
2109 needed in the middle of the callee, where the call clobbered registers or
2110 memory might be already clobbered, and if the consumer was not assured by
2111 the producer it can safely use those values, the consumer could not safely
2112 use the values at all.}
2114 For parameters passed by reference, where the code passes a pointer to
2115 a location which contains the parameter, or for reference type parameters
2116 the \DWTAGcallsiteparameter{} entry may also have
2117 \DWATcalldatalocationNAME{}
2118 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2119 whose value is a location expression and a
2120 \DWATcalldatavalueNAME{}
2121 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2122 whose value is a DWARF expression. The \DWATcalldatalocationNAME{} attribute
2123 describes where the referenced value lives during the call. If it is just
2124 \DWOPpushobjectaddress{}, it may be left out. The
2125 \DWATcalldatavalueNAME{} attribute describes the value in that location.
2126 The expression should not use registers or memory
2127 locations that might be clobbered by the call, as it might be evaluated after
2128 unwinding from the called function back to the caller.
2131 Each call site parameter entry may also have a
2132 \DWATcallparameter{}
2133 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2134 which contains a reference to a \DWTAGformalparameter{} entry,
2135 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2136 attribute describing the parameter's name.
2140 \section{Lexical Block Entries}
2141 \label{chap:lexicalblockentries}
2144 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2146 \addtoindexx{lexical block}
2147 a bracketed sequence of source statements
2148 that may contain any number of declarations. In some languages
2149 (including \addtoindex{C} and \addtoindex{C++}),
2150 \nolink{blocks} can be nested within other
2151 \nolink{blocks} to any depth.}
2153 % We do not need to link to the preceding paragraph.
2154 A lexical \nolink{block} is represented by a debugging information
2156 tag \DWTAGlexicalblockTARG.
2158 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2160 either a \DWATlowpc{} and
2161 \DWAThighpc{} pair of
2163 \addtoindexx{high PC attribute}
2165 \addtoindexx{low PC attribute}
2167 \DWATranges{} attribute
2168 \addtoindexx{ranges attribute}
2169 whose values encode the contiguous or non-contiguous address
2170 ranges, respectively, of the machine instructions generated
2171 for the lexical \nolink{block}
2172 (see Section \refersec{chap:codeaddressesandranges}).
2175 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2176 lexical block entry may also have
2177 \addtoindexx{entry pc attribute!for lexical block}
2179 \DWATentrypc{} attribute
2180 whose value is the address of the first executable instruction
2181 of the lexical block (see
2182 Section \refersec{chap:entryaddress}).
2184 If a name has been given to the
2185 lexical \nolink{block}
2187 program, then the corresponding
2188 lexical \nolink{block} entry has a
2189 \DWATname{} attribute whose
2190 \addtoindexx{name attribute}
2191 value is a null\dash terminated string
2192 containing the name of the lexical \nolink{block}
2196 \textit{This is not the same as a \addtoindex{C} or
2197 \addtoindex{C++} label (see below).}
2199 The lexical \nolink{block} entry owns
2200 debugging information entries that
2201 describe the declarations within that lexical \nolink{block}.
2203 one such debugging information entry for each local declaration
2204 of an identifier or inner lexical \nolink{block}.
2206 \section{Label Entries}
2207 \label{chap:labelentries}
2208 \textit{A label is a way of identifying a source statement. A labeled
2209 statement is usually the target of one or more \doublequote{go to}
2214 A label is represented by a debugging information entry with
2215 \addtoindexx{label entry}
2217 tag \DWTAGlabelTARG.
2218 The entry for a label should be owned by
2219 the debugging information entry representing the scope within
2220 which the name of the label could be legally referenced within
2223 The label entry has a \DWATlowpc{} attribute whose value
2224 is the relocated address of the first machine instruction
2225 generated for the statement identified by the label in
2226 the source program. The label entry also has a
2227 \DWATname{} attribute
2228 \addtoindexx{name attribute}
2229 whose value is a null-terminated string containing
2230 the name of the label as it appears in the source program.
2233 \section{With Statement Entries}
2234 \label{chap:withstatemententries}
2236 \textit{Both \addtoindex{Pascal} and
2237 \addtoindexx{Modula-2}
2238 Modula\dash 2 support the concept of a \doublequote{with}
2239 statement. The with statement specifies a sequence of
2240 executable statements within which the fields of a record
2241 variable may be referenced, unqualified by the name of the
2244 A with statement is represented by a
2245 \addtoindexi{debugging information entry}{with statement entry}
2246 with the tag \DWTAGwithstmtTARG.
2248 A with statement entry may have either a
2250 \DWAThighpc{} pair of attributes
2251 \addtoindexx{high PC attribute}
2253 \addtoindexx{low PC attribute}
2254 a \DWATranges{} attribute
2255 \addtoindexx{ranges attribute}
2256 whose values encode the contiguous or non\dash contiguous address
2257 ranges, respectively, of the machine instructions generated
2258 for the with statement
2259 (see Section \refersec{chap:codeaddressesandranges}).
2262 \hypertarget{chap:DWATentrypcofwithstmt}{}
2263 with statement entry may also have
2264 \addtoindexx{entry pc attribute!for with statement}
2266 \DWATentrypc{} attribute
2267 whose value is the address of the first executable instruction
2268 of the with statement (see
2269 Section \refersec{chap:entryaddress}).
2272 The with statement entry has
2273 \addtoindexx{type attribute}
2274 a \DWATtype{} attribute, denoting
2275 the type of record whose fields may be referenced without full
2276 qualification within the body of the statement. It also has
2277 \addtoindexx{location attribute}
2278 a \DWATlocation{} attribute, describing how to find the base
2279 address of the record object referenced within the body of
2283 \section{Try and Catch Block Entries}
2284 \label{chap:tryandcatchblockentries}
2286 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
2287 designated as a \doublequote{catch \nolink{block}.}
2288 A catch \livetargi{chap:catchblock}{block}{catch block} is an
2289 exception handler that handles
2290 exceptions thrown by an immediately
2291 preceding \doublequote{try \livelink{chap:tryblock}{block}.}
2292 A catch \livelink{chap:catchblock}{block}
2293 designates the type of the exception that it
2296 A try \livetargi{chap:tryblock}{block}{try block} is represented
2297 by a debugging information entry
2298 \addtoindexx{try block entry}
2299 with the tag \DWTAGtryblockTARG.
2300 A catch \livelink{chap:catchblock}{block} is represented by
2301 a debugging information entry with
2302 \addtoindexx{catch block entry}
2303 the tag \DWTAGcatchblockTARG.
2305 % nolink as we have links just above and do not have a combo link for both
2306 Both try and catch \nolink{block} entries may have either a
2308 \DWAThighpc{} pair of attributes
2309 \addtoindexx{high PC attribute}
2311 \addtoindexx{low PC attribute}
2313 \DWATranges{} attribute
2314 \addtoindexx{ranges attribute}
2315 whose values encode the contiguous
2316 or non\dash contiguous address ranges, respectively, of the
2317 machine instructions generated for the \livelink{chap:lexicalblock}{block}
2319 \refersec{chap:codeaddressesandranges}).
2322 \hypertarget{chap:DWATentrypcoftryblock}{}
2323 \hypertarget{chap:DWATentrypcofcatchblock}{}
2324 try or catch block entry may also have
2325 \addtoindexx{entry pc attribute!for try block}
2326 \addtoindexx{entry pc attribute!for catch block}
2328 \DWATentrypc{} attribute
2329 whose value is the address of the first executable instruction
2330 of the try or catch block (see
2331 Section \refersec{chap:entryaddress}).
2333 Catch \livelink{chap:catchblock}{block} entries have at
2334 least one child entry, an
2335 entry representing the type of exception accepted by
2336 that catch \livelink{chap:catchblock}{block}.
2337 This child entry has one of
2338 \addtoindexx{formal parameter entry!in catch block}
2340 \addtoindexx{unspecified parameters entry!in catch block}
2342 \DWTAGformalparameter{} or
2343 \DWTAGunspecifiedparameters,
2344 and will have the same form as other parameter entries.
2346 The siblings immediately following
2347 a try \livelink{chap:tryblock}{block} entry are its
2348 corresponding catch \livelink{chap:catchblock}{block} entries.