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 \DWLANGModulatwoTARG & ISO Modula\dash 2:1996 \addtoindexx{Modula-2:1996 (ISO)} \\
163 \DWLANGModulathreeTARG & \addtoindex{Modula-3} \\
164 \DWLANGObjCTARG{} & \addtoindex{Objective C} \\
165 \DWLANGObjCplusplusTARG{} & \addtoindex{Objective C++} \\
166 \DWLANGOCamlTARG{} \dag & \addtoindex{OCaml}\index{Objective Caml|see{OCaml}} \\
167 \DWLANGOpenCLTARG{} \dag & \addtoindex{OpenCL} \\
168 \DWLANGPascaleightythreeTARG & ISO Pascal:1983 \addtoindexx{Pascal:1983 (ISO)} \\
169 \DWLANGPLITARG{} \dag & ANSI PL/I:1976 \addtoindexx{PL/I:1976 (ANSI)} \\
170 \DWLANGPythonTARG{} \dag & \addtoindex{Python} \\
171 \DWLANGRustTARG{} \dag & \addtoindex{Rust} \\
172 \DWLANGUPCTARG{} & UPC (Unified Parallel C) \addtoindexx{UPC}
173 \index{Unified Parallel C|see{UPC}} \\
175 \dag \ \ \textit{Support for these languages is limited.}& \\
179 \item A \DWATstmtlist{}
180 attribute whose value is
181 \addtoindexx{statement list attribute}
183 \addtoindexx{section offset!in statement list attribute}
185 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}{}
186 offset to the line number information for this compilation
189 This information is placed in a separate object file
190 section from the debugging information entries themselves. The
191 value of the statement list attribute is the offset in the
192 \dotdebugline{} section of the first byte of the line number
193 information for this compilation unit
194 (see Section \refersec{chap:linenumberinformation}).
199 \item A \DWATmacros{} attribute
200 \addtoindexx{macro information attribute}
202 \addtoindexx{section offset!in macro information attribute}
204 \hypertarget{chap:DWATmacrosmacroinformation}{}
205 offset to the macro information for this compilation unit.
207 This information is placed in a separate object file section
208 from the debugging information entries themselves. The
209 value of the macro information attribute is the offset in
210 the \dotdebugmacro{} section of the first byte of the macro
211 information for this compilation unit
212 (see Section \refersec{chap:macroinformation}).
214 \textit{The \DWATmacros{} attribute is new in \DWARFVersionV,
216 \DWATmacroinfo{} attribute of earlier DWARF versions.
217 \livetarg{chap:DWATmacroinfomacroinformation}{}
218 While \DWATmacros{} and \DWATmacroinfo{} attributes cannot both occur in the same
219 compilation unit, both may be found in the set of units that make up an executable
220 or shared object. The two attributes have distinct encodings to facilitate such
227 \hypertarget{chap:DWATcompdircompilationdirectory}{}
229 null\dash terminated string containing the current working directory
230 of the compilation command that produced this compilation
231 unit in whatever form makes sense for the host system.
233 \item A \DWATproducer{} attribute
234 \addtoindexx{producer attribute}
235 whose value is a null\dash
236 terminated string containing information about the compiler
237 \hypertarget{chap:DWATproducercompileridentification}{}
238 that produced the compilation unit. The actual contents of
239 the string will be specific to each producer, but should
240 begin with the name of the compiler vendor or some other
241 identifying character sequence that should avoid confusion
242 with other producer values.
245 \item A \DWATidentifiercase{}
247 \addtoindexx{identifier case attribute}
249 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}{}
250 constant value is a code describing the treatment
251 of identifiers within this compilation unit. The
252 set of identifier case codes is given in
253 Table \refersec{tab:identifiercasecodes}.
255 \begin{simplenametable}{Identifier case codes}{tab:identifiercasecodes}
256 \DWIDcasesensitive{} \\
259 \DWIDcaseinsensitive{} \\
260 \end{simplenametable}
262 \DWIDcasesensitiveTARG{} is the default for all compilation units
263 that do not have this attribute. It indicates that names given
264 as the values of \DWATname{} attributes
265 \addtoindexx{name attribute}
266 in debugging information
267 entries for the compilation unit reflect the names as they
268 appear in the source program. The debugger should be sensitive
269 to the case of identifier names when doing identifier lookups.
272 \DWIDupcaseTARG{} means that the
273 producer of the debugging
274 information for this compilation unit converted all source
275 names to upper case. The values of the name attributes may not
276 reflect the names as they appear in the source program. The
277 debugger should convert all names to upper case when doing
280 \DWIDdowncaseTARG{} means that
281 the producer of the debugging
282 information for this compilation unit converted all source
283 names to lower case. The values of the name attributes may not
284 reflect the names as they appear in the source program. The
285 debugger should convert all names to lower case when doing
289 \DWIDcaseinsensitiveTARG{} means that the values of the name
290 attributes reflect the names as they appear in the source
291 program but that a case insensitive lookup should be used to
295 \item A \DWATbasetypes{} attribute whose value is a
296 \livelink{chap:classreference}{reference}.
299 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}{}
301 \addtoindexx{base types attribute}
302 points to a debugging information entry
303 representing another compilation unit. It may be used
304 to specify the compilation unit containing the base type
305 entries used by entries in the current compilation unit
306 (see Section \refersec{chap:basetypeentries}).
309 This attribute provides a consumer a way to find the definition
310 of base types for a compilation unit that does not itself
311 contain such definitions. This allows a consumer, for example,
312 to interpret a type conversion to a base type
313 % getting this link target at the right spot is tricky.
314 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}{}
317 \item A \DWATuseUTFeight{} attribute,
318 \addtoindexx{use UTF8 attribute}\addtoindexx{UTF-8}
319 which is a \livelink{chap:classflag}{flag} whose
320 presence indicates that all strings (such as the names of
321 declared entities in the source program, or file names in the line table)
322 are represented using the UTF\dash 8 representation.
324 \item A \DWATmainsubprogram{} attribute, which is a \livelink{chap:classflag}{flag}
325 \addtoindexx{main subprogram attribute}
326 whose presence indicates
327 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}{}
328 that the compilation unit contains a
329 subprogram that has been identified as the starting function
330 of the program. If more than one compilation unit contains
331 this \nolink{flag}, any one of them may contain the starting function.
333 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
335 to specify and provide a user\dash specified name for the main
336 subroutine of a program.
337 \addtoindex{C} uses the name \doublequote{main} to identify
338 the main subprogram of a program. Some other languages provide
339 similar or other means to identify the main subprogram of
342 \item A \DWATentrypc{} attribute whose value is the address of the first
343 \hypertarget{chap:DWATentrypcofcompileunit}{}
344 \hypertarget{chap:DWATentrypcofpartialunit}{}
345 \addtoindexx{entry pc attribute!for normal compilation unit}
346 \addtoindexx{entry pc attribute!for partial compilation unit}
347 executable instruction of the unit (see
348 Section \refersec{chap:entryaddress}).
350 \item A \DWATstroffsetsbaseNAME\addtoindexx{string offset base attribute}
351 \hypertarget{chap:DWATstroffsetbaseforindirectstringtable}{}
352 attribute, whose value is a reference.
353 This attribute points to the first string
354 offset of the compilation unit's contribution to the
355 \dotdebugstroffsets{} (or \dotdebugstroffsetsdwo{}) section.
356 Indirect string references
357 (using \DWFORMstrx) within the compilation unit are
358 interpreted as indices relative to this base.
361 \item A \DWATaddrbaseNAME\addtoindexx{address table base attribute}
362 \hypertarget{chap:DWATaddrbaseforaddresstable}{}
363 attribute, whose value is a reference.
364 This attribute points to the beginning of the compilation
365 unit's contribution to the \dotdebugaddr{} section.
366 Indirect references (using \DWFORMaddrx, \DWOPaddrx,
367 \DWOPconstx, \DWLLEbaseaddressselectionentry{},
368 \DWLLEstartendentry, or \DWLLEstartlengthentry) within the compilation unit are
369 interpreted as indices relative to this base.
372 \item A \DWATrangesbaseNAME\addtoindexx{ranges table base attribute}
373 \hypertarget{chap:DWATrangesbaseforrangelists}{}
374 attribute, whose value is a reference.
375 This attribute points to the beginning of the compilation
376 unit's contribution to the \dotdebugranges{} section.
377 References to range lists (using \DWFORMsecoffset)
378 within the compilation unit are
379 interpreted as offsets relative to this base.
384 The base address of a compilation unit is defined as the
385 value of the \DWATlowpc{} attribute, if present; otherwise,
386 it is undefined. If the base address is undefined, then any
387 DWARF entry or structure defined in terms of the base address
388 of that compilation unit is not valid.
390 \subsection{Skeleton Compilation Unit Entries}
391 \label{chap:skeletoncompilationunitentries}
392 When generating a split DWARF object (see
393 Section \refersec{datarep:splitdwarfobjects}), the
394 compilation unit in the \dotdebuginfo{} section is a "skeleton"
395 compilation unit, which contains only a subset of the
396 attributes of the full compilation unit. In general, it
397 contains those attributes that are necessary for the consumer
398 to locate the DWARF object where the full compilation unit
399 can be found, and for the consumer to interpret references to
400 addresses in the program.
402 A skeleton compilation unit has no
403 children, and may have the following attributes:
404 \begin{enumerate}[1. ]
407 Either a \DWATlowpc{} and \DWAThighpc{} pair of attributes
408 or a \DWATranges{} attribute (the same as for regular
409 compilation unit entries).
412 A \DWATstmtlist{} attribute (the same as for regular
413 compilation unit entries).
416 A \DWATcompdir{} attribute (the same as for regular
417 compilation unit entries).
420 \livetarg{chap:DWATdwonameforunit}{}
421 A \DWATdwonameNAME{} attribute whose value is a
422 null-terminated string containing the full or relative
423 path name of the DWARF object file that contains the full
427 \livetarg{chap:DWATdwoidforunit}{}
428 A \DWATdwoidNAME{} attribute whose value is an 8-byte
429 unsigned hash of the full compilation unit. This hash
430 value is computed by the method described in
431 Section \refersec{datarep:typesignaturecomputation}.
435 A \DWATuseUTFeight{} attribute (the same as for regular compilation unit
438 \textit{This attribute applies to strings referred to by the skeleton
439 compilation unit entry itself, and strings in the associated line
441 The representation for strings in the DWARF object file is determined
442 by the presence of a \DWATuseUTFeight{} attribute in the full compilation
446 A \DWATstroffsetsbase{} attribute, for indirect strings references
447 from the skeleton compilation unit (the same as for regular
448 compilation unit entries).
451 A \DWATaddrbase{} attribute (the same as for regular
452 compilation unit entries).
455 A \DWATrangesbase{} attribute (the same as for regular
456 compilation unit entries).
460 All other attributes of a compilation unit entry (described
461 in Section \refersec{chap:normalandpartialcompilationunitentries})
462 should be placed in the full compilation
463 unit entry in the \dotdebuginfodwo{} section of the split DWARF
464 object. The attributes provided by the skeleton compilation
465 unit entry do not need to be repeated in the full compilation
466 unit entry, except for \DWATdwoid, which should appear in
467 both entries so that the consumer can verify that it has
468 found the correct DWARF object.
471 \subsection{Imported Unit Entries}
472 \label{chap:importedunitentries}
474 \hypertarget{chap:DWATimportimportedunit}{}
475 place where a normal or partial unit is imported is
476 represented by a debugging information entry with the
477 \addtoindexx{imported unit entry}
478 tag \DWTAGimportedunitTARG.
479 An imported unit entry contains
480 \addtoindexx{import attribute}
482 \DWATimport{} attribute
483 whose value is a \livelink{chap:classreference}{reference} to the
484 normal or partial compilation unit whose declarations logically
485 belong at the place of the imported unit entry.
487 \textit{An imported unit entry does not necessarily correspond to
488 any entity or construct in the source program. It is merely
489 \doublequote{glue} used to relate a partial unit, or a compilation
490 unit used as a partial unit, to a place in some other
494 \subsection{Separate Type Unit Entries}
495 \label{chap:separatetypeunitentries}
496 An object file may contain any number of separate type
497 unit entries, each representing a single complete type
499 Each \addtoindex{type unit} must be uniquely identified by
500 a 64\dash bit signature, stored as part of the type unit, which
501 can be used to reference the type definition from debugging
502 information entries in other compilation units and type units.
504 A type unit is represented by a debugging information entry
505 with the tag \DWTAGtypeunitTARG.
506 A \addtoindex{type unit entry} owns debugging
507 information entries that represent the definition of a single
508 type, plus additional debugging information entries that may
509 be necessary to include as part of the definition of the type.
511 A type unit entry may have a
512 \DWATlanguage{} attribute,
514 \addtoindexx{language attribute}
515 constant value is an integer code indicating the source
516 language used to define the type. The set of language names
517 and their meanings are given in Table \refersec{tab:languagenames}.
519 A type unit entry may have a
520 \DWATstroffsetsbase\addtoindexx{string base offset attribute}
521 attribute, whose value is a reference. This attribute points
522 to the first string offset of the type unit's contribution to
523 the \dotdebugstroffsets{} section. Indirect string references
524 (using \DWFORMstrx) within the type unit must be interpreted
525 as indices relative to this base.
527 A type unit entry may have a \DWATstmtlist{} attribute, whose
528 value is a section offset to a line number table for this
529 type unit. Because type units do not describe any code, they
530 do not actually need a line number table, but the line number
531 tables also contain a list of directories and file names that
532 may be referenced by the \DWATdeclfile{} attribute. In a
533 normal object file with a regular compilation unit entry, the
534 type unit entries can simply refer to the line number table
535 used by the compilation unit. In a split DWARF object, where
536 the type units are located in a separate DWARF object file,
537 the \DWATstmtlist{} attribute refers to a "skeleton"
538 line number table in the \dotdebuglinedwo{} section, which
539 contains only the list of directories and file names. All
540 type unit entries in a split DWARF object may (but are not
541 required to) refer to the same skeleton line number table.
543 A type unit entry may have a \DWATuseUTFeight{} attribute, which is a flag
544 whose presence indicates that all strings referred to by this type
545 unit entry, its children, and the skeleton line number table, are
546 represented using the UTF-8 representation.
548 A \addtoindex{type unit} entry for a given type T owns a debugging
549 information entry that represents a defining declaration
550 of type T. If the type is nested within enclosing types or
551 namespaces, the debugging information entry for T is nested
552 within debugging information entries describing its containers;
553 otherwise, T is a direct child of the type unit entry.
555 A type unit entry may also own additional debugging information
556 entries that represent declarations of additional types that
557 are referenced by type T and have not themselves been placed in
558 separate type units. Like T, if an additional type U is nested
559 within enclosing types or namespaces, the debugging information
560 entry for U is nested within entries describing its containers;
561 otherwise, U is a direct child of the type unit entry.
563 The containing entries for types T and U are declarations,
564 and the outermost containing entry for any given type T or
565 U is a direct child of the type unit entry. The containing
566 entries may be shared among the additional types and between
567 T and the additional types.
569 \textit{Types are not required to be placed in type units. In general,
570 only large types such as structure, class, enumeration, and
571 union types included from header files should be considered
572 for separate type units. Base types and other small types
573 are not usually worth the overhead of placement in separate
574 type units. Types that are unlikely to be replicated, such
575 as those defined in the main source file, are also better
576 left in the main compilation unit.}
578 \section{Module, Namespace and Importing Entries}
579 \textit{Modules and namespaces provide a means to collect related
580 entities into a single entity and to manage the names of
583 \subsection{Module Entries}
584 \label{chap:moduleentries}
585 \textit{Several languages have the concept of a \doublequote{module.}
586 \addtoindexx{Modula-2}
587 A Modula\dash 2 definition module
588 \addtoindexx{Modula-2!definition module}
589 may be represented by a module
591 \addtoindex{declaration attribute}
592 (\DWATdeclaration). A
593 \addtoindex{Fortran 90} module
594 \addtoindexx{Fortran!module (Fortran 90)}
595 may also be represented by a module entry
596 (but no declaration attribute is warranted because \addtoindex{Fortran}
597 has no concept of a corresponding module body).}
599 A module is represented by a debugging information entry
601 tag \DWTAGmoduleTARG.
602 Module entries may own other
603 debugging information entries describing program entities
604 whose declaration scopes end at the end of the module itself.
606 If the module has a name, the module entry has a
607 \DWATname{} attribute
608 \addtoindexx{name attribute}
609 whose value is a null\dash terminated string containing
610 the module name as it appears in the source program.
612 The \addtoindex{module entry} may have either a
616 \addtoindexx{high PC attribute}
618 \addtoindexx{low PC attribute}
620 \DWATranges{} attribute
621 \addtoindexx{ranges attribute}
622 whose values encode the contiguous or non\dash contiguous address
623 ranges, respectively, of the machine instructions generated for
624 the module initialization code
625 (see Section \refersec{chap:codeaddressesandranges}).
626 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}{}
628 \addtoindexx{entry pc attribute!for module initialization}
630 \DWATentrypc{} attribute whose value is the address of
631 the first executable instruction of that initialization code
632 (see Section \refersec{chap:entryaddress}).
635 \hypertarget{chap:DWATprioritymodulepriority}{}
636 the module has been assigned a priority, it may have
637 \addtoindexx{priority attribute}
639 \DWATpriority{} attribute.
640 The value of this attribute is a
641 reference to another debugging information entry describing
642 a variable with a constant value. The value of this variable
643 is the actual constant value of the module\textquoteright s priority,
644 represented as it would be on the target architecture.
646 \subsection{Namespace Entries}
647 \label{chap:namespaceentries}
648 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
649 \addtoindexx{namespace (C++)}
650 implement name hiding, so that names of unrelated things
651 do not accidentally clash in the
652 \addtoindex{global namespace} when an
653 application is linked together.}
655 A namespace is represented by a debugging information entry
657 tag \DWTAGnamespaceTARG.
658 A namespace extension is
659 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}{}
661 \DWTAGnamespace{} entry
663 \addtoindexx{extension attribute}
666 attribute referring to the previous extension, or if there
667 is no previous extension, to the original
669 entry. A namespace extension entry does not need to duplicate
670 information in a previous extension entry of the namespace
671 nor need it duplicate information in the original namespace
672 entry. (Thus, for a namespace with a name,
673 a \DWATname{} attribute
674 \addtoindexx{name attribute}
675 need only be attached directly to the original
676 \DWTAGnamespace{} entry.)
679 Namespace and namespace extension entries may own
680 \addtoindexx{namespace extension entry}
682 \addtoindexx{namespace declaration entry}
683 debugging information entries describing program entities
684 whose declarations occur in the namespace.
686 \textit{For \addtoindex{C++}, such
687 owned program entities may be declarations,
688 including certain declarations that are also object or
689 function definitions.}
691 If a type, variable, or function declared in a namespace is
692 defined outside of the body of the namespace declaration,
693 that type, variable, or function definition entry has a
694 \DWATspecification{} attribute
695 \addtoindexx{specification attribute}
696 whose value is a \livelink{chap:classreference}{reference} to the
697 debugging information entry representing the declaration of
698 the type, variable or function. Type, variable, or function
700 \DWATspecification{} attribute
701 \addtoindexx{specification attribute}
703 to duplicate information provided by the declaration entry
704 referenced by the specification attribute.
706 \textit{The \addtoindex{C++} \addtoindex{global namespace}
708 \addtoindexx{global namespace|see{namespace (C++), global}}
710 \addtoindexx{namespace (C++)!global}
712 \texttt{::f}, for example) is not explicitly represented in
713 DWARF with a namespace entry (thus mirroring the situation
714 in \addtoindex{C++} source).
715 Global items may be simply declared with no
716 reference to a namespace.}
718 \textit{The \addtoindex{C++}
719 compilation unit specific \doublequote{unnamed namespace} may
720 \addtoindexx{namespace (C++)!unnamed}
721 \addtoindexx{unnamed namespace|see {namespace (C++), unnamed}}
722 be represented by a namespace entry with no name attribute in
723 the original namespace declaration entry (and therefore no name
724 attribute in any namespace extension entry of this namespace).
727 \textit{A compiler emitting namespace information may choose to
728 explicitly represent namespace extensions, or to represent the
729 final namespace declaration of a compilation unit; this is a
730 quality\dash of\dash implementation issue and no specific requirements
731 are given here. If only the final namespace is represented,
732 \addtoindexx{namespace (C++)!using declaration}
733 it is impossible for a debugger to interpret using declaration
734 references in exactly the manner defined by the
735 \addtoindex{C++} language.
738 \textit{Emitting all namespace declaration information in all
739 compilation units can result in a significant increase in the
740 size of the debug information and significant duplication of
741 information across compilation units.
742 The \addtoindex{C++} namespace std,
744 \addtoindexx{namespace (C++)!std}
745 is large and will probably be referenced in
746 every \addtoindex{C++} compilation unit.
749 \textit{For a \addtoindex{C++} namespace example,
750 see Appendix \refersec{app:namespaceexample}.
755 \subsection{Imported (or Renamed) Declaration Entries}
756 \label{chap:importedorrenameddeclarationentries}
757 \textit{Some languages support the concept of importing into or making
758 accessible in a given unit declarations made in a different
759 module or scope. An imported declaration may sometimes be
764 imported declaration is represented by one or
765 \addtoindexx{imported declaration entry}
766 more debugging information entries with the
767 tag \DWTAGimporteddeclarationTARG.
769 \hypertarget{chap:DWATimportimporteddeclaration}{}
771 is imported, there is one imported declaration entry for
773 \addtoindexx{import attribute}
774 Each imported declaration entry has a
775 \DWATimport{} attribute,
776 whose value is a \livelink{chap:classreference}{reference} to the
777 debugging information entry representing the declaration that
780 An imported declaration may also have a
783 \addtoindexx{name attribute}
784 whose value is a null\dash terminated string containing the
785 name, as it appears in the source program, by which the
786 imported entity is to be known in the context of the imported
787 declaration entry (which may be different than the name of
788 the entity being imported). If no name is present, then the
789 name by which the entity is to be known is the same as the
790 name of the entity being imported.
792 An imported declaration entry with a name attribute may be
793 used as a general means to rename or provide an alias for
794 \addtoindexx{alias declaration|see{imported declaration entry}}
795 an entity, regardless of the context in which the importing
796 declaration or the imported entity occurs.
798 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
799 \hypertarget{chap:DWATimportnamespacealias}{}
801 \addtoindexx{namespace (C++)!alias}
802 with a name attribute whose value is
803 a null\dash terminated string containing the alias name as it
804 appears in the source program and an import attribute whose
805 value is a \livelink{chap:classreference}{reference} to the applicable original namespace or
806 namespace extension entry.
809 \textit{A \addtoindex{C++} using declaration may be represented by one or more
810 \hypertarget{chap:DWATimportnamespaceusingdeclaration}{}
812 \addtoindexx{namespace (C++)!using declaration}
813 declaration entries. When the using declaration
814 refers to an overloaded function, there is one imported
815 declaration entry corresponding to each overloading. Each
816 imported declaration entry has no name attribute but it does
817 have an import attribute that refers to the entry for the
818 entity being imported. (\addtoindex{C++}
819 provides no means to \doublequote{rename}
820 an imported entity, other than a namespace).
823 \textit{A \addtoindex{Fortran} use statement
824 \addtoindexx{Fortran!use statement}
825 \addtoindexx{use statement|see {Fortran, use statement}}
826 with an \doublequote{only list} may be
827 represented by a series of imported declaration entries,
828 one (or more) for each entity that is imported. An entity
829 \addtoindexx{renamed declaration|see{imported declaration entry}}
830 that is renamed in the importing context may be represented
831 by an imported declaration entry with a name attribute that
832 specifies the new local name.
835 \subsection{Imported Module Entries}
836 \label{chap:importedmoduleentries}
838 \textit{Some languages support the concept of importing into or making
839 accessible in a given unit all of the declarations contained
840 within a separate module or namespace.
843 An imported module declaration is represented by a debugging
844 information entry with
845 \addtoindexx{imported module attribute}
847 \addtoindexx{imported module entry}
848 tag \DWTAGimportedmoduleTARG.
850 imported module entry contains a
851 \DWATimport{} attribute
852 \addtoindexx{import attribute}
853 whose value is a \livelink{chap:classreference}{reference}
854 to the module or namespace entry
855 containing the definition and/or declaration entries for
856 the entities that are to be imported into the context of the
857 imported module entry.
859 An imported module declaration may own a set of imported
860 declaration entries, each of which refers to an entry in the
861 module whose corresponding entity is to be known in the context
862 of the imported module declaration by a name other than its
863 name in that module. Any entity in the module that is not
864 renamed in this way is known in the context of the imported
865 module entry by the same name as it is declared in the module.
867 \textit{A \addtoindex{C++} using directive
868 \addtoindexx{namespace (C++)!using directive}
869 \addtoindexx{using directive|see {namespace (C++), using directive}}
870 may be represented by an imported module
871 \hypertarget{chap:DWATimportnamespaceusingdirective}{}
872 entry, with an import attribute referring to the namespace
873 entry of the appropriate extension of the namespace (which
874 might be the original namespace entry) and no owned entries.
877 \textit{A \addtoindex{Fortran} use statement
878 \addtoindexx{Fortran!use statement}
879 with a \doublequote{rename list} may be
880 represented by an imported module entry with an import
881 attribute referring to the module and owned entries
882 corresponding to those entities that are renamed as part of
886 \textit{A \addtoindex{Fortran} use statement
887 \addtoindexx{Fortran!use statement}
888 with neither a \doublequote{rename list} nor
889 an \doublequote{only list} may be represented by an imported module
890 entry with an import attribute referring to the module and
891 no owned child entries.
894 \textit{A use statement with an \doublequote{only list} is represented by a
895 series of individual imported declaration entries as described
896 in Section \refersec{chap:importedorrenameddeclarationentries}.
899 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
900 \addtoindexx{Fortran!use statement}
901 itself imported by a use statement without an explicit mention
902 may be represented by an imported declaration entry that refers
903 to the original debugging information entry. For example, given
920 \textit{the imported declaration entry for Q within module C refers
921 directly to the variable declaration entry for X in module A
922 because there is no explicit representation for X in module B.
925 \textit{A similar situation arises for a \addtoindex{C++} using declaration
926 \addtoindexx{namespace (C++)!using declaration}
927 \addtoindexx{using declaration|see {namespace (C++), using declaration}}
928 that imports an entity in terms of a namespace alias. See
929 Appendix \refersec{app:namespaceexample}
933 \section{Subroutine and Entry Point Entries}
934 \label{chap:subroutineandentrypointentries}
936 The following tags exist to describe
937 debugging information entries
938 \addtoindexx{function entry|see{subroutine entry}}
940 \addtoindexx{subroutine entry}
942 \addtoindexx{subprogram entry}
944 % FIXME: is entry point entry the right index 'entry'?
945 \addtoindexx{entry point entry}
948 \begin{tabular}{lp{9.0cm}}
949 \DWTAGsubprogramTARG{} & A subroutine or function \\
950 \DWTAGinlinedsubroutine{} & A particular inlined
951 \addtoindexx{inlined subprogram entry}
952 instance of a subroutine or function \\
953 \DWTAGentrypointTARG{} & An alternate entry point \\
958 \subsection{General Subroutine and Entry Point Information}
959 \label{chap:generalsubroutineandentrypointinformation}
960 The subroutine or entry point entry has a \DWATname{}
961 attribute whose value is a null-terminated string containing the
962 subroutine or entry point name as it appears in the source program.
963 It may also have a \DWATlinkagename{} attribute as
964 described in Section \refersec{chap:linkagenames}.
966 If the name of the subroutine described by an entry with the
967 \addtoindexx{subprogram entry}
968 tag \DWTAGsubprogram{}
969 is visible outside of its containing
970 \hypertarget{chap:DWATexternalexternalsubroutine}{}
971 compilation unit, that entry has
972 \addtoindexx{external attribute}
974 \DWATexternal{} attribute,
975 which is a \livelink{chap:classflag}{flag}.
977 \textit{Additional attributes for functions that are members of a
978 class or structure are described in
979 Section \refersec{chap:memberfunctionentries}.
983 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}{}
986 \DWATmainsubprogram{}
988 \addtoindexx{main subprogram attribute}
990 a \livelink{chap:classflag}{flag} whose presence indicates that the
991 subroutine has been identified as the starting function of
992 the program. If more than one subprogram contains this
994 any one of them may be the starting subroutine of the program.
996 \textit{\addtoindex{Fortran} has a \addtoindex{PROGRAM statement}
997 which is used to specify
998 and provide a user\dash supplied name for the main subroutine of
1002 \textit{A common debugger feature is to allow the debugger user to call
1003 a subroutine within the subject program. In certain cases,
1004 however, the generated code for a subroutine will not obey
1005 the standard calling conventions for the target architecture
1006 and will therefore not be safe to call from within a debugger.
1009 A subroutine entry may
1010 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}{}
1012 \DWATcallingconvention{}
1013 attribute, whose value is an
1014 \livelink{chap:classconstant}{integer constant}. The set of
1015 calling convention codes is given in
1016 Table \refersec{tab:callingconventioncodes}.
1018 \begin{simplenametable}[1.4in]{Calling convention codes}{tab:callingconventioncodes}
1022 \end{simplenametable}
1024 If this attribute is not present, or its value is the constant
1025 \DWCCnormalTARG, then the subroutine may be safely called by
1026 obeying the \doublequote{standard} calling conventions of the target
1027 architecture. If the value of the calling convention attribute
1028 is the constant \DWCCnocallTARG, the subroutine does not obey
1029 standard calling conventions, and it may not be safe for the
1030 debugger to call this subroutine.
1032 If the semantics of the language of the compilation unit
1033 containing the subroutine entry distinguishes between ordinary
1034 subroutines and subroutines that can serve as the \doublequote{main
1035 program,} that is, subroutines that cannot be called
1036 directly according to the ordinary calling conventions,
1037 then the debugging information entry for such a subroutine
1038 may have a calling convention attribute whose value is the
1039 constant \DWCCprogramTARG.
1041 \textit{The \DWCCprogram{}
1042 value is intended to support \addtoindex{Fortran} main
1043 \addtoindexx{Fortran!main program}
1044 programs which in some implementations may not be callable
1045 or which must be invoked in a special way. It is not intended
1046 as a way of finding the entry address for the program.
1049 \textit{In \addtoindex{C}
1050 there is a difference between the types of functions
1051 declared using function prototype style declarations and
1052 those declared using non\dash prototype declarations.
1055 A subroutine entry declared with a function prototype style
1056 declaration may have
1057 \addtoindexx{prototyped attribute}
1059 \DWATprototyped{} attribute, which is
1060 a \livelink{chap:classflag}{flag}.
1062 \textit{The \addtoindex{Fortran}
1063 language allows the keywords \texttt{elemental}, \texttt{pure}
1064 and \texttt{recursive} to be included as part of the declaration of
1065 a subroutine; these attributes reflect that usage. These
1066 attributes are not relevant for languages that do not support
1067 similar keywords or syntax. In particular, the \DWATrecursive{}
1068 attribute is neither needed nor appropriate in languages such
1070 where functions support recursion by default.
1074 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}{}
1076 \addtoindexx{elemental attribute}
1078 \DWATelemental{} attribute, which
1079 is a \livelink{chap:classflag}{flag}.
1080 The attribute indicates whether the subroutine
1081 or entry point was declared with the \doublequote{elemental} keyword
1085 \hypertarget{chap:DWATpurepurepropertyofasubroutine}{}
1086 subprogram entry may have
1087 \addtoindexx{pure attribute}
1089 \DWATpure{} attribute, which is
1090 a \livelink{chap:classflag}{flag}.
1091 The attribute indicates whether the subroutine was
1092 declared with the \doublequote{pure} keyword or property.
1095 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}{}
1096 subprogram entry may have a
1097 \DWATrecursive{} attribute, which
1098 is a \livelink{chap:classflag}{flag}.
1099 The attribute indicates whether the subroutine
1100 or entry point was declared with the \doublequote{recursive} keyword
1103 \subsubsection{Call Site-Related Attributes}
1104 A subroutine entry may have \DWATcallalltailcalls, \DWATcallallcalls{}
1105 and/or \DWATcallallsourcecalls{} attributes, each of which is a
1106 \livelink{chap:classflag}{flag}.
1107 These flags indicate the completeness of the call site information
1108 within the subprogram.
1110 The \DWATcallalltailcalls{} attribute indicates that every tail call
1111 that occurs in the code for the subprogram is described by a
1112 \DWTAGcallsite{} entry.
1113 (There may or may not be other non-tail calls to some of the same
1114 target subprograms.)
1116 The \DWATcallallcalls{} attribute indicates that every non-inlined call
1117 (either a tail call or a normal call) that occurs in the code for the subprogram
1118 is described by a \DWTAGcallsite{} entry.
1120 The \DWATcallallsourcecalls{} attribute indicates that every call that occurs in the
1121 code for the subprogram, including every call inlined into it, is described by either a
1122 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1123 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1124 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1126 \textit{The \DWATcallallsourcecalls{} attribute is intended for debugging
1127 information format consumers that analyse call graphs.}
1129 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1130 \DWATcallallcalls{} and \DWATcallallcalls{} attributes are necessarily also true, and
1131 those attributes need not be present. Similarly, if the value of the
1132 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1133 attribute is also true and the latter attribute need not be present.
1135 \subsection{Subroutine and Entry Point Return Types}
1136 \label{chap:subroutineandentrypointreturntypes}
1139 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1140 the subroutine or entry point
1141 \addtoindexx{return type of subroutine}
1142 is a function that returns a
1143 value, then its debugging information entry has
1144 \addtoindexx{type attribute}
1145 a \DWATtype{} attribute
1146 to denote the type returned by that function.
1148 \textit{Debugging information entries for
1149 \addtoindex{C} void functions should
1150 not have an attribute for the return type. }
1152 \textit{Debugging information entries for declarations of \addtoindex{C++}
1153 member functions with an
1154 \addtoindex{\texttt{auto} return type} specifier should use an unspecified
1156 Section \refersec{chap:unspecifiedtypeentries}).
1157 The debugging information entry for the corresponding definition
1158 should provide the deduced return type. This practice causes the description of
1159 the containing class to be consistent across compilation units, allowing the class
1160 declaration to be placed into a separate type unit if desired.}
1163 \subsection{Subroutine and Entry Point Locations}
1164 \label{chap:subroutineandentrypointlocations}
1166 A subroutine entry may have either a \DWATlowpc{} and
1167 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1168 \addtoindexx{ranges attribute}
1170 \addtoindexx{high PC attribute}
1172 \addtoindexx{low PC attribute}
1173 encode the contiguous or non\dash contiguous address
1174 ranges, respectively, of the machine instructions generated
1175 for the subroutine (see
1176 Section \refersec{chap:codeaddressesandranges}).
1179 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1180 subroutine entry may also have
1181 \addtoindexx{entry pc attribute!for subroutine}
1183 \DWATentrypc{} attribute
1184 whose value is the address of the first executable instruction
1185 of the subroutine (see
1186 Section \refersec{chap:entryaddress}).
1188 An entry point has a \DWATlowpc{} attribute whose value is the
1189 relocated address of the first machine instruction generated
1190 for the entry point.
1193 \DWATentrypc{} attribute
1194 \addtoindexx{entry pc attribute!for subroutine}
1196 also seem appropriate
1197 for this purpose, historically the
1198 \DWATlowpc{} attribute
1200 \DWATentrypc{} was introduced (in
1201 \addtoindex{DWARF Version 3}).
1202 There is insufficient reason to change this.}
1208 \addtoindexx{address class!attribute}
1210 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1214 \DWATaddressclass{} attributes,
1215 as appropriate, to specify
1216 which segments the code for the subroutine resides in and
1217 the addressing mode to be used in calling that subroutine.
1219 A subroutine entry representing a subroutine declaration
1220 that is not also a definition does not have code address or
1224 \subsection{Declarations Owned by Subroutines and Entry Points}
1225 \label{chap:declarationsownedbysubroutinesandentrypoints}
1227 The declarations enclosed by a subroutine or entry point are
1228 represented by debugging information entries that are owned
1229 by the subroutine or entry point entry. Entries representing
1230 \addtoindexx{formal parameter}
1231 the formal parameters of the subroutine or entry point appear
1232 in the same order as the corresponding declarations in the
1236 \textit{There is no ordering requirement for entries for declarations
1237 that are children of subroutine or entry point entries but
1238 that do not represent formal parameters. The formal parameter
1239 entries may be interspersed with other entries used by formal
1240 parameter entries, such as type entries.}
1242 The unspecified parameters of a variable parameter list are
1243 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1245 \DWTAGunspecifiedparametersTARG.
1247 The entry for a subroutine that includes a
1248 \addtoindex{Fortran}
1249 \addtoindexx{Fortran!common block}
1250 \livelink{chap:fortrancommonblock}{common}
1251 \livelink{chap:commonblockentry}{block}
1252 \addtoindexx{common block|see{Fortran common block}}
1253 has a child entry with the
1254 tag \DWTAGcommoninclusionTARG.
1256 \hypertarget{chap:commonreferencecommonblockusage}{}
1257 common inclusion entry has a
1258 \DWATcommonreference{} attribute
1259 whose value is a \livelink{chap:classreference}{reference}
1260 to the debugging information entry
1261 for the common \nolink{block} being included
1262 (see Section \refersec{chap:commonblockentries}).
1264 \subsection{Low-Level Information}
1265 \label{chap:lowlevelinformation}
1268 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1269 subroutine or entry point entry may have
1270 \addtoindexx{return address attribute}
1273 attribute, whose value is a location description. The location
1274 calculated is the place where the return address for the
1275 subroutine or entry point is stored.
1278 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1279 subroutine or entry point entry may also have
1280 \addtoindexx{frame base attribute}
1282 \DWATframebase{} attribute, whose value is a location
1283 description that computes the \doublequote{frame base} for the
1284 subroutine or entry point. If the location description is
1285 a simple register location description, the given register
1286 contains the frame base address. If the location description is
1287 a DWARF expression, the result of evaluating that expression
1288 is the frame base address. Finally, for a
1289 \addtoindex{location list},
1290 this interpretation applies to each location description
1291 contained in the list of \addtoindex{location list} entries.
1293 \textit{The use of one of the \DWOPregn{}
1295 context is equivalent to using
1298 compact. However, these are not equivalent in general.}
1301 \textit{The frame base for a procedure is typically an address fixed
1302 relative to the first unit of storage allocated for the
1303 procedure\textquoteright s stack frame. The \DWATframebase{} attribute
1304 can be used in several ways:}
1305 \begin{enumerate}[1. ]
1306 \item \textit{In procedures that need
1307 \addtoindexx{location list}
1308 location lists to locate local
1309 variables, the \DWATframebase{} can hold the needed location
1310 list, while all variables\textquoteright\ location descriptions can be
1311 simpler ones involving the frame base.}
1313 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1314 within nested routines.
1315 (See also \DWATstaticlink, below)}
1319 \textit{Some languages support nested subroutines. In such languages,
1320 it is possible to reference the local variables of an
1321 outer subroutine from within an inner subroutine. The
1322 \DWATstaticlink{} and \DWATframebase{} attributes allow
1323 debuggers to support this same kind of referencing.}
1326 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1328 \addtoindexx{address!uplevel|see {static link attribute}}
1329 \addtoindexx{uplevel address|see {static link attribute}}
1330 subroutine or entry point is nested, it may have a
1332 attribute, whose value is a location
1333 description that computes the frame base of the relevant
1334 instance of the subroutine that immediately encloses the
1335 subroutine or entry point.
1337 In the context of supporting nested subroutines, the
1338 \DWATframebase{} attribute value should obey the following
1341 \begin{enumerate}[1. ]
1342 \item It should compute a value that does not change during the
1343 life of the procedure, and
1345 \item The computed value should be unique among instances of
1346 the same subroutine. (For typical \DWATframebase{} use, this
1347 means that a recursive subroutine\textquoteright s stack frame must have
1348 non\dash zero size.)
1351 \textit{If a debugger is attempting to resolve an up\dash level reference
1352 to a variable, it uses the nesting structure of DWARF to
1353 determine which subroutine is the lexical parent and the
1354 \DWATstaticlink{} value to identify the appropriate active
1355 frame of the parent. It can then attempt to find the reference
1356 within the context of the parent.}
1360 \subsection{Types Thrown by Exceptions}
1361 \label{chap:typesthrownbyexceptions}
1363 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1364 it may validly throw.}
1366 If a subroutine explicitly declares that it may throw
1367 \addtoindexx{exception thrown|see{thrown type entry}}
1369 \addtoindexx{thrown exception|see{thrown type entry}}
1370 exception of one or more types, each such type is
1371 represented by a debugging information entry with
1372 \addtoindexx{thrown type entry}
1374 \DWTAGthrowntypeTARG.
1375 Each such entry is a child of the entry
1376 representing the subroutine that may throw this type. Each
1377 thrown type entry contains
1378 \addtoindexx{type attribute}
1379 a \DWATtype{} attribute, whose
1380 value is a \livelink{chap:classreference}{reference}
1381 to an entry describing the type of the
1382 exception that may be thrown.
1384 \subsection{Function Template Instantiations}
1385 \label{chap:functiontemplateinstantiations}
1387 \textit{In \addtoindex{C++}, a function template is a generic definition of
1388 a function that is instantiated differently for calls with
1389 values of different types. DWARF does not represent the generic
1390 template definition, but does represent each instantiation.}
1393 A \addtoindex{template instantiation} is represented by a debugging
1394 information entry with the
1395 \addtoindexx{subprogram entry!use for template instantiation}
1396 tag \DWTAGsubprogram.
1398 exceptions, such an entry will contain the same attributes and
1399 will have the same types of child entries as would an entry
1400 for a subroutine defined explicitly using the instantiation
1401 types and values. The exceptions are:
1403 \begin{enumerate}[1. ]
1404 \item Template parameters are described and referenced as specified in
1405 Section \refersec{chap:templateparameters}.
1407 \item If the compiler has generated a special compilation unit
1408 to hold the template instantiation and that compilation unit
1409 has a different name from the compilation unit containing
1410 the template definition, the name attribute for the debugging
1411 information entry representing that compilation unit is empty
1414 \item If the subprogram entry representing the template
1415 instantiation or any of its child entries contain declaration
1416 coordinate attributes, those attributes refer to the source
1417 for the template definition, not to any source generated
1418 artificially by the compiler for this instantiation.
1423 \subsection{Inlinable and Inlined Subroutines}
1424 \label{chap:inlinedsubroutines}
1425 A declaration or a definition of an inlinable subroutine
1426 is represented by a debugging information entry with the
1430 \addtoindexx{subprogram entry!use in inlined subprogram}
1432 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1433 explicitly declared to be available for inline expansion or
1434 that was expanded inline implicitly by the compiler has
1435 \addtoindexx{inline attribute}
1437 \DWATinline{} attribute whose value is an
1438 \livelink{chap:classconstant}{integer constant}. The
1439 set of values for the \DWATinline{} attribute is given in
1440 Table \refersec{tab:inlinecodes}.
1444 \caption{Inline codes}
1445 \label{tab:inlinecodes}
1446 \begin{tabular}{l|p{8cm}}
1448 Name&Meaning\\ \hline
1449 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1450 \mbox{compiler} (equivalent to the absence of the
1451 containing \DWATinline{} attribute) \\
1452 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1453 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1454 not inlined by the \mbox{compiler} \\
1455 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1461 \textit{In \addtoindex{C++}, a function or a constructor declared with
1462 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1463 instance (see below) is represented by a debugging information
1464 entry with the tag \DWTAGsubprogram. Such an entry has a
1465 \DWATinline{} attribute whose value is \DWINLinlined.}
1468 \subsubsection{Abstract Instances}
1469 \label{chap:abstractinstances}
1470 Any debugging information entry that is owned (either
1471 \hypertarget{chap:DWATinlineabstracttinstance}{}
1472 directly or indirectly) by a debugging information entry
1474 \DWATinline{} attribute is referred to
1475 \addtoindexx{abstract instance!entry}
1476 as an \doublequote{abstract instance entry.}
1477 Any subroutine entry
1479 \addtoindexx{inline attribute}
1480 a \DWATinline{} attribute whose value is other
1481 than \DWINLnotinlined{}
1483 \addtoindexx{abstract instance!root}
1484 an \doublequote{abstract instance root.}
1485 Any set of abstract instance entries that are all
1486 children (either directly or indirectly) of some abstract
1487 instance root, together with the root itself, is known as
1488 \addtoindexx{abstract instance!tree}
1489 an \doublequote{abstract instance tree.} However, in the case where
1490 an abstract instance tree is nested within another abstract
1491 instance tree, the entries in the
1492 \addtoindex{nested abstract instance}
1493 tree are not considered to be entries in the outer abstract
1496 Each abstract instance root is either part of a larger
1497 \addtoindexx{abstract instance!root}
1498 tree (which gives a context for the root) or
1499 \addtoindexx{specification attribute}
1501 \DWATspecification{}
1502 to refer to the declaration in context.
1504 \textit{For example, in \addtoindex{C++} the context might be a namespace
1505 declaration or a class declaration.}
1507 \textit{Abstract instance trees are defined so that no entry is part
1508 of more than one abstract instance tree. This simplifies the
1509 following descriptions.}
1511 A debugging information entry that is a member of an abstract
1512 instance tree should not contain any attributes which describe
1513 aspects of the subroutine which vary between distinct inlined
1514 expansions or distinct out\dash of\dash line expansions. For example,
1515 \addtoindexx{entry pc attribute!and abstract instance}
1526 \addtoindexx{location attribute!and abstract instance}
1528 \addtoindexx{ranges attribute!and abstract instance}
1530 \addtoindexx{high PC attribute!and abstract instance}
1532 \addtoindexx{low PC attribute!and abstract instance}
1534 \addtoindexx{segment attribute!and abstract instance}
1536 \addtoindexx{return address attribute!and abstract instance}
1538 \addtoindexx{segment attribute!and abstract instance}
1540 \addtoindexx{start scope attribute!and abstract instance}
1544 \textit{It would not make sense normally to put these attributes into
1545 abstract instance entries since such entries do not represent
1546 actual (concrete) instances and thus do not actually exist at
1547 run\dash time. However,
1548 see Appendix \refersec{app:inlineouteronenormalinner}
1549 for a contrary example.}
1551 The rules for the relative location of entries belonging to
1552 abstract instance trees are exactly the same as for other
1553 similar types of entries that are not abstract. Specifically,
1554 the rule that requires that an entry representing a declaration
1555 be a direct child of the entry representing the scope of the
1556 declaration applies equally to both abstract and non\dash abstract
1557 entries. Also, the ordering rules for formal parameter entries,
1558 member entries, and so on, all apply regardless of whether
1559 or not a given entry is abstract.
1562 \subsubsection{Concrete Inlined Instances}
1563 \label{chap:concreteinlinedinstances}
1565 Each inline expansion of a subroutine is represented
1566 by a debugging information entry with the
1567 tag \DWTAGinlinedsubroutineTARG.
1568 Each such entry should be a direct
1569 child of the entry that represents the scope within which
1570 the inlining occurs.
1572 Each inlined subroutine entry may have either a
1574 and \DWAThighpc{} pair
1576 \addtoindexx{high PC attribute}
1578 \addtoindexx{low PC attribute}
1580 \addtoindexx{ranges attribute}
1583 attribute whose values encode the contiguous or non\dash contiguous
1584 address ranges, respectively, of the machine instructions
1585 generated for the inlined subroutine (see
1586 Section \referfol{chap:codeaddressesandranges}).
1588 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1589 inlined subroutine entry may
1590 \addtoindexx{inlined subprogram entry!in concrete instance}
1592 \addtoindexx{inlined subprogram entry}
1594 \addtoindexx{entry pc attribute!for inlined subprogram}
1597 attribute, representing the first executable instruction of
1598 the inline expansion (see
1599 Section \refersec{chap:entryaddress}).
1601 % Positions of the 3 targets here is a bit arbitrary.
1603 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1605 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1607 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1608 may also have \DWATcallfile,
1609 \DWATcallline{} and \DWATcallcolumn{} attributes,
1611 value is an \livelink{chap:classconstant}{integer constant}.
1612 These attributes represent the
1613 source file, source line number, and source column number,
1614 respectively, of the first character of the statement or
1615 expression that caused the inline expansion. The call file,
1616 call line, and call column attributes are interpreted in
1617 the same way as the declaration file, declaration line, and
1618 declaration column attributes, respectively (see
1619 Section \refersec{chap:declarationcoordinates}).
1621 \textit{The call file, call line and call column coordinates do not
1622 describe the coordinates of the subroutine declaration that
1623 was inlined, rather they describe the coordinates of the call.
1626 An inlined subroutine entry
1627 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1630 attribute, which is a \livelink{chap:classflag}{flag}
1631 whose presence indicates that the
1632 subroutine has been evaluated as a compile\dash time constant. Such
1633 an entry may also have a \DWATconstvalue{} attribute,
1634 whose value may be of any form that is appropriate for the
1635 representation of the subroutine's return value. The value of
1636 this attribute is the actual return value of the subroutine,
1637 represented as it would be on the target architecture.
1639 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1640 \addttindex{constexpr}
1641 is called with constant expressions, then the corresponding
1642 concrete inlined instance has a
1643 \DWATconstexpr{} attribute,
1644 as well as a \DWATconstvalue{} attribute whose value represents
1645 the actual return value of the concrete inlined instance.}
1647 Any debugging information entry that is owned (either
1648 directly or indirectly) by a debugging information entry
1649 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1650 \doublequote{concrete inlined instance entry.} Any entry that has
1652 \DWTAGinlinedsubroutine{}
1653 is known as a \doublequote{concrete inlined instance root.}
1654 Any set of concrete inlined instance
1655 entries that are all children (either directly or indirectly)
1656 of some concrete inlined instance root, together with the root
1657 itself, is known as a \doublequote{concrete inlined instance tree.}
1658 However, in the case where a concrete inlined instance tree
1659 is nested within another concrete instance tree, the entries
1660 in the \addtoindex{nested concrete inline instance} tree
1661 are not considered to
1662 be entries in the outer concrete instance tree.
1664 \textit{Concrete inlined instance trees are defined so that no entry
1665 is part of more than one concrete inlined instance tree. This
1666 simplifies later descriptions.}
1668 Each concrete inlined instance tree is uniquely associated
1669 with one (and only one) abstract instance tree.
1671 \textit{Note, however, that the reverse is not true. Any given abstract
1672 instance tree may be associated with several different concrete
1673 inlined instance trees, or may even be associated with zero
1674 concrete inlined instance trees.}
1676 Concrete inlined instance entries may omit attributes that
1677 are not specific to the concrete instance (but present in
1678 the abstract instance) and need include only attributes that
1679 are specific to the concrete instance (but omitted in the
1680 abstract instance). In place of these omitted attributes, each
1681 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1682 concrete inlined instance entry
1683 \addtoindexx{abstract origin attribute}
1685 \DWATabstractorigin{}
1686 attribute that may be used to obtain the missing information
1687 (indirectly) from the associated abstract instance entry. The
1688 value of the abstract origin attribute is a reference to the
1689 associated abstract instance entry.
1691 If an entry within a concrete inlined instance tree contains
1692 attributes describing the
1693 \addtoindexx{declaration coordinates!in concrete instance}
1694 \livelink{chap:declarationcoordinates}{declaration coordinates}
1695 of that entry, then those attributes should refer to the file, line
1696 and column of the original declaration of the subroutine,
1697 not to the point at which it was inlined. As a consequence,
1698 they may usually be omitted from any entry that has an abstract
1702 For each pair of entries that are associated via a
1703 \addtoindexx{abstract origin attribute}
1704 \DWATabstractorigin{} attribute, both members of the pair
1705 have the same tag. So, for example, an entry with the tag
1706 \DWTAGvariable{} can only be associated with another entry
1707 that also has the tag \DWTAGvariable. The only exception
1708 to this rule is that the root of a concrete instance tree
1709 (which must always have the tag \DWTAGinlinedsubroutine)
1710 can only be associated with the root of its associated abstract
1711 instance tree (which must have the tag \DWTAGsubprogram).
1714 In general, the structure and content of any given concrete
1715 inlined instance tree will be closely analogous to the
1716 structure and content of its associated abstract instance
1717 tree. There are a few exceptions:
1719 \begin{enumerate}[1. ]
1720 \item An entry in the concrete instance tree may be omitted if
1722 \addtoindexx{abstract origin attribute}
1723 \DWATabstractorigin{} attribute and either
1724 has no children, or its children are omitted. Such entries
1725 would provide no useful information. In C\dash like languages,
1726 such entries frequently include types, including structure,
1727 union, class, and interface types; and members of types. If any
1728 entry within a concrete inlined instance tree needs to refer
1729 to an entity declared within the scope of the relevant inlined
1730 subroutine and for which no concrete instance entry exists,
1731 the reference should refer to the abstract instance entry.
1733 \item Entries in the concrete instance tree which are associated
1734 with entries in the abstract instance tree such that neither
1735 has a \DWATname{} attribute,
1736 \addtoindexx{name attribute}
1737 and neither is referenced by
1738 any other debugging information entry, may be omitted. This
1739 may happen for debugging information entries in the abstract
1740 instance trees that became unnecessary in the concrete instance
1741 tree because of additional information available there. For
1742 example, an anonymous variable might have been created and
1743 described in the abstract instance tree, but because of
1744 the actual parameters for a particular inlined expansion,
1745 it could be described as a constant value without the need
1746 for that separate debugging information entry.
1748 \item A concrete instance tree may contain entries which do
1749 not correspond to entries in the abstract instance tree
1750 to describe new entities that are specific to a particular
1751 inlined expansion. In that case, they will not have associated
1752 entries in the abstract instance tree, should not contain
1753 \addtoindexx{abstract origin attribute}
1754 \DWATabstractorigin{} attributes, and must contain all their
1755 own attributes directly. This allows an abstract instance tree
1756 to omit debugging information entries for anonymous entities
1757 that are unlikely to be needed in most inlined expansions. In
1758 any expansion which deviates from that expectation, the
1759 entries can be described in its concrete inlined instance tree.
1763 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1764 \label{chap:outoflineinstancesofinlinedsubroutines}
1765 Under some conditions, compilers may need to generate concrete
1766 executable instances of inlined subroutines other than at
1767 points where those subroutines are actually called. Such
1768 concrete instances of inlined subroutines are referred to as
1769 \doublequote{concrete out\dash of\dash line instances.}
1771 \textit{In \addtoindex{C++}, for example,
1772 taking the address of a function declared
1773 to be inline can necessitate the generation of a concrete
1774 out\dash of\dash line instance of the given function.}
1776 The DWARF representation of a concrete out\dash of\dash line instance
1777 of an inlined subroutine is essentially the same as for a
1778 concrete inlined instance of that subroutine (as described in
1779 the preceding section). The representation of such a concrete
1780 % It is critical that the hypertarget and livelink be
1781 % separated to avoid problems with latex.
1782 out\dash of\dash line
1783 \addtoindexx{abstract origin attribute}
1785 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1787 \DWATabstractorigin{}
1788 attributes in exactly the same way as they are used for
1789 a concrete inlined instance (that is, as references to
1790 corresponding entries within the associated abstract instance
1793 The differences between the DWARF representation of a
1794 concrete out\dash of\dash line instance of a given subroutine and the
1795 representation of a concrete inlined instance of that same
1796 subroutine are as follows:
1798 \begin{enumerate}[1. ]
1799 \item The root entry for a concrete out\dash of\dash line instance
1800 of a given inlined subroutine has the same tag as does its
1801 associated (abstract) inlined subroutine entry (that is, tag
1802 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1804 \item The root entry for a concrete out\dash of\dash line instance tree
1805 is normally owned by the same parent entry that also owns
1806 the root entry of the associated abstract instance. However,
1807 it is not required that the abstract and out\dash of\dash line instance
1808 trees be owned by the same parent entry.
1812 \subsubsection{Nested Inlined Subroutines}
1813 \label{nestedinlinedsubroutines}
1814 Some languages and compilers may permit the logical nesting of
1815 a subroutine within another subroutine, and may permit either
1816 the outer or the nested subroutine, or both, to be inlined.
1818 For a non\dash inlined subroutine nested within an inlined
1819 subroutine, the nested subroutine is described normally in
1820 both the abstract and concrete inlined instance trees for
1821 the outer subroutine. All rules pertaining to the abstract
1822 and concrete instance trees for the outer subroutine apply
1823 also to the abstract and concrete instance entries for the
1827 For an inlined subroutine nested within another inlined
1828 subroutine, the following rules apply to their abstract and
1829 \addtoindexx{abstract instance!nested}
1830 \addtoindexx{concrete instance!nested}
1831 concrete instance trees:
1833 \begin{enumerate}[1. ]
1834 \item The abstract instance tree for the nested subroutine is
1835 described within the abstract instance tree for the outer
1836 subroutine according to the rules in
1837 Section \refersec{chap:abstractinstances}, and
1838 without regard to the fact that it is within an outer abstract
1841 \item Any abstract instance tree for a nested subroutine is
1842 always omitted within the concrete instance tree for an
1845 \item A concrete instance tree for a nested subroutine is
1846 always omitted within the abstract instance tree for an
1849 \item The concrete instance tree for any inlined or
1850 \addtoindexx{out-of-line instance}
1852 \addtoindexx{out-of-line-instance|see{concrete out-of-line-instance}}
1853 expansion of the nested subroutine is described within a
1854 concrete instance tree for the outer subroutine according
1856 Sections \refersec{chap:concreteinlinedinstances} or
1857 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1859 and without regard to the fact that it is within an outer
1860 concrete instance tree.
1863 See Appendix \refersec{app:inliningexamples}
1864 for discussion and examples.
1866 \subsection{Trampolines}
1867 \label{chap:trampolines}
1869 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1870 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1871 an intermediary in making a call to another subroutine. It may
1872 adjust parameters and/or the result (if any) as appropriate
1873 to the combined calling and called execution contexts.}
1875 A trampoline is represented by a debugging information entry
1876 \addtoindexx{trampoline (subprogram) entry}
1877 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1879 \addtoindexx{trampoline attribute}
1880 a \DWATtrampoline{} attribute.
1882 attribute indicates the target subroutine of the trampoline,
1883 that is, the subroutine to which the trampoline passes
1884 control. (A trampoline entry may but need not also have a
1885 \DWATartificial{} attribute.)
1888 The value of the trampoline attribute may be represented
1889 using any of the following forms, which are listed in order
1893 \item If the value is of class reference, then the value
1894 specifies the debugging information entry of the target
1897 \item If the value is of class address, then the value is
1898 the relocated address of the target subprogram.
1900 \item If the value is of class string, then the value is the
1901 (possibly mangled) \addtoindexx{mangled names}
1902 name of the target subprogram.
1904 \item If the value is of class \livelink{chap:classflag}{flag}, then the value true
1905 indicates that the containing subroutine is a trampoline but
1906 that the target subroutine is not known.
1910 The target subprogram may itself be a trampoline. (A sequence
1911 of trampolines necessarily ends with a non\dash trampoline
1914 \textit{In \addtoindex{C++}, trampolines may be used
1915 to implement derived virtual
1916 member functions; such trampolines typically adjust the
1917 \addtoindexx{this parameter}
1918 implicit this pointer parameter in the course of passing
1920 Other languages and environments may use trampolines
1921 in a manner sometimes known as transfer functions or transfer
1924 \textit{Trampolines may sometimes pass control to the target
1925 subprogram using a branch or jump instruction instead of a
1926 call instruction, thereby leaving no trace of their existence
1927 in the subsequent execution context. }
1929 \textit{This attribute helps make it feasible for a debugger to arrange
1930 that stepping into a trampoline or setting a breakpoint in
1931 a trampoline will result in stepping into or setting the
1932 breakpoint in the target subroutine instead. This helps to
1933 hide the compiler generated subprogram from the user. }
1935 \textit{If the target subroutine is not known, a debugger may choose
1936 to repeatedly step until control arrives in a new subroutine
1937 which can be assumed to be the target subroutine. }
1939 \subsection{Call Site Entries}
1940 \label{chap:callsiteentries}
1942 A call site entry provides a way to represent the static or dynamic
1943 call graph of a program in the debugging information. It also provides
1944 information about how parameters are passed so that they may be more
1945 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
1946 call site entries can be also useful for computing values of variables
1947 and expressions where some value is no longer present in the current
1948 subroutine's registers or local stack frame, but it is known that the
1949 values are equal to some parameter passed to the function.
1950 The consumer can then use unwind
1951 information to find the caller and in the call site information sometimes
1952 find how to compute the value passed in a particular parameter.}
1954 A call site is represented by a debugging information entry with the tag
1955 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
1956 debugging information entry representing the scope within which the
1957 call is present in the source program.
1959 \textit{A scope entry (for example, for a lexical block) that would not
1960 otherwise be present in the debugging information of a subroutine
1961 need not be introduced solely to represent the immediately containing scope
1962 of a call. The call site entry is owned by the innermost scope entry that
1965 A source call can be compiled into different types of machine code:
1968 A \textit{normal call} uses a call-like instruction which transfers control to the start
1969 of some subprogram and leaves the call site location address somewhere where
1970 unwind information can find it.
1972 A \textit{tail call} uses a jump-like instruction which
1973 transfers control to the start of some subprogram, but the call site location
1974 address is not preserved (and thus not available using the unwind information).
1976 A \textit{tail recursion call} is a call
1977 to the current subroutine which is compiled as a loop into the middle of the
1980 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
1981 where at least one instruction has the location of the inlined subprogram
1982 or any of its blocks or inlined subprograms.
1985 There are also different types of \doublequote{optimized out} calls:
1988 An \textit{optimized out (normal) call} is a call that is in unreachable code that
1989 has not been emitted (such as, for example, the call to \texttt{foo} in
1990 \texttt{if (0) foo();}).
1992 An \textit{optimized out inline call}
1993 is a call to an inlined subprogram which either did not expand to any instructions
1994 or only parts of instructions belong to it and for debug information purposes those
1995 instructions are given a location in the caller.
1998 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
1999 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2000 (see Section \refersec{chap:inlinedsubroutines}).
2002 The call site entry has a
2003 \DWATcallreturnpcTARG{} \addtoindexi{attribute}{call return pc attribute}
2004 which is the return address after the call.
2005 The value of this attribute corresponds to the return address computed by
2006 call frame information in the called subprogram
2007 (see Section \refersec{datarep:callframeinformation}).
2009 \textit{On many architectures the return address is the address immediately following the
2010 call instruction, but on architectures with delay slots it might
2011 be an address after the delay slot of the call.}
2013 The call site entry may have a
2014 \DWATcallpcTARG{} \addtoindexi{attribute}{call pc attribute} which is the
2015 address of the call instruction.
2017 If the call site entry corresponds to a tail call, it has the
2018 \DWATcalltailcallTARG{} \addtoindexi{attribute}{call tail call attribute},
2019 which is a \CLASSflag.
2021 The call site entry may have a
2022 \DWATcalloriginTARG{} \addtoindex{attribute}{call origin attribute}
2023 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2024 known it is a reference to the called subprogram's debugging
2025 information entry. For indirect calls it may be a reference to a
2026 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2027 the subroutine pointer that is called.
2029 The call site may have a
2030 \DWATcalltargetTARG{} \addtoindexi{attribute}{call target attribute} which is
2031 a DWARF expression. For indirect calls or jumps where it is unknown at
2032 compile time which subprogram will be called the expression computes the
2033 address of the subprogram that will be called. The DWARF expression should
2034 not use register or memory locations that might be clobbered by the call.
2036 The call site entry may have a
2037 \DWATcalltargetclobberedTARG{} \addtoindexi{attribute}{call target clobbered attribute}
2038 which is a DWARF expression. For indirect calls or jumps where the
2039 address is not computable without use of registers or memory locations that
2040 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2041 attribute is used instead of the \DWATcalltarget{} attribute.
2043 The call site entry may have a \DWATtype{} attribute referencing
2044 a debugging information entry for the type of the called function.
2045 When \DWATcallorigin{} is present, \DWATtype{} is usually omitted.
2047 The call site entry may have \DWATcallfile{}, \DWATcallline{} and
2048 \DWATcallcolumn{} attributes, each of whose value is an integer constant.
2049 These attributes represent the source file, source line number, and source
2050 column number, respectively, of the first character of the call statement or
2051 expression. The call file, call line, and call column attributes are
2052 interpreted in the same way as the declaration file, declaration
2053 line, and declaration column attributes, respectively
2054 (see Section \refersec{chap:declarationcoordinates}).
2056 \textit{The call file, call line and call column coordinates do not describe the
2057 coordinates of the subroutine declaration that was inlined, rather they describe
2058 the coordinates of the call.}
2060 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2061 entries\index{call site parameter entry} representing the parameters passed to the call.
2062 Each such entry has a \DWATlocation{} attribute which is a location expression.
2063 This location expression describes where the parameter is passed
2064 in (usually either some register, or a memory location expressible as the
2065 contents of the stack register plus some offset).
2067 Each \DWTAGcallsiteparameterTARG{} entry may have a
2068 \DWATcallvalue{} \addtoindexi{attribute}{call value attribute}
2069 which is a DWARF expression. This expression computes the value
2070 passed for that parameter. The expression should not use registers or memory
2071 locations that might be clobbered by the call, as it might be evaluated after
2072 unwinding from the called function back to the caller. If it is not
2073 possible to avoid registers or memory locations that might be clobbered by
2074 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2077 \textit{The reason for the restriction is that the value of the parameter may be
2078 needed in the middle of the callee, where the call clobbered registers or
2079 memory might be already clobbered, and if the consumer was not assured by
2080 the producer it can safely use those values, the consumer could not safely
2081 use the values at all.}
2083 For parameters passed by reference, where the code passes a pointer to
2084 a location which contains the parameter, or for reference type parameters
2085 the \DWTAGcallsiteparameter{} entry may also have
2086 \DWATcalldatalocation{} \addtoindexi{attribute}{call data location attribute}
2087 whose value is a location expression and a
2088 \DWATcalldatavalue{} \addtoindexi{attribute}{call data value attribute}
2089 whose value is a DWARF expression. The \DWATcalldatalocationNAME{} attribute
2090 describes where the referenced value lives during the call. If it is just
2091 \DWOPpushobjectaddress{}, it may be left out. The
2092 \DWATcalldatavalueNAME{} attribute describes the value in that location.
2093 The expression should not use registers or memory
2094 locations that might be clobbered by the call, as it might be evaluated after
2095 unwinding from the called function back to the caller.
2097 Each call site parameter entry may also have a
2098 \DWATcallparameter{} \addtoindexi{attribute}{call parameter entry}
2099 which contains a reference to a \DWTAGformalparameter{} entry,
2100 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2101 attribute describing the parameter's name.
2105 \section{Lexical Block Entries}
2106 \label{chap:lexicalblockentries}
2109 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2111 \addtoindexx{lexical block}
2112 a bracketed sequence of source statements
2113 that may contain any number of declarations. In some languages
2114 (including \addtoindex{C} and \addtoindex{C++}),
2115 \nolink{blocks} can be nested within other
2116 \nolink{blocks} to any depth.}
2118 % We do not need to link to the preceding paragraph.
2119 A lexical \nolink{block} is represented by a debugging information
2121 tag \DWTAGlexicalblockTARG.
2123 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2125 either a \DWATlowpc{} and
2126 \DWAThighpc{} pair of
2128 \addtoindexx{high PC attribute}
2130 \addtoindexx{low PC attribute}
2132 \DWATranges{} attribute
2133 \addtoindexx{ranges attribute}
2134 whose values encode the contiguous or non-contiguous address
2135 ranges, respectively, of the machine instructions generated
2136 for the lexical \nolink{block}
2137 (see Section \refersec{chap:codeaddressesandranges}).
2140 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2141 lexical block entry may also have
2142 \addtoindexx{entry pc attribute!for lexical block}
2144 \DWATentrypc{} attribute
2145 whose value is the address of the first executable instruction
2146 of the lexical block (see
2147 Section \refersec{chap:entryaddress}).
2149 If a name has been given to the
2150 lexical \nolink{block}
2152 program, then the corresponding
2153 lexical \nolink{block} entry has a
2154 \DWATname{} attribute whose
2155 \addtoindexx{name attribute}
2156 value is a null\dash terminated string
2157 containing the name of the lexical \nolink{block}
2161 \textit{This is not the same as a \addtoindex{C} or
2162 \addtoindex{C++} label (see below).}
2164 The lexical \nolink{block} entry owns
2165 debugging information entries that
2166 describe the declarations within that lexical \nolink{block}.
2168 one such debugging information entry for each local declaration
2169 of an identifier or inner lexical \nolink{block}.
2171 \section{Label Entries}
2172 \label{chap:labelentries}
2173 \textit{A label is a way of identifying a source statement. A labeled
2174 statement is usually the target of one or more \doublequote{go to}
2179 A label is represented by a debugging information entry with
2180 \addtoindexx{label entry}
2182 tag \DWTAGlabelTARG.
2183 The entry for a label should be owned by
2184 the debugging information entry representing the scope within
2185 which the name of the label could be legally referenced within
2188 The label entry has a \DWATlowpc{} attribute whose value
2189 is the relocated address of the first machine instruction
2190 generated for the statement identified by the label in
2191 the source program. The label entry also has a
2192 \DWATname{} attribute
2193 \addtoindexx{name attribute}
2194 whose value is a null-terminated string containing
2195 the name of the label as it appears in the source program.
2198 \section{With Statement Entries}
2199 \label{chap:withstatemententries}
2201 \textit{Both \addtoindex{Pascal} and
2202 \addtoindexx{Modula-2}
2203 Modula\dash 2 support the concept of a \doublequote{with}
2204 statement. The with statement specifies a sequence of
2205 executable statements within which the fields of a record
2206 variable may be referenced, unqualified by the name of the
2209 A with statement is represented by a
2210 \addtoindexi{debugging information entry}{with statement entry}
2211 with the tag \DWTAGwithstmtTARG.
2213 A with statement entry may have either a
2215 \DWAThighpc{} pair of attributes
2216 \addtoindexx{high PC attribute}
2218 \addtoindexx{low PC attribute}
2219 a \DWATranges{} attribute
2220 \addtoindexx{ranges attribute}
2221 whose values encode the contiguous or non\dash contiguous address
2222 ranges, respectively, of the machine instructions generated
2223 for the with statement
2224 (see Section \refersec{chap:codeaddressesandranges}).
2227 \hypertarget{chap:DWATentrypcofwithstmt}{}
2228 with statement entry may also have
2229 \addtoindexx{entry pc attribute!for with statement}
2231 \DWATentrypc{} attribute
2232 whose value is the address of the first executable instruction
2233 of the with statement (see
2234 Section \refersec{chap:entryaddress}).
2237 The with statement entry has
2238 \addtoindexx{type attribute}
2239 a \DWATtype{} attribute, denoting
2240 the type of record whose fields may be referenced without full
2241 qualification within the body of the statement. It also has
2242 \addtoindexx{location attribute}
2243 a \DWATlocation{} attribute, describing how to find the base
2244 address of the record object referenced within the body of
2248 \section{Try and Catch Block Entries}
2249 \label{chap:tryandcatchblockentries}
2251 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
2252 designated as a \doublequote{catch \nolink{block}.}
2253 A catch \livetargi{chap:catchblock}{block}{catch block} is an
2254 exception handler that handles
2255 exceptions thrown by an immediately
2256 preceding \doublequote{try \livelink{chap:tryblock}{block}.}
2257 A catch \livelink{chap:catchblock}{block}
2258 designates the type of the exception that it
2261 A try \livetargi{chap:tryblock}{block}{try block} is represented
2262 by a debugging information entry
2263 \addtoindexx{try block entry}
2264 with the tag \DWTAGtryblockTARG.
2265 A catch \livelink{chap:catchblock}{block} is represented by
2266 a debugging information entry with
2267 \addtoindexx{catch block entry}
2268 the tag \DWTAGcatchblockTARG.
2270 % nolink as we have links just above and do not have a combo link for both
2271 Both try and catch \nolink{block} entries may have either a
2273 \DWAThighpc{} pair of attributes
2274 \addtoindexx{high PC attribute}
2276 \addtoindexx{low PC attribute}
2278 \DWATranges{} attribute
2279 \addtoindexx{ranges attribute}
2280 whose values encode the contiguous
2281 or non\dash contiguous address ranges, respectively, of the
2282 machine instructions generated for the \livelink{chap:lexicalblock}{block}
2284 \refersec{chap:codeaddressesandranges}).
2287 \hypertarget{chap:DWATentrypcoftryblock}{}
2288 \hypertarget{chap:DWATentrypcofcatchblock}{}
2289 try or catch block entry may also have
2290 \addtoindexx{entry pc attribute!for try block}
2291 \addtoindexx{entry pc attribute!for catch block}
2293 \DWATentrypc{} attribute
2294 whose value is the address of the first executable instruction
2295 of the try or catch block (see
2296 Section \refersec{chap:entryaddress}).
2298 Catch \livelink{chap:catchblock}{block} entries have at
2299 least one child entry, an
2300 entry representing the type of exception accepted by
2301 that catch \livelink{chap:catchblock}{block}.
2302 This child entry has one of
2303 \addtoindexx{formal parameter entry!in catch block}
2305 \addtoindexx{unspecified parameters entry!in catch block}
2307 \DWTAGformalparameter{} or
2308 \DWTAGunspecifiedparameters,
2309 and will have the same form as other parameter entries.
2311 The siblings immediately following
2312 a try \livelink{chap:tryblock}{block} entry are its
2313 corresponding catch \livelink{chap:catchblock}{block} entries.