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 attributes:
71 \item Either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of
72 attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute whose values encode the
73 contiguous or non\dash contiguous address ranges, respectively,
74 of the machine instructions generated for the compilation
75 unit (see Section {chap:codeaddressesandranges}).
76 A \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute may also
77 be specified in combination with \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} to specify the
78 default base address for use in location lists (see Section
79 \refersec{chap:locationlists}) and range lists
80 (see Section \refersec{chap:noncontiguousaddressranges}).
82 \item A \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
84 \hypertarget{chap:DWATnamepathnameofcompilationsource}
85 containing the full or relative path name of the primary
86 source file from which the compilation unit was derived.
88 \item A \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language} attribute whose constant value is an
89 integer code indicating the source language of the compilation
90 unit. The set of language names and their meanings are given
92 Figure \refersec{fig:languagenames}.
96 \caption{Language names}
97 \label{fig:languagenames}
99 Language name & Meaning\\ \hline
100 \livetarg{chap:DWLANGAda83}{DW\-\_LANG\-\_Ada83} \dag&ISO Ada:1983 \\
101 \livetarg{chap:DWLANGAda95}{DW\-\_LANG\-\_Ada95} \dag&ISO Ada:1995 \\
102 \livetarg{chap:DWLANGC}{DW\-\_LANG\-\_C}&Non-standardized C, such as K\&R \\
103 \livetarg{chap:DWLANGC89}{DW\-\_LANG\-\_C89}&ISO C:1989 \\
104 \livetarg{chap:DWLANGC99}{DW\-\_LANG\-\_C99} & ISO C:1999 \\
105 \livetarg{chap:DWLANGCplusplus}{DW\-\_LANG\-\_C\-\_plus\-\_plus}&ISO C++:1998 \\
106 \livetarg{chap:DWLANGCobol74}{DW\-\_LANG\-\_Cobol74}& ISO Cobol:1974 \\
107 \livetarg{chap:DWLANGCobol85}{DW\-\_LANG\-\_Cobol85} & ISO Cobol:1985 \\
108 \livetarg{chap:DWLANGD}{DW\-\_LANG\-\_D} \dag & D \\
109 \livetarg{chap:DWLANGFortran77}{DW\-\_LANG\-\_Fortran77} &ISO FORTRAN 77\\
110 \livetarg{chap:DWLANGFortran90}{DW\-\_LANG\-\_Fortran90} & ISO Fortran 90\\
111 \livetarg{chap:DWLANGFortran95}{DW\-\_LANG\-\_Fortran95} & ISO Fortran 95\\
112 \livetarg{chap:DWLANGJava}{DW\-\_LANG\-\_Java} & Java\\
113 \livetarg{chap:DWLANGModula2}{DW\-\_LANG\-\_Modula2} & ISO Modula\dash 2:1996\\
114 \livetarg{chap:DWLANGObjC}{DW\-\_LANG\-\_ObjC} & Objective C\\
115 \livetarg{chap:DWLANGObjCplusplus}{DW\-\_LANG\-\_ObjC\-\_plus\-\_plus} & Objective C++\\
116 \livetarg{chap:DWLANGPascal83}{DW\-\_LANG\-\_Pascal83} & ISO Pascal:1983\\
117 \livetarg{chap:DWLANGPLI}{DW\-\_LANG\-\_PLI} \dag & ANSI PL/I:1976\\
118 \livetarg{chap:DWLANGPython}{DW\-\_LANG\-\_Python} \dag & Python\\
119 \livetarg{chap:DWLANGUPC}{DW\-\_LANG\-\_UPC} &Unified Parallel C\\ \hline
120 \dag \ \ Support for these languages is limited.& \\
124 \item A \livelink{chap:DWATstmtlist}{DW\-\_AT\-\_stmt\-\_list} attribute whose value is a section
125 offset to the line number information for this compilation
126 unit. This information is placed in a separate object file
127 section from the debugging information entries themselves. The
128 value of the statement list attribute is the offset in the
129 .debug\_line section of the first byte of the line number
130 information for this compilation unit
131 (see Section \refersec{chap:linenumberinformation}).
133 \item A \livelink{chap:DWATmacroinfo}{DW\-\_AT\-\_macro\-\_info} attribute whose value is a section
134 \hypertarget{chap:DWATmacroinfomacroinformation}
135 offset to the macro information for this compilation unit.
136 This information is placed in a separate object file section
137 from the debugging information entries themselves. The
138 value of the macro information attribute is the offset in
139 the .debug\_macinfo section of the first byte of the macro
140 information for this compilation unit
141 (see Section \refersec{chap:macroinformation}).
144 \livelink{chap:DWATcompdir}{DW\-\_AT\-\_comp\-\_dir}
146 \hypertarget{chap:DWATcompdircompilationdirectory}
148 null\dash terminated string containing the current working directory
149 of the compilation command that produced this compilation
150 unit in whatever form makes sense for the host system.
152 \item A \livelink{chap:DWATproducer}{DW\-\_AT\-\_producer} attribute whose value is a null\dash
153 terminated string containing information about the compiler
154 that produced the compilation unit. The actual contents of
155 the string will be specific to each producer, but should
156 begin with the name of the compiler vendor or some other
157 identifying character sequence that should avoid confusion
158 with other producer values.
161 \item A \livelink{chap:DWATidentifiercase}{DW\-\_AT\-\_identifier\-\_case} attribute whose integer
162 constant value is a code describing the treatment
163 of identifiers within this compilation unit. The
164 set of identifier case codes is given in Figure
165 \refersec{fig:identifiercasecodes}.
168 \autorows[0pt]{c}{1}{l}{
169 \livelink{chap:DWIDcasesensitive}{DW\-\_ID\-\_case\-\_sensitive},
170 \livelink{chap:DWIDupcase}{DW\-\_ID\-\_up\-\_case},
171 \livelink{chap:DWIDdowncase}{DW\-\_ID\-\_down\-\_case},
172 \livelink{chap:DWIDcaseinsensitive}{DW\-\_ID\-\_case\-\_insensitive}
174 \caption{Identifier case codes}\label{fig:identifiercasecodes}
177 \livetarg{chap:DWIDcasesensitive}{DW\-\_ID\-\_case\-\_sensitive} is the default for all compilation units
178 that do not have this attribute. It indicates that names given
179 as the values of \livelink{chap:DWATname}{DW\-\_AT\-\_name} attributes in debugging information
180 entries for the compilation unit reflect the names as they
181 appear in the source program. The debugger should be sensitive
182 to the case of identifier names when doing identifier lookups.
184 \livetarg{chap:DWIDupcase}{DW\-\_ID\-\_up\-\_case} means that the producer of the debugging
185 information for this compilation unit converted all source
186 names to upper case. The values of the name attributes may not
187 reflect the names as they appear in the source program. The
188 debugger should convert all names to upper case when doing
191 \livetarg{chap:DWIDdowncase}{DW\-\_ID\-\_down\-\_case} means that the producer of the debugging
192 information for this compilation unit converted all source
193 names to lower case. The values of the name attributes may not
194 reflect the names as they appear in the source program. The
195 debugger should convert all names to lower case when doing
198 \livetarg{chap:DWIDcaseinsensitive}{DW\-\_ID\-\_case\-\_insensitive} means that the values of the name
199 attributes reflect the names as they appear in the source
200 program but that a case insensitive lookup should be used to
203 \item A \livelink{chap:DWATbasetypes}{DW\-\_AT\-\_base\-\_types} attribute whose value is a reference.
207 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}
208 attribute points to a debugging information entry
209 representing another compilation unit. It may be used
210 to specify the compilation unit containing the base type
211 entries used by entries in the current compilation unit
212 (see Section \refersec{chap:basetypeentries}).
214 This attribute provides a consumer a way to find the definition
215 of base types for a compilation unit that does not itself
216 contain such definitions. This allows a consumer, for example,
217 to interpret a type conversion to a base type correctly.
219 \item A \livelink{chap:DWATuseUTF8}{DW\-\_AT\-\_use\-\_UTF8} attribute,
220 which is a \livelink{chap:flag}{flag} whose
221 presence indicates that all strings (such as the names of
222 declared entities in the source program) are represented
223 using the UTF\dash 8 representation
224 (see Section \refersec{datarep:attributeencodings}).
227 \item A \livelink{chap:DWATmainsubprogram}{DW\-\_AT\-\_main\-\_subprogram} attribute, which is a \livelink{chap:flag}{flag}
228 whose presence indicates
229 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}
230 that the compilation unit contains a
231 subprogram that has been identified as the starting function
232 of the program. If more than one compilation unit contains
233 this \nolink{flag}, any one of them may contain the starting function.
235 \textit{Fortran has a PROGRAM statement which is used
236 to specify and provide a user\dash specified name for the main
237 subroutine of a program. C uses the name “main” to identify
238 the main subprogram of a program. Some other languages provide
239 similar or other means to identify the main subprogram of
244 The base address of a compilation unit is defined as the
245 value of the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute, if present; otherwise,
246 it is undefined. If the base address is undefined, then any
247 DWARF entry or structure defined in terms of the base address
248 of that compilation unit is not valid.
251 \subsection{Imported Unit Entries}
252 \label{chap:importedunitentries}
253 The place where a normal or partial unit is imported is
254 represented by a debugging information entry with the
255 tag \livetarg{chap:DWTAGimportedunit}{DW\-\_TAG\-\_imported\-\_unit}.
256 An imported unit entry contains a
257 \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute whose value is a reference to the
258 normal or partial compilation unit whose declarations logically
259 belong at the place of the imported unit entry.
261 An imported unit entry does not necessarily correspond to
262 any entity or construct in the source program. It is merely
263 “glue” used to relate a partial unit, or a compilation
264 unit used as a partial unit, to a place in some other
267 \subsection{Separate Type Unit Entries}
268 \label{chap:separatetypeunitentries}
269 An object file may contain any number of separate type
270 unit entries, each representing a single complete type
271 definition. Each type unit must be uniquely identified by
272 a 64\dash bit signature, stored as part of the type unit, which
273 can be used to reference the type definition from debugging
274 information entries in other compilation units and type units.
276 A type unit is represented by a debugging information entry
277 with the tag \livetarg{chap:DWTAGtypeunit}{DW\-\_TAG\-\_type\-\_unit}.
278 A type unit entry owns debugging
279 information entries that represent the definition of a single
280 type, plus additional debugging information entries that may
281 be necessary to include as part of the definition of the type.
283 A type unit entry may have a \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language} attribute, whose
284 constant value is an integer code indicating the source
285 language used to define the type. The set of language names
286 and their meanings are given in Figure \refersec{fig:languagenames}.
288 A type unit entry for a given type T owns a debugging
289 information entry that represents a defining declaration
290 of type T. If the type is nested within enclosing types or
291 namespaces, the debugging information entry for T is nested
292 within debugging information entries describing its containers;
293 otherwise, T is a direct child of the type unit entry.
295 A type unit entry may also own additional debugging information
296 entries that represent declarations of additional types that
297 are referenced by type T and have not themselves been placed in
298 separate type units. Like T, if an additional type U is nested
299 within enclosing types or namespaces, the debugging information
300 entry for U is nested within entries describing its containers;
301 otherwise, U is a direct child of the type unit entry.
303 The containing entries for types T and U are declarations,
304 and the outermost containing entry for any given type T or
305 U is a direct child of the type unit entry. The containing
306 entries may be shared among the additional types and between
307 T and the additional types.
309 Types are not required to be placed in type units. In general,
310 only large types such as structure, class, enumeration, and
311 union types included from header files should be considered
312 for separate type units. Base types and other small types
313 are not usually worth the overhead of placement in separate
314 type units. Types that are unlikely to be replicated, such
315 as those defined in the main source file, are also better
316 left in the main compilation unit.
318 \section{Module, Namespace and Importing Entries}
319 \textit{Modules and namespaces provide a means to collect related
320 entities into a single entity and to manage the names of
323 \subsection{Module Entries}
324 \label{chap:moduleentries}
325 \textit{Several languages have the concept of a ``module.''
326 A Modula\dash 2 definition module may be represented by a module
327 entry containing a declaration attribute (\livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration}). A
328 Fortran 90 module may also be represented by a module entry
329 (but no declaration attribute is warranted because Fortran
330 has no concept of a corresponding module body).}
332 A module is represented by a debugging information entry
334 tag \livetarg{chap:DWTAGmodule}{DW\-\_TAG\-\_module}.
335 Module entries may own other
336 debugging information entries describing program entities
337 whose declaration scopes end at the end of the module itself.
339 If the module has a name, the module entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
340 attribute whose value is a null\dash terminated string containing
341 the module name as it appears in the source program.
343 The module entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
344 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
345 whose values encode the contiguous or non\dash contiguous address
346 ranges, respectively, of the machine instructions generated for
347 the module initialization code
348 (see Section \refersec{chap:codeaddressesandranges}).
349 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}
351 have a \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute whose value is the address of
352 the first executable instruction of that initialization code
353 (see Section \refersec{chap:entryaddress}).
355 If the module has been assigned a priority, it may have a
356 \livelink{chap:DWATpriority}{DW\-\_AT\-\_priority} attribute. The value of this attribute is a
357 reference to another debugging information entry describing
358 a variable with a constant value. The value of this variable
359 is the actual constant value of the module’s priority,
360 represented as it would be on the target architecture.
362 \subsection{Namespace Entries}
363 \label{chap:namespaceentries}
364 \textit{C++ has the notion of a namespace, which provides a way to
365 implement name hiding, so that names of unrelated things
366 do not accidentally clash in the global namespace when an
367 application is linked together.}
369 A namespace is represented by a debugging information entry
371 tag \livetarg{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace}.
372 A namespace extension is
373 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}
375 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace} entry
377 \livelink{chap:DWATextension}{DW\-\_AT\-\_extension}
378 attribute referring to the previous extension, or if there
379 is no previous extension, to the original
380 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace}
381 entry. A namespace extension entry does not need to duplicate
382 information in a previous extension entry of the namespace
383 nor need it duplicate information in the original namespace
384 entry. (Thus, for a namespace with a name,
385 a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
386 attribute need only be attached directly to the original
387 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace} entry.)
389 Namespace and namespace extension entries may own other
390 debugging information entries describing program entities
391 whose declarations occur in the namespace.
393 \textit{For C++, such owned program entities may be declarations,
394 including certain declarations that are also object or
395 function definitions.}
397 If a type, variable, or function declared in a namespace is
398 defined outside of the body of the namespace declaration,
399 that type, variable, or function definition entry has a
400 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to the
401 debugging information entry representing the declaration of
402 the type, variable or function. Type, variable, or function
403 entries with a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need
404 to duplicate information provided by the declaration entry
405 referenced by the specification attribute.
407 \textit{The C++ global namespace (the namespace referred to by
408 ``::f'', for example) is not explicitly represented in
409 DWARF with a namespace entry (thus mirroring the situation
410 in C++ source). Global items may be simply declared with no
411 reference to a namespace.}
413 \textit{The C++ compilation unit specific ``unnamed namespace'' may
414 be represented by a namespace entry with no name attribute in
415 the original namespace declaration entry (and therefore no name
416 attribute in any namespace extension entry of this namespace).
419 \textit{A compiler emitting namespace information may choose to
420 explicitly represent namespace extensions, or to represent the
421 final namespace declaration of a compilation unit; this is a
422 quality\dash of\dash implementation issue and no specific requirements
423 are given here. If only the final namespace is represented,
424 it is impossible for a debugger to interpret using declaration
425 references in exactly the manner defined by the C++ language.
428 \textit{Emitting all namespace declaration information in all
429 compilation units can result in a significant increase in the
430 size of the debug information and significant duplication of
431 information across compilation units. The C++ namespace std,
432 for example, is large and will probably be referenced in
433 every C++ compilation unit.
436 \textit{For a C++ namespace example, see Appendix \refersec{app:namespaceexample}.
441 \subsection{Imported (or Renamed) Declaration Entries}
442 \label{chap:importedorrenameddeclarationentries}
443 \textit{Some languages support the concept of importing into or making
444 accessible in a given unit declarations made in a different
445 module or scope. An imported declaration may sometimes be
449 An imported declaration is represented by one or
450 more debugging information entries with the
451 tag \livetarg{chap:DWTAGimporteddeclaration}{DW\-\_TAG\-\_imported\-\_declaration}.
452 When an overloaded entity
453 is imported, there is one imported declaration entry for
454 each overloading. Each imported declaration entry has a
455 \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute, whose value is a reference to the
456 debugging information entry representing the declaration that
459 An imported declaration may also have a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute
460 whose value is a null\dash terminated string containing the
461 name, as it appears in the source program, by which the
462 imported entity is to be known in the context of the imported
463 declaration entry (which may be different than the name of
464 the entity being imported). If no name is present, then the
465 name by which the entity is to be known is the same as the
466 name of the entity being imported.
468 An imported declaration entry with a name attribute may be
469 used as a general means to rename or provide an alias for
470 an entity, regardless of the context in which the importing
471 declaration or the imported entity occurs.
473 \textit{A C++ namespace alias may be represented by an imported
474 declaration entry with a name attribute whose value is
475 a null\dash terminated string containing the alias name as it
476 appears in the source program and an import attribute whose
477 value is a reference to the applicable original namespace or
478 namespace extension entry.
481 \textit{A C++ using declaration may be represented by one or more
482 imported declaration entries. When the using declaration
483 refers to an overloaded function, there is one imported
484 declaration entry corresponding to each overloading. Each
485 imported declaration entry has no name attribute but it does
486 have an import attribute that refers to the entry for the
487 entity being imported. (C++ provides no means to ``rename''
488 an imported entity, other than a namespace).
491 \textit{A Fortran use statement with an ``only list'' may be
492 represented by a series of imported declaration entries,
493 one (or more) for each entity that is imported. An entity
494 that is renamed in the importing context may be represented
495 by an imported declaration entry with a name attribute that
496 specifies the new local name.
499 \subsection{Imported Module Entries}
500 \label{chap:importedmoduleentries}
502 \textit{Some languages support the concept of importing into or making
503 accessible in a given unit all of the declarations contained
504 within a separate module or namespace.
507 An imported module declaration is represented by a debugging
508 information entry with the
509 tag \livetarg{chap:DWTAGimportedmodule}{DW\-\_TAG\-\_imported\-\_module}.
511 imported module entry contains a \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute
512 whose value is a reference to the module or namespace entry
513 containing the definition and/or declaration entries for
514 the entities that are to be imported into the context of the
515 imported module entry.
517 An imported module declaration may own a set of imported
518 declaration entries, each of which refers to an entry in the
519 module whose corresponding entity is to be known in the context
520 of the imported module declaration by a name other than its
521 name in that module. Any entity in the module that is not
522 renamed in this way is known in the context of the imported
523 module entry by the same name as it is declared in the module.
525 \textit{A C++ using directive may be represented by an imported module
526 entry, with an import attribute referring to the namespace
527 entry of the appropriate extension of the namespace (which
528 might be the original namespace entry) and no owned entries.
531 \textit{A Fortran use statement with a “rename list” may be
532 represented by an imported module entry with an import
533 attribute referring to the module and owned entries
534 corresponding to those entities that are renamed as part of
538 \textit{A Fortran use statement with neither a “rename list” nor
539 an “only list” may be represented by an imported module
540 entry with an import attribute referring to the module and
541 no owned child entries.
544 \textit{A use statement with an “only list” is represented by a
545 series of individual imported declaration entries as described
546 in Section \refersec{chap:importedorrenameddeclarationentries}.
549 \textit{A Fortran use statement for an entity in a module that is
550 itself imported by a use statement without an explicit mention
551 may be represented by an imported declaration entry that refers
552 to the original debugging information entry. For example, given
568 the imported declaration entry for Q within module C refers
569 directly to the variable declaration entry for A in module A
570 because there is no explicit representation for X in module B.
572 A similar situation arises for a C++ using declaration that
573 imports an entity in terms of a namespace alias. See
574 Appendix \refersec{app:namespaceexample}
578 \section{Subroutine and Entry Point Entries}
579 \label{chap:subroutineandentrypointentries}
581 The following tags exist to describe debugging information entries for subroutines and entry
584 \begin{tabular}{lp{9.0cm}}
585 \livetarg{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} & A subroutine or function. \\
586 \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine} & A particular inlined
587 instance of a subroutine or function. \\
588 \livetarg{chap:DWTAGentrypoint}{DW\-\_TAG\-\_entry\-\_point} & An alternate entry point. \\
591 \subsection{General Subroutine and Entry Point Information}
592 \label{chap:generalsubroutineandentrypointinformation}
594 It may also have a \livelink{chap:DWATlinkagename}{DW\-\_AT\-\_linkage\-\_name} attribute as
595 described in Section \refersec{chap:linkagenames}.
597 If the name of the subroutine described by an entry with the
598 tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}
599 is visible outside of its containing
600 \hypertarget{chap:DWATexternalexternalsubroutine}
601 compilation unit, that entry has a
602 \livelink{chap:DWATexternal}{DW\-\_AT\-\_external} attribute,
603 which is a \livelink{chap:flag}{flag}.
605 \textit{Additional attributes for functions that are members of a
606 class or structure are described in
607 Section \refersec{chap:memberfunctionentries}.
611 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}
612 subroutine entry may contain a \livelink{chap:DWATmainsubprogram}{DW\-\_AT\-\_main\-\_subprogram}
614 a \livelink{chap:flag}{flag} whose presence indicates that the
615 subroutine has been identified as the starting function of
616 the program. If more than one subprogram contains this
618 any one of them may be the starting subroutine of the program.
620 \textit{Fortran has a PROGRAM statement which is used to specify
621 and provide a user\dash supplied name for the main subroutine of
625 \textit{A common debugger feature is to allow the debugger user to call
626 a subroutine within the subject program. In certain cases,
627 however, the generated code for a subroutine will not obey
628 the standard calling conventions for the target architecture
629 and will therefore not be safe to call from within a debugger.
632 A subroutine entry may
633 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}
635 \livelink{chap:DWATcallingconvention}{DW\-\_AT\-\_calling\-\_convention}
636 attribute, whose value is an integer constant. The set of
637 calling convention codes is given in
638 Figure \refersec{fig:callingconventioncodes}.
641 \autorows[0pt]{c}{1}{l}{
642 \addtoindex{DW\-\_CC\-\_normal},
643 \addtoindex{DW\-\_CC\-\_program},
644 \addtoindex{DW\-\_CC\-\_nocall},
646 \caption{Calling convention codes}\label{fig:callingconventioncodes}
649 If this attribute is not present, or its value is the constant
650 \livetarg{chap:DWCCnormal}{DW\-\_CC\-\_normal}, then the subroutine may be safely called by
651 obeying the ``standard'' calling conventions of the target
652 architecture. If the value of the calling convention attribute
653 is the constant \livetarg{chap:DWCCnocall}{DW\-\_CC\-\_nocall}, the subroutine does not obey
654 standard calling conventions, and it may not be safe for the
655 debugger to call this subroutine.
657 If the semantics of the language of the compilation unit
658 containing the subroutine entry distinguishes between ordinary
659 subroutines and subroutines that can serve as the ``main
660 program,'' that is, subroutines that cannot be called
661 directly according to the ordinary calling conventions,
662 then the debugging information entry for such a subroutine
663 may have a calling convention attribute whose value is the
664 constant \livetarg{chap:DWCCprogram}{DW\-\_CC\-\_program}.
666 \textit{The \livelink{chap:DWCCprogram}{DW\-\_CC\-\_program} value is intended to support Fortran main
667 programs which in some implementations may not be callable
668 or which must be invoked in a special way. It is not intended
669 as a way of finding the entry address for the program.
672 \textit{In C there is a difference between the types of functions
673 declared using function prototype style declarations and
674 those declared using non\dash prototype declarations.
677 A subroutine entry declared with a function prototype style
678 declaration may have a
679 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
680 a \livelink{chap:flag}{flag}.
682 \textit{The Fortran language allows the keywords elemental, pure
683 and recursive to be included as part of the declaration of
684 a subroutine; these attributes reflect that usage. These
685 attributes are not relevant for languages that do not support
686 similar keywords or syntax. In particular, the \livelink{chap:DWATrecursive}{DW\-\_AT\-\_recursive}
687 attribute is neither needed nor appropriate in languages such
688 as C where functions support recursion by default.
692 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}
694 \livelink{chap:DWATelemental}{DW\-\_AT\-\_elemental} attribute, which
695 is a \livelink{chap:flag}{flag}.
696 The attribute indicates whether the subroutine
697 or entry point was declared with the ``elemental'' keyword
700 A subprogram entry may have a \livelink{chap:DWATpure}{DW\-\_AT\-\_pure} attribute, which is
701 a \livelink{chap:flag}{flag}.
702 The attribute indicates whether the subroutine was
703 declared with the ``pure'' keyword or property.
705 A subprogram entry may have a \livelink{chap:DWATrecursive}{DW\-\_AT\-\_recursive} attribute, which
706 is a \livelink{chap:flag}{flag}.
707 The attribute indicates whether the subroutine
708 or entry point was declared with the ``recursive'' keyword
713 \subsection{Subroutine and Entry Point Return Types}
714 \label{chap:subroutineandentrypointreturntypes}
716 If the subroutine or entry point is a function that returns a
717 value, then its debugging information entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
718 attribute to denote the type returned by that function.
720 \textit{Debugging information entries for C void functions should
721 not have an attribute for the return type. }
724 \subsection{Subroutine and Entry Point Locations}
725 \label{chap:subroutineandentrypointlocations}
727 A subroutine entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
728 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
729 whose values encode the contiguous or non\dash contiguous address
730 ranges, respectively, of the machine instructions generated
731 for the subroutine (see
732 Section \refersec{chap:codeaddressesandranges}).
735 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}
736 subroutine entry may also have a
737 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute
738 whose value is the address of the first executable instruction
739 of the subroutine (see
740 Section \refersec{chap:entryaddress}).
742 An entry point has a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute whose value is the
743 relocated address of the first machine instruction generated
746 \textit{While the \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute might also seem appropriate
747 for this purpose, historically the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute
748 was used before the \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} was introduced (in DWARF
749 Version 3). There is insufficient reason to change this.}
752 Subroutines and entry points
753 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}
755 \livelink{chap:DWATsegment}{DW\-\_AT\-\_segment}
757 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class} attributes,
758 as appropriate, to specify
759 which segments the code for the subroutine resides in and
760 the addressing mode to be used in calling that subroutine.
762 A subroutine entry representing a subroutine declaration
763 that is not also a definition does not have code address or
767 \subsection{Declarations Owned by Subroutines and Entry Points}
768 \label{chap:declarationsownedbysubroutinesandentrypoints}
770 The declarations enclosed by a subroutine or entry point are
771 represented by debugging information entries that are owned
772 by the subroutine or entry point entry. Entries representing
773 the formal parameters of the subroutine or entry point appear
774 in the same order as the corresponding declarations in the
777 \textit{There is no ordering requirement for entries for declarations
778 that are children of subroutine or entry point entries but
779 that do not represent formal parameters. The formal parameter
780 entries may be interspersed with other entries used by formal
781 parameter entries, such as type entries.}
783 The unspecified parameters of a variable parameter list are
784 represented by a debugging information entry with the tag
785 \livetarg{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
787 The entry for a subroutine that includes a
788 Fortran \livelink{chap:fortrancommonblock}{common} \livelink{chap:commonblockentry}{block}
789 \index{common block|see{Fortran common block}}
790 has a child entry with the
791 tag \livetarg{chap:DWTAGcommoninclusion}{DW\-\_TAG\-\_common\-\_inclusion}.
793 \hypertarget{chap:commonreferencecommonblockusage}
794 common inclusion entry has a
795 \livelink{chap:DWATcommonreference}{DW\-\_AT\-\_common\-\_reference} attribute
796 whose value is a reference to the debugging information entry
797 for the common \nolink{block} being included
798 (see Section \refersec{chap:commonblockentries}).
800 \subsection{Low-Level Information}
801 \label{chap:lowlevelinformation}
803 A subroutine or entry point entry may have a \livelink{chap:DWATreturnaddr}{DW\-\_AT\-\_return\-\_addr}
804 attribute, whose value is a location description. The location
805 calculated is the place where the return address for the
806 subroutine or entry point is stored.
808 A subroutine or entry point entry may also have a
809 \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute, whose value is a location
810 description that computes the “frame base” for the
811 subroutine or entry point. If the location description is
812 a simple register location description, the given register
813 contains the frame base address. If the location description is
814 a DWARF expression, the result of evaluating that expression
815 is the frame base address. Finally, for a location list,
816 this interpretation applies to each location description
817 contained in the list of location list entries.
819 \textit{The use of one of the \livelink{chap:DWOPreg}{DW\-\_OP\-\_reg}~\textless~n~\textgreater
821 context is equivalent to using
822 \livelink{chap:DWOPbreg}{DW\-\_OP\-\_breg}~\textless~n~\textgreater(0)
824 compact. However, these are not equivalent in general.}
826 \textit{The frame base for a procedure is typically an address fixed
827 relative to the first unit of storage allocated for the
828 procedure’s stack frame. The \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute
829 can be used in several ways:}
831 \begin{enumerate}[1.]
832 \item \textit{In procedures that need location lists to locate local
833 variables, the \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} can hold the needed location
834 list, while all variables’ location descriptions can be
835 simpler ones involving the frame base.}
837 \item \textit{It can be used in resolving ``up\dash level'' addressing
838 within nested routines.
839 (See also \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link}, below)}
840 %The -See also- here is ok, the DW\-\_AT should be
841 %a hyperref to the def itself, which is earlier in this document.
844 \textit{Some languages support nested subroutines. In such languages,
845 it is possible to reference the local variables of an
846 outer subroutine from within an inner subroutine. The
847 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} and \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attributes allow
848 debuggers to support this same kind of referencing.}
850 If a subroutine or entry point is nested, it may have a
851 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} attribute, whose value is a location
852 description that computes the frame base of the relevant
853 instance of the subroutine that immediately encloses the
854 subroutine or entry point.
856 In the context of supporting nested subroutines, the
857 \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute value should obey the following
860 \begin{enumerate}[1.]
861 \item It should compute a value that does not change during the
862 life of the procedure, and
864 \item The computed value should be unique among instances of
865 the same subroutine. (For typical \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} use, this
866 means that a recursive subroutine’s stack frame must have
870 \textit{If a debugger is attempting to resolve an up\dash level reference
871 to a variable, it uses the nesting structure of DWARF to
872 determine which subroutine is the lexical parent and the
873 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} value to identify the appropriate active
874 frame of the parent. It can then attempt to find the reference
875 within the context of the parent.}
879 \subsection{Types Thrown by Exceptions}
880 \label{chap:typesthrownbyexceptions}
882 \textit{In C++ a subroutine may declare a set of types which
883 it may validly throw.}
885 If a subroutine explicitly declares that it may throw
886 an exception for one or more types, each such type is
887 represented by a debugging information entry with the tag
888 \livetarg{chap:DWTAGthrowntype}{DW\-\_TAG\-\_thrown\-\_type}.
889 Each such entry is a child of the entry
890 representing the subroutine that may throw this type. Each
891 thrown type entry contains a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, whose
892 value is a reference to an entry describing the type of the
893 exception that may be thrown.
895 \subsection{Function Template Instantiations}
896 \label{chap:functiontemplateinstantiations}
898 \textit{In C++, a function template is a generic definition of
899 a function that is instantiated differently when called with
900 values of different types. DWARF does not represent the generic
901 template definition, but does represent each instantiation.}
903 A template instantiation is represented by a debugging
904 information entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. With four
905 exceptions, such an entry will contain the same attributes and
906 will have the same types of child entries as would an entry
907 for a subroutine defined explicitly using the instantiation
908 types. The exceptions are:
910 \begin{enumerate}[1.]
911 \item Each formal parameterized type declaration appearing in the
912 template definition is represented by a debugging information
914 tag \livetarg{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
916 such entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
917 null\dash terminated string containing the name of the formal
918 type parameter as it appears in the source program. The
919 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
920 describing the actual type by which the formal is replaced
921 for this instantiation.
923 \item The subprogram entry and each of its child entries reference
924 a template type parameter entry in any circumstance where
925 the template definition referenced a formal parameterized type.
927 \item If the compiler has generated a special compilation unit
928 to hold the template instantiation and that compilation unit
929 has a different name from the compilation unit containing
930 the template definition, the name attribute for the debugging
931 information entry representing that compilation unit is empty
934 \item If the subprogram entry representing the template
935 instantiation or any of its child entries contain declaration
936 coordinate attributes, those attributes refer to the source
937 for the template definition, not to any source generated
938 artificially by the compiler for this instantiation.
943 \subsection{Inlinable and Inlined Subroutines}
944 A declaration or a definition of an inlinable subroutine
945 is represented by a debugging information entry with the
946 tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. The entry for a subroutine that is
947 explicitly declared to be available for inline expansion or
948 that was expanded inline implicitly by the compiler has a
949 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is an integer constant. The
950 set of values for the \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute is given in
951 Figure \refersec{fig:inlinecodes}.
955 \caption{Inline codes}
956 \label{fig:inlinecodes}
957 \begin{tabular}{lp{9cm}}
958 Name&Meaning\\ \hline
959 \livetarg{chap:DWINLnotinlined}{DW\-\_INL\-\_not\-\_inlined} & Not delared inline nor inlined by the
960 compiler(equivalent to the absense of the containing
961 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute) \\
962 \livetarg{chap:DWINLinlined}{DW\-\_INL\-\_inlined} & Not declared inline but inlined by the compiler \\
963 \livetarg{chap:DWINLdeclarednotinlined}{DW\-\_INL\-\_declared\-\_not\-\_inlined} & Declared inline but
964 not inlined by the compiler \\
965 \livetarg{chap:DWINLdeclaredinlined}{DW\-\_INL\-\_declared\-\_inlined} & Declared inline and inlined by the compiler \\
969 \textit{In C++, a function or a constructor declared with
970 constexpr is implicitly declared inline. The abstract inline
971 instance (see below) is represented by a debugging information
972 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. Such an entry has a
973 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is \livelink{chap:DWINLinlined}{DW\-\_INL\-\_inlined}.}
976 \paragraph{Abstract Instances}
977 \label{chap:abstractinstances}
978 Any debugging information entry that is owned (either
979 directly or indirectly) by a debugging information entry
980 that contains the \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute is referred to
981 as an ``abstract instance entry.'' Any subroutine entry
982 that contains a \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is other
983 than \livelink{chap:DWINLnotinlined}{DW\-\_INL\-\_not\-\_inlined} is known as
984 an ``abstract instance root.''
985 Any set of abstract instance entries that are all
986 children (either directly or indirectly) of some abstract
987 instance root, together with the root itself, is known as
988 an ``abstract instance tree.'' However, in the case where
989 an abstract instance tree is nested within another abstract
990 instance tree, the entries in the nested abstract instance
991 tree are not considered to be entries in the outer abstract
994 Each abstract instance root is either part of a larger
995 tree (which gives a context for the root) or uses
996 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} to refer to the declaration in context.
998 \textit{For example, in C++ the context might be a namespace
999 declaration or a class declaration.}
1001 \textit{Abstract instance trees are defined so that no entry is part
1002 of more than one abstract instance tree. This simplifies the
1003 following descriptions.}
1005 A debugging information entry that is a member of an abstract
1006 instance tree should not contain any attributes which describe
1007 aspects of the subroutine which vary between distinct inlined
1008 expansions or distinct out\dash of\dash line expansions. For example,
1009 the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc},
1010 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc}, \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges},
1011 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc}, \livelink{chap:DWATlocation}{DW\-\_AT\-\_location},
1012 \livelink{chap:DWATreturnaddr}{DW\-\_AT\-\_return\-\_addr}, \livelink{chap:DWATstartscope}{DW\-\_AT\-\_start\-\_scope}, and
1013 \livelink{chap:DWATsegment}{DW\-\_AT\-\_segment}
1014 attributes typically should be omitted; however, this list
1017 \textit{It would not make sense normally to put these attributes into
1018 abstract instance entries since such entries do not represent
1019 actual (concrete) instances and thus do not actually exist at
1020 run\dash time. However,
1021 see Appendix \refersec{app:inlineouteronenormalinner}
1022 for a contrary example.}
1024 The rules for the relative location of entries belonging to
1025 abstract instance trees are exactly the same as for other
1026 similar types of entries that are not abstract. Specifically,
1027 the rule that requires that an entry representing a declaration
1028 be a direct child of the entry representing the scope of the
1029 declaration applies equally to both abstract and non\dash abstract
1030 entries. Also, the ordering rules for formal parameter entries,
1031 member entries, and so on, all apply regardless of whether
1032 or not a given entry is abstract.
1034 \paragraph{Concrete Inlined Instances}
1035 \label{chap:concreteinlinedinstances}
1037 Each inline expansion of a subroutine is represented
1038 by a debugging information entry with the
1039 tag \livetarg{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}.
1040 Each such entry should be a direct
1041 child of the entry that represents the scope within which
1042 the inlining occurs.
1044 Each inlined subroutine entry may have either a
1045 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc}
1046 and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges}
1047 attribute whose values encode the contiguous or non\dash contiguous
1048 address ranges, respectively, of the machine instructions
1049 generated for the inlined subroutine (see
1050 Section \refersec{chap:codeaddressesandranges}).
1052 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}
1053 inlined subroutine entry may also contain a
1054 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc}
1055 attribute, representing the first executable instruction of
1056 the inline expansion (see
1057 Section \refersec{chap:entryaddress}).
1059 % Positions of the 3 targets here is a bit arbitrary.
1061 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}
1063 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}
1065 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}
1066 may also have \livelink{chap:DWATcallfile}{DW\-\_AT\-\_call\-\_file},
1067 \livelink{chap:DWATcallline}{DW\-\_AT\-\_call\-\_line} and \livelink{chap:DWATcallcolumn}{DW\-\_AT\-\_call\-\_column} attributes,
1069 value is an integer constant. These attributes represent the
1070 source file, source line number, and source column number,
1071 respectively, of the first character of the statement or
1072 expression that caused the inline expansion. The call file,
1073 call line, and call column attributes are interpreted in
1074 the same way as the declaration file, declaration line, and
1075 declaration column attributes, respectively (see
1076 Section \refersec{chap:declarationcoordinates}).
1078 The call file, call line and call column coordinates do not
1079 describe the coordinates of the subroutine declaration that
1080 was inlined, rather they describe the coordinates of the call.
1082 An inlined subroutine entry
1083 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}
1085 \livelink{chap:DWATconstexpr}{DW\-\_AT\-\_const\-\_expr}
1086 attribute, which is a \livelink{chap:flag}{flag}
1087 whose presence indicates that the
1088 subroutine has been evaluated as a compile\dash time constant. Such
1089 an entry may also have a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1090 whose value may be of any form that is appropriate for the
1091 representation of the subroutine's return value. The value of
1092 this attribute is the actual return value of the subroutine,
1093 represented as it would be on the target architecture.
1095 \textit{In C++, if a function or a constructor declared with constexpr
1096 is called with constant expressions, then the corresponding
1097 concrete inlined instance has a \livelink{chap:DWATconstexpr}{DW\-\_AT\-\_const\-\_expr} attribute,
1098 as well as a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute whose value represents
1099 the actual return value of the concrete inlined instance.}
1101 Any debugging information entry that is owned (either
1102 directly or indirectly) by a debugging information entry
1103 with the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine} is referred to as a
1104 ``concrete inlined instance entry.'' Any entry that has
1105 the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}
1106 is known as a ``concrete inlined instance root.'' Any set of concrete inlined instance
1107 entries that are all children (either directly or indirectly)
1108 of some concrete inlined instance root, together with the root
1109 itself, is known as a ``concrete inlined instance tree.''
1110 However, in the case where a concrete inlined instance tree
1111 is nested within another concrete instance tree, the entries
1112 in the nested concrete instance tree are not considered to
1113 be entries in the outer concrete instance tree.
1115 \textit{Concrete inlined instance trees are defined so that no entry
1116 is part of more than one concrete inlined instance tree. This
1117 simplifies later descriptions.}
1119 Each concrete inlined instance tree is uniquely associated
1120 with one (and only one) abstract instance tree.
1122 \textit{Note, however, that the reverse is not true. Any given abstract
1123 instance tree may be associated with several different concrete
1124 inlined instance trees, or may even be associated with zero
1125 concrete inlined instance trees.}
1127 Concrete inlined instance entries may omit attributes that
1128 are not specific to the concrete instance (but present in
1129 the abstract instance) and need include only attributes that
1130 are specific to the concrete instance (but omitted in the
1131 abstract instance). In place of these omitted attributes, each
1132 \hypertarget{chap:DWATabstractorigininlineinstance}
1133 concrete inlined instance entry
1135 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin}
1136 attribute that may be used to obtain the missing information
1137 (indirectly) from the associated abstract instance entry. The
1138 value of the abstract origin attribute is a reference to the
1139 associated abstract instance entry.
1141 If an entry within a concrete inlined instance tree contains
1142 attributes describing the declaration coordinates of that
1143 entry, then those attributes should refer to the file, line
1144 and column of the original declaration of the subroutine,
1145 not to the point at which it was inlined. As a consequence,
1146 they may usually be omitted from any entry that has an abstract
1149 For each pair of entries that are associated via a
1150 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attribute, both members of the pair
1151 have the same tag. So, for example, an entry with the tag
1152 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable} can only be associated with another entry
1153 that also has the tag \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}. The only exception
1154 to this rule is that the root of a concrete instance tree
1155 (which must always have the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine})
1156 can only be associated with the root of its associated abstract
1157 instance tree (which must have the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}).
1159 In general, the structure and content of any given concrete
1160 inlined instance tree will be closely analogous to the
1161 structure and content of its associated abstract instance
1162 tree. There are a few exceptions:
1164 \begin{enumerate}[1.]
1165 \item An entry in the concrete instance tree may be omitted if
1166 it contains only a \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attribute and either
1167 has no children, or its children are omitted. Such entries
1168 would provide no useful information. In C\dash like languages,
1169 such entries frequently include types, including structure,
1170 union, class, and interface types; and members of types. If any
1171 entry within a concrete inlined instance tree needs to refer
1172 to an entity declared within the scope of the relevant inlined
1173 subroutine and for which no concrete instance entry exists,
1174 the reference should refer to the abstract instance entry.
1176 \item Entries in the concrete instance tree which are associated
1177 with entries in the abstract instance tree such that neither
1178 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, and neither is referenced by
1179 any other debugging information entry, may be omitted. This
1180 may happen for debugging information entries in the abstract
1181 instance trees that became unnecessary in the concrete instance
1182 tree because of additional information available there. For
1183 example, an anonymous variable might have been created and
1184 described in the abstract instance tree, but because of
1185 the actual parameters for a particular inlined expansion,
1186 it could be described as a constant value without the need
1187 for that separate debugging information entry.
1189 \item A concrete instance tree may contain entries which do
1190 not correspond to entries in the abstract instance tree
1191 to describe new entities that are specific to a particular
1192 inlined expansion. In that case, they will not have associated
1193 entries in the abstract instance tree, should not contain
1194 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attributes, and must contain all their
1195 own attributes directly. This allows an abstract instance tree
1196 to omit debugging information entries for anonymous entities
1197 that are unlikely to be needed in most inlined expansions. In
1198 any expansion which deviates from that expectation, the
1199 entries can be described in its concrete inlined instance tree.
1203 \paragraph{Out-of-Line Instances of Inlined Subroutines}
1204 \label{chap:outoflineinstancesofinlinedsubroutines}
1205 Under some conditions, compilers may need to generate concrete
1206 executable instances of inlined subroutines other than at
1207 points where those subroutines are actually called. Such
1208 concrete instances of inlined subroutines are referred to as
1209 ``concrete out\dash of\dash line instances.''
1211 \textit{In C++, for example, taking the address of a function declared
1212 to be inline can necessitate the generation of a concrete
1213 out\dash of\dash line instance of the given function.}
1215 The DWARF representation of a concrete out\dash of\dash line instance
1216 of an inlined subroutine is essentially the same as for a
1217 concrete inlined instance of that subroutine (as described in
1218 the preceding section). The representation of such a concrete
1219 % It is critical that the hypertarget and livelink be
1220 % separated to avoid problems with latex.
1221 out\dash of\dash line instance
1222 \hypertarget{chap:DWATabstractoriginoutoflineinstance}
1224 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin}
1225 attributes in exactly the same way as they are used for
1226 a concrete inlined instance (that is, as references to
1227 corresponding entries within the associated abstract instance
1230 The differences between the DWARF representation of a
1231 concrete out\dash of\dash line instance of a given subroutine and the
1232 representation of a concrete inlined instance of that same
1233 subroutine are as follows:
1235 \begin{enumerate}[1.]
1236 \item The root entry for a concrete out\dash of\dash line instance
1237 of a given inlined subroutine has the same tag as does its
1238 associated (abstract) inlined subroutine entry (that is, tag
1239 \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} rather than \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}).
1241 \item The root entry for a concrete out\dash of\dash line instance tree
1242 is normally owned by the same parent entry that also owns
1243 the root entry of the associated abstract instance. However,
1244 it is not required that the abstract and out\dash of\dash line instance
1245 trees be owned by the same parent entry.
1249 \paragraph{Nested Inlined Subroutines}
1250 \label{nestedinlinedsubroutines}
1251 Some languages and compilers may permit the logical nesting of
1252 a subroutine within another subroutine, and may permit either
1253 the outer or the nested subroutine, or both, to be inlined.
1255 For a non\dash inlined subroutine nested within an inlined
1256 subroutine, the nested subroutine is described normally in
1257 both the abstract and concrete inlined instance trees for
1258 the outer subroutine. All rules pertaining to the abstract
1259 and concrete instance trees for the outer subroutine apply
1260 also to the abstract and concrete instance entries for the
1263 For an inlined subroutine nested within another inlined
1264 subroutine, the following rules apply to their abstract and
1265 concrete instance trees:
1267 \begin{enumerate}[1.]
1268 \item The abstract instance tree for the nested subroutine is
1269 described within the abstract instance tree for the outer
1270 subroutine according to the rules in
1271 Section \refersec{chap:abstractinstances}, and
1272 without regard to the fact that it is within an outer abstract
1275 \item Any abstract instance tree for a nested subroutine is
1276 always omitted within the concrete instance tree for an
1279 \item A concrete instance tree for a nested subroutine is
1280 always omitted within the abstract instance tree for an
1283 \item The concrete instance tree for any inlined or out-of-line
1284 expansion of the nested subroutine is described within a
1285 concrete instance tree for the outer subroutine according
1287 Sections \refersec{chap:concreteinlinedinstances} or
1288 \refersec{chap:outoflineinstancesofinlinedsubroutines}
1290 and without regard to the fact that it is within an outer
1291 concrete instance tree.
1294 See Appendix \refersec{app:inliningexamples}
1295 for discussion and examples.
1297 \subsection{Trampolines}
1298 \label{chap:trampolines}
1300 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1301 an intermediary in making a call to another subroutine. It may
1302 adjust parameters and/or the result (if any) as appropriate
1303 to the combined calling and called execution contexts.}
1305 A trampoline is represented by a debugging information entry
1306 with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} or \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}
1307 that has a \livelink{chap:DWATtrampoline}{DW\-\_AT\-\_trampoline} attribute. The value of that
1308 attribute indicates the target subroutine of the trampoline,
1309 that is, the subroutine to which the trampoline passes
1310 control. (A trampoline entry may but need not also have a
1311 \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute.)
1313 The value of the trampoline attribute may be represented
1314 using any of the following forms, which are listed in order
1318 \item If the value is of class reference, then the value
1319 specifies the debugging information entry of the target
1322 \item If the value is of class address, then the value is
1323 the relocated address of the target subprogram.
1325 \item If the value is of class string, then the value is the
1326 (possibly mangled) name of the target subprogram.
1328 \item If the value is of class \livelink{chap:flag}{flag}, then the value true
1329 indicates that the containing subroutine is a trampoline but
1330 that the target subroutine is not known.
1334 The target subprogram may itself be a trampoline. (A sequence
1335 of trampolines necessarily ends with a non\dash trampoline
1338 \textit{In C++, trampolines may be used to implement derived virtual
1339 member functions; such trampolines typically adjust the
1340 implicit this pointer parameter in the course of passing
1341 control. Other languages and environments may use trampolines
1342 in a manner sometimes known as transfer functions or transfer
1345 \textit{Trampolines may sometimes pass control to the target
1346 subprogram using a branch or jump instruction instead of a
1347 call instruction, thereby leaving no trace of their existence
1348 in the subsequent execution context. }
1350 \textit{This attribute helps make it feasible for a debugger to arrange
1351 that stepping into a trampoline or setting a breakpoint in
1352 a trampoline will result in stepping into or setting the
1353 breakpoint in the target subroutine instead. This helps to
1354 hide the compiler generated subprogram from the user. }
1356 \textit{If the target subroutine is not known, a debugger may choose
1357 to repeatedly step until control arrives in a new subroutine
1358 which can be assumed to be the target subroutine. }
1362 \section{Lexical Block Entries}
1363 \label{chap:lexicalblockentries}
1365 \textit{A lexical \livetargi{chap:lexicalblock}{block}{lexical block} is a bracketed sequence of source statements
1366 that may contain any number of declarations. In some languages
1367 (including C and C++), \nolink{blocks} can be nested within other
1368 \nolink{blocks} to any depth.}
1370 % We do not need to link to the preceeding paragraph.
1371 A lexical \nolink{block} is represented by a debugging information
1373 tag \livetarg{chap:DWTAGlexicalblock}{DW\-\_TAG\-\_lexical\-\_block}.
1375 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry} entry
1377 either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
1378 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of
1379 attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
1380 whose values encode the contiguous or non-contiguous address
1381 ranges, respectively, of the machine instructions generated
1382 for the lexical \livelink{chap:lexicalblock}{block}
1383 (see Section \refersec{chap:codeaddressesandranges}).
1385 If a name has been given to the
1386 lexical \livelink{chap:lexicalblock}{block}
1388 program, then the corresponding
1389 lexical \livelink{chap:lexicalblockentry}{block} entry has a
1390 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose
1391 value is a null\dash terminated string
1392 containing the name of the lexical \livelink{chap:lexicalblock}{block}
1396 \textit{This is not the same as a C or C++ label (see below).}
1398 The lexical \livelink{chap:lexicalblockentry}{block} entry owns
1399 debugging information entries that
1400 describe the declarations within that lexical \livelink{chap:lexicalblock}{block}.
1402 one such debugging information entry for each local declaration
1403 of an identifier or inner lexical \livelink{chap:lexicalblock}{block}.
1405 \section{Label Entries}
1406 \label{chap:labelentries}
1408 A label is a way of identifying a source statement. A labeled
1409 statement is usually the target of one or more ``go to''
1412 A label is represented by a debugging information entry with
1414 tag \livetarg{chap:DWTAGlabel}{DW\-\_TAG\-\_label}.
1415 The entry for a label should be owned by
1416 the debugging information entry representing the scope within
1417 which the name of the label could be legally referenced within
1420 The label entry has a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute whose value
1421 is the relocated address of the first machine instruction
1422 generated for the statement identified by the label in
1423 the source program. The label entry also has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1424 attribute whose value is a null-terminated string containing
1425 the name of the label as it appears in the source program.
1428 \section{With Statement Entries}
1429 \label{chap:withstatemententries}
1431 \textit{Both Pascal and Modula\dash 2 support the concept of a ``with''
1432 statement. The with statement specifies a sequence of
1433 executable statements within which the fields of a record
1434 variable may be referenced, unqualified by the name of the
1437 A with statement is represented by a debugging information
1438 entry with the tag \livetarg{chap:DWTAGwithstmt}{DW\-\_TAG\-\_with\-\_stmt}.
1440 A with statement entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
1441 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
1442 whose values encode the contiguous or non\dash contiguous address
1443 ranges, respectively, of the machine instructions generated
1444 for the with statement
1445 (see Section \refersec{chap:codeaddressesandranges}).
1447 The with statement entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, denoting
1448 the type of record whose fields may be referenced without full
1449 qualification within the body of the statement. It also has
1450 a \livelink{chap:DWATlocation}{DW\-\_AT\-\_location} attribute, describing how to find the base
1451 address of the record object referenced within the body of
1454 \section{Try and Catch Block Entries}
1455 \label{chap:tryandcatchblockentries}
1457 \textit{In C++ a lexical \livelink{chap:lexicalblock}{block} may be
1458 designated as a ``catch \nolink{block}.''
1459 A catch \livetargi{chap:catchblock}{block}{catch block} is an
1460 exception handler that handles
1461 exceptions thrown by an immediately
1462 preceding ``try \livelink{chap:tryblock}{block}.''
1463 A catch \livelink{chap:catchblock}{block}
1464 designates the type of the exception that it
1467 A try \livetargi{chap:tryblock}{block}{try block} is represented
1468 by a debugging information entry
1469 with the tag \livetarg{chap:DWTAGtryblock}{DW\-\_TAG\-\_try\-\_block}.
1470 A catch \livelink{chap:catchblock}{block} is represented by
1471 a debugging information entry with
1472 the tag \livetarg{chap:DWTAGcatchblock}{DW\-\_TAG\-\_catch\-\_block}.
1474 % nolink as we have links just above and do not have a combo link for both
1475 Both try and catch \nolink{block} entries may have either a
1476 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a
1477 \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute whose values encode the contiguous
1478 or non\dash contiguous address ranges, respectively, of the
1479 machine instructions generated for the \livelink{chap:lexicalblock}{block}
1481 \refersec{chap:codeaddressesandranges}).
1483 Catch \livelink{chap:catchblock}{block} entries have at
1484 least one child entry, an
1485 entry representing the type of exception accepted by
1486 that catch \livelink{chap:catchblock}{block}.
1487 This child entry has one of the tags
1488 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} or \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters},
1489 and will have the same form as other parameter entries.
1491 The siblings immediately following
1492 a try \livelink{chap:tryblock}{block} entry are its
1493 corresponding catch \livelink{chap:catchblock}{block} entries.