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
73 attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute whose values encode the
74 contiguous or non\dash contiguous address ranges, respectively,
75 of the machine instructions generated for the compilation
76 unit (see Section {chap:codeaddressesandranges}).
77 A \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute may also
78 be specified in combination with \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} to specify the
79 default base address for use in location lists (see Section
80 \refersec{chap:locationlists}) and range lists
81 (see Section \refersec{chap:noncontiguousaddressranges}).
83 \item A \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose value is a null\dash terminated
85 \hypertarget{chap:DWATnamepathnameofcompilationsource}
86 containing the full or relative path name of the primary
87 source file from which the compilation unit was derived.
89 \item A \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language} attribute whose constant value is an
90 \hypertarget{chap:DWATlanguageprogramminglanguage}
91 integer code indicating the source language of the compilation
92 unit. The set of language names and their meanings are given
94 Figure \refersec{fig:languagenames}.
98 \caption{Language names}
99 \label{fig:languagenames}
101 Language name & Meaning\\ \hline
102 \livetarg{chap:DWLANGAda83}{DW\-\_LANG\-\_Ada83} \dag&ISO Ada:1983 \addtoindexx{Ada} \\
103 \livetarg{chap:DWLANGAda95}{DW\-\_LANG\-\_Ada95} \dag&ISO Ada:1995 \addtoindexx{Ada} \\
104 \livetarg{chap:DWLANGC}{DW\-\_LANG\-\_C}&Non-standardized C, such as K\&R \\
105 \livetarg{chap:DWLANGC89}{DW\-\_LANG\-\_C89}&ISO C:1989 \\
106 \livetarg{chap:DWLANGC99}{DW\-\_LANG\-\_C99} & ISO C:1999 \\
107 \livetarg{chap:DWLANGCplusplus}{DW\-\_LANG\-\_C\-\_plus\-\_plus}&ISO C++:1998 \\
108 \livetarg{chap:DWLANGCobol74}{DW\-\_LANG\-\_Cobol74}& ISO Cobol:1974 \\
109 \livetarg{chap:DWLANGCobol85}{DW\-\_LANG\-\_Cobol85} & ISO Cobol:1985 \\
110 \livetarg{chap:DWLANGD}{DW\-\_LANG\-\_D} \dag & D \\
111 \livetarg{chap:DWLANGFortran77}{DW\-\_LANG\-\_Fortran77} &ISO FORTRAN 77\\
112 \livetarg{chap:DWLANGFortran90}{DW\-\_LANG\-\_Fortran90} & ISO Fortran 90\\
113 \livetarg{chap:DWLANGFortran95}{DW\-\_LANG\-\_Fortran95} & ISO Fortran 95\\
114 \livetarg{chap:DWLANGJava}{DW\-\_LANG\-\_Java} & Java\\
115 \livetarg{chap:DWLANGModula2}{DW\-\_LANG\-\_Modula2} & ISO Modula\dash 2:1996\\
116 \livetarg{chap:DWLANGObjC}{DW\-\_LANG\-\_ObjC} & Objective C\\
117 \livetarg{chap:DWLANGObjCplusplus}{DW\-\_LANG\-\_ObjC\-\_plus\-\_plus} & Objective C++\\
118 \livetarg{chap:DWLANGPascal83}{DW\-\_LANG\-\_Pascal83} & ISO Pascal:1983\\
119 \livetarg{chap:DWLANGPLI}{DW\-\_LANG\-\_PLI} \dag & ANSI PL/I:1976\\
120 \livetarg{chap:DWLANGPython}{DW\-\_LANG\-\_Python} \dag & Python\\
121 \livetarg{chap:DWLANGUPC}{DW\-\_LANG\-\_UPC} &Unified Parallel C\\ \hline
122 \dag \ \ Support for these languages is limited.& \\
126 \item A \livelink{chap:DWATstmtlist}{DW\-\_AT\-\_stmt\-\_list} attribute whose value is a section
127 \hypertarget{chap:DWATstmtlistlinenumberinformationforunit}
128 offset to the line number information for this compilation
129 unit. This information is placed in a separate object file
130 section from the debugging information entries themselves. The
131 value of the statement list attribute is the offset in the
132 \addtoindex{.debug\_line} section of the first byte of the line number
133 information for this compilation unit
134 (see Section \refersec{chap:linenumberinformation}).
136 \item A \livelink{chap:DWATmacroinfo}{DW\-\_AT\-\_macro\-\_info} attribute whose value is a section
137 \hypertarget{chap:DWATmacroinfomacroinformation}
138 offset to the macro information for this compilation unit.
139 This information is placed in a separate object file section
140 from the debugging information entries themselves. The
141 value of the macro information attribute is the offset in
142 the \addtoindex{.debug\_macinfo} section of the first byte of the macro
143 information for this compilation unit
144 (see Section \refersec{chap:macroinformation}).
147 \livelink{chap:DWATcompdir}{DW\-\_AT\-\_comp\-\_dir}
149 \hypertarget{chap:DWATcompdircompilationdirectory}
151 null\dash terminated string containing the current working directory
152 of the compilation command that produced this compilation
153 unit in whatever form makes sense for the host system.
155 \item A \livelink{chap:DWATproducer}{DW\-\_AT\-\_producer} attribute whose value is a null\dash
156 terminated string containing information about the compiler
157 \hypertarget{chap:DWATproducercompileridentification}
158 that produced the compilation unit. The actual contents of
159 the string will be specific to each producer, but should
160 begin with the name of the compiler vendor or some other
161 identifying character sequence that should avoid confusion
162 with other producer values.
165 \item A \livelink{chap:DWATidentifiercase}{DW\-\_AT\-\_identifier\-\_case}
166 attribute whose integer
167 \hypertarget{chap:DWATidentifiercaseidentifiercaserule}
168 constant value is a code describing the treatment
169 of identifiers within this compilation unit. The
170 set of identifier case codes is given in Figure
171 \refersec{fig:identifiercasecodes}.
174 \autorows[0pt]{c}{1}{l}{
175 \livelink{chap:DWIDcasesensitive}{DW\-\_ID\-\_case\-\_sensitive},
176 \livelink{chap:DWIDupcase}{DW\-\_ID\-\_up\-\_case},
177 \livelink{chap:DWIDdowncase}{DW\-\_ID\-\_down\-\_case},
178 \livelink{chap:DWIDcaseinsensitive}{DW\-\_ID\-\_case\-\_insensitive}
180 \caption{Identifier case codes}\label{fig:identifiercasecodes}
183 \livetarg{chap:DWIDcasesensitive}{DW\-\_ID\-\_case\-\_sensitive} is the default for all compilation units
184 that do not have this attribute. It indicates that names given
185 as the values of \livelink{chap:DWATname}{DW\-\_AT\-\_name} attributes in debugging information
186 entries for the compilation unit reflect the names as they
187 appear in the source program. The debugger should be sensitive
188 to the case of identifier names when doing identifier lookups.
190 \livetarg{chap:DWIDupcase}{DW\-\_ID\-\_up\-\_case} means that the producer of the debugging
191 information for this compilation unit converted all source
192 names to upper case. The values of the name attributes may not
193 reflect the names as they appear in the source program. The
194 debugger should convert all names to upper case when doing
197 \livetarg{chap:DWIDdowncase}{DW\-\_ID\-\_down\-\_case} means that the producer of the debugging
198 information for this compilation unit converted all source
199 names to lower case. The values of the name attributes may not
200 reflect the names as they appear in the source program. The
201 debugger should convert all names to lower case when doing
204 \livetarg{chap:DWIDcaseinsensitive}{DW\-\_ID\-\_case\-\_insensitive} means that the values of the name
205 attributes reflect the names as they appear in the source
206 program but that a case insensitive lookup should be used to
209 \item A \livelink{chap:DWATbasetypes}{DW\-\_AT\-\_base\-\_types} attribute whose value is a reference.
213 \hypertarget{chap:DWATbasetypesprimitivedatatypesofcompilationunit}
215 \addtoindexx{base types attribute}
216 points to a debugging information entry
217 representing another compilation unit. It may be used
218 to specify the compilation unit containing the base type
219 entries used by entries in the current compilation unit
220 (see Section \refersec{chap:basetypeentries}).
222 This attribute provides a consumer a way to find the definition
223 of base types for a compilation unit that does not itself
224 contain such definitions. This allows a consumer, for example,
225 to interpret a type conversion to a base type
226 % getting this link target at the right spot is tricky.
227 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}
230 \item A \livelink{chap:DWATuseUTF8}{DW\-\_AT\-\_use\-\_UTF8} attribute,
231 which is a \livelink{chap:flag}{flag} whose
232 presence indicates that all strings (such as the names of
233 declared entities in the source program) are represented
234 using the UTF\dash 8 representation
235 (see Section \refersec{datarep:attributeencodings}).
238 \item A \livelink{chap:DWATmainsubprogram}{DW\-\_AT\-\_main\-\_subprogram} attribute, which is a \livelink{chap:flag}{flag}
239 whose presence indicates
240 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}
241 that the compilation unit contains a
242 subprogram that has been identified as the starting function
243 of the program. If more than one compilation unit contains
244 this \nolink{flag}, any one of them may contain the starting function.
246 \textit{\addtoindex{Fortran} has a PROGRAM statement which is used
247 to specify and provide a user\dash specified name for the main
248 subroutine of a program.
249 \addtoindex{C} uses the name “main” to identify
250 the main subprogram of a program. Some other languages provide
251 similar or other means to identify the main subprogram of
256 The base address of a compilation unit is defined as the
257 value of the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute, if present; otherwise,
258 it is undefined. If the base address is undefined, then any
259 DWARF entry or structure defined in terms of the base address
260 of that compilation unit is not valid.
263 \subsection{Imported Unit Entries}
264 \label{chap:importedunitentries}
266 \hypertarget{chap:DWATimportimportedunit}
267 place where a normal or partial unit is imported is
268 represented by a debugging information entry with the
269 tag \livetarg{chap:DWTAGimportedunit}{DW\-\_TAG\-\_imported\-\_unit}.
270 An imported unit entry contains a
271 \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute whose value is a reference to the
272 normal or partial compilation unit whose declarations logically
273 belong at the place of the imported unit entry.
275 An imported unit entry does not necessarily correspond to
276 any entity or construct in the source program. It is merely
277 “glue” used to relate a partial unit, or a compilation
278 unit used as a partial unit, to a place in some other
281 \subsection{Separate Type Unit Entries}
282 \label{chap:separatetypeunitentries}
283 An object file may contain any number of separate type
284 unit entries, each representing a single complete type
285 definition. Each type unit must be uniquely identified by
286 a 64\dash bit signature, stored as part of the type unit, which
287 can be used to reference the type definition from debugging
288 information entries in other compilation units and type units.
290 A type unit is represented by a debugging information entry
291 with the tag \livetarg{chap:DWTAGtypeunit}{DW\-\_TAG\-\_type\-\_unit}.
292 A type unit entry owns debugging
293 information entries that represent the definition of a single
294 type, plus additional debugging information entries that may
295 be necessary to include as part of the definition of the type.
297 A type unit entry may have a \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language} attribute, whose
298 constant value is an integer code indicating the source
299 language used to define the type. The set of language names
300 and their meanings are given in Figure \refersec{fig:languagenames}.
302 A type unit entry for a given type T owns a debugging
303 information entry that represents a defining declaration
304 of type T. If the type is nested within enclosing types or
305 namespaces, the debugging information entry for T is nested
306 within debugging information entries describing its containers;
307 otherwise, T is a direct child of the type unit entry.
309 A type unit entry may also own additional debugging information
310 entries that represent declarations of additional types that
311 are referenced by type T and have not themselves been placed in
312 separate type units. Like T, if an additional type U is nested
313 within enclosing types or namespaces, the debugging information
314 entry for U is nested within entries describing its containers;
315 otherwise, U is a direct child of the type unit entry.
317 The containing entries for types T and U are declarations,
318 and the outermost containing entry for any given type T or
319 U is a direct child of the type unit entry. The containing
320 entries may be shared among the additional types and between
321 T and the additional types.
323 Types are not required to be placed in type units. In general,
324 only large types such as structure, class, enumeration, and
325 union types included from header files should be considered
326 for separate type units. Base types and other small types
327 are not usually worth the overhead of placement in separate
328 type units. Types that are unlikely to be replicated, such
329 as those defined in the main source file, are also better
330 left in the main compilation unit.
332 \section{Module, Namespace and Importing Entries}
333 \textit{Modules and namespaces provide a means to collect related
334 entities into a single entity and to manage the names of
337 \subsection{Module Entries}
338 \label{chap:moduleentries}
339 \textit{Several languages have the concept of a ``module.''
340 \addtoindexx{Modula-2}
341 A Modula\dash 2 definition module may be represented by a module
342 entry containing a declaration attribute (\livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration}). A
343 \addtoindex{Fortran 90} module may also be represented by a module entry
344 (but no declaration attribute is warranted because \addtoindex{Fortran}
345 has no concept of a corresponding module body).}
347 A module is represented by a debugging information entry
349 tag \livetarg{chap:DWTAGmodule}{DW\-\_TAG\-\_module}.
350 Module entries may own other
351 debugging information entries describing program entities
352 whose declaration scopes end at the end of the module itself.
354 If the module has a name, the module entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
355 attribute whose value is a null\dash terminated string containing
356 the module name as it appears in the source program.
358 The module entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
359 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
360 whose values encode the contiguous or non\dash contiguous address
361 ranges, respectively, of the machine instructions generated for
362 the module initialization code
363 (see Section \refersec{chap:codeaddressesandranges}).
364 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}
366 have a \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute whose value is the address of
367 the first executable instruction of that initialization code
368 (see Section \refersec{chap:entryaddress}).
371 \hypertarget{chap:DWATprioritymodulepriority}
372 the module has been assigned a priority, it may have a
373 \livelink{chap:DWATpriority}{DW\-\_AT\-\_priority} attribute. The value of this attribute is a
374 reference to another debugging information entry describing
375 a variable with a constant value. The value of this variable
376 is the actual constant value of the module’s priority,
377 represented as it would be on the target architecture.
379 \subsection{Namespace Entries}
380 \label{chap:namespaceentries}
381 \textit{\addtoindex{C++} has the notion of a namespace, which provides a way to
382 implement name hiding, so that names of unrelated things
383 do not accidentally clash in the global namespace when an
384 application is linked together.}
386 A namespace is represented by a debugging information entry
388 tag \livetarg{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace}.
389 A namespace extension is
390 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}
392 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace} entry
394 \livelink{chap:DWATextension}{DW\-\_AT\-\_extension}
395 attribute referring to the previous extension, or if there
396 is no previous extension, to the original
397 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace}
398 entry. A namespace extension entry does not need to duplicate
399 information in a previous extension entry of the namespace
400 nor need it duplicate information in the original namespace
401 entry. (Thus, for a namespace with a name,
402 a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
403 attribute need only be attached directly to the original
404 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace} entry.)
406 Namespace and namespace extension entries may own other
407 debugging information entries describing program entities
408 whose declarations occur in the namespace.
410 \textit{For \addtoindex{C++}, such
411 owned program entities may be declarations,
412 including certain declarations that are also object or
413 function definitions.}
415 If a type, variable, or function declared in a namespace is
416 defined outside of the body of the namespace declaration,
417 that type, variable, or function definition entry has a
418 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to the
419 debugging information entry representing the declaration of
420 the type, variable or function. Type, variable, or function
421 entries with a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need
422 to duplicate information provided by the declaration entry
423 referenced by the specification attribute.
425 \textit{The \addtoindex{C++} global namespace
426 (the namespace referred to by
427 ``::f'', for example) is not explicitly represented in
428 DWARF with a namespace entry (thus mirroring the situation
429 in \addtoindex{C++} source).
430 Global items may be simply declared with no
431 reference to a namespace.}
433 \textit{The \addtoindex{C++}
434 compilation unit specific ``unnamed namespace'' may
435 be represented by a namespace entry with no name attribute in
436 the original namespace declaration entry (and therefore no name
437 attribute in any namespace extension entry of this namespace).
440 \textit{A compiler emitting namespace information may choose to
441 explicitly represent namespace extensions, or to represent the
442 final namespace declaration of a compilation unit; this is a
443 quality\dash of\dash implementation issue and no specific requirements
444 are given here. If only the final namespace is represented,
445 it is impossible for a debugger to interpret using declaration
446 references in exactly the manner defined by the
447 \addtoindex{C++} language.
450 \textit{Emitting all namespace declaration information in all
451 compilation units can result in a significant increase in the
452 size of the debug information and significant duplication of
453 information across compilation units.
454 The \addtoindex{C++} namespace std,
455 for example, is large and will probably be referenced in
456 every \addtoindex{C++} compilation unit.
459 \textit{For a \addtoindex{C++} namespace example,
460 see Appendix \refersec{app:namespaceexample}.
465 \subsection{Imported (or Renamed) Declaration Entries}
466 \label{chap:importedorrenameddeclarationentries}
467 \textit{Some languages support the concept of importing into or making
468 accessible in a given unit declarations made in a different
469 module or scope. An imported declaration may sometimes be
474 imported declaration is represented by one or
475 \addtoindex{imported declaration entry}
476 more debugging information entries with the
477 tag \livetarg{chap:DWTAGimporteddeclaration}{DW\-\_TAG\-\_imported\-\_declaration}.
479 \hypertarget{chap:DWATimportimporteddeclaration}
481 is imported, there is one imported declaration entry for
482 each overloading. Each imported declaration entry has a
483 \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute, whose value is a reference to the
484 debugging information entry representing the declaration that
487 An imported declaration may also have a
488 \livelink{chap:DWATname}{DW\-\_AT\-\_name}
490 whose value is a null\dash terminated string containing the
491 name, as it appears in the source program, by which the
492 imported entity is to be known in the context of the imported
493 declaration entry (which may be different than the name of
494 the entity being imported). If no name is present, then the
495 name by which the entity is to be known is the same as the
496 name of the entity being imported.
498 An imported declaration entry with a name attribute may be
499 used as a general means to rename or provide an alias for
500 \addtoindexx{alias declaration|see{imported declaration entry}}
501 an entity, regardless of the context in which the importing
502 declaration or the imported entity occurs.
504 \textit{A \addtoindex{C++} namespace alias may be represented by an imported
505 \hypertarget{chap:DWATimportnamespacealias}
506 declaration entry with a name attribute whose value is
507 a null\dash terminated string containing the alias name as it
508 appears in the source program and an import attribute whose
509 value is a reference to the applicable original namespace or
510 namespace extension entry.
513 \textit{A \addtoindex{C++} using declaration may be represented by one or more
514 \hypertarget{chap:DWATimportnamespaceusingdeclaration}
515 imported declaration entries. When the using declaration
516 refers to an overloaded function, there is one imported
517 declaration entry corresponding to each overloading. Each
518 imported declaration entry has no name attribute but it does
519 have an import attribute that refers to the entry for the
520 entity being imported. (\addtoindex{C++}
521 provides no means to ``rename''
522 an imported entity, other than a namespace).
525 \textit{A \addtoindex{Fortran} use statement with an ``only list'' may be
526 represented by a series of imported declaration entries,
527 one (or more) for each entity that is imported. An entity
528 that is renamed in the importing context may be represented
529 by an imported declaration entry with a name attribute that
530 specifies the new local name.
533 \subsection{Imported Module Entries}
534 \label{chap:importedmoduleentries}
536 \textit{Some languages support the concept of importing into or making
537 accessible in a given unit all of the declarations contained
538 within a separate module or namespace.
541 An imported module declaration is represented by a debugging
542 information entry with the
543 tag \livetarg{chap:DWTAGimportedmodule}{DW\-\_TAG\-\_imported\-\_module}.
545 imported module entry contains a \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute
546 whose value is a reference to the module or namespace entry
547 containing the definition and/or declaration entries for
548 the entities that are to be imported into the context of the
549 imported module entry.
551 An imported module declaration may own a set of imported
552 declaration entries, each of which refers to an entry in the
553 module whose corresponding entity is to be known in the context
554 of the imported module declaration by a name other than its
555 name in that module. Any entity in the module that is not
556 renamed in this way is known in the context of the imported
557 module entry by the same name as it is declared in the module.
559 \textit{A \addtoindex{C++} using directive
560 may be represented by an imported module
561 \hypertarget{chap:DWATimportnamespaceusingdirective}
562 entry, with an import attribute referring to the namespace
563 entry of the appropriate extension of the namespace (which
564 might be the original namespace entry) and no owned entries.
567 \textit{A \addtoindex{Fortran} use statement with a “rename list” may be
568 represented by an imported module entry with an import
569 attribute referring to the module and owned entries
570 corresponding to those entities that are renamed as part of
574 \textit{A \addtoindex{Fortran} use statement
575 with neither a “rename list” nor
576 an “only list” may be represented by an imported module
577 entry with an import attribute referring to the module and
578 no owned child entries.
581 \textit{A use statement with an “only list” is represented by a
582 series of individual imported declaration entries as described
583 in Section \refersec{chap:importedorrenameddeclarationentries}.
586 \textit{A \addtoindex{Fortran} use statement for an entity in a module that is
587 itself imported by a use statement without an explicit mention
588 may be represented by an imported declaration entry that refers
589 to the original debugging information entry. For example, given
605 the imported declaration entry for Q within module C refers
606 directly to the variable declaration entry for A in module A
607 because there is no explicit representation for X in module B.
609 A similar situation arises for a \addtoindex{C++} using declaration that
610 imports an entity in terms of a namespace alias. See
611 Appendix \refersec{app:namespaceexample}
615 \section{Subroutine and Entry Point Entries}
616 \label{chap:subroutineandentrypointentries}
618 The following tags exist to describe debugging information entries for subroutines and entry
621 \begin{tabular}{lp{9.0cm}}
622 \livetarg{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} & A subroutine or function. \\
623 \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine} & A particular inlined
624 instance of a subroutine or function. \\
625 \livetarg{chap:DWTAGentrypoint}{DW\-\_TAG\-\_entry\-\_point} & An alternate entry point. \\
628 \subsection{General Subroutine and Entry Point Information}
629 \label{chap:generalsubroutineandentrypointinformation}
631 It may also have a \livelink{chap:DWATlinkagename}{DW\-\_AT\-\_linkage\-\_name} attribute as
632 described in Section \refersec{chap:linkagenames}.
634 If the name of the subroutine described by an entry with the
635 tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}
636 is visible outside of its containing
637 \hypertarget{chap:DWATexternalexternalsubroutine}
638 compilation unit, that entry has a
639 \livelink{chap:DWATexternal}{DW\-\_AT\-\_external} attribute,
640 which is a \livelink{chap:flag}{flag}.
642 \textit{Additional attributes for functions that are members of a
643 class or structure are described in
644 Section \refersec{chap:memberfunctionentries}.
648 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}
649 subroutine entry may contain a \livelink{chap:DWATmainsubprogram}{DW\-\_AT\-\_main\-\_subprogram}
651 a \livelink{chap:flag}{flag} whose presence indicates that the
652 subroutine has been identified as the starting function of
653 the program. If more than one subprogram contains this
655 any one of them may be the starting subroutine of the program.
657 \textit{\addtoindex{Fortran} has a PROGRAM statement which is used to specify
658 and provide a user\dash supplied name for the main subroutine of
662 \textit{A common debugger feature is to allow the debugger user to call
663 a subroutine within the subject program. In certain cases,
664 however, the generated code for a subroutine will not obey
665 the standard calling conventions for the target architecture
666 and will therefore not be safe to call from within a debugger.
669 A subroutine entry may
670 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}
672 \livelink{chap:DWATcallingconvention}{DW\-\_AT\-\_calling\-\_convention}
673 attribute, whose value is an integer constant. The set of
674 calling convention codes is given in
675 Figure \refersec{fig:callingconventioncodes}.
678 \autorows[0pt]{c}{1}{l}{
679 \addtoindex{DW\-\_CC\-\_normal},
680 \addtoindex{DW\-\_CC\-\_program},
681 \addtoindex{DW\-\_CC\-\_nocall},
683 \caption{Calling convention codes}\label{fig:callingconventioncodes}
686 If this attribute is not present, or its value is the constant
687 \livetarg{chap:DWCCnormal}{DW\-\_CC\-\_normal}, then the subroutine may be safely called by
688 obeying the ``standard'' calling conventions of the target
689 architecture. If the value of the calling convention attribute
690 is the constant \livetarg{chap:DWCCnocall}{DW\-\_CC\-\_nocall}, the subroutine does not obey
691 standard calling conventions, and it may not be safe for the
692 debugger to call this subroutine.
694 If the semantics of the language of the compilation unit
695 containing the subroutine entry distinguishes between ordinary
696 subroutines and subroutines that can serve as the ``main
697 program,'' that is, subroutines that cannot be called
698 directly according to the ordinary calling conventions,
699 then the debugging information entry for such a subroutine
700 may have a calling convention attribute whose value is the
701 constant \livetarg{chap:DWCCprogram}{DW\-\_CC\-\_program}.
703 \textit{The \livelink{chap:DWCCprogram}{DW\-\_CC\-\_program} value is intended to support \addtoindex{Fortran} main
704 programs which in some implementations may not be callable
705 or which must be invoked in a special way. It is not intended
706 as a way of finding the entry address for the program.
709 \textit{In \addtoindex{C}
710 there is a difference between the types of functions
711 declared using function prototype style declarations and
712 those declared using non\dash prototype declarations.
715 A subroutine entry declared with a function prototype style
716 declaration may have a
717 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
718 a \livelink{chap:flag}{flag}.
720 \textit{The \addtoindex{Fortran}
721 language allows the keywords elemental, pure
722 and recursive to be included as part of the declaration of
723 a subroutine; these attributes reflect that usage. These
724 attributes are not relevant for languages that do not support
725 similar keywords or syntax. In particular, the \livelink{chap:DWATrecursive}{DW\-\_AT\-\_recursive}
726 attribute is neither needed nor appropriate in languages such
728 where functions support recursion by default.
732 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}
734 \livelink{chap:DWATelemental}{DW\-\_AT\-\_elemental} attribute, which
735 is a \livelink{chap:flag}{flag}.
736 The attribute indicates whether the subroutine
737 or entry point was declared with the ``elemental'' keyword
741 \hypertarget{chap:DWATpurepurepropertyofasubroutine}
742 subprogram entry may have a
743 \livelink{chap:DWATpure}{DW\-\_AT\-\_pure} attribute, which is
744 a \livelink{chap:flag}{flag}.
745 The attribute indicates whether the subroutine was
746 declared with the ``pure'' keyword or property.
749 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}
750 subprogram entry may have a
751 \livelink{chap:DWATrecursive}{DW\-\_AT\-\_recursive} attribute, which
752 is a \livelink{chap:flag}{flag}.
753 The attribute indicates whether the subroutine
754 or entry point was declared with the ``recursive'' keyword
759 \subsection{Subroutine and Entry Point Return Types}
760 \label{chap:subroutineandentrypointreturntypes}
763 \hypertarget{chap:DWATtypetypeofsubroutinereturn}
764 the subroutine or entry point is a function that returns a
765 value, then its debugging information entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
766 attribute to denote the type returned by that function.
768 \textit{Debugging information entries for
769 \addtoindex{C} void functions should
770 not have an attribute for the return type. }
773 \subsection{Subroutine and Entry Point Locations}
774 \label{chap:subroutineandentrypointlocations}
776 A subroutine entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
777 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
778 whose values encode the contiguous or non\dash contiguous address
779 ranges, respectively, of the machine instructions generated
780 for the subroutine (see
781 Section \refersec{chap:codeaddressesandranges}).
784 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}
785 subroutine entry may also have a
786 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute
787 whose value is the address of the first executable instruction
788 of the subroutine (see
789 Section \refersec{chap:entryaddress}).
791 An entry point has a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute whose value is the
792 relocated address of the first machine instruction generated
795 \textit{While the \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute might also seem appropriate
796 for this purpose, historically the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute
797 was used before the \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} was introduced (in DWARF
798 Version 3). There is insufficient reason to change this.}
804 \addtoindexx{address class!attribute}
806 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}
808 \livelink{chap:DWATsegment}{DW\-\_AT\-\_segment}
810 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class} attributes,
811 as appropriate, to specify
812 which segments the code for the subroutine resides in and
813 the addressing mode to be used in calling that subroutine.
815 A subroutine entry representing a subroutine declaration
816 that is not also a definition does not have code address or
820 \subsection{Declarations Owned by Subroutines and Entry Points}
821 \label{chap:declarationsownedbysubroutinesandentrypoints}
823 The declarations enclosed by a subroutine or entry point are
824 represented by debugging information entries that are owned
825 by the subroutine or entry point entry. Entries representing
826 the formal parameters of the subroutine or entry point appear
827 in the same order as the corresponding declarations in the
830 \textit{There is no ordering requirement for entries for declarations
831 that are children of subroutine or entry point entries but
832 that do not represent formal parameters. The formal parameter
833 entries may be interspersed with other entries used by formal
834 parameter entries, such as type entries.}
836 The unspecified parameters of a variable parameter list are
837 represented by a debugging information entry\addtoindexx{unspecified parameters entry}
839 \livetarg{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
841 The entry for a subroutine that includes a
843 \livelink{chap:fortrancommonblock}{common}
844 \livelink{chap:commonblockentry}{block}
845 \addtoindexx{common block|see{Fortran common block}}
846 has a child entry with the
847 tag \livetarg{chap:DWTAGcommoninclusion}{DW\-\_TAG\-\_common\-\_inclusion}.
849 \hypertarget{chap:commonreferencecommonblockusage}
850 common inclusion entry has a
851 \livelink{chap:DWATcommonreference}{DW\-\_AT\-\_common\-\_reference} attribute
852 whose value is a reference to the debugging information entry
853 for the common \nolink{block} being included
854 (see Section \refersec{chap:commonblockentries}).
856 \subsection{Low-Level Information}
857 \label{chap:lowlevelinformation}
860 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}
861 subroutine or entry point entry may have a
862 \livelink{chap:DWATreturnaddr}{DW\-\_AT\-\_return\-\_addr}
863 attribute, whose value is a location description. The location
864 calculated is the place where the return address for the
865 subroutine or entry point is stored.
868 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}
869 subroutine or entry point entry may also have a
870 \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute, whose value is a location
871 description that computes the “frame base” for the
872 subroutine or entry point. If the location description is
873 a simple register location description, the given register
874 contains the frame base address. If the location description is
875 a DWARF expression, the result of evaluating that expression
876 is the frame base address. Finally, for a location list,
877 this interpretation applies to each location description
878 contained in the list of location list entries.
880 \textit{The use of one of the \livelink{chap:DWOPreg}{DW\-\_OP\-\_reg}~\textless~n~\textgreater
882 context is equivalent to using
883 \livelink{chap:DWOPbreg}{DW\-\_OP\-\_breg}~\textless~n~\textgreater(0)
885 compact. However, these are not equivalent in general.}
887 \textit{The frame base for a procedure is typically an address fixed
888 relative to the first unit of storage allocated for the
889 procedure’s stack frame. The \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute
890 can be used in several ways:}
892 \begin{enumerate}[1.]
893 \item \textit{In procedures that need location lists to locate local
894 variables, the \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} can hold the needed location
895 list, while all variables’ location descriptions can be
896 simpler ones involving the frame base.}
898 \item \textit{It can be used in resolving ``up\dash level'' addressing
899 within nested routines.
900 (See also \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link}, below)}
901 %The -See also- here is ok, the DW\-\_AT should be
902 %a hyperref to the def itself, which is earlier in this document.
905 \textit{Some languages support nested subroutines. In such languages,
906 it is possible to reference the local variables of an
907 outer subroutine from within an inner subroutine. The
908 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} and \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attributes allow
909 debuggers to support this same kind of referencing.}
912 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}
914 \addtoindexx{address!uplevel|see{static link attribute}}
915 subroutine or entry point is nested, it may have a
916 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link}
917 attribute, whose value is a location
918 description that computes the frame base of the relevant
919 instance of the subroutine that immediately encloses the
920 subroutine or entry point.
922 In the context of supporting nested subroutines, the
923 \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute value should obey the following
926 \begin{enumerate}[1.]
927 \item It should compute a value that does not change during the
928 life of the procedure, and
930 \item The computed value should be unique among instances of
931 the same subroutine. (For typical \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} use, this
932 means that a recursive subroutine’s stack frame must have
936 \textit{If a debugger is attempting to resolve an up\dash level reference
937 to a variable, it uses the nesting structure of DWARF to
938 determine which subroutine is the lexical parent and the
939 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} value to identify the appropriate active
940 frame of the parent. It can then attempt to find the reference
941 within the context of the parent.}
945 \subsection{Types Thrown by Exceptions}
946 \label{chap:typesthrownbyexceptions}
948 \textit{In \addtoindex{C++} a subroutine may declare a set of types which
949 it may validly throw.}
951 If a subroutine explicitly declares that it may throw
952 an exception for one or more types, each such type is
953 represented by a debugging information entry with the tag
954 \livetarg{chap:DWTAGthrowntype}{DW\-\_TAG\-\_thrown\-\_type}.
955 Each such entry is a child of the entry
956 representing the subroutine that may throw this type. Each
957 thrown type entry contains a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, whose
958 value is a reference to an entry describing the type of the
959 exception that may be thrown.
961 \subsection{Function Template Instantiations}
962 \label{chap:functiontemplateinstantiations}
964 \textit{In \addtoindex{C++}, a function template is a generic definition of
965 a function that is instantiated differently when called with
966 values of different types. DWARF does not represent the generic
967 template definition, but does represent each instantiation.}
969 A template instantiation is represented by a debugging
970 information entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. With four
971 exceptions, such an entry will contain the same attributes and
972 will have the same types of child entries as would an entry
973 for a subroutine defined explicitly using the instantiation
974 types. The exceptions are:
976 \begin{enumerate}[1.]
977 \item Each formal parameterized type declaration appearing in the
978 template definition is represented by a debugging information
980 tag \livetarg{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
982 such entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
983 null\dash terminated string containing the name of the formal
984 type parameter as it appears in the source program. The
985 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
986 describing the actual type by which the formal is replaced
987 for this instantiation.
989 \item The subprogram entry and each of its child entries reference
990 a template type parameter entry in any circumstance where
991 the template definition referenced a formal parameterized type.
993 \item If the compiler has generated a special compilation unit
994 to hold the template instantiation and that compilation unit
995 has a different name from the compilation unit containing
996 the template definition, the name attribute for the debugging
997 information entry representing that compilation unit is empty
1000 \item If the subprogram entry representing the template
1001 instantiation or any of its child entries contain declaration
1002 coordinate attributes, those attributes refer to the source
1003 for the template definition, not to any source generated
1004 artificially by the compiler for this instantiation.
1009 \subsection{Inlinable and Inlined Subroutines}
1010 A declaration or a definition of an inlinable subroutine
1011 is represented by a debugging information entry with the
1013 \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
1014 The entry for a subroutine that is
1015 \hypertarget{chap:DWATinlineinlinedsubroutine}
1016 explicitly declared to be available for inline expansion or
1017 that was expanded inline implicitly by the compiler has a
1018 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is an integer constant. The
1019 set of values for the \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute is given in
1020 Figure \refersec{fig:inlinecodes}.
1022 \begin{figure}[here]
1024 \caption{Inline codes}
1025 \label{fig:inlinecodes}
1026 \begin{tabular}{lp{9cm}}
1027 Name&Meaning\\ \hline
1028 \livetarg{chap:DWINLnotinlined}{DW\-\_INL\-\_not\-\_inlined} & Not delared inline nor inlined by the
1029 compiler(equivalent to the absense of the containing
1030 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute) \\
1031 \livetarg{chap:DWINLinlined}{DW\-\_INL\-\_inlined} & Not declared inline but inlined by the compiler \\
1032 \livetarg{chap:DWINLdeclarednotinlined}{DW\-\_INL\-\_declared\-\_not\-\_inlined} & Declared inline but
1033 not inlined by the compiler \\
1034 \livetarg{chap:DWINLdeclaredinlined}{DW\-\_INL\-\_declared\-\_inlined} & Declared inline and inlined by the compiler \\
1038 \textit{In \addtoindex{C++}, a function or a constructor declared with
1039 constexpr is implicitly declared inline. The abstract inline
1040 instance (see below) is represented by a debugging information
1041 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. Such an entry has a
1042 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is \livelink{chap:DWINLinlined}{DW\-\_INL\-\_inlined}.}
1045 \paragraph{Abstract Instances}
1046 \label{chap:abstractinstances}
1047 Any debugging information entry that is owned (either
1048 \hypertarget{chap:DWATinlineabstracttinstance}
1049 directly or indirectly) by a debugging information entry
1051 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute is referred to
1052 \addtoindexx{abstract instance!entry}
1053 as an ``abstract instance entry.''
1054 Any subroutine entry
1055 that contains a \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is other
1056 than \livelink{chap:DWINLnotinlined}{DW\-\_INL\-\_not\-\_inlined}
1058 \addtoindexx{abstract instance!root}
1059 an ``abstract instance root.''
1060 Any set of abstract instance entries that are all
1061 children (either directly or indirectly) of some abstract
1062 instance root, together with the root itself, is known as
1063 \addtoindexx{abstract instance!tree}
1064 an ``abstract instance tree.'' However, in the case where
1065 an abstract instance tree is nested within another abstract
1066 instance tree, the entries in the nested abstract instance
1067 tree are not considered to be entries in the outer abstract
1070 Each abstract instance root is either part of a larger
1071 \addtoindexx{abstract instance!root}
1072 tree (which gives a context for the root) or uses
1073 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} to refer to the declaration in context.
1075 \textit{For example, in \addtoindex{C++} the context might be a namespace
1076 declaration or a class declaration.}
1078 \textit{Abstract instance trees are defined so that no entry is part
1079 of more than one abstract instance tree. This simplifies the
1080 following descriptions.}
1082 A debugging information entry that is a member of an abstract
1083 instance tree should not contain any attributes which describe
1084 aspects of the subroutine which vary between distinct inlined
1085 expansions or distinct out\dash of\dash line expansions. For example,
1086 the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc},
1087 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc}, \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges},
1088 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc}, \livelink{chap:DWATlocation}{DW\-\_AT\-\_location},
1089 \livelink{chap:DWATreturnaddr}{DW\-\_AT\-\_return\-\_addr}, \livelink{chap:DWATstartscope}{DW\-\_AT\-\_start\-\_scope}, and
1090 \livelink{chap:DWATsegment}{DW\-\_AT\-\_segment}
1091 attributes typically should be omitted; however, this list
1094 \textit{It would not make sense normally to put these attributes into
1095 abstract instance entries since such entries do not represent
1096 actual (concrete) instances and thus do not actually exist at
1097 run\dash time. However,
1098 see Appendix \refersec{app:inlineouteronenormalinner}
1099 for a contrary example.}
1101 The rules for the relative location of entries belonging to
1102 abstract instance trees are exactly the same as for other
1103 similar types of entries that are not abstract. Specifically,
1104 the rule that requires that an entry representing a declaration
1105 be a direct child of the entry representing the scope of the
1106 declaration applies equally to both abstract and non\dash abstract
1107 entries. Also, the ordering rules for formal parameter entries,
1108 member entries, and so on, all apply regardless of whether
1109 or not a given entry is abstract.
1111 \paragraph{Concrete Inlined Instances}
1112 \label{chap:concreteinlinedinstances}
1114 Each inline expansion of a subroutine is represented
1115 by a debugging information entry with the
1116 tag \livetarg{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}.
1117 Each such entry should be a direct
1118 child of the entry that represents the scope within which
1119 the inlining occurs.
1121 Each inlined subroutine entry may have either a
1122 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc}
1123 and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges}
1124 attribute whose values encode the contiguous or non\dash contiguous
1125 address ranges, respectively, of the machine instructions
1126 generated for the inlined subroutine (see
1127 Section \refersec{chap:codeaddressesandranges}).
1129 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}
1130 inlined subroutine entry may also contain a
1131 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc}
1132 attribute, representing the first executable instruction of
1133 the inline expansion (see
1134 Section \refersec{chap:entryaddress}).
1136 % Positions of the 3 targets here is a bit arbitrary.
1138 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}
1140 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}
1142 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}
1143 may also have \livelink{chap:DWATcallfile}{DW\-\_AT\-\_call\-\_file},
1144 \livelink{chap:DWATcallline}{DW\-\_AT\-\_call\-\_line} and \livelink{chap:DWATcallcolumn}{DW\-\_AT\-\_call\-\_column} attributes,
1146 value is an integer constant. These attributes represent the
1147 source file, source line number, and source column number,
1148 respectively, of the first character of the statement or
1149 expression that caused the inline expansion. The call file,
1150 call line, and call column attributes are interpreted in
1151 the same way as the declaration file, declaration line, and
1152 declaration column attributes, respectively (see
1153 Section \refersec{chap:declarationcoordinates}).
1155 The call file, call line and call column coordinates do not
1156 describe the coordinates of the subroutine declaration that
1157 was inlined, rather they describe the coordinates of the call.
1159 An inlined subroutine entry
1160 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}
1162 \livelink{chap:DWATconstexpr}{DW\-\_AT\-\_const\-\_expr}
1163 attribute, which is a \livelink{chap:flag}{flag}
1164 whose presence indicates that the
1165 subroutine has been evaluated as a compile\dash time constant. Such
1166 an entry may also have a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1167 whose value may be of any form that is appropriate for the
1168 representation of the subroutine's return value. The value of
1169 this attribute is the actual return value of the subroutine,
1170 represented as it would be on the target architecture.
1172 \textit{In \addtoindex{C++}, if a function or a constructor declared with constexpr
1173 is called with constant expressions, then the corresponding
1174 concrete inlined instance has a \livelink{chap:DWATconstexpr}{DW\-\_AT\-\_const\-\_expr} attribute,
1175 as well as a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute whose value represents
1176 the actual return value of the concrete inlined instance.}
1178 Any debugging information entry that is owned (either
1179 directly or indirectly) by a debugging information entry
1180 with the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine} is referred to as a
1181 ``concrete inlined instance entry.'' Any entry that has
1182 the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}
1183 is known as a ``concrete inlined instance root.'' Any set of concrete inlined instance
1184 entries that are all children (either directly or indirectly)
1185 of some concrete inlined instance root, together with the root
1186 itself, is known as a ``concrete inlined instance tree.''
1187 However, in the case where a concrete inlined instance tree
1188 is nested within another concrete instance tree, the entries
1189 in the nested concrete instance tree are not considered to
1190 be entries in the outer concrete instance tree.
1192 \textit{Concrete inlined instance trees are defined so that no entry
1193 is part of more than one concrete inlined instance tree. This
1194 simplifies later descriptions.}
1196 Each concrete inlined instance tree is uniquely associated
1197 with one (and only one) abstract instance tree.
1199 \textit{Note, however, that the reverse is not true. Any given abstract
1200 instance tree may be associated with several different concrete
1201 inlined instance trees, or may even be associated with zero
1202 concrete inlined instance trees.}
1204 Concrete inlined instance entries may omit attributes that
1205 are not specific to the concrete instance (but present in
1206 the abstract instance) and need include only attributes that
1207 are specific to the concrete instance (but omitted in the
1208 abstract instance). In place of these omitted attributes, each
1209 \hypertarget{chap:DWATabstractorigininlineinstance}
1210 concrete inlined instance entry
1211 \addtoindexx{abstract origin attribute}
1213 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin}
1214 attribute that may be used to obtain the missing information
1215 (indirectly) from the associated abstract instance entry. The
1216 value of the abstract origin attribute is a reference to the
1217 associated abstract instance entry.
1219 If an entry within a concrete inlined instance tree contains
1220 attributes describing the declaration coordinates of that
1221 entry, then those attributes should refer to the file, line
1222 and column of the original declaration of the subroutine,
1223 not to the point at which it was inlined. As a consequence,
1224 they may usually be omitted from any entry that has an abstract
1227 For each pair of entries that are associated via a
1228 \addtoindexx{abstract origin attribute}
1229 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attribute, both members of the pair
1230 have the same tag. So, for example, an entry with the tag
1231 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable} can only be associated with another entry
1232 that also has the tag \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}. The only exception
1233 to this rule is that the root of a concrete instance tree
1234 (which must always have the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine})
1235 can only be associated with the root of its associated abstract
1236 instance tree (which must have the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}).
1238 In general, the structure and content of any given concrete
1239 inlined instance tree will be closely analogous to the
1240 structure and content of its associated abstract instance
1241 tree. There are a few exceptions:
1243 \begin{enumerate}[1.]
1244 \item An entry in the concrete instance tree may be omitted if
1246 \addtoindexx{abstract origin attribute}
1247 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attribute and either
1248 has no children, or its children are omitted. Such entries
1249 would provide no useful information. In C\dash like languages,
1250 such entries frequently include types, including structure,
1251 union, class, and interface types; and members of types. If any
1252 entry within a concrete inlined instance tree needs to refer
1253 to an entity declared within the scope of the relevant inlined
1254 subroutine and for which no concrete instance entry exists,
1255 the reference should refer to the abstract instance entry.
1257 \item Entries in the concrete instance tree which are associated
1258 with entries in the abstract instance tree such that neither
1259 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, and neither is referenced by
1260 any other debugging information entry, may be omitted. This
1261 may happen for debugging information entries in the abstract
1262 instance trees that became unnecessary in the concrete instance
1263 tree because of additional information available there. For
1264 example, an anonymous variable might have been created and
1265 described in the abstract instance tree, but because of
1266 the actual parameters for a particular inlined expansion,
1267 it could be described as a constant value without the need
1268 for that separate debugging information entry.
1270 \item A concrete instance tree may contain entries which do
1271 not correspond to entries in the abstract instance tree
1272 to describe new entities that are specific to a particular
1273 inlined expansion. In that case, they will not have associated
1274 entries in the abstract instance tree, should not contain
1275 \addtoindexx{abstract origin attribute}
1276 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attributes, and must contain all their
1277 own attributes directly. This allows an abstract instance tree
1278 to omit debugging information entries for anonymous entities
1279 that are unlikely to be needed in most inlined expansions. In
1280 any expansion which deviates from that expectation, the
1281 entries can be described in its concrete inlined instance tree.
1285 \paragraph{Out-of-Line Instances of Inlined Subroutines}
1286 \label{chap:outoflineinstancesofinlinedsubroutines}
1287 Under some conditions, compilers may need to generate concrete
1288 executable instances of inlined subroutines other than at
1289 points where those subroutines are actually called. Such
1290 concrete instances of inlined subroutines are referred to as
1291 ``concrete out\dash of\dash line instances.''
1293 \textit{In \addtoindex{C++}, for example,
1294 taking the address of a function declared
1295 to be inline can necessitate the generation of a concrete
1296 out\dash of\dash line instance of the given function.}
1298 The DWARF representation of a concrete out\dash of\dash line instance
1299 of an inlined subroutine is essentially the same as for a
1300 concrete inlined instance of that subroutine (as described in
1301 the preceding section). The representation of such a concrete
1302 % It is critical that the hypertarget and livelink be
1303 % separated to avoid problems with latex.
1304 out\dash of\dash line
1305 \addtoindexx{abstract origin attribute}
1307 \hypertarget{chap:DWATabstractoriginoutoflineinstance}
1309 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin}
1310 attributes in exactly the same way as they are used for
1311 a concrete inlined instance (that is, as references to
1312 corresponding entries within the associated abstract instance
1315 The differences between the DWARF representation of a
1316 concrete out\dash of\dash line instance of a given subroutine and the
1317 representation of a concrete inlined instance of that same
1318 subroutine are as follows:
1320 \begin{enumerate}[1.]
1321 \item The root entry for a concrete out\dash of\dash line instance
1322 of a given inlined subroutine has the same tag as does its
1323 associated (abstract) inlined subroutine entry (that is, tag
1324 \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} rather than \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}).
1326 \item The root entry for a concrete out\dash of\dash line instance tree
1327 is normally owned by the same parent entry that also owns
1328 the root entry of the associated abstract instance. However,
1329 it is not required that the abstract and out\dash of\dash line instance
1330 trees be owned by the same parent entry.
1334 \paragraph{Nested Inlined Subroutines}
1335 \label{nestedinlinedsubroutines}
1336 Some languages and compilers may permit the logical nesting of
1337 a subroutine within another subroutine, and may permit either
1338 the outer or the nested subroutine, or both, to be inlined.
1340 For a non\dash inlined subroutine nested within an inlined
1341 subroutine, the nested subroutine is described normally in
1342 both the abstract and concrete inlined instance trees for
1343 the outer subroutine. All rules pertaining to the abstract
1344 and concrete instance trees for the outer subroutine apply
1345 also to the abstract and concrete instance entries for the
1348 For an inlined subroutine nested within another inlined
1349 subroutine, the following rules apply to their abstract and
1350 \addtoindexx{abstract instance!nested}
1351 \addtoindexx{concrete instance!nested}
1352 concrete instance trees:
1354 \begin{enumerate}[1.]
1355 \item The abstract instance tree for the nested subroutine is
1356 described within the abstract instance tree for the outer
1357 subroutine according to the rules in
1358 Section \refersec{chap:abstractinstances}, and
1359 without regard to the fact that it is within an outer abstract
1362 \item Any abstract instance tree for a nested subroutine is
1363 always omitted within the concrete instance tree for an
1366 \item A concrete instance tree for a nested subroutine is
1367 always omitted within the abstract instance tree for an
1370 \item The concrete instance tree for any inlined or out-of-line
1371 expansion of the nested subroutine is described within a
1372 concrete instance tree for the outer subroutine according
1374 Sections \refersec{chap:concreteinlinedinstances} or
1375 \refersec{chap:outoflineinstancesofinlinedsubroutines}
1377 and without regard to the fact that it is within an outer
1378 concrete instance tree.
1381 See Appendix \refersec{app:inliningexamples}
1382 for discussion and examples.
1384 \subsection{Trampolines}
1385 \label{chap:trampolines}
1387 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1388 \hypertarget{chap:DWATtrampolinetargetsubroutine}
1389 an intermediary in making a call to another subroutine. It may
1390 adjust parameters and/or the result (if any) as appropriate
1391 to the combined calling and called execution contexts.}
1393 A trampoline is represented by a debugging information entry
1394 with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} or \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}
1395 that has a \livelink{chap:DWATtrampoline}{DW\-\_AT\-\_trampoline} attribute. The value of that
1396 attribute indicates the target subroutine of the trampoline,
1397 that is, the subroutine to which the trampoline passes
1398 control. (A trampoline entry may but need not also have a
1399 \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute.)
1401 The value of the trampoline attribute may be represented
1402 using any of the following forms, which are listed in order
1406 \item If the value is of class reference, then the value
1407 specifies the debugging information entry of the target
1410 \item If the value is of class address, then the value is
1411 the relocated address of the target subprogram.
1413 \item If the value is of class string, then the value is the
1414 (possibly mangled) name of the target subprogram.
1416 \item If the value is of class \livelink{chap:flag}{flag}, then the value true
1417 indicates that the containing subroutine is a trampoline but
1418 that the target subroutine is not known.
1422 The target subprogram may itself be a trampoline. (A sequence
1423 of trampolines necessarily ends with a non\dash trampoline
1426 \textit{In \addtoindex{C++}, trampolines may be used
1427 to implement derived virtual
1428 member functions; such trampolines typically adjust the
1429 implicit this pointer parameter in the course of passing
1430 control. Other languages and environments may use trampolines
1431 in a manner sometimes known as transfer functions or transfer
1434 \textit{Trampolines may sometimes pass control to the target
1435 subprogram using a branch or jump instruction instead of a
1436 call instruction, thereby leaving no trace of their existence
1437 in the subsequent execution context. }
1439 \textit{This attribute helps make it feasible for a debugger to arrange
1440 that stepping into a trampoline or setting a breakpoint in
1441 a trampoline will result in stepping into or setting the
1442 breakpoint in the target subroutine instead. This helps to
1443 hide the compiler generated subprogram from the user. }
1445 \textit{If the target subroutine is not known, a debugger may choose
1446 to repeatedly step until control arrives in a new subroutine
1447 which can be assumed to be the target subroutine. }
1451 \section{Lexical Block Entries}
1452 \label{chap:lexicalblockentries}
1454 \textit{A lexical \livetargi{chap:lexicalblock}{block}{lexical block} is a bracketed sequence of source statements
1455 that may contain any number of declarations. In some languages
1456 (including \addtoindex{C} and \addtoindex{C++}),
1457 \nolink{blocks} can be nested within other
1458 \nolink{blocks} to any depth.}
1460 % We do not need to link to the preceeding paragraph.
1461 A lexical \nolink{block} is represented by a debugging information
1463 tag \livetarg{chap:DWTAGlexicalblock}{DW\-\_TAG\-\_lexical\-\_block}.
1465 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry} entry
1467 either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
1468 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of
1469 attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
1470 whose values encode the contiguous or non-contiguous address
1471 ranges, respectively, of the machine instructions generated
1472 for the lexical \livelink{chap:lexicalblock}{block}
1473 (see Section \refersec{chap:codeaddressesandranges}).
1475 If a name has been given to the
1476 lexical \livelink{chap:lexicalblock}{block}
1478 program, then the corresponding
1479 lexical \livelink{chap:lexicalblockentry}{block} entry has a
1480 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose
1481 value is a null\dash terminated string
1482 containing the name of the lexical \livelink{chap:lexicalblock}{block}
1486 \textit{This is not the same as a \addtoindex{C} or
1487 \addtoindex{C++} label (see below).}
1489 The lexical \livelink{chap:lexicalblockentry}{block} entry owns
1490 debugging information entries that
1491 describe the declarations within that lexical \livelink{chap:lexicalblock}{block}.
1493 one such debugging information entry for each local declaration
1494 of an identifier or inner lexical \livelink{chap:lexicalblock}{block}.
1496 \section{Label Entries}
1497 \label{chap:labelentries}
1499 A label is a way of identifying a source statement. A labeled
1500 statement is usually the target of one or more ``go to''
1503 A label is represented by a debugging information entry with
1505 tag \livetarg{chap:DWTAGlabel}{DW\-\_TAG\-\_label}.
1506 The entry for a label should be owned by
1507 the debugging information entry representing the scope within
1508 which the name of the label could be legally referenced within
1511 The label entry has a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute whose value
1512 is the relocated address of the first machine instruction
1513 generated for the statement identified by the label in
1514 the source program. The label entry also has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1515 attribute whose value is a null-terminated string containing
1516 the name of the label as it appears in the source program.
1519 \section{With Statement Entries}
1520 \label{chap:withstatemententries}
1522 \textit{Both \addtoindex{Pascal} and
1523 \addtoindexx{Modula-2}
1524 Modula\dash 2 support the concept of a ``with''
1525 statement. The with statement specifies a sequence of
1526 executable statements within which the fields of a record
1527 variable may be referenced, unqualified by the name of the
1530 A with statement is represented by a
1531 \addtoindexi{debugging information entry}{with statement entry}
1532 with the tag \livetarg{chap:DWTAGwithstmt}{DW\-\_TAG\-\_with\-\_stmt}.
1534 A with statement entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
1535 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
1536 whose values encode the contiguous or non\dash contiguous address
1537 ranges, respectively, of the machine instructions generated
1538 for the with statement
1539 (see Section \refersec{chap:codeaddressesandranges}).
1541 The with statement entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, denoting
1542 the type of record whose fields may be referenced without full
1543 qualification within the body of the statement. It also has
1544 a \livelink{chap:DWATlocation}{DW\-\_AT\-\_location} attribute, describing how to find the base
1545 address of the record object referenced within the body of
1548 \section{Try and Catch Block Entries}
1549 \label{chap:tryandcatchblockentries}
1551 \textit{In \addtoindex{C++} a lexical \livelink{chap:lexicalblock}{block} may be
1552 designated as a ``catch \nolink{block}.''
1553 A catch \livetargi{chap:catchblock}{block}{catch block} is an
1554 exception handler that handles
1555 exceptions thrown by an immediately
1556 preceding ``try \livelink{chap:tryblock}{block}.''
1557 A catch \livelink{chap:catchblock}{block}
1558 designates the type of the exception that it
1561 A try \livetargi{chap:tryblock}{block}{try block} is represented
1562 by a debugging information entry
1563 with the tag \livetarg{chap:DWTAGtryblock}{DW\-\_TAG\-\_try\-\_block}.
1564 A catch \livelink{chap:catchblock}{block} is represented by
1565 a debugging information entry with
1566 the tag \livetarg{chap:DWTAGcatchblock}{DW\-\_TAG\-\_catch\-\_block}.
1568 % nolink as we have links just above and do not have a combo link for both
1569 Both try and catch \nolink{block} entries may have either a
1570 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a
1571 \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute whose values encode the contiguous
1572 or non\dash contiguous address ranges, respectively, of the
1573 machine instructions generated for the \livelink{chap:lexicalblock}{block}
1575 \refersec{chap:codeaddressesandranges}).
1577 Catch \livelink{chap:catchblock}{block} entries have at
1578 least one child entry, an
1579 entry representing the type of exception accepted by
1580 that catch \livelink{chap:catchblock}{block}.
1582 This child entry has one of the
1583 \addtoindexx{unspecified parameters entry!in catch block}
1585 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} or
1586 \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters},
1587 and will have the same form as other parameter entries.
1589 The siblings immediately following
1590 a try \livelink{chap:tryblock}{block} entry are its
1591 corresponding catch \livelink{chap:catchblock}{block} entries.