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 A subprogram entry may have a
1104 \DWATnoreturn\livetargi{chap:DWATnoreturnofsubprogram}{ attribute}{noreturn attribute},
1105 which is a \CLASSflag. The attribute
1106 indicates whether the subprogram was declared with the \doublequote{noreturn} keyword or property
1107 indicating that the subprogram can be called, but will never return to its caller.
1109 \subsubsection{Call Site-Related Attributes}
1110 A subroutine entry may have \DWATcallalltailcalls, \DWATcallallcalls{}
1111 and/or \DWATcallallsourcecalls{} attributes, each of which is a
1112 \livelink{chap:classflag}{flag}.
1113 These flags indicate the completeness of the call site information
1114 within the subprogram.
1116 The \DWATcallalltailcallsNAME{}
1117 \livetargi{chap:DWATcallalltailcallsofasubprogram}{attribute}{all tail calls summary attribute}
1118 indicates that every tail call
1119 that occurs in the code for the subprogram is described by a
1120 \DWTAGcallsite{} entry.
1121 (There may or may not be other non-tail calls to some of the same
1122 target subprograms.)
1124 The \DWATcallallcallsNAME{}
1125 \livetargi{chap:DWATcallallcallsofasubprogram}{attribute}{all calls summary attribute}
1126 indicates that every non-inlined call
1127 (either a tail call or a normal call) that occurs in the code for the subprogram
1128 is described by a \DWTAGcallsite{} entry.
1130 The \DWATcallallsourcecallsNAME{}
1131 \livetargi{chap:DWATcallallsourcecallsofasubprogram}{attribute}{all source calls summary attribute}
1132 indicates that every call that occurs in the
1133 code for the subprogram, including every call inlined into it, is described by either a
1134 \DWTAGcallsite{} entry or a \DWTAGinlinedsubroutine{} entry; further, any call
1135 that is optimized out is nonetheless also described using a \DWTAGcallsite{} entry
1136 that has neither a \DWATcallpc{} nor \DWATcallreturnpc{} attribute.
1138 \textit{The \DWATcallallsourcecallsNAME{} attribute is intended for debugging
1139 information format consumers that analyse call graphs.}
1141 If the value of the \DWATcallallsourcecalls{} attribute is true then the values of the
1142 \DWATcallallcalls{} and \DWATcallallcalls{} attributes are necessarily also true, and
1143 those attributes need not be present. Similarly, if the value of the
1144 \DWATcallallcalls{} attribute is true then the value of the \DWATcallalltailcalls{}
1145 attribute is also true and the latter attribute need not be present.
1147 \subsection{Subroutine and Entry Point Return Types}
1148 \label{chap:subroutineandentrypointreturntypes}
1151 \hypertarget{chap:DWATtypetypeofsubroutinereturn}{}
1152 the subroutine or entry point
1153 \addtoindexx{return type of subroutine}
1154 is a function that returns a
1155 value, then its debugging information entry has
1156 \addtoindexx{type attribute}
1157 a \DWATtype{} attribute
1158 to denote the type returned by that function.
1160 \textit{Debugging information entries for
1161 \addtoindex{C} void functions should
1162 not have an attribute for the return type. }
1164 \textit{Debugging information entries for declarations of \addtoindex{C++}
1165 member functions with an
1166 \addtoindex{\texttt{auto} return type} specifier should use an unspecified
1168 Section \refersec{chap:unspecifiedtypeentries}).
1169 The debugging information entry for the corresponding definition
1170 should provide the deduced return type. This practice causes the description of
1171 the containing class to be consistent across compilation units, allowing the class
1172 declaration to be placed into a separate type unit if desired.}
1175 \subsection{Subroutine and Entry Point Locations}
1176 \label{chap:subroutineandentrypointlocations}
1178 A subroutine entry may have either a \DWATlowpc{} and
1179 \DWAThighpc{} pair of attributes or a \DWATranges{} attribute
1180 \addtoindexx{ranges attribute}
1182 \addtoindexx{high PC attribute}
1184 \addtoindexx{low PC attribute}
1185 encode the contiguous or non\dash contiguous address
1186 ranges, respectively, of the machine instructions generated
1187 for the subroutine (see
1188 Section \refersec{chap:codeaddressesandranges}).
1191 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}{}
1192 subroutine entry may also have
1193 \addtoindexx{entry pc attribute!for subroutine}
1195 \DWATentrypc{} attribute
1196 whose value is the address of the first executable instruction
1197 of the subroutine (see
1198 Section \refersec{chap:entryaddress}).
1200 An entry point has a \DWATlowpc{} attribute whose value is the
1201 relocated address of the first machine instruction generated
1202 for the entry point.
1205 \DWATentrypc{} attribute
1206 \addtoindexx{entry pc attribute!for subroutine}
1208 also seem appropriate
1209 for this purpose, historically the
1210 \DWATlowpc{} attribute
1212 \DWATentrypc{} was introduced (in
1213 \addtoindex{DWARF Version 3}).
1214 There is insufficient reason to change this.}
1220 \addtoindexx{address class!attribute}
1222 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}{}
1226 \DWATaddressclass{} attributes,
1227 as appropriate, to specify
1228 which segments the code for the subroutine resides in and
1229 the addressing mode to be used in calling that subroutine.
1231 A subroutine entry representing a subroutine declaration
1232 that is not also a definition does not have code address or
1236 \subsection{Declarations Owned by Subroutines and Entry Points}
1237 \label{chap:declarationsownedbysubroutinesandentrypoints}
1239 The declarations enclosed by a subroutine or entry point are
1240 represented by debugging information entries that are owned
1241 by the subroutine or entry point entry. Entries representing
1242 \addtoindexx{formal parameter}
1243 the formal parameters of the subroutine or entry point appear
1244 in the same order as the corresponding declarations in the
1248 \textit{There is no ordering requirement for entries for declarations
1249 that are children of subroutine or entry point entries but
1250 that do not represent formal parameters. The formal parameter
1251 entries may be interspersed with other entries used by formal
1252 parameter entries, such as type entries.}
1254 The unspecified parameters of a variable parameter list are
1255 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
1257 \DWTAGunspecifiedparametersTARG.
1259 The entry for a subroutine that includes a
1260 \addtoindex{Fortran}
1261 \addtoindexx{Fortran!common block}
1262 \livelink{chap:fortrancommonblock}{common}
1263 \livelink{chap:commonblockentry}{block}
1264 \addtoindexx{common block|see{Fortran common block}}
1265 has a child entry with the
1266 tag \DWTAGcommoninclusionTARG.
1268 \hypertarget{chap:commonreferencecommonblockusage}{}
1269 common inclusion entry has a
1270 \DWATcommonreference{} attribute
1271 whose value is a \livelink{chap:classreference}{reference}
1272 to the debugging information entry
1273 for the common \nolink{block} being included
1274 (see Section \refersec{chap:commonblockentries}).
1276 \subsection{Low-Level Information}
1277 \label{chap:lowlevelinformation}
1280 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}{}
1281 subroutine or entry point entry may have
1282 \addtoindexx{return address attribute}
1285 attribute, whose value is a location description. The location
1286 calculated is the place where the return address for the
1287 subroutine or entry point is stored.
1290 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}{}
1291 subroutine or entry point entry may also have
1292 \addtoindexx{frame base attribute}
1294 \DWATframebase{} attribute, whose value is a location
1295 description that computes the \doublequote{frame base} for the
1296 subroutine or entry point. If the location description is
1297 a simple register location description, the given register
1298 contains the frame base address. If the location description is
1299 a DWARF expression, the result of evaluating that expression
1300 is the frame base address. Finally, for a
1301 \addtoindex{location list},
1302 this interpretation applies to each location description
1303 contained in the list of \addtoindex{location list} entries.
1305 \textit{The use of one of the \DWOPregn{}
1307 context is equivalent to using
1310 compact. However, these are not equivalent in general.}
1313 \textit{The frame base for a procedure is typically an address fixed
1314 relative to the first unit of storage allocated for the
1315 procedure\textquoteright s stack frame. The \DWATframebase{} attribute
1316 can be used in several ways:}
1317 \begin{enumerate}[1. ]
1318 \item \textit{In procedures that need
1319 \addtoindexx{location list}
1320 location lists to locate local
1321 variables, the \DWATframebase{} can hold the needed location
1322 list, while all variables\textquoteright\ location descriptions can be
1323 simpler ones involving the frame base.}
1325 \item \textit{It can be used in resolving \doublequote{up\dash level} addressing
1326 within nested routines.
1327 (See also \DWATstaticlink, below)}
1331 \textit{Some languages support nested subroutines. In such languages,
1332 it is possible to reference the local variables of an
1333 outer subroutine from within an inner subroutine. The
1334 \DWATstaticlink{} and \DWATframebase{} attributes allow
1335 debuggers to support this same kind of referencing.}
1338 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}{}
1340 \addtoindexx{address!uplevel|see {static link attribute}}
1341 \addtoindexx{uplevel address|see {static link attribute}}
1342 subroutine or entry point is nested, it may have a
1344 attribute, whose value is a location
1345 description that computes the frame base of the relevant
1346 instance of the subroutine that immediately encloses the
1347 subroutine or entry point.
1349 In the context of supporting nested subroutines, the
1350 \DWATframebase{} attribute value should obey the following
1353 \begin{enumerate}[1. ]
1354 \item It should compute a value that does not change during the
1355 life of the procedure, and
1357 \item The computed value should be unique among instances of
1358 the same subroutine. (For typical \DWATframebase{} use, this
1359 means that a recursive subroutine\textquoteright s stack frame must have
1360 non\dash zero size.)
1363 \textit{If a debugger is attempting to resolve an up\dash level reference
1364 to a variable, it uses the nesting structure of DWARF to
1365 determine which subroutine is the lexical parent and the
1366 \DWATstaticlink{} value to identify the appropriate active
1367 frame of the parent. It can then attempt to find the reference
1368 within the context of the parent.}
1372 \subsection{Types Thrown by Exceptions}
1373 \label{chap:typesthrownbyexceptions}
1375 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
1376 it may validly throw.}
1378 If a subroutine explicitly declares that it may throw
1379 \addtoindexx{exception thrown|see{thrown type entry}}
1381 \addtoindexx{thrown exception|see{thrown type entry}}
1382 exception of one or more types, each such type is
1383 represented by a debugging information entry with
1384 \addtoindexx{thrown type entry}
1386 \DWTAGthrowntypeTARG.
1387 Each such entry is a child of the entry
1388 representing the subroutine that may throw this type. Each
1389 thrown type entry contains
1390 \addtoindexx{type attribute}
1391 a \DWATtype{} attribute, whose
1392 value is a \livelink{chap:classreference}{reference}
1393 to an entry describing the type of the
1394 exception that may be thrown.
1396 \subsection{Function Template Instantiations}
1397 \label{chap:functiontemplateinstantiations}
1399 \textit{In \addtoindex{C++}, a function template is a generic definition of
1400 a function that is instantiated differently for calls with
1401 values of different types. DWARF does not represent the generic
1402 template definition, but does represent each instantiation.}
1405 A \addtoindex{template instantiation} is represented by a debugging
1406 information entry with the
1407 \addtoindexx{subprogram entry!use for template instantiation}
1408 tag \DWTAGsubprogram.
1410 exceptions, such an entry will contain the same attributes and
1411 will have the same types of child entries as would an entry
1412 for a subroutine defined explicitly using the instantiation
1413 types and values. The exceptions are:
1415 \begin{enumerate}[1. ]
1416 \item Template parameters are described and referenced as specified in
1417 Section \refersec{chap:templateparameters}.
1419 \item If the compiler has generated a special compilation unit
1420 to hold the template instantiation and that compilation unit
1421 has a different name from the compilation unit containing
1422 the template definition, the name attribute for the debugging
1423 information entry representing that compilation unit is empty
1426 \item If the subprogram entry representing the template
1427 instantiation or any of its child entries contain declaration
1428 coordinate attributes, those attributes refer to the source
1429 for the template definition, not to any source generated
1430 artificially by the compiler for this instantiation.
1435 \subsection{Inlinable and Inlined Subroutines}
1436 \label{chap:inlinedsubroutines}
1437 A declaration or a definition of an inlinable subroutine
1438 is represented by a debugging information entry with the
1442 \addtoindexx{subprogram entry!use in inlined subprogram}
1444 \hypertarget{chap:DWATinlineinlinedsubroutine}{}
1445 explicitly declared to be available for inline expansion or
1446 that was expanded inline implicitly by the compiler has
1447 \addtoindexx{inline attribute}
1449 \DWATinline{} attribute whose value is an
1450 \livelink{chap:classconstant}{integer constant}. The
1451 set of values for the \DWATinline{} attribute is given in
1452 Table \refersec{tab:inlinecodes}.
1456 \caption{Inline codes}
1457 \label{tab:inlinecodes}
1458 \begin{tabular}{l|p{8cm}}
1460 Name&Meaning\\ \hline
1461 \DWINLnotinlinedTARG{} & Not declared inline nor inlined by the
1462 \mbox{compiler} (equivalent to the absence of the
1463 containing \DWATinline{} attribute) \\
1464 \DWINLinlinedTARG{} & Not declared inline but inlined by the \mbox{compiler} \\
1465 \DWINLdeclarednotinlinedTARG{} & Declared inline but
1466 not inlined by the \mbox{compiler} \\
1467 \DWINLdeclaredinlinedTARG{} & Declared inline and inlined by the
1473 \textit{In \addtoindex{C++}, a function or a constructor declared with
1474 \addttindex{constexpr} is implicitly declared inline. The abstract inline
1475 instance (see below) is represented by a debugging information
1476 entry with the tag \DWTAGsubprogram. Such an entry has a
1477 \DWATinline{} attribute whose value is \DWINLinlined.}
1480 \subsubsection{Abstract Instances}
1481 \label{chap:abstractinstances}
1482 Any debugging information entry that is owned (either
1483 \hypertarget{chap:DWATinlineabstracttinstance}{}
1484 directly or indirectly) by a debugging information entry
1486 \DWATinline{} attribute is referred to
1487 \addtoindexx{abstract instance!entry}
1488 as an \doublequote{abstract instance entry.}
1489 Any subroutine entry
1491 \addtoindexx{inline attribute}
1492 a \DWATinline{} attribute whose value is other
1493 than \DWINLnotinlined{}
1495 \addtoindexx{abstract instance!root}
1496 an \doublequote{abstract instance root.}
1497 Any set of abstract instance entries that are all
1498 children (either directly or indirectly) of some abstract
1499 instance root, together with the root itself, is known as
1500 \addtoindexx{abstract instance!tree}
1501 an \doublequote{abstract instance tree.} However, in the case where
1502 an abstract instance tree is nested within another abstract
1503 instance tree, the entries in the
1504 \addtoindex{nested abstract instance}
1505 tree are not considered to be entries in the outer abstract
1508 Each abstract instance root is either part of a larger
1509 \addtoindexx{abstract instance!root}
1510 tree (which gives a context for the root) or
1511 \addtoindexx{specification attribute}
1513 \DWATspecification{}
1514 to refer to the declaration in context.
1516 \textit{For example, in \addtoindex{C++} the context might be a namespace
1517 declaration or a class declaration.}
1519 \textit{Abstract instance trees are defined so that no entry is part
1520 of more than one abstract instance tree. This simplifies the
1521 following descriptions.}
1523 A debugging information entry that is a member of an abstract
1524 instance tree should not contain any attributes which describe
1525 aspects of the subroutine which vary between distinct inlined
1526 expansions or distinct out\dash of\dash line expansions. For example,
1527 \addtoindexx{entry pc attribute!and abstract instance}
1538 \addtoindexx{location attribute!and abstract instance}
1540 \addtoindexx{ranges attribute!and abstract instance}
1542 \addtoindexx{high PC attribute!and abstract instance}
1544 \addtoindexx{low PC attribute!and abstract instance}
1546 \addtoindexx{segment attribute!and abstract instance}
1548 \addtoindexx{return address attribute!and abstract instance}
1550 \addtoindexx{segment attribute!and abstract instance}
1552 \addtoindexx{start scope attribute!and abstract instance}
1556 \textit{It would not make sense normally to put these attributes into
1557 abstract instance entries since such entries do not represent
1558 actual (concrete) instances and thus do not actually exist at
1559 run\dash time. However,
1560 see Appendix \refersec{app:inlineouteronenormalinner}
1561 for a contrary example.}
1563 The rules for the relative location of entries belonging to
1564 abstract instance trees are exactly the same as for other
1565 similar types of entries that are not abstract. Specifically,
1566 the rule that requires that an entry representing a declaration
1567 be a direct child of the entry representing the scope of the
1568 declaration applies equally to both abstract and non\dash abstract
1569 entries. Also, the ordering rules for formal parameter entries,
1570 member entries, and so on, all apply regardless of whether
1571 or not a given entry is abstract.
1574 \subsubsection{Concrete Inlined Instances}
1575 \label{chap:concreteinlinedinstances}
1577 Each inline expansion of a subroutine is represented
1578 by a debugging information entry with the
1579 tag \DWTAGinlinedsubroutineTARG.
1580 Each such entry should be a direct
1581 child of the entry that represents the scope within which
1582 the inlining occurs.
1584 Each inlined subroutine entry may have either a
1586 and \DWAThighpc{} pair
1588 \addtoindexx{high PC attribute}
1590 \addtoindexx{low PC attribute}
1592 \addtoindexx{ranges attribute}
1595 attribute whose values encode the contiguous or non\dash contiguous
1596 address ranges, respectively, of the machine instructions
1597 generated for the inlined subroutine (see
1598 Section \referfol{chap:codeaddressesandranges}).
1600 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}{}
1601 inlined subroutine entry may
1602 \addtoindexx{inlined subprogram entry!in concrete instance}
1604 \addtoindexx{inlined subprogram entry}
1606 \addtoindexx{entry pc attribute!for inlined subprogram}
1609 attribute, representing the first executable instruction of
1610 the inline expansion (see
1611 Section \refersec{chap:entryaddress}).
1613 % Positions of the 3 targets here is a bit arbitrary.
1615 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}{}
1617 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}{}
1619 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}{}
1620 may also have \DWATcallfile,
1621 \DWATcallline{} and \DWATcallcolumn{} attributes,
1623 value is an \livelink{chap:classconstant}{integer constant}.
1624 These attributes represent the
1625 source file, source line number, and source column number,
1626 respectively, of the first character of the statement or
1627 expression that caused the inline expansion. The call file,
1628 call line, and call column attributes are interpreted in
1629 the same way as the declaration file, declaration line, and
1630 declaration column attributes, respectively (see
1631 Section \refersec{chap:declarationcoordinates}).
1633 \textit{The call file, call line and call column coordinates do not
1634 describe the coordinates of the subroutine declaration that
1635 was inlined, rather they describe the coordinates of the call.
1638 An inlined subroutine entry
1639 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}{}
1642 attribute, which is a \livelink{chap:classflag}{flag}
1643 whose presence indicates that the
1644 subroutine has been evaluated as a compile\dash time constant. Such
1645 an entry may also have a \DWATconstvalue{} attribute,
1646 whose value may be of any form that is appropriate for the
1647 representation of the subroutine's return value. The value of
1648 this attribute is the actual return value of the subroutine,
1649 represented as it would be on the target architecture.
1651 \textit{In \addtoindex{C++}, if a function or a constructor declared with
1652 \addttindex{constexpr}
1653 is called with constant expressions, then the corresponding
1654 concrete inlined instance has a
1655 \DWATconstexpr{} attribute,
1656 as well as a \DWATconstvalue{} attribute whose value represents
1657 the actual return value of the concrete inlined instance.}
1659 Any debugging information entry that is owned (either
1660 directly or indirectly) by a debugging information entry
1661 with the tag \DWTAGinlinedsubroutine{} is referred to as a
1662 \doublequote{concrete inlined instance entry.} Any entry that has
1664 \DWTAGinlinedsubroutine{}
1665 is known as a \doublequote{concrete inlined instance root.}
1666 Any set of concrete inlined instance
1667 entries that are all children (either directly or indirectly)
1668 of some concrete inlined instance root, together with the root
1669 itself, is known as a \doublequote{concrete inlined instance tree.}
1670 However, in the case where a concrete inlined instance tree
1671 is nested within another concrete instance tree, the entries
1672 in the \addtoindex{nested concrete inline instance} tree
1673 are not considered to
1674 be entries in the outer concrete instance tree.
1676 \textit{Concrete inlined instance trees are defined so that no entry
1677 is part of more than one concrete inlined instance tree. This
1678 simplifies later descriptions.}
1680 Each concrete inlined instance tree is uniquely associated
1681 with one (and only one) abstract instance tree.
1683 \textit{Note, however, that the reverse is not true. Any given abstract
1684 instance tree may be associated with several different concrete
1685 inlined instance trees, or may even be associated with zero
1686 concrete inlined instance trees.}
1688 Concrete inlined instance entries may omit attributes that
1689 are not specific to the concrete instance (but present in
1690 the abstract instance) and need include only attributes that
1691 are specific to the concrete instance (but omitted in the
1692 abstract instance). In place of these omitted attributes, each
1693 \hypertarget{chap:DWATabstractorigininlineinstance}{}
1694 concrete inlined instance entry
1695 \addtoindexx{abstract origin attribute}
1697 \DWATabstractorigin{}
1698 attribute that may be used to obtain the missing information
1699 (indirectly) from the associated abstract instance entry. The
1700 value of the abstract origin attribute is a reference to the
1701 associated abstract instance entry.
1703 If an entry within a concrete inlined instance tree contains
1704 attributes describing the
1705 \addtoindexx{declaration coordinates!in concrete instance}
1706 \livelink{chap:declarationcoordinates}{declaration coordinates}
1707 of that entry, then those attributes should refer to the file, line
1708 and column of the original declaration of the subroutine,
1709 not to the point at which it was inlined. As a consequence,
1710 they may usually be omitted from any entry that has an abstract
1714 For each pair of entries that are associated via a
1715 \addtoindexx{abstract origin attribute}
1716 \DWATabstractorigin{} attribute, both members of the pair
1717 have the same tag. So, for example, an entry with the tag
1718 \DWTAGvariable{} can only be associated with another entry
1719 that also has the tag \DWTAGvariable. The only exception
1720 to this rule is that the root of a concrete instance tree
1721 (which must always have the tag \DWTAGinlinedsubroutine)
1722 can only be associated with the root of its associated abstract
1723 instance tree (which must have the tag \DWTAGsubprogram).
1726 In general, the structure and content of any given concrete
1727 inlined instance tree will be closely analogous to the
1728 structure and content of its associated abstract instance
1729 tree. There are a few exceptions:
1731 \begin{enumerate}[1. ]
1732 \item An entry in the concrete instance tree may be omitted if
1734 \addtoindexx{abstract origin attribute}
1735 \DWATabstractorigin{} attribute and either
1736 has no children, or its children are omitted. Such entries
1737 would provide no useful information. In C\dash like languages,
1738 such entries frequently include types, including structure,
1739 union, class, and interface types; and members of types. If any
1740 entry within a concrete inlined instance tree needs to refer
1741 to an entity declared within the scope of the relevant inlined
1742 subroutine and for which no concrete instance entry exists,
1743 the reference should refer to the abstract instance entry.
1745 \item Entries in the concrete instance tree which are associated
1746 with entries in the abstract instance tree such that neither
1747 has a \DWATname{} attribute,
1748 \addtoindexx{name attribute}
1749 and neither is referenced by
1750 any other debugging information entry, may be omitted. This
1751 may happen for debugging information entries in the abstract
1752 instance trees that became unnecessary in the concrete instance
1753 tree because of additional information available there. For
1754 example, an anonymous variable might have been created and
1755 described in the abstract instance tree, but because of
1756 the actual parameters for a particular inlined expansion,
1757 it could be described as a constant value without the need
1758 for that separate debugging information entry.
1760 \item A concrete instance tree may contain entries which do
1761 not correspond to entries in the abstract instance tree
1762 to describe new entities that are specific to a particular
1763 inlined expansion. In that case, they will not have associated
1764 entries in the abstract instance tree, should not contain
1765 \addtoindexx{abstract origin attribute}
1766 \DWATabstractorigin{} attributes, and must contain all their
1767 own attributes directly. This allows an abstract instance tree
1768 to omit debugging information entries for anonymous entities
1769 that are unlikely to be needed in most inlined expansions. In
1770 any expansion which deviates from that expectation, the
1771 entries can be described in its concrete inlined instance tree.
1775 \subsubsection{Out-of-Line Instances of Inlined Subroutines}
1776 \label{chap:outoflineinstancesofinlinedsubroutines}
1777 Under some conditions, compilers may need to generate concrete
1778 executable instances of inlined subroutines other than at
1779 points where those subroutines are actually called. Such
1780 concrete instances of inlined subroutines are referred to as
1781 \doublequote{concrete out\dash of\dash line instances.}
1783 \textit{In \addtoindex{C++}, for example,
1784 taking the address of a function declared
1785 to be inline can necessitate the generation of a concrete
1786 out\dash of\dash line instance of the given function.}
1788 The DWARF representation of a concrete out\dash of\dash line instance
1789 of an inlined subroutine is essentially the same as for a
1790 concrete inlined instance of that subroutine (as described in
1791 the preceding section). The representation of such a concrete
1792 % It is critical that the hypertarget and livelink be
1793 % separated to avoid problems with latex.
1794 out\dash of\dash line
1795 \addtoindexx{abstract origin attribute}
1797 \hypertarget{chap:DWATabstractoriginoutoflineinstance}{}
1799 \DWATabstractorigin{}
1800 attributes in exactly the same way as they are used for
1801 a concrete inlined instance (that is, as references to
1802 corresponding entries within the associated abstract instance
1805 The differences between the DWARF representation of a
1806 concrete out\dash of\dash line instance of a given subroutine and the
1807 representation of a concrete inlined instance of that same
1808 subroutine are as follows:
1810 \begin{enumerate}[1. ]
1811 \item The root entry for a concrete out\dash of\dash line instance
1812 of a given inlined subroutine has the same tag as does its
1813 associated (abstract) inlined subroutine entry (that is, tag
1814 \DWTAGsubprogram{} rather than \DWTAGinlinedsubroutine).
1816 \item The root entry for a concrete out\dash of\dash line instance tree
1817 is normally owned by the same parent entry that also owns
1818 the root entry of the associated abstract instance. However,
1819 it is not required that the abstract and out\dash of\dash line instance
1820 trees be owned by the same parent entry.
1824 \subsubsection{Nested Inlined Subroutines}
1825 \label{nestedinlinedsubroutines}
1826 Some languages and compilers may permit the logical nesting of
1827 a subroutine within another subroutine, and may permit either
1828 the outer or the nested subroutine, or both, to be inlined.
1830 For a non\dash inlined subroutine nested within an inlined
1831 subroutine, the nested subroutine is described normally in
1832 both the abstract and concrete inlined instance trees for
1833 the outer subroutine. All rules pertaining to the abstract
1834 and concrete instance trees for the outer subroutine apply
1835 also to the abstract and concrete instance entries for the
1839 For an inlined subroutine nested within another inlined
1840 subroutine, the following rules apply to their abstract and
1841 \addtoindexx{abstract instance!nested}
1842 \addtoindexx{concrete instance!nested}
1843 concrete instance trees:
1845 \begin{enumerate}[1. ]
1846 \item The abstract instance tree for the nested subroutine is
1847 described within the abstract instance tree for the outer
1848 subroutine according to the rules in
1849 Section \refersec{chap:abstractinstances}, and
1850 without regard to the fact that it is within an outer abstract
1853 \item Any abstract instance tree for a nested subroutine is
1854 always omitted within the concrete instance tree for an
1857 \item A concrete instance tree for a nested subroutine is
1858 always omitted within the abstract instance tree for an
1861 \item The concrete instance tree for any inlined or
1862 \addtoindexx{out-of-line instance}
1864 \addtoindexx{out-of-line-instance|see{concrete out-of-line-instance}}
1865 expansion of the nested subroutine is described within a
1866 concrete instance tree for the outer subroutine according
1868 Sections \refersec{chap:concreteinlinedinstances} or
1869 \referfol{chap:outoflineinstancesofinlinedsubroutines}
1871 and without regard to the fact that it is within an outer
1872 concrete instance tree.
1875 See Appendix \refersec{app:inliningexamples}
1876 for discussion and examples.
1878 \subsection{Trampolines}
1879 \label{chap:trampolines}
1881 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1882 \hypertarget{chap:DWATtrampolinetargetsubroutine}{}
1883 an intermediary in making a call to another subroutine. It may
1884 adjust parameters and/or the result (if any) as appropriate
1885 to the combined calling and called execution contexts.}
1887 A trampoline is represented by a debugging information entry
1888 \addtoindexx{trampoline (subprogram) entry}
1889 with the tag \DWTAGsubprogram{} or \DWTAGinlinedsubroutine{}
1891 \addtoindexx{trampoline attribute}
1892 a \DWATtrampoline{} attribute.
1894 attribute indicates the target subroutine of the trampoline,
1895 that is, the subroutine to which the trampoline passes
1896 control. (A trampoline entry may but need not also have a
1897 \DWATartificial{} attribute.)
1900 The value of the trampoline attribute may be represented
1901 using any of the following forms, which are listed in order
1905 \item If the value is of class reference, then the value
1906 specifies the debugging information entry of the target
1909 \item If the value is of class address, then the value is
1910 the relocated address of the target subprogram.
1912 \item If the value is of class string, then the value is the
1913 (possibly mangled) \addtoindexx{mangled names}
1914 name of the target subprogram.
1916 \item If the value is of class \livelink{chap:classflag}{flag}, then the value true
1917 indicates that the containing subroutine is a trampoline but
1918 that the target subroutine is not known.
1922 The target subprogram may itself be a trampoline. (A sequence
1923 of trampolines necessarily ends with a non\dash trampoline
1926 \textit{In \addtoindex{C++}, trampolines may be used
1927 to implement derived virtual
1928 member functions; such trampolines typically adjust the
1929 \addtoindexx{this parameter}
1930 implicit this pointer parameter in the course of passing
1932 Other languages and environments may use trampolines
1933 in a manner sometimes known as transfer functions or transfer
1936 \textit{Trampolines may sometimes pass control to the target
1937 subprogram using a branch or jump instruction instead of a
1938 call instruction, thereby leaving no trace of their existence
1939 in the subsequent execution context. }
1941 \textit{This attribute helps make it feasible for a debugger to arrange
1942 that stepping into a trampoline or setting a breakpoint in
1943 a trampoline will result in stepping into or setting the
1944 breakpoint in the target subroutine instead. This helps to
1945 hide the compiler generated subprogram from the user. }
1947 \textit{If the target subroutine is not known, a debugger may choose
1948 to repeatedly step until control arrives in a new subroutine
1949 which can be assumed to be the target subroutine. }
1951 \subsection{Call Site Entries}
1952 \label{chap:callsiteentries}
1954 A call site entry provides a way to represent the static or dynamic
1955 call graph of a program in the debugging information. It also provides
1956 information about how parameters are passed so that they may be more
1957 easily accessed by a debugger. Together with the \DWOPentryvalue{} opcode,
1958 call site entries can be also useful for computing values of variables
1959 and expressions where some value is no longer present in the current
1960 subroutine's registers or local stack frame, but it is known that the
1961 values are equal to some parameter passed to the function.
1962 The consumer can then use unwind
1963 information to find the caller and in the call site information sometimes
1964 find how to compute the value passed in a particular parameter.}
1966 A call site is represented by a debugging information entry with the tag
1967 \DWTAGcallsiteTARG{}. The entry for a call site is owned by the innermost
1968 debugging information entry representing the scope within which the
1969 call is present in the source program.
1971 \textit{A scope entry (for example, for a lexical block) that would not
1972 otherwise be present in the debugging information of a subroutine
1973 need not be introduced solely to represent the immediately containing scope
1974 of a call. The call site entry is owned by the innermost scope entry that
1977 A source call can be compiled into different types of machine code:
1980 A \textit{normal call} uses a call-like instruction which transfers control to the start
1981 of some subprogram and leaves the call site location address somewhere where
1982 unwind information can find it.
1984 A \textit{tail call} uses a jump-like instruction which
1985 transfers control to the start of some subprogram, but the call site location
1986 address is not preserved (and thus not available using the unwind information).
1988 A \textit{tail recursion call} is a call
1989 to the current subroutine which is compiled as a loop into the middle of the
1992 An \textit{inline (or inlined) call} is a call to an inlined subprogram,
1993 where at least one instruction has the location of the inlined subprogram
1994 or any of its blocks or inlined subprograms.
1997 There are also different types of \doublequote{optimized out} calls:
2000 An \textit{optimized out (normal) call} is a call that is in unreachable code that
2001 has not been emitted (such as, for example, the call to \texttt{foo} in
2002 \texttt{if (0) foo();}).
2004 An \textit{optimized out inline call}
2005 is a call to an inlined subprogram which either did not expand to any instructions
2006 or only parts of instructions belong to it and for debug information purposes those
2007 instructions are given a location in the caller.
2010 \DWTAGcallsite{} entries describe normal and tail calls but not tail recursion calls,
2011 while \DWTAGinlinedsubroutine{} entries describe inlined calls
2012 (see Section \refersec{chap:inlinedsubroutines}).
2014 The call site entry has a
2015 \DWATcallreturnpcNAME{}
2016 \livetargi{chap:DWATcallreturnpcofcallsite}{attribute}{call return pc attribute}
2017 which is the return address after the call.
2018 The value of this attribute corresponds to the return address computed by
2019 call frame information in the called subprogram
2020 (see Section \refersec{datarep:callframeinformation}).
2022 \textit{On many architectures the return address is the address immediately following the
2023 call instruction, but on architectures with delay slots it might
2024 be an address after the delay slot of the call.}
2026 The call site entry may have a
2028 \livetargi{chap:DWATcallpcofcallsite}{attribute}{call pc attribute} which is the
2029 address of the call instruction.
2031 If the call site entry corresponds to a tail call, it has the
2032 \DWATcalltailcallNAME{}
2033 \livetargi{chap:DWATcalltailcallofcallsite}{attribute}{call tail call attribute},
2034 which is a \CLASSflag.
2036 The call site entry may have a
2037 \DWATcalloriginNAME{}
2038 \livetargi{chap:DWATcalloriginofcallsite}{attribute}{call origin attribute}
2039 which is a \CLASSreference. For direct calls or jumps where the called subprogram is
2040 known it is a reference to the called subprogram's debugging
2041 information entry. For indirect calls it may be a reference to a
2042 \DWTAGvariable{}, \DWTAGformalparameter{} or \DWTAGmember{} entry representing
2043 the subroutine pointer that is called.
2045 The call site may have a
2046 \DWATcalltargetNAME{}
2047 \livetargi{dwatcalltargetofcallsite}{attribute}{call target attribute} which is
2048 a DWARF expression. For indirect calls or jumps where it is unknown at
2049 compile time which subprogram will be called the expression computes the
2050 address of the subprogram that will be called. The DWARF expression should
2051 not use register or memory locations that might be clobbered by the call.
2053 The call site entry may have a
2054 \DWATcalltargetclobberedNAME{}
2055 \livetargi{chap:DWATcalltargetclobbered}{attribute}{call target clobbered attribute}
2056 which is a DWARF expression. For indirect calls or jumps where the
2057 address is not computable without use of registers or memory locations that
2058 might be clobbered by the call the \DWATcalltargetclobberedNAME{}
2059 attribute is used instead of the \DWATcalltarget{} attribute.
2061 The call site entry may have a \DWATtypeNAME{}
2062 \livetargi{chap:DWATtypeofcallsite}{attribute}{type attribute!of call site entry}
2063 referencing a debugging information entry for the type of the called function.
2064 When \DWATcallorigin{} is present, \DWATtypeNAME{} is usually omitted.
2066 The call site entry may have
2067 \DWATcallfileNAME{}, \DWATcalllineNAME{} and \DWATcallcolumnNAME{}
2068 \livetargi{chap:DWATcallfileofcallsite}{attributes,}{call file attribute!of call site entry}
2069 \livetargi{chap:DWATcalllineofcallsite}{}{call line attribute!of call site entry}
2070 \livetargi{chap:DWATcallcolumnofcallsite}{}{call column attribute!of call site entry}
2071 each of whose value is an integer constant.
2072 These attributes represent the source file, source line number, and source
2073 column number, respectively, of the first character of the call statement or
2074 expression. The call file, call line, and call column attributes are
2075 interpreted in the same way as the declaration file, declaration
2076 line, and declaration column attributes, respectively
2077 (see Section \refersec{chap:declarationcoordinates}).
2079 \textit{The call file, call line and call column coordinates do not describe the
2080 coordinates of the subroutine declaration that was inlined, rather they describe
2081 the coordinates of the call.}
2083 The call site entry may own \DWTAGcallsiteparameterTARG{} debugging information
2084 entries\index{call site parameter entry} representing the parameters passed to the call.
2085 Each such entry has a \DWATlocation{} attribute which is a location expression.
2086 This location expression describes where the parameter is passed
2087 (usually either some register, or a memory location expressible as the
2088 contents of the stack register plus some offset).
2090 Each \DWTAGcallsiteparameter{} entry may have a
2091 \DWATcallvalueNAME{}
2092 \livetargi{chap:DWATcallvalueofcallparameter}{attribute}{call value attribute}
2093 which is a DWARF expression. This expression computes the value
2094 passed for that parameter. The expression should not use registers or memory
2095 locations that might be clobbered by the call, as it might be evaluated after
2096 unwinding from the called function back to the caller. If it is not
2097 possible to avoid registers or memory locations that might be clobbered by
2098 the call in the expression, then the \DWATcallvalueNAME{} attribute should
2101 \textit{The reason for the restriction is that the value of the parameter may be
2102 needed in the middle of the callee, where the call clobbered registers or
2103 memory might be already clobbered, and if the consumer was not assured by
2104 the producer it can safely use those values, the consumer could not safely
2105 use the values at all.}
2107 For parameters passed by reference, where the code passes a pointer to
2108 a location which contains the parameter, or for reference type parameters
2109 the \DWTAGcallsiteparameter{} entry may also have
2110 \DWATcalldatalocationNAME{}
2111 \livetargi{chap:DWATcalldatalocationofcallparameter}{attribute}{call data location attribute}
2112 whose value is a location expression and a
2113 \DWATcalldatavalueNAME{}
2114 \livetargi{chap:DWATcalldatavalueofcallparameter}{attribute}{call data value attribute}
2115 whose value is a DWARF expression. The \DWATcalldatalocationNAME{} attribute
2116 describes where the referenced value lives during the call. If it is just
2117 \DWOPpushobjectaddress{}, it may be left out. The
2118 \DWATcalldatavalueNAME{} attribute describes the value in that location.
2119 The expression should not use registers or memory
2120 locations that might be clobbered by the call, as it might be evaluated after
2121 unwinding from the called function back to the caller.
2123 Each call site parameter entry may also have a
2124 \DWATcallparameter{}
2125 \livetargi{chap:DWATcallparameterofcallparameter}{attribute}{call parameter attribute}
2126 which contains a reference to a \DWTAGformalparameter{} entry,
2127 \DWATtype{} attribute referencing the type of the parameter or \DWATname{}
2128 attribute describing the parameter's name.
2132 \section{Lexical Block Entries}
2133 \label{chap:lexicalblockentries}
2136 lexical \livetargi{chap:lexicalblock}{block}{lexical block}
2138 \addtoindexx{lexical block}
2139 a bracketed sequence of source statements
2140 that may contain any number of declarations. In some languages
2141 (including \addtoindex{C} and \addtoindex{C++}),
2142 \nolink{blocks} can be nested within other
2143 \nolink{blocks} to any depth.}
2145 % We do not need to link to the preceding paragraph.
2146 A lexical \nolink{block} is represented by a debugging information
2148 tag \DWTAGlexicalblockTARG.
2150 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry}
2152 either a \DWATlowpc{} and
2153 \DWAThighpc{} pair of
2155 \addtoindexx{high PC attribute}
2157 \addtoindexx{low PC attribute}
2159 \DWATranges{} attribute
2160 \addtoindexx{ranges attribute}
2161 whose values encode the contiguous or non-contiguous address
2162 ranges, respectively, of the machine instructions generated
2163 for the lexical \nolink{block}
2164 (see Section \refersec{chap:codeaddressesandranges}).
2167 \hypertarget{chap:DWATentrypcoflexicalblock}{}
2168 lexical block entry may also have
2169 \addtoindexx{entry pc attribute!for lexical block}
2171 \DWATentrypc{} attribute
2172 whose value is the address of the first executable instruction
2173 of the lexical block (see
2174 Section \refersec{chap:entryaddress}).
2176 If a name has been given to the
2177 lexical \nolink{block}
2179 program, then the corresponding
2180 lexical \nolink{block} entry has a
2181 \DWATname{} attribute whose
2182 \addtoindexx{name attribute}
2183 value is a null\dash terminated string
2184 containing the name of the lexical \nolink{block}
2188 \textit{This is not the same as a \addtoindex{C} or
2189 \addtoindex{C++} label (see below).}
2191 The lexical \nolink{block} entry owns
2192 debugging information entries that
2193 describe the declarations within that lexical \nolink{block}.
2195 one such debugging information entry for each local declaration
2196 of an identifier or inner lexical \nolink{block}.
2198 \section{Label Entries}
2199 \label{chap:labelentries}
2200 \textit{A label is a way of identifying a source statement. A labeled
2201 statement is usually the target of one or more \doublequote{go to}
2206 A label is represented by a debugging information entry with
2207 \addtoindexx{label entry}
2209 tag \DWTAGlabelTARG.
2210 The entry for a label should be owned by
2211 the debugging information entry representing the scope within
2212 which the name of the label could be legally referenced within
2215 The label entry has a \DWATlowpc{} attribute whose value
2216 is the relocated address of the first machine instruction
2217 generated for the statement identified by the label in
2218 the source program. The label entry also has a
2219 \DWATname{} attribute
2220 \addtoindexx{name attribute}
2221 whose value is a null-terminated string containing
2222 the name of the label as it appears in the source program.
2225 \section{With Statement Entries}
2226 \label{chap:withstatemententries}
2228 \textit{Both \addtoindex{Pascal} and
2229 \addtoindexx{Modula-2}
2230 Modula\dash 2 support the concept of a \doublequote{with}
2231 statement. The with statement specifies a sequence of
2232 executable statements within which the fields of a record
2233 variable may be referenced, unqualified by the name of the
2236 A with statement is represented by a
2237 \addtoindexi{debugging information entry}{with statement entry}
2238 with the tag \DWTAGwithstmtTARG.
2240 A with statement entry may have either a
2242 \DWAThighpc{} pair of attributes
2243 \addtoindexx{high PC attribute}
2245 \addtoindexx{low PC attribute}
2246 a \DWATranges{} attribute
2247 \addtoindexx{ranges attribute}
2248 whose values encode the contiguous or non\dash contiguous address
2249 ranges, respectively, of the machine instructions generated
2250 for the with statement
2251 (see Section \refersec{chap:codeaddressesandranges}).
2254 \hypertarget{chap:DWATentrypcofwithstmt}{}
2255 with statement entry may also have
2256 \addtoindexx{entry pc attribute!for with statement}
2258 \DWATentrypc{} attribute
2259 whose value is the address of the first executable instruction
2260 of the with statement (see
2261 Section \refersec{chap:entryaddress}).
2264 The with statement entry has
2265 \addtoindexx{type attribute}
2266 a \DWATtype{} attribute, denoting
2267 the type of record whose fields may be referenced without full
2268 qualification within the body of the statement. It also has
2269 \addtoindexx{location attribute}
2270 a \DWATlocation{} attribute, describing how to find the base
2271 address of the record object referenced within the body of
2275 \section{Try and Catch Block Entries}
2276 \label{chap:tryandcatchblockentries}
2278 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
2279 designated as a \doublequote{catch \nolink{block}.}
2280 A catch \livetargi{chap:catchblock}{block}{catch block} is an
2281 exception handler that handles
2282 exceptions thrown by an immediately
2283 preceding \doublequote{try \livelink{chap:tryblock}{block}.}
2284 A catch \livelink{chap:catchblock}{block}
2285 designates the type of the exception that it
2288 A try \livetargi{chap:tryblock}{block}{try block} is represented
2289 by a debugging information entry
2290 \addtoindexx{try block entry}
2291 with the tag \DWTAGtryblockTARG.
2292 A catch \livelink{chap:catchblock}{block} is represented by
2293 a debugging information entry with
2294 \addtoindexx{catch block entry}
2295 the tag \DWTAGcatchblockTARG.
2297 % nolink as we have links just above and do not have a combo link for both
2298 Both try and catch \nolink{block} entries may have either a
2300 \DWAThighpc{} pair of attributes
2301 \addtoindexx{high PC attribute}
2303 \addtoindexx{low PC attribute}
2305 \DWATranges{} attribute
2306 \addtoindexx{ranges attribute}
2307 whose values encode the contiguous
2308 or non\dash contiguous address ranges, respectively, of the
2309 machine instructions generated for the \livelink{chap:lexicalblock}{block}
2311 \refersec{chap:codeaddressesandranges}).
2314 \hypertarget{chap:DWATentrypcoftryblock}{}
2315 \hypertarget{chap:DWATentrypcofcatchblock}{}
2316 try or catch block entry may also have
2317 \addtoindexx{entry pc attribute!for try block}
2318 \addtoindexx{entry pc attribute!for catch block}
2320 \DWATentrypc{} attribute
2321 whose value is the address of the first executable instruction
2322 of the try or catch block (see
2323 Section \refersec{chap:entryaddress}).
2325 Catch \livelink{chap:catchblock}{block} entries have at
2326 least one child entry, an
2327 entry representing the type of exception accepted by
2328 that catch \livelink{chap:catchblock}{block}.
2329 This child entry has one of
2330 \addtoindexx{formal parameter entry!in catch block}
2332 \addtoindexx{unspecified parameters entry!in catch block}
2334 \DWTAGformalparameter{} or
2335 \DWTAGunspecifiedparameters,
2336 and will have the same form as other parameter entries.
2338 The siblings immediately following
2339 a try \livelink{chap:tryblock}{block} entry are its
2340 corresponding catch \livelink{chap:catchblock}{block} entries.