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,
12 of which there are three kinds: normal compilation units,
13 partial compilation units and type units. A partial compilation
14 unit is related to one or more other compilation units that
15 import it. A type unit represents a single complete type in a
16 separate unit. Either a normal compilation unit or a partial
17 compilation unit may be logically incorporated into another
18 compilation unit using an imported unit entry.
20 \subsection[Normal and Partial CU Entries]{Normal and Partial Compilation Unit Entries}
21 \label{chap:normalandpartialcompilationunitentries}
23 A normal compilation unit is represented by a debugging
24 information entry with the
25 tag \livetarg{chap:DWTAGcompileunit}{DW\-\_TAG\-\_compile\-\_unit}. A partial
26 compilation unit is represented by a debugging information
28 tag \livetarg{chap:DWTAGpartialunit}{DW\-\_TAG\-\_partial\-\_unit}.
30 In a simple normal compilation, a single compilation unit with
32 \livelink{chap:DWTAGcompileunit}{DW\-\_TAG\-\_compile\-\_unit} represents a complete object file
34 \livelink{chap:DWTAGpartialunit}{DW\-\_TAG\-\_partial\-\_unit} is not used.
36 employing the DWARF space compression and duplicate elimination
38 Appendix \refersec{app:usingcompilationunits},
39 multiple compilation units using
41 \livelink{chap:DWTAGcompileunit}{DW\-\_TAG\-\_compile\-\_unit} and/or
42 \livelink{chap:DWTAGpartialunit}{DW\-\_TAG\-\_partial\-\_unit} are
43 used to represent portions of an object file.
45 \textit{A normal compilation unit typically represents the text and
46 data contributed to an executable by a single relocatable
47 object file. It may be derived from several source files,
48 including pre\dash processed ``include files.'' A partial
49 compilation unit typically represents a part of the text
50 and data of a relocatable object file, in a manner that can
51 potentially be shared with the results of other compilations
52 to save space. It may be derived from an ``include file'',
53 template instantiation, or other implementation\dash dependent
54 portion of a compilation. A normal compilation unit can also
55 function in a manner similar to a partial compilation unit
58 A compilation unit entry owns debugging information
59 entries that represent all or part of the declarations
60 made in the corresponding compilation. In the case of a
61 partial compilation unit, the containing scope of its owned
62 declarations is indicated by imported unit entries in one
63 or more other compilation unit entries that refer to that
64 partial compilation unit (see
65 Section \refersec{chap:importedunitentries}).
68 Compilation unit entries may have the following
72 \item Either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of
74 \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
76 \addtoindexx{discontiguous address ranges|see{non-contiguous address ranges}}
79 non\dash contiguous address ranges, respectively,
80 of the machine instructions generated for the compilation
81 unit (see Section {chap:codeaddressesandranges}).
82 A \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute may also
83 be specified in combination with \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} to specify the
84 default base address for use in location lists (see Section
85 \refersec{chap:locationlists}) and range lists
86 (see Section \refersec{chap:noncontiguousaddressranges}).
88 \item A \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
90 \hypertarget{chap:DWATnamepathnameofcompilationsource}
91 containing the full or relative path name of the primary
92 source file from which the compilation unit was derived.
94 \item A \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language} attribute whose constant value is an
95 \hypertarget{chap:DWATlanguageprogramminglanguage}
96 integer code indicating the source language of the compilation
97 unit. The set of language names and their meanings are given
99 Figure \refersec{fig:languagenames}.
103 \caption{Language names}
104 \label{fig:languagenames}
106 Language name & Meaning\\ \hline
107 \livetarg{chap:DWLANGAda83}{DW\-\_LANG\-\_Ada83} \dag&ISO Ada:1983 \addtoindexx{Ada} \\
108 \livetarg{chap:DWLANGAda95}{DW\-\_LANG\-\_Ada95} \dag&ISO Ada:1995 \addtoindexx{Ada} \\
109 \livetarg{chap:DWLANGC}{DW\-\_LANG\-\_C}&Non-standardized C, such as K\&R \\
110 \livetarg{chap:DWLANGC89}{DW\-\_LANG\-\_C89}&ISO C:1989 \\
111 \livetarg{chap:DWLANGC99}{DW\-\_LANG\-\_C99} & ISO C:1999 \\
112 \livetarg{chap:DWLANGCplusplus}{DW\-\_LANG\-\_C\-\_plus\-\_plus}&ISO C++:1998 \\
113 \livetarg{chap:DWLANGCobol74}{DW\-\_LANG\-\_Cobol74}& ISO Cobol:1974 \\
114 \livetarg{chap:DWLANGCobol85}{DW\-\_LANG\-\_Cobol85} & ISO Cobol:1985 \\
115 \livetarg{chap:DWLANGD}{DW\-\_LANG\-\_D} \dag & D \\
116 \livetarg{chap:DWLANGFortran77}{DW\-\_LANG\-\_Fortran77} &ISO FORTRAN 77\\
117 \livetarg{chap:DWLANGFortran90}{DW\-\_LANG\-\_Fortran90} & ISO Fortran 90\\
118 \livetarg{chap:DWLANGFortran95}{DW\-\_LANG\-\_Fortran95} & ISO Fortran 95\\
119 \livetarg{chap:DWLANGJava}{DW\-\_LANG\-\_Java} & Java\\
120 \livetarg{chap:DWLANGModula2}{DW\-\_LANG\-\_Modula2} & ISO Modula\dash 2:1996\\
121 \livetarg{chap:DWLANGObjC}{DW\-\_LANG\-\_ObjC} & Objective C\\
122 \livetarg{chap:DWLANGObjCplusplus}{DW\-\_LANG\-\_ObjC\-\_plus\-\_plus} & Objective C++\\
123 \livetarg{chap:DWLANGPascal83}{DW\-\_LANG\-\_Pascal83} & ISO Pascal:1983\\
124 \livetarg{chap:DWLANGPLI}{DW\-\_LANG\-\_PLI} \dag & ANSI PL/I:1976\\
125 \livetarg{chap:DWLANGPython}{DW\-\_LANG\-\_Python} \dag & Python\\
126 \livetarg{chap:DWLANGUPC}{DW\-\_LANG\-\_UPC} &Unified Parallel C\\ \hline
127 \dag \ \ Support for these languages is limited.& \\
131 \item A \livelink{chap:DWATstmtlist}{DW\-\_AT\-\_stmt\-\_list} attribute whose value is a section
132 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}
133 offset to the line number information for this compilation
134 unit. This information is placed in a separate object file
135 section from the debugging information entries themselves. The
136 value of the statement list attribute is the offset in the
137 \addtoindex{.debug\_line} section of the first byte of the line number
138 information for this compilation unit
139 (see Section \refersec{chap:linenumberinformation}).
141 \item A \livelink{chap:DWATmacroinfo}{DW\-\_AT\-\_macro\-\_info} attribute whose value is a section
142 \hypertarget{chap:DWATmacroinfomacroinformation}
143 offset to the macro information for this compilation unit.
144 This information is placed in a separate object file section
145 from the debugging information entries themselves. The
146 value of the macro information attribute is the offset in
147 the \addtoindex{.debug\_macinfo} section of the first byte of the macro
148 information for this compilation unit
149 (see Section \refersec{chap:macroinformation}).
152 \livelink{chap:DWATcompdir}{DW\-\_AT\-\_comp\-\_dir}
154 \hypertarget{chap:DWATcompdircompilationdirectory}
156 null\dash terminated string containing the current working directory
157 of the compilation command that produced this compilation
158 unit in whatever form makes sense for the host system.
160 \item A \livelink{chap:DWATproducer}{DW\-\_AT\-\_producer} attribute whose value is a null\dash
161 terminated string containing information about the compiler
162 \hypertarget{chap:DWATproducercompileridentification}
163 that produced the compilation unit. The actual contents of
164 the string will be specific to each producer, but should
165 begin with the name of the compiler vendor or some other
166 identifying character sequence that should avoid confusion
167 with other producer values.
170 \item A \livelink{chap:DWATidentifiercase}{DW\-\_AT\-\_identifier\-\_case}
171 attribute whose integer
172 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}
173 constant value is a code describing the treatment
174 of identifiers within this compilation unit. The
175 set of identifier case codes is given in Figure
176 \refersec{fig:identifiercasecodes}.
179 \autorows[0pt]{c}{1}{l}{
180 \livelink{chap:DWIDcasesensitive}{DW\-\_ID\-\_case\-\_sensitive},
181 \livelink{chap:DWIDupcase}{DW\-\_ID\-\_up\-\_case},
182 \livelink{chap:DWIDdowncase}{DW\-\_ID\-\_down\-\_case},
183 \livelink{chap:DWIDcaseinsensitive}{DW\-\_ID\-\_case\-\_insensitive}
185 \caption{Identifier case codes}\label{fig:identifiercasecodes}
188 \livetarg{chap:DWIDcasesensitive}{DW\-\_ID\-\_case\-\_sensitive} is the default for all compilation units
189 that do not have this attribute. It indicates that names given
190 as the values of \livelink{chap:DWATname}{DW\-\_AT\-\_name} attributes in debugging information
191 entries for the compilation unit reflect the names as they
192 appear in the source program. The debugger should be sensitive
193 to the case of identifier names when doing identifier lookups.
195 \livetarg{chap:DWIDupcase}{DW\-\_ID\-\_up\-\_case} means that the producer of the debugging
196 information for this compilation unit converted all source
197 names to upper case. The values of the name attributes may not
198 reflect the names as they appear in the source program. The
199 debugger should convert all names to upper case when doing
202 \livetarg{chap:DWIDdowncase}{DW\-\_ID\-\_down\-\_case} means that the producer of the debugging
203 information for this compilation unit converted all source
204 names to lower case. The values of the name attributes may not
205 reflect the names as they appear in the source program. The
206 debugger should convert all names to lower case when doing
209 \livetarg{chap:DWIDcaseinsensitive}{DW\-\_ID\-\_case\-\_insensitive} means that the values of the name
210 attributes reflect the names as they appear in the source
211 program but that a case insensitive lookup should be used to
214 \item A \livelink{chap:DWATbasetypes}{DW\-\_AT\-\_base\-\_types} attribute whose value is a reference.
218 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}
220 \addtoindexx{base types attribute}
221 points to a debugging information entry
222 representing another compilation unit. It may be used
223 to specify the compilation unit containing the base type
224 entries used by entries in the current compilation unit
225 (see Section \refersec{chap:basetypeentries}).
227 This attribute provides a consumer a way to find the definition
228 of base types for a compilation unit that does not itself
229 contain such definitions. This allows a consumer, for example,
230 to interpret a type conversion to a base type
231 % getting this link target at the right spot is tricky.
232 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}
235 \item A \livelink{chap:DWATuseUTF8}{DW\-\_AT\-\_use\-\_UTF8} attribute,
236 which is a \livelink{chap:flag}{flag} whose
237 presence indicates that all strings (such as the names of
238 declared entities in the source program) are represented
239 using the UTF\dash 8 representation
240 (see Section \refersec{datarep:attributeencodings}).
243 \item A \livelink{chap:DWATmainsubprogram}{DW\-\_AT\-\_main\-\_subprogram} attribute, which is a \livelink{chap:flag}{flag}
244 whose presence indicates
245 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}
246 that the compilation unit contains a
247 subprogram that has been identified as the starting function
248 of the program. If more than one compilation unit contains
249 this \nolink{flag}, any one of them may contain the starting function.
251 \textit{\addtoindex{Fortran} has a PROGRAM statement which is used
252 to specify and provide a user\dash specified name for the main
253 subroutine of a program.
254 \addtoindex{C} uses the name “main” to identify
255 the main subprogram of a program. Some other languages provide
256 similar or other means to identify the main subprogram of
261 The base address of a compilation unit is defined as the
262 value of the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute, if present; otherwise,
263 it is undefined. If the base address is undefined, then any
264 DWARF entry or structure defined in terms of the base address
265 of that compilation unit is not valid.
268 \subsection{Imported Unit Entries}
269 \label{chap:importedunitentries}
271 \hypertarget{chap:DWATimportimportedunit}
272 place where a normal or partial unit is imported is
273 represented by a debugging information entry with the
274 tag \livetarg{chap:DWTAGimportedunit}{DW\-\_TAG\-\_imported\-\_unit}.
275 An imported unit entry contains a
276 \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute whose value is a reference to the
277 normal or partial compilation unit whose declarations logically
278 belong at the place of the imported unit entry.
280 An imported unit entry does not necessarily correspond to
281 any entity or construct in the source program. It is merely
282 “glue” used to relate a partial unit, or a compilation
283 unit used as a partial unit, to a place in some other
286 \subsection{Separate Type Unit Entries}
287 \label{chap:separatetypeunitentries}
288 An object file may contain any number of separate type
289 unit entries, each representing a single complete type
290 definition. Each type unit must be uniquely identified by
291 a 64\dash bit signature, stored as part of the type unit, which
292 can be used to reference the type definition from debugging
293 information entries in other compilation units and type units.
295 A type unit is represented by a debugging information entry
296 with the tag \livetarg{chap:DWTAGtypeunit}{DW\-\_TAG\-\_type\-\_unit}.
297 A type unit entry owns debugging
298 information entries that represent the definition of a single
299 type, plus additional debugging information entries that may
300 be necessary to include as part of the definition of the type.
302 A type unit entry may have a \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language} attribute, whose
303 constant value is an integer code indicating the source
304 language used to define the type. The set of language names
305 and their meanings are given in Figure \refersec{fig:languagenames}.
307 A type unit entry for a given type T owns a debugging
308 information entry that represents a defining declaration
309 of type T. If the type is nested within enclosing types or
310 namespaces, the debugging information entry for T is nested
311 within debugging information entries describing its containers;
312 otherwise, T is a direct child of the type unit entry.
314 A type unit entry may also own additional debugging information
315 entries that represent declarations of additional types that
316 are referenced by type T and have not themselves been placed in
317 separate type units. Like T, if an additional type U is nested
318 within enclosing types or namespaces, the debugging information
319 entry for U is nested within entries describing its containers;
320 otherwise, U is a direct child of the type unit entry.
322 The containing entries for types T and U are declarations,
323 and the outermost containing entry for any given type T or
324 U is a direct child of the type unit entry. The containing
325 entries may be shared among the additional types and between
326 T and the additional types.
328 Types are not required to be placed in type units. In general,
329 only large types such as structure, class, enumeration, and
330 union types included from header files should be considered
331 for separate type units. Base types and other small types
332 are not usually worth the overhead of placement in separate
333 type units. Types that are unlikely to be replicated, such
334 as those defined in the main source file, are also better
335 left in the main compilation unit.
337 \section{Module, Namespace and Importing Entries}
338 \textit{Modules and namespaces provide a means to collect related
339 entities into a single entity and to manage the names of
342 \subsection{Module Entries}
343 \label{chap:moduleentries}
344 \textit{Several languages have the concept of a ``module.''
345 \addtoindexx{Modula-2}
346 A Modula\dash 2 definition module may be represented by a module
348 \addtoindex{declaration attribute}
349 (\livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration}). A
350 \addtoindex{Fortran 90} module may also be represented by a module entry
351 (but no declaration attribute is warranted because \addtoindex{Fortran}
352 has no concept of a corresponding module body).}
354 A module is represented by a debugging information entry
356 tag \livetarg{chap:DWTAGmodule}{DW\-\_TAG\-\_module}.
357 Module entries may own other
358 debugging information entries describing program entities
359 whose declaration scopes end at the end of the module itself.
361 If the module has a name, the module entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
362 attribute whose value is a null\dash terminated string containing
363 the module name as it appears in the source program.
365 The module entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
366 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc}
367 pair of attributes or a
368 \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
369 whose values encode the contiguous or non\dash contiguous address
370 ranges, respectively, of the machine instructions generated for
371 the module initialization code
372 (see Section \refersec{chap:codeaddressesandranges}).
373 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}
375 \addtoindexx{entry pc attribute!for module initialization}
377 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute whose value is the address of
378 the first executable instruction of that initialization code
379 (see Section \refersec{chap:entryaddress}).
382 \hypertarget{chap:DWATprioritymodulepriority}
383 the module has been assigned a priority, it may have a
384 \livelink{chap:DWATpriority}{DW\-\_AT\-\_priority} attribute. The value of this attribute is a
385 reference to another debugging information entry describing
386 a variable with a constant value. The value of this variable
387 is the actual constant value of the module’s priority,
388 represented as it would be on the target architecture.
390 \subsection{Namespace Entries}
391 \label{chap:namespaceentries}
392 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
393 implement name hiding, so that names of unrelated things
394 do not accidentally clash in the global namespace when an
395 application is linked together.}
397 A namespace is represented by a debugging information entry
399 tag \livetarg{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace}.
400 A namespace extension is
401 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}
403 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace} entry
405 \addtoindexx{extension attribute}
407 \livelink{chap:DWATextension}{DW\-\_AT\-\_extension}
408 attribute referring to the previous extension, or if there
409 is no previous extension, to the original
410 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace}
411 entry. A namespace extension entry does not need to duplicate
412 information in a previous extension entry of the namespace
413 nor need it duplicate information in the original namespace
414 entry. (Thus, for a namespace with a name,
415 a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
416 attribute need only be attached directly to the original
417 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace} entry.)
419 Namespace and namespace extension entries may own other
420 debugging information entries describing program entities
421 whose declarations occur in the namespace.
423 \textit{For \addtoindex{C++}, such
424 owned program entities may be declarations,
425 including certain declarations that are also object or
426 function definitions.}
428 If a type, variable, or function declared in a namespace is
429 defined outside of the body of the namespace declaration,
430 that type, variable, or function definition entry has a
431 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to the
432 debugging information entry representing the declaration of
433 the type, variable or function. Type, variable, or function
434 entries with a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need
435 to duplicate information provided by the declaration entry
436 referenced by the specification attribute.
438 \textit{The \addtoindex{C++} global namespace
439 (the namespace referred to by
440 ``::f'', for example) is not explicitly represented in
441 DWARF with a namespace entry (thus mirroring the situation
442 in \addtoindex{C++} source).
443 Global items may be simply declared with no
444 reference to a namespace.}
446 \textit{The \addtoindex{C++}
447 compilation unit specific ``unnamed namespace'' may
448 be represented by a namespace entry with no name attribute in
449 the original namespace declaration entry (and therefore no name
450 attribute in any namespace extension entry of this namespace).
453 \textit{A compiler emitting namespace information may choose to
454 explicitly represent namespace extensions, or to represent the
455 final namespace declaration of a compilation unit; this is a
456 quality\dash of\dash implementation issue and no specific requirements
457 are given here. If only the final namespace is represented,
458 it is impossible for a debugger to interpret using declaration
459 references in exactly the manner defined by the
460 \addtoindex{C++} language.
463 \textit{Emitting all namespace declaration information in all
464 compilation units can result in a significant increase in the
465 size of the debug information and significant duplication of
466 information across compilation units.
467 The \addtoindex{C++} namespace std,
468 for example, is large and will probably be referenced in
469 every \addtoindex{C++} compilation unit.
472 \textit{For a \addtoindex{C++} namespace example,
473 see Appendix \refersec{app:namespaceexample}.
478 \subsection{Imported (or Renamed) Declaration Entries}
479 \label{chap:importedorrenameddeclarationentries}
480 \textit{Some languages support the concept of importing into or making
481 accessible in a given unit declarations made in a different
482 module or scope. An imported declaration may sometimes be
487 imported declaration is represented by one or
488 \addtoindex{imported declaration entry}
489 more debugging information entries with the
490 tag \livetarg{chap:DWTAGimporteddeclaration}{DW\-\_TAG\-\_imported\-\_declaration}.
492 \hypertarget{chap:DWATimportimporteddeclaration}
494 is imported, there is one imported declaration entry for
495 each overloading. Each imported declaration entry has a
496 \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute, whose value is a reference to the
497 debugging information entry representing the declaration that
500 An imported declaration may also have a
501 \livelink{chap:DWATname}{DW\-\_AT\-\_name}
503 whose value is a null\dash terminated string containing the
504 name, as it appears in the source program, by which the
505 imported entity is to be known in the context of the imported
506 declaration entry (which may be different than the name of
507 the entity being imported). If no name is present, then the
508 name by which the entity is to be known is the same as the
509 name of the entity being imported.
511 An imported declaration entry with a name attribute may be
512 used as a general means to rename or provide an alias for
513 \addtoindexx{alias declaration|see{imported declaration entry}}
514 an entity, regardless of the context in which the importing
515 declaration or the imported entity occurs.
517 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
518 \hypertarget{chap:DWATimportnamespacealias}
519 declaration entry with a name attribute whose value is
520 a null\dash terminated string containing the alias name as it
521 appears in the source program and an import attribute whose
522 value is a reference to the applicable original namespace or
523 namespace extension entry.
526 \textit{A \addtoindex{C++} using declaration may be represented by one or more
527 \hypertarget{chap:DWATimportnamespaceusingdeclaration}
528 imported declaration entries. When the using declaration
529 refers to an overloaded function, there is one imported
530 declaration entry corresponding to each overloading. Each
531 imported declaration entry has no name attribute but it does
532 have an import attribute that refers to the entry for the
533 entity being imported. (\addtoindex{C++}
534 provides no means to ``rename''
535 an imported entity, other than a namespace).
538 \textit{A \addtoindex{Fortran} use statement with an ``only list'' may be
539 represented by a series of imported declaration entries,
540 one (or more) for each entity that is imported. An entity
541 that is renamed in the importing context may be represented
542 by an imported declaration entry with a name attribute that
543 specifies the new local name.
546 \subsection{Imported Module Entries}
547 \label{chap:importedmoduleentries}
549 \textit{Some languages support the concept of importing into or making
550 accessible in a given unit all of the declarations contained
551 within a separate module or namespace.
554 An imported module declaration is represented by a debugging
555 information entry with the
556 tag \livetarg{chap:DWTAGimportedmodule}{DW\-\_TAG\-\_imported\-\_module}.
558 imported module entry contains a \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute
559 whose value is a reference to the module or namespace entry
560 containing the definition and/or declaration entries for
561 the entities that are to be imported into the context of the
562 imported module entry.
564 An imported module declaration may own a set of imported
565 declaration entries, each of which refers to an entry in the
566 module whose corresponding entity is to be known in the context
567 of the imported module declaration by a name other than its
568 name in that module. Any entity in the module that is not
569 renamed in this way is known in the context of the imported
570 module entry by the same name as it is declared in the module.
572 \textit{A \addtoindex{C++} using directive
573 may be represented by an imported module
574 \hypertarget{chap:DWATimportnamespaceusingdirective}
575 entry, with an import attribute referring to the namespace
576 entry of the appropriate extension of the namespace (which
577 might be the original namespace entry) and no owned entries.
580 \textit{A \addtoindex{Fortran} use statement with a “rename list” may be
581 represented by an imported module entry with an import
582 attribute referring to the module and owned entries
583 corresponding to those entities that are renamed as part of
587 \textit{A \addtoindex{Fortran} use statement
588 with neither a “rename list” nor
589 an “only list” may be represented by an imported module
590 entry with an import attribute referring to the module and
591 no owned child entries.
594 \textit{A use statement with an “only list” is represented by a
595 series of individual imported declaration entries as described
596 in Section \refersec{chap:importedorrenameddeclarationentries}.
599 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
600 itself imported by a use statement without an explicit mention
601 may be represented by an imported declaration entry that refers
602 to the original debugging information entry. For example, given
618 the imported declaration entry for Q within module C refers
619 directly to the variable declaration entry for A in module A
620 because there is no explicit representation for X in module B.
622 A similar situation arises for a \addtoindex{C++} using declaration that
623 imports an entity in terms of a namespace alias. See
624 Appendix \refersec{app:namespaceexample}
628 \section{Subroutine and Entry Point Entries}
629 \label{chap:subroutineandentrypointentries}
631 The following tags exist to describe
632 debugging information entries for subroutines and entry
633 % FIXME: is entry point entry the right index 'entry'?
634 \addtoindexx{entry point entry}
637 \begin{tabular}{lp{9.0cm}}
638 \livetarg{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} & A subroutine or function. \\
639 \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine} & A particular inlined
640 instance of a subroutine or function. \\
641 \livetarg{chap:DWTAGentrypoint}{DW\-\_TAG\-\_entry\-\_point} & An alternate entry point. \\
644 \subsection{General Subroutine and Entry Point Information}
645 \label{chap:generalsubroutineandentrypointinformation}
647 It may also have a \livelink{chap:DWATlinkagename}{DW\-\_AT\-\_linkage\-\_name} attribute as
648 described in Section \refersec{chap:linkagenames}.
650 If the name of the subroutine described by an entry with the
651 tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}
652 is visible outside of its containing
653 \hypertarget{chap:DWATexternalexternalsubroutine}
654 compilation unit, that entry has
655 \addtoindexx{external attribute}
657 \livelink{chap:DWATexternal}{DW\-\_AT\-\_external} attribute,
658 which is a \livelink{chap:flag}{flag}.
660 \textit{Additional attributes for functions that are members of a
661 class or structure are described in
662 Section \refersec{chap:memberfunctionentries}.
666 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}
667 subroutine entry may contain a \livelink{chap:DWATmainsubprogram}{DW\-\_AT\-\_main\-\_subprogram}
669 a \livelink{chap:flag}{flag} whose presence indicates that the
670 subroutine has been identified as the starting function of
671 the program. If more than one subprogram contains this
673 any one of them may be the starting subroutine of the program.
675 \textit{\addtoindex{Fortran} has a PROGRAM statement which is used to specify
676 and provide a user\dash supplied name for the main subroutine of
680 \textit{A common debugger feature is to allow the debugger user to call
681 a subroutine within the subject program. In certain cases,
682 however, the generated code for a subroutine will not obey
683 the standard calling conventions for the target architecture
684 and will therefore not be safe to call from within a debugger.
687 A subroutine entry may
688 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}
690 \livelink{chap:DWATcallingconvention}{DW\-\_AT\-\_calling\-\_convention}
691 attribute, whose value is an integer constant. The set of
692 calling convention codes is given in
693 Figure \refersec{fig:callingconventioncodes}.
696 \autorows[0pt]{c}{1}{l}{
697 \addtoindex{DW\-\_CC\-\_normal},
698 \addtoindex{DW\-\_CC\-\_program},
699 \addtoindex{DW\-\_CC\-\_nocall},
701 \caption{Calling convention codes}\label{fig:callingconventioncodes}
704 If this attribute is not present, or its value is the constant
705 \livetarg{chap:DWCCnormal}{DW\-\_CC\-\_normal}, then the subroutine may be safely called by
706 obeying the ``standard'' calling conventions of the target
707 architecture. If the value of the calling convention attribute
708 is the constant \livetarg{chap:DWCCnocall}{DW\-\_CC\-\_nocall}, the subroutine does not obey
709 standard calling conventions, and it may not be safe for the
710 debugger to call this subroutine.
712 If the semantics of the language of the compilation unit
713 containing the subroutine entry distinguishes between ordinary
714 subroutines and subroutines that can serve as the ``main
715 program,'' that is, subroutines that cannot be called
716 directly according to the ordinary calling conventions,
717 then the debugging information entry for such a subroutine
718 may have a calling convention attribute whose value is the
719 constant \livetarg{chap:DWCCprogram}{DW\-\_CC\-\_program}.
721 \textit{The \livelink{chap:DWCCprogram}{DW\-\_CC\-\_program} value is intended to support \addtoindex{Fortran} main
722 programs which in some implementations may not be callable
723 or which must be invoked in a special way. It is not intended
724 as a way of finding the entry address for the program.
727 \textit{In \addtoindex{C}
728 there is a difference between the types of functions
729 declared using function prototype style declarations and
730 those declared using non\dash prototype declarations.
733 A subroutine entry declared with a function prototype style
734 declaration may have a
735 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
736 a \livelink{chap:flag}{flag}.
738 \textit{The \addtoindex{Fortran}
739 language allows the keywords elemental, pure
740 and recursive to be included as part of the declaration of
741 a subroutine; these attributes reflect that usage. These
742 attributes are not relevant for languages that do not support
743 similar keywords or syntax. In particular, the \livelink{chap:DWATrecursive}{DW\-\_AT\-\_recursive}
744 attribute is neither needed nor appropriate in languages such
746 where functions support recursion by default.
750 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}
752 \addtoindexx{elemental attribute}
754 \livelink{chap:DWATelemental}{DW\-\_AT\-\_elemental} attribute, which
755 is a \livelink{chap:flag}{flag}.
756 The attribute indicates whether the subroutine
757 or entry point was declared with the ``elemental'' keyword
761 \hypertarget{chap:DWATpurepurepropertyofasubroutine}
762 subprogram entry may have a
763 \livelink{chap:DWATpure}{DW\-\_AT\-\_pure} attribute, which is
764 a \livelink{chap:flag}{flag}.
765 The attribute indicates whether the subroutine was
766 declared with the ``pure'' keyword or property.
769 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}
770 subprogram entry may have a
771 \livelink{chap:DWATrecursive}{DW\-\_AT\-\_recursive} attribute, which
772 is a \livelink{chap:flag}{flag}.
773 The attribute indicates whether the subroutine
774 or entry point was declared with the ``recursive'' keyword
779 \subsection{Subroutine and Entry Point Return Types}
780 \label{chap:subroutineandentrypointreturntypes}
783 \hypertarget{chap:DWATtypetypeofsubroutinereturn}
784 the subroutine or entry point is a function that returns a
785 value, then its debugging information entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
786 attribute to denote the type returned by that function.
788 \textit{Debugging information entries for
789 \addtoindex{C} void functions should
790 not have an attribute for the return type. }
793 \subsection{Subroutine and Entry Point Locations}
794 \label{chap:subroutineandentrypointlocations}
796 A subroutine entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
797 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
798 whose values encode the contiguous or non\dash contiguous address
799 ranges, respectively, of the machine instructions generated
800 for the subroutine (see
801 Section \refersec{chap:codeaddressesandranges}).
804 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}
805 subroutine entry may also have
806 \addtoindexx{entry pc attribute!for subroutine}
808 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute
809 whose value is the address of the first executable instruction
810 of the subroutine (see
811 Section \refersec{chap:entryaddress}).
813 An entry point has a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute whose value is the
814 relocated address of the first machine instruction generated
818 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute
819 \addtoindexx{entry pc attribute!for subroutine}
821 also seem appropriate
822 for this purpose, historically the
823 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute
825 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} was introduced (in
826 \addtoindex{DWARF Version 3}).
827 There is insufficient reason to change this.}
833 \addtoindexx{address class!attribute}
835 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}
837 \livelink{chap:DWATsegment}{DW\-\_AT\-\_segment}
839 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class} attributes,
840 as appropriate, to specify
841 which segments the code for the subroutine resides in and
842 the addressing mode to be used in calling that subroutine.
844 A subroutine entry representing a subroutine declaration
845 that is not also a definition does not have code address or
849 \subsection{Declarations Owned by Subroutines and Entry Points}
850 \label{chap:declarationsownedbysubroutinesandentrypoints}
852 The declarations enclosed by a subroutine or entry point are
853 represented by debugging information entries that are owned
854 by the subroutine or entry point entry. Entries representing
855 the formal parameters of the subroutine or entry point appear
856 in the same order as the corresponding declarations in the
859 \textit{There is no ordering requirement for entries for declarations
860 that are children of subroutine or entry point entries but
861 that do not represent formal parameters. The formal parameter
862 entries may be interspersed with other entries used by formal
863 parameter entries, such as type entries.}
865 The unspecified parameters of a variable parameter list are
866 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
868 \livetarg{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
870 The entry for a subroutine that includes a
872 \livelink{chap:fortrancommonblock}{common}
873 \livelink{chap:commonblockentry}{block}
874 \addtoindexx{common block|see{Fortran common block}}
875 has a child entry with the
876 tag \livetarg{chap:DWTAGcommoninclusion}{DW\-\_TAG\-\_common\-\_inclusion}.
878 \hypertarget{chap:commonreferencecommonblockusage}
879 common inclusion entry has a
880 \livelink{chap:DWATcommonreference}{DW\-\_AT\-\_common\-\_reference} attribute
881 whose value is a reference to the debugging information entry
882 for the common \nolink{block} being included
883 (see Section \refersec{chap:commonblockentries}).
885 \subsection{Low-Level Information}
886 \label{chap:lowlevelinformation}
889 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}
890 subroutine or entry point entry may have a
891 \livelink{chap:DWATreturnaddr}{DW\-\_AT\-\_return\-\_addr}
892 attribute, whose value is a location description. The location
893 calculated is the place where the return address for the
894 subroutine or entry point is stored.
897 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}
898 subroutine or entry point entry may also have a
899 \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute, whose value is a location
900 description that computes the “frame base” for the
901 subroutine or entry point. If the location description is
902 a simple register location description, the given register
903 contains the frame base address. If the location description is
904 a DWARF expression, the result of evaluating that expression
905 is the frame base address. Finally, for a location list,
906 this interpretation applies to each location description
907 contained in the list of location list entries.
909 \textit{The use of one of the \livelink{chap:DWOPreg}{DW\-\_OP\-\_reg}~\textless~n~\textgreater
911 context is equivalent to using
912 \livelink{chap:DWOPbreg}{DW\-\_OP\-\_breg}~\textless~n~\textgreater(0)
914 compact. However, these are not equivalent in general.}
916 \textit{The frame base for a procedure is typically an address fixed
917 relative to the first unit of storage allocated for the
918 procedure’s stack frame. The \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute
919 can be used in several ways:}
921 \begin{enumerate}[1.]
922 \item \textit{In procedures that need location lists to locate local
923 variables, the \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} can hold the needed location
924 list, while all variables’ location descriptions can be
925 simpler ones involving the frame base.}
927 \item \textit{It can be used in resolving ``up\dash level'' addressing
928 within nested routines.
929 (See also \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link}, below)}
930 %The -See also- here is ok, the DW\-\_AT should be
931 %a hyperref to the def itself, which is earlier in this document.
934 \textit{Some languages support nested subroutines. In such languages,
935 it is possible to reference the local variables of an
936 outer subroutine from within an inner subroutine. The
937 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} and \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attributes allow
938 debuggers to support this same kind of referencing.}
941 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}
943 \addtoindexx{address!uplevel|see{static link attribute}}
944 subroutine or entry point is nested, it may have a
945 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link}
946 attribute, whose value is a location
947 description that computes the frame base of the relevant
948 instance of the subroutine that immediately encloses the
949 subroutine or entry point.
951 In the context of supporting nested subroutines, the
952 \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute value should obey the following
955 \begin{enumerate}[1.]
956 \item It should compute a value that does not change during the
957 life of the procedure, and
959 \item The computed value should be unique among instances of
960 the same subroutine. (For typical \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} use, this
961 means that a recursive subroutine’s stack frame must have
965 \textit{If a debugger is attempting to resolve an up\dash level reference
966 to a variable, it uses the nesting structure of DWARF to
967 determine which subroutine is the lexical parent and the
968 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} value to identify the appropriate active
969 frame of the parent. It can then attempt to find the reference
970 within the context of the parent.}
974 \subsection{Types Thrown by Exceptions}
975 \label{chap:typesthrownbyexceptions}
977 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
978 it may validly throw.}
980 If a subroutine explicitly declares that it may throw
981 \addtoindexx{exception thrown|see{thrown type entry}}
982 an exception for one or more types, each such type is
983 represented by a debugging information entry with
984 \addtoindexx{thrown type entry}
986 \livetarg{chap:DWTAGthrowntype}{DW\-\_TAG\-\_thrown\-\_type}.
987 Each such entry is a child of the entry
988 representing the subroutine that may throw this type. Each
989 thrown type entry contains a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, whose
990 value is a reference to an entry describing the type of the
991 exception that may be thrown.
993 \subsection{Function Template Instantiations}
994 \label{chap:functiontemplateinstantiations}
996 \textit{In \addtoindex{C++}, a function template is a generic definition of
997 a function that is instantiated differently when called with
998 values of different types. DWARF does not represent the generic
999 template definition, but does represent each instantiation.}
1001 A template instantiation is represented by a debugging
1002 information entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. With four
1003 exceptions, such an entry will contain the same attributes and
1004 will have the same types of child entries as would an entry
1005 for a subroutine defined explicitly using the instantiation
1006 types. The exceptions are:
1008 \begin{enumerate}[1.]
1009 \item Each formal parameterized type declaration appearing in the
1010 template definition is represented by a debugging information
1012 tag \livetarg{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
1014 such entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
1015 null\dash terminated string containing the name of the formal
1016 type parameter as it appears in the source program. The
1017 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
1018 describing the actual type by which the formal is replaced
1019 for this instantiation.
1021 \item The subprogram entry and each of its child entries reference
1022 a template type parameter entry in any circumstance where
1023 the template definition referenced a formal parameterized type.
1025 \item If the compiler has generated a special compilation unit
1026 to hold the template instantiation and that compilation unit
1027 has a different name from the compilation unit containing
1028 the template definition, the name attribute for the debugging
1029 information entry representing that compilation unit is empty
1032 \item If the subprogram entry representing the template
1033 instantiation or any of its child entries contain declaration
1034 coordinate attributes, those attributes refer to the source
1035 for the template definition, not to any source generated
1036 artificially by the compiler for this instantiation.
1041 \subsection{Inlinable and Inlined Subroutines}
1042 A declaration or a definition of an inlinable subroutine
1043 is represented by a debugging information entry with the
1045 \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1046 The entry for a subroutine that is
1047 \hypertarget{chap:DWATinlineinlinedsubroutine}
1048 explicitly declared to be available for inline expansion or
1049 that was expanded inline implicitly by the compiler has a
1050 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is an integer constant. The
1051 set of values for the \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute is given in
1052 Figure \refersec{fig:inlinecodes}.
1054 \begin{figure}[here]
1056 \caption{Inline codes}
1057 \label{fig:inlinecodes}
1058 \begin{tabular}{lp{9cm}}
1059 Name&Meaning\\ \hline
1060 \livetarg{chap:DWINLnotinlined}{DW\-\_INL\-\_not\-\_inlined} & Not delared inline nor inlined by the
1061 compiler(equivalent to the absense of the containing
1062 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute) \\
1063 \livetarg{chap:DWINLinlined}{DW\-\_INL\-\_inlined} & Not declared inline but inlined by the compiler \\
1064 \livetarg{chap:DWINLdeclarednotinlined}{DW\-\_INL\-\_declared\-\_not\-\_inlined} & Declared inline but
1065 not inlined by the compiler \\
1066 \livetarg{chap:DWINLdeclaredinlined}{DW\-\_INL\-\_declared\-\_inlined} & Declared inline and inlined by the compiler \\
1070 \textit{In \addtoindex{C++}, a function or a constructor declared with
1071 constexpr is implicitly declared inline. The abstract inline
1072 instance (see below) is represented by a debugging information
1073 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. Such an entry has a
1074 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is \livelink{chap:DWINLinlined}{DW\-\_INL\-\_inlined}.}
1077 \paragraph{Abstract Instances}
1078 \label{chap:abstractinstances}
1079 Any debugging information entry that is owned (either
1080 \hypertarget{chap:DWATinlineabstracttinstance}
1081 directly or indirectly) by a debugging information entry
1083 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute is referred to
1084 \addtoindexx{abstract instance!entry}
1085 as an ``abstract instance entry.''
1086 Any subroutine entry
1087 that contains a \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is other
1088 than \livelink{chap:DWINLnotinlined}{DW\-\_INL\-\_not\-\_inlined}
1090 \addtoindexx{abstract instance!root}
1091 an ``abstract instance root.''
1092 Any set of abstract instance entries that are all
1093 children (either directly or indirectly) of some abstract
1094 instance root, together with the root itself, is known as
1095 \addtoindexx{abstract instance!tree}
1096 an ``abstract instance tree.'' However, in the case where
1097 an abstract instance tree is nested within another abstract
1098 instance tree, the entries in the nested abstract instance
1099 tree are not considered to be entries in the outer abstract
1102 Each abstract instance root is either part of a larger
1103 \addtoindexx{abstract instance!root}
1104 tree (which gives a context for the root) or uses
1105 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} to refer to the declaration in context.
1107 \textit{For example, in \addtoindex{C++} the context might be a namespace
1108 declaration or a class declaration.}
1110 \textit{Abstract instance trees are defined so that no entry is part
1111 of more than one abstract instance tree. This simplifies the
1112 following descriptions.}
1114 A debugging information entry that is a member of an abstract
1115 instance tree should not contain any attributes which describe
1116 aspects of the subroutine which vary between distinct inlined
1117 expansions or distinct out\dash of\dash line expansions. For example,
1118 \addtoindexx{entry pc attribute!and abstract instance}
1119 the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc},
1120 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc},
1121 \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges},
1122 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc},
1123 \livelink{chap:DWATlocation}{DW\-\_AT\-\_location},
1124 \livelink{chap:DWATreturnaddr}{DW\-\_AT\-\_return\-\_addr}, \livelink{chap:DWATstartscope}{DW\-\_AT\-\_start\-\_scope}, and
1125 \livelink{chap:DWATsegment}{DW\-\_AT\-\_segment}
1126 attributes typically should be omitted; however, this list
1129 \textit{It would not make sense normally to put these attributes into
1130 abstract instance entries since such entries do not represent
1131 actual (concrete) instances and thus do not actually exist at
1132 run\dash time. However,
1133 see Appendix \refersec{app:inlineouteronenormalinner}
1134 for a contrary example.}
1136 The rules for the relative location of entries belonging to
1137 abstract instance trees are exactly the same as for other
1138 similar types of entries that are not abstract. Specifically,
1139 the rule that requires that an entry representing a declaration
1140 be a direct child of the entry representing the scope of the
1141 declaration applies equally to both abstract and non\dash abstract
1142 entries. Also, the ordering rules for formal parameter entries,
1143 member entries, and so on, all apply regardless of whether
1144 or not a given entry is abstract.
1146 \paragraph{Concrete Inlined Instances}
1147 \label{chap:concreteinlinedinstances}
1149 Each inline expansion of a subroutine is represented
1150 by a debugging information entry with the
1151 tag \livetarg{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}.
1152 Each such entry should be a direct
1153 child of the entry that represents the scope within which
1154 the inlining occurs.
1156 Each inlined subroutine entry may have either a
1157 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc}
1158 and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges}
1159 attribute whose values encode the contiguous or non\dash contiguous
1160 address ranges, respectively, of the machine instructions
1161 generated for the inlined subroutine (see
1162 Section \refersec{chap:codeaddressesandranges}).
1164 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}
1165 inlined subroutine entry may also contain
1166 \addtoindexx{entry pc attribute!for inlined subprogram}
1168 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc}
1169 attribute, representing the first executable instruction of
1170 the inline expansion (see
1171 Section \refersec{chap:entryaddress}).
1173 % Positions of the 3 targets here is a bit arbitrary.
1175 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}
1177 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}
1179 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}
1180 may also have \livelink{chap:DWATcallfile}{DW\-\_AT\-\_call\-\_file},
1181 \livelink{chap:DWATcallline}{DW\-\_AT\-\_call\-\_line} and \livelink{chap:DWATcallcolumn}{DW\-\_AT\-\_call\-\_column} attributes,
1183 value is an integer constant. These attributes represent the
1184 source file, source line number, and source column number,
1185 respectively, of the first character of the statement or
1186 expression that caused the inline expansion. The call file,
1187 call line, and call column attributes are interpreted in
1188 the same way as the declaration file, declaration line, and
1189 declaration column attributes, respectively (see
1190 Section \refersec{chap:declarationcoordinates}).
1192 The call file, call line and call column coordinates do not
1193 describe the coordinates of the subroutine declaration that
1194 was inlined, rather they describe the coordinates of the call.
1196 An inlined subroutine entry
1197 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}
1199 \livelink{chap:DWATconstexpr}{DW\-\_AT\-\_const\-\_expr}
1200 attribute, which is a \livelink{chap:flag}{flag}
1201 whose presence indicates that the
1202 subroutine has been evaluated as a compile\dash time constant. Such
1203 an entry may also have a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1204 whose value may be of any form that is appropriate for the
1205 representation of the subroutine's return value. The value of
1206 this attribute is the actual return value of the subroutine,
1207 represented as it would be on the target architecture.
1209 \textit{In \addtoindex{C++}, if a function or a constructor declared with constexpr
1210 is called with constant expressions, then the corresponding
1211 concrete inlined instance has a
1212 \livelink{chap:DWATconstexpr}{DW\-\_AT\-\_const\-\_expr} attribute,
1213 as well as a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute whose value represents
1214 the actual return value of the concrete inlined instance.}
1216 Any debugging information entry that is owned (either
1217 directly or indirectly) by a debugging information entry
1218 with the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine} is referred to as a
1219 ``concrete inlined instance entry.'' Any entry that has
1220 the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}
1221 is known as a ``concrete inlined instance root.'' Any set of concrete inlined instance
1222 entries that are all children (either directly or indirectly)
1223 of some concrete inlined instance root, together with the root
1224 itself, is known as a ``concrete inlined instance tree.''
1225 However, in the case where a concrete inlined instance tree
1226 is nested within another concrete instance tree, the entries
1227 in the nested concrete instance tree are not considered to
1228 be entries in the outer concrete instance tree.
1230 \textit{Concrete inlined instance trees are defined so that no entry
1231 is part of more than one concrete inlined instance tree. This
1232 simplifies later descriptions.}
1234 Each concrete inlined instance tree is uniquely associated
1235 with one (and only one) abstract instance tree.
1237 \textit{Note, however, that the reverse is not true. Any given abstract
1238 instance tree may be associated with several different concrete
1239 inlined instance trees, or may even be associated with zero
1240 concrete inlined instance trees.}
1242 Concrete inlined instance entries may omit attributes that
1243 are not specific to the concrete instance (but present in
1244 the abstract instance) and need include only attributes that
1245 are specific to the concrete instance (but omitted in the
1246 abstract instance). In place of these omitted attributes, each
1247 \hypertarget{chap:DWATabstractorigininlineinstance}
1248 concrete inlined instance entry
1249 \addtoindexx{abstract origin attribute}
1251 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin}
1252 attribute that may be used to obtain the missing information
1253 (indirectly) from the associated abstract instance entry. The
1254 value of the abstract origin attribute is a reference to the
1255 associated abstract instance entry.
1257 If an entry within a concrete inlined instance tree contains
1258 attributes describing the
1259 \addtoindexx{declaration coordinates!in concrete instance}
1260 declaration coordinates
1262 entry, then those attributes should refer to the file, line
1263 and column of the original declaration of the subroutine,
1264 not to the point at which it was inlined. As a consequence,
1265 they may usually be omitted from any entry that has an abstract
1268 For each pair of entries that are associated via a
1269 \addtoindexx{abstract origin attribute}
1270 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attribute, both members of the pair
1271 have the same tag. So, for example, an entry with the tag
1272 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable} can only be associated with another entry
1273 that also has the tag \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}. The only exception
1274 to this rule is that the root of a concrete instance tree
1275 (which must always have the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine})
1276 can only be associated with the root of its associated abstract
1277 instance tree (which must have the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}).
1279 In general, the structure and content of any given concrete
1280 inlined instance tree will be closely analogous to the
1281 structure and content of its associated abstract instance
1282 tree. There are a few exceptions:
1284 \begin{enumerate}[1.]
1285 \item An entry in the concrete instance tree may be omitted if
1287 \addtoindexx{abstract origin attribute}
1288 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attribute and either
1289 has no children, or its children are omitted. Such entries
1290 would provide no useful information. In C\dash like languages,
1291 such entries frequently include types, including structure,
1292 union, class, and interface types; and members of types. If any
1293 entry within a concrete inlined instance tree needs to refer
1294 to an entity declared within the scope of the relevant inlined
1295 subroutine and for which no concrete instance entry exists,
1296 the reference should refer to the abstract instance entry.
1298 \item Entries in the concrete instance tree which are associated
1299 with entries in the abstract instance tree such that neither
1300 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, and neither is referenced by
1301 any other debugging information entry, may be omitted. This
1302 may happen for debugging information entries in the abstract
1303 instance trees that became unnecessary in the concrete instance
1304 tree because of additional information available there. For
1305 example, an anonymous variable might have been created and
1306 described in the abstract instance tree, but because of
1307 the actual parameters for a particular inlined expansion,
1308 it could be described as a constant value without the need
1309 for that separate debugging information entry.
1311 \item A concrete instance tree may contain entries which do
1312 not correspond to entries in the abstract instance tree
1313 to describe new entities that are specific to a particular
1314 inlined expansion. In that case, they will not have associated
1315 entries in the abstract instance tree, should not contain
1316 \addtoindexx{abstract origin attribute}
1317 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attributes, and must contain all their
1318 own attributes directly. This allows an abstract instance tree
1319 to omit debugging information entries for anonymous entities
1320 that are unlikely to be needed in most inlined expansions. In
1321 any expansion which deviates from that expectation, the
1322 entries can be described in its concrete inlined instance tree.
1326 \paragraph{Out-of-Line Instances of Inlined Subroutines}
1327 \label{chap:outoflineinstancesofinlinedsubroutines}
1328 Under some conditions, compilers may need to generate concrete
1329 executable instances of inlined subroutines other than at
1330 points where those subroutines are actually called. Such
1331 concrete instances of inlined subroutines are referred to as
1332 ``concrete out\dash of\dash line instances.''
1334 \textit{In \addtoindex{C++}, for example,
1335 taking the address of a function declared
1336 to be inline can necessitate the generation of a concrete
1337 out\dash of\dash line instance of the given function.}
1339 The DWARF representation of a concrete out\dash of\dash line instance
1340 of an inlined subroutine is essentially the same as for a
1341 concrete inlined instance of that subroutine (as described in
1342 the preceding section). The representation of such a concrete
1343 % It is critical that the hypertarget and livelink be
1344 % separated to avoid problems with latex.
1345 out\dash of\dash line
1346 \addtoindexx{abstract origin attribute}
1348 \hypertarget{chap:DWATabstractoriginoutoflineinstance}
1350 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin}
1351 attributes in exactly the same way as they are used for
1352 a concrete inlined instance (that is, as references to
1353 corresponding entries within the associated abstract instance
1356 The differences between the DWARF representation of a
1357 concrete out\dash of\dash line instance of a given subroutine and the
1358 representation of a concrete inlined instance of that same
1359 subroutine are as follows:
1361 \begin{enumerate}[1.]
1362 \item The root entry for a concrete out\dash of\dash line instance
1363 of a given inlined subroutine has the same tag as does its
1364 associated (abstract) inlined subroutine entry (that is, tag
1365 \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} rather than \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}).
1367 \item The root entry for a concrete out\dash of\dash line instance tree
1368 is normally owned by the same parent entry that also owns
1369 the root entry of the associated abstract instance. However,
1370 it is not required that the abstract and out\dash of\dash line instance
1371 trees be owned by the same parent entry.
1375 \paragraph{Nested Inlined Subroutines}
1376 \label{nestedinlinedsubroutines}
1377 Some languages and compilers may permit the logical nesting of
1378 a subroutine within another subroutine, and may permit either
1379 the outer or the nested subroutine, or both, to be inlined.
1381 For a non\dash inlined subroutine nested within an inlined
1382 subroutine, the nested subroutine is described normally in
1383 both the abstract and concrete inlined instance trees for
1384 the outer subroutine. All rules pertaining to the abstract
1385 and concrete instance trees for the outer subroutine apply
1386 also to the abstract and concrete instance entries for the
1389 For an inlined subroutine nested within another inlined
1390 subroutine, the following rules apply to their abstract and
1391 \addtoindexx{abstract instance!nested}
1392 \addtoindexx{concrete instance!nested}
1393 concrete instance trees:
1395 \begin{enumerate}[1.]
1396 \item The abstract instance tree for the nested subroutine is
1397 described within the abstract instance tree for the outer
1398 subroutine according to the rules in
1399 Section \refersec{chap:abstractinstances}, and
1400 without regard to the fact that it is within an outer abstract
1403 \item Any abstract instance tree for a nested subroutine is
1404 always omitted within the concrete instance tree for an
1407 \item A concrete instance tree for a nested subroutine is
1408 always omitted within the abstract instance tree for an
1411 \item The concrete instance tree for any inlined or out-of-line
1412 expansion of the nested subroutine is described within a
1413 concrete instance tree for the outer subroutine according
1415 Sections \refersec{chap:concreteinlinedinstances} or
1416 \refersec{chap:outoflineinstancesofinlinedsubroutines}
1418 and without regard to the fact that it is within an outer
1419 concrete instance tree.
1422 See Appendix \refersec{app:inliningexamples}
1423 for discussion and examples.
1425 \subsection{Trampolines}
1426 \label{chap:trampolines}
1428 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1429 \hypertarget{chap:DWATtrampolinetargetsubroutine}
1430 an intermediary in making a call to another subroutine. It may
1431 adjust parameters and/or the result (if any) as appropriate
1432 to the combined calling and called execution contexts.}
1434 A trampoline is represented by a debugging information entry
1435 with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} or \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}
1436 that has a \livelink{chap:DWATtrampoline}{DW\-\_AT\-\_trampoline} attribute. The value of that
1437 attribute indicates the target subroutine of the trampoline,
1438 that is, the subroutine to which the trampoline passes
1439 control. (A trampoline entry may but need not also have a
1440 \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute.)
1442 The value of the trampoline attribute may be represented
1443 using any of the following forms, which are listed in order
1447 \item If the value is of class reference, then the value
1448 specifies the debugging information entry of the target
1451 \item If the value is of class address, then the value is
1452 the relocated address of the target subprogram.
1454 \item If the value is of class string, then the value is the
1455 (possibly mangled) name of the target subprogram.
1457 \item If the value is of class \livelink{chap:flag}{flag}, then the value true
1458 indicates that the containing subroutine is a trampoline but
1459 that the target subroutine is not known.
1463 The target subprogram may itself be a trampoline. (A sequence
1464 of trampolines necessarily ends with a non\dash trampoline
1467 \textit{In \addtoindex{C++}, trampolines may be used
1468 to implement derived virtual
1469 member functions; such trampolines typically adjust the
1470 implicit this pointer parameter in the course of passing
1471 control. Other languages and environments may use trampolines
1472 in a manner sometimes known as transfer functions or transfer
1475 \textit{Trampolines may sometimes pass control to the target
1476 subprogram using a branch or jump instruction instead of a
1477 call instruction, thereby leaving no trace of their existence
1478 in the subsequent execution context. }
1480 \textit{This attribute helps make it feasible for a debugger to arrange
1481 that stepping into a trampoline or setting a breakpoint in
1482 a trampoline will result in stepping into or setting the
1483 breakpoint in the target subroutine instead. This helps to
1484 hide the compiler generated subprogram from the user. }
1486 \textit{If the target subroutine is not known, a debugger may choose
1487 to repeatedly step until control arrives in a new subroutine
1488 which can be assumed to be the target subroutine. }
1492 \section{Lexical Block Entries}
1493 \label{chap:lexicalblockentries}
1495 \textit{A lexical \livetargi{chap:lexicalblock}{block}{lexical block} is a bracketed sequence of source statements
1496 that may contain any number of declarations. In some languages
1497 (including \addtoindex{C} and \addtoindex{C++}),
1498 \nolink{blocks} can be nested within other
1499 \nolink{blocks} to any depth.}
1501 % We do not need to link to the preceeding paragraph.
1502 A lexical \nolink{block} is represented by a debugging information
1504 tag \livetarg{chap:DWTAGlexicalblock}{DW\-\_TAG\-\_lexical\-\_block}.
1506 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry} entry
1508 either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
1509 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of
1510 attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
1511 whose values encode the contiguous or non-contiguous address
1512 ranges, respectively, of the machine instructions generated
1513 for the lexical \livelink{chap:lexicalblock}{block}
1514 (see Section \refersec{chap:codeaddressesandranges}).
1516 If a name has been given to the
1517 lexical \livelink{chap:lexicalblock}{block}
1519 program, then the corresponding
1520 lexical \livelink{chap:lexicalblockentry}{block} entry has a
1521 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose
1522 value is a null\dash terminated string
1523 containing the name of the lexical \livelink{chap:lexicalblock}{block}
1527 \textit{This is not the same as a \addtoindex{C} or
1528 \addtoindex{C++} label (see below).}
1530 The lexical \livelink{chap:lexicalblockentry}{block} entry owns
1531 debugging information entries that
1532 describe the declarations within that lexical \livelink{chap:lexicalblock}{block}.
1534 one such debugging information entry for each local declaration
1535 of an identifier or inner lexical \livelink{chap:lexicalblock}{block}.
1537 \section{Label Entries}
1538 \label{chap:labelentries}
1540 A label is a way of identifying a source statement. A labeled
1541 statement is usually the target of one or more ``go to''
1544 A label is represented by a debugging information entry with
1546 tag \livetarg{chap:DWTAGlabel}{DW\-\_TAG\-\_label}.
1547 The entry for a label should be owned by
1548 the debugging information entry representing the scope within
1549 which the name of the label could be legally referenced within
1552 The label entry has a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute whose value
1553 is the relocated address of the first machine instruction
1554 generated for the statement identified by the label in
1555 the source program. The label entry also has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1556 attribute whose value is a null-terminated string containing
1557 the name of the label as it appears in the source program.
1560 \section{With Statement Entries}
1561 \label{chap:withstatemententries}
1563 \textit{Both \addtoindex{Pascal} and
1564 \addtoindexx{Modula-2}
1565 Modula\dash 2 support the concept of a ``with''
1566 statement. The with statement specifies a sequence of
1567 executable statements within which the fields of a record
1568 variable may be referenced, unqualified by the name of the
1571 A with statement is represented by a
1572 \addtoindexi{debugging information entry}{with statement entry}
1573 with the tag \livetarg{chap:DWTAGwithstmt}{DW\-\_TAG\-\_with\-\_stmt}.
1575 A with statement entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
1576 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
1577 whose values encode the contiguous or non\dash contiguous address
1578 ranges, respectively, of the machine instructions generated
1579 for the with statement
1580 (see Section \refersec{chap:codeaddressesandranges}).
1582 The with statement entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, denoting
1583 the type of record whose fields may be referenced without full
1584 qualification within the body of the statement. It also has
1585 a \livelink{chap:DWATlocation}{DW\-\_AT\-\_location} attribute, describing how to find the base
1586 address of the record object referenced within the body of
1589 \section{Try and Catch Block Entries}
1590 \label{chap:tryandcatchblockentries}
1592 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
1593 designated as a ``catch \nolink{block}.''
1594 A catch \livetargi{chap:catchblock}{block}{catch block} is an
1595 exception handler that handles
1596 exceptions thrown by an immediately
1597 preceding ``try \livelink{chap:tryblock}{block}.''
1598 A catch \livelink{chap:catchblock}{block}
1599 designates the type of the exception that it
1602 A try \livetargi{chap:tryblock}{block}{try block} is represented
1603 by a debugging information entry
1604 with the tag \livetarg{chap:DWTAGtryblock}{DW\-\_TAG\-\_try\-\_block}.
1605 A catch \livelink{chap:catchblock}{block} is represented by
1606 a debugging information entry with
1607 the tag \livetarg{chap:DWTAGcatchblock}{DW\-\_TAG\-\_catch\-\_block}.
1609 % nolink as we have links just above and do not have a combo link for both
1610 Both try and catch \nolink{block} entries may have either a
1611 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a
1612 \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute whose values encode the contiguous
1613 or non\dash contiguous address ranges, respectively, of the
1614 machine instructions generated for the \livelink{chap:lexicalblock}{block}
1616 \refersec{chap:codeaddressesandranges}).
1618 Catch \livelink{chap:catchblock}{block} entries have at
1619 least one child entry, an
1620 entry representing the type of exception accepted by
1621 that catch \livelink{chap:catchblock}{block}.
1623 This child entry has one of the
1624 \addtoindexx{unspecified parameters entry!in catch block}
1626 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} or
1627 \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters},
1628 and will have the same form as other parameter entries.
1630 The siblings immediately following
1631 a try \livelink{chap:tryblock}{block} entry are its
1632 corresponding catch \livelink{chap:catchblock}{block} entries.