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 \\
103 \livetarg{chap:DWLANGAda95}{DW\-\_LANG\-\_Ada95} \dag&ISO Ada:1995 \\
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}
214 attribute points to a debugging information entry
215 representing another compilation unit. It may be used
216 to specify the compilation unit containing the base type
217 entries used by entries in the current compilation unit
218 (see Section \refersec{chap:basetypeentries}).
220 This attribute provides a consumer a way to find the definition
221 of base types for a compilation unit that does not itself
222 contain such definitions. This allows a consumer, for example,
223 to interpret a type conversion to a base type
224 % getting this link target at the right spot is tricky.
225 \hypertarget{chap:DWATuseUTF8compilationunitusesutf8strings}
228 \item A \livelink{chap:DWATuseUTF8}{DW\-\_AT\-\_use\-\_UTF8} attribute,
229 which is a \livelink{chap:flag}{flag} whose
230 presence indicates that all strings (such as the names of
231 declared entities in the source program) are represented
232 using the UTF\dash 8 representation
233 (see Section \refersec{datarep:attributeencodings}).
236 \item A \livelink{chap:DWATmainsubprogram}{DW\-\_AT\-\_main\-\_subprogram} attribute, which is a \livelink{chap:flag}{flag}
237 whose presence indicates
238 \hypertarget{chap:DWATmainsubprogramunitcontainingmainorstartingsubprogram}
239 that the compilation unit contains a
240 subprogram that has been identified as the starting function
241 of the program. If more than one compilation unit contains
242 this \nolink{flag}, any one of them may contain the starting function.
244 \textit{Fortran has a PROGRAM statement which is used
245 to specify and provide a user\dash specified name for the main
246 subroutine of a program. C uses the name “main” to identify
247 the main subprogram of a program. Some other languages provide
248 similar or other means to identify the main subprogram of
253 The base address of a compilation unit is defined as the
254 value of the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute, if present; otherwise,
255 it is undefined. If the base address is undefined, then any
256 DWARF entry or structure defined in terms of the base address
257 of that compilation unit is not valid.
260 \subsection{Imported Unit Entries}
261 \label{chap:importedunitentries}
263 \hypertarget{chap:DWATimportimportedunit}
264 place where a normal or partial unit is imported is
265 represented by a debugging information entry with the
266 tag \livetarg{chap:DWTAGimportedunit}{DW\-\_TAG\-\_imported\-\_unit}.
267 An imported unit entry contains a
268 \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute whose value is a reference to the
269 normal or partial compilation unit whose declarations logically
270 belong at the place of the imported unit entry.
272 An imported unit entry does not necessarily correspond to
273 any entity or construct in the source program. It is merely
274 “glue” used to relate a partial unit, or a compilation
275 unit used as a partial unit, to a place in some other
278 \subsection{Separate Type Unit Entries}
279 \label{chap:separatetypeunitentries}
280 An object file may contain any number of separate type
281 unit entries, each representing a single complete type
282 definition. Each type unit must be uniquely identified by
283 a 64\dash bit signature, stored as part of the type unit, which
284 can be used to reference the type definition from debugging
285 information entries in other compilation units and type units.
287 A type unit is represented by a debugging information entry
288 with the tag \livetarg{chap:DWTAGtypeunit}{DW\-\_TAG\-\_type\-\_unit}.
289 A type unit entry owns debugging
290 information entries that represent the definition of a single
291 type, plus additional debugging information entries that may
292 be necessary to include as part of the definition of the type.
294 A type unit entry may have a \livelink{chap:DWATlanguage}{DW\-\_AT\-\_language} attribute, whose
295 constant value is an integer code indicating the source
296 language used to define the type. The set of language names
297 and their meanings are given in Figure \refersec{fig:languagenames}.
299 A type unit entry for a given type T owns a debugging
300 information entry that represents a defining declaration
301 of type T. If the type is nested within enclosing types or
302 namespaces, the debugging information entry for T is nested
303 within debugging information entries describing its containers;
304 otherwise, T is a direct child of the type unit entry.
306 A type unit entry may also own additional debugging information
307 entries that represent declarations of additional types that
308 are referenced by type T and have not themselves been placed in
309 separate type units. Like T, if an additional type U is nested
310 within enclosing types or namespaces, the debugging information
311 entry for U is nested within entries describing its containers;
312 otherwise, U is a direct child of the type unit entry.
314 The containing entries for types T and U are declarations,
315 and the outermost containing entry for any given type T or
316 U is a direct child of the type unit entry. The containing
317 entries may be shared among the additional types and between
318 T and the additional types.
320 Types are not required to be placed in type units. In general,
321 only large types such as structure, class, enumeration, and
322 union types included from header files should be considered
323 for separate type units. Base types and other small types
324 are not usually worth the overhead of placement in separate
325 type units. Types that are unlikely to be replicated, such
326 as those defined in the main source file, are also better
327 left in the main compilation unit.
329 \section{Module, Namespace and Importing Entries}
330 \textit{Modules and namespaces provide a means to collect related
331 entities into a single entity and to manage the names of
334 \subsection{Module Entries}
335 \label{chap:moduleentries}
336 \textit{Several languages have the concept of a ``module.''
337 A Modula\dash 2 definition module may be represented by a module
338 entry containing a declaration attribute (\livelink{chap:DWATdeclaration}{DW\-\_AT\-\_declaration}). A
339 Fortran 90 module may also be represented by a module entry
340 (but no declaration attribute is warranted because Fortran
341 has no concept of a corresponding module body).}
343 A module is represented by a debugging information entry
345 tag \livetarg{chap:DWTAGmodule}{DW\-\_TAG\-\_module}.
346 Module entries may own other
347 debugging information entries describing program entities
348 whose declaration scopes end at the end of the module itself.
350 If the module has a name, the module entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
351 attribute whose value is a null\dash terminated string containing
352 the module name as it appears in the source program.
354 The module entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
355 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
356 whose values encode the contiguous or non\dash contiguous address
357 ranges, respectively, of the machine instructions generated for
358 the module initialization code
359 (see Section \refersec{chap:codeaddressesandranges}).
360 \hypertarget{chap:DWATentrypcentryaddressofmoduleinitialization}
362 have a \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute whose value is the address of
363 the first executable instruction of that initialization code
364 (see Section \refersec{chap:entryaddress}).
367 \hypertarget{chap:DWATprioritymodulepriority}
368 the module has been assigned a priority, it may have a
369 \livelink{chap:DWATpriority}{DW\-\_AT\-\_priority} attribute. The value of this attribute is a
370 reference to another debugging information entry describing
371 a variable with a constant value. The value of this variable
372 is the actual constant value of the module’s priority,
373 represented as it would be on the target architecture.
375 \subsection{Namespace Entries}
376 \label{chap:namespaceentries}
377 \textit{C++ has the notion of a namespace, which provides a way to
378 implement name hiding, so that names of unrelated things
379 do not accidentally clash in the global namespace when an
380 application is linked together.}
382 A namespace is represented by a debugging information entry
384 tag \livetarg{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace}.
385 A namespace extension is
386 \hypertarget{chap:DWATextensionpreviousnamespaceextensionororiginalnamespace}
388 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace} entry
390 \livelink{chap:DWATextension}{DW\-\_AT\-\_extension}
391 attribute referring to the previous extension, or if there
392 is no previous extension, to the original
393 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace}
394 entry. A namespace extension entry does not need to duplicate
395 information in a previous extension entry of the namespace
396 nor need it duplicate information in the original namespace
397 entry. (Thus, for a namespace with a name,
398 a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
399 attribute need only be attached directly to the original
400 \livelink{chap:DWTAGnamespace}{DW\-\_TAG\-\_namespace} entry.)
402 Namespace and namespace extension entries may own other
403 debugging information entries describing program entities
404 whose declarations occur in the namespace.
406 \textit{For C++, such owned program entities may be declarations,
407 including certain declarations that are also object or
408 function definitions.}
410 If a type, variable, or function declared in a namespace is
411 defined outside of the body of the namespace declaration,
412 that type, variable, or function definition entry has a
413 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute whose value is a reference to the
414 debugging information entry representing the declaration of
415 the type, variable or function. Type, variable, or function
416 entries with a \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} attribute do not need
417 to duplicate information provided by the declaration entry
418 referenced by the specification attribute.
420 \textit{The C++ global namespace (the namespace referred to by
421 ``::f'', for example) is not explicitly represented in
422 DWARF with a namespace entry (thus mirroring the situation
423 in C++ source). Global items may be simply declared with no
424 reference to a namespace.}
426 \textit{The C++ compilation unit specific ``unnamed namespace'' may
427 be represented by a namespace entry with no name attribute in
428 the original namespace declaration entry (and therefore no name
429 attribute in any namespace extension entry of this namespace).
432 \textit{A compiler emitting namespace information may choose to
433 explicitly represent namespace extensions, or to represent the
434 final namespace declaration of a compilation unit; this is a
435 quality\dash of\dash implementation issue and no specific requirements
436 are given here. If only the final namespace is represented,
437 it is impossible for a debugger to interpret using declaration
438 references in exactly the manner defined by the C++ language.
441 \textit{Emitting all namespace declaration information in all
442 compilation units can result in a significant increase in the
443 size of the debug information and significant duplication of
444 information across compilation units. The C++ namespace std,
445 for example, is large and will probably be referenced in
446 every C++ compilation unit.
449 \textit{For a C++ namespace example, see Appendix \refersec{app:namespaceexample}.
454 \subsection{Imported (or Renamed) Declaration Entries}
455 \label{chap:importedorrenameddeclarationentries}
456 \textit{Some languages support the concept of importing into or making
457 accessible in a given unit declarations made in a different
458 module or scope. An imported declaration may sometimes be
462 An imported declaration is represented by one or
463 more debugging information entries with the
464 tag \livetarg{chap:DWTAGimporteddeclaration}{DW\-\_TAG\-\_imported\-\_declaration}.
466 \hypertarget{chap:DWATimportimporteddeclaration}
468 is imported, there is one imported declaration entry for
469 each overloading. Each imported declaration entry has a
470 \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute, whose value is a reference to the
471 debugging information entry representing the declaration that
474 An imported declaration may also have a
475 \livelink{chap:DWATname}{DW\-\_AT\-\_name}
477 whose value is a null\dash terminated string containing the
478 name, as it appears in the source program, by which the
479 imported entity is to be known in the context of the imported
480 declaration entry (which may be different than the name of
481 the entity being imported). If no name is present, then the
482 name by which the entity is to be known is the same as the
483 name of the entity being imported.
485 An imported declaration entry with a name attribute may be
486 used as a general means to rename or provide an alias for
487 an entity, regardless of the context in which the importing
488 declaration or the imported entity occurs.
490 \textit{A C++ namespace alias may be represented by an imported
491 \hypertarget{chap:DWATimportnamespacealias}
492 declaration entry with a name attribute whose value is
493 a null\dash terminated string containing the alias name as it
494 appears in the source program and an import attribute whose
495 value is a reference to the applicable original namespace or
496 namespace extension entry.
499 \textit{A C++ using declaration may be represented by one or more
500 \hypertarget{chap:DWATimportnamespaceusingdeclaration}
501 imported declaration entries. When the using declaration
502 refers to an overloaded function, there is one imported
503 declaration entry corresponding to each overloading. Each
504 imported declaration entry has no name attribute but it does
505 have an import attribute that refers to the entry for the
506 entity being imported. (C++ provides no means to ``rename''
507 an imported entity, other than a namespace).
510 \textit{A Fortran use statement with an ``only list'' may be
511 represented by a series of imported declaration entries,
512 one (or more) for each entity that is imported. An entity
513 that is renamed in the importing context may be represented
514 by an imported declaration entry with a name attribute that
515 specifies the new local name.
518 \subsection{Imported Module Entries}
519 \label{chap:importedmoduleentries}
521 \textit{Some languages support the concept of importing into or making
522 accessible in a given unit all of the declarations contained
523 within a separate module or namespace.
526 An imported module declaration is represented by a debugging
527 information entry with the
528 tag \livetarg{chap:DWTAGimportedmodule}{DW\-\_TAG\-\_imported\-\_module}.
530 imported module entry contains a \livelink{chap:DWATimport}{DW\-\_AT\-\_import} attribute
531 whose value is a reference to the module or namespace entry
532 containing the definition and/or declaration entries for
533 the entities that are to be imported into the context of the
534 imported module entry.
536 An imported module declaration may own a set of imported
537 declaration entries, each of which refers to an entry in the
538 module whose corresponding entity is to be known in the context
539 of the imported module declaration by a name other than its
540 name in that module. Any entity in the module that is not
541 renamed in this way is known in the context of the imported
542 module entry by the same name as it is declared in the module.
544 \textit{A C++ using directive may be represented by an imported module
545 \hypertarget{chap:DWATimportnamespaceusingdirective}
546 entry, with an import attribute referring to the namespace
547 entry of the appropriate extension of the namespace (which
548 might be the original namespace entry) and no owned entries.
551 \textit{A Fortran use statement with a “rename list” may be
552 represented by an imported module entry with an import
553 attribute referring to the module and owned entries
554 corresponding to those entities that are renamed as part of
558 \textit{A Fortran use statement with neither a “rename list” nor
559 an “only list” may be represented by an imported module
560 entry with an import attribute referring to the module and
561 no owned child entries.
564 \textit{A use statement with an “only list” is represented by a
565 series of individual imported declaration entries as described
566 in Section \refersec{chap:importedorrenameddeclarationentries}.
569 \textit{A Fortran use statement for an entity in a module that is
570 itself imported by a use statement without an explicit mention
571 may be represented by an imported declaration entry that refers
572 to the original debugging information entry. For example, given
588 the imported declaration entry for Q within module C refers
589 directly to the variable declaration entry for A in module A
590 because there is no explicit representation for X in module B.
592 A similar situation arises for a C++ using declaration that
593 imports an entity in terms of a namespace alias. See
594 Appendix \refersec{app:namespaceexample}
598 \section{Subroutine and Entry Point Entries}
599 \label{chap:subroutineandentrypointentries}
601 The following tags exist to describe debugging information entries for subroutines and entry
604 \begin{tabular}{lp{9.0cm}}
605 \livetarg{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} & A subroutine or function. \\
606 \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine} & A particular inlined
607 instance of a subroutine or function. \\
608 \livetarg{chap:DWTAGentrypoint}{DW\-\_TAG\-\_entry\-\_point} & An alternate entry point. \\
611 \subsection{General Subroutine and Entry Point Information}
612 \label{chap:generalsubroutineandentrypointinformation}
614 It may also have a \livelink{chap:DWATlinkagename}{DW\-\_AT\-\_linkage\-\_name} attribute as
615 described in Section \refersec{chap:linkagenames}.
617 If the name of the subroutine described by an entry with the
618 tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}
619 is visible outside of its containing
620 \hypertarget{chap:DWATexternalexternalsubroutine}
621 compilation unit, that entry has a
622 \livelink{chap:DWATexternal}{DW\-\_AT\-\_external} attribute,
623 which is a \livelink{chap:flag}{flag}.
625 \textit{Additional attributes for functions that are members of a
626 class or structure are described in
627 Section \refersec{chap:memberfunctionentries}.
631 \hypertarget{chap:DWATmainsubprogrammainorstartingsubprogram}
632 subroutine entry may contain a \livelink{chap:DWATmainsubprogram}{DW\-\_AT\-\_main\-\_subprogram}
634 a \livelink{chap:flag}{flag} whose presence indicates that the
635 subroutine has been identified as the starting function of
636 the program. If more than one subprogram contains this
638 any one of them may be the starting subroutine of the program.
640 \textit{Fortran has a PROGRAM statement which is used to specify
641 and provide a user\dash supplied name for the main subroutine of
645 \textit{A common debugger feature is to allow the debugger user to call
646 a subroutine within the subject program. In certain cases,
647 however, the generated code for a subroutine will not obey
648 the standard calling conventions for the target architecture
649 and will therefore not be safe to call from within a debugger.
652 A subroutine entry may
653 \hypertarget{chap:DWATcallingconventionsubprogramcallingconvention}
655 \livelink{chap:DWATcallingconvention}{DW\-\_AT\-\_calling\-\_convention}
656 attribute, whose value is an integer constant. The set of
657 calling convention codes is given in
658 Figure \refersec{fig:callingconventioncodes}.
661 \autorows[0pt]{c}{1}{l}{
662 \addtoindex{DW\-\_CC\-\_normal},
663 \addtoindex{DW\-\_CC\-\_program},
664 \addtoindex{DW\-\_CC\-\_nocall},
666 \caption{Calling convention codes}\label{fig:callingconventioncodes}
669 If this attribute is not present, or its value is the constant
670 \livetarg{chap:DWCCnormal}{DW\-\_CC\-\_normal}, then the subroutine may be safely called by
671 obeying the ``standard'' calling conventions of the target
672 architecture. If the value of the calling convention attribute
673 is the constant \livetarg{chap:DWCCnocall}{DW\-\_CC\-\_nocall}, the subroutine does not obey
674 standard calling conventions, and it may not be safe for the
675 debugger to call this subroutine.
677 If the semantics of the language of the compilation unit
678 containing the subroutine entry distinguishes between ordinary
679 subroutines and subroutines that can serve as the ``main
680 program,'' that is, subroutines that cannot be called
681 directly according to the ordinary calling conventions,
682 then the debugging information entry for such a subroutine
683 may have a calling convention attribute whose value is the
684 constant \livetarg{chap:DWCCprogram}{DW\-\_CC\-\_program}.
686 \textit{The \livelink{chap:DWCCprogram}{DW\-\_CC\-\_program} value is intended to support Fortran main
687 programs which in some implementations may not be callable
688 or which must be invoked in a special way. It is not intended
689 as a way of finding the entry address for the program.
692 \textit{In C there is a difference between the types of functions
693 declared using function prototype style declarations and
694 those declared using non\dash prototype declarations.
697 A subroutine entry declared with a function prototype style
698 declaration may have a
699 \livelink{chap:DWATprototyped}{DW\-\_AT\-\_prototyped} attribute, which is
700 a \livelink{chap:flag}{flag}.
702 \textit{The Fortran language allows the keywords elemental, pure
703 and recursive to be included as part of the declaration of
704 a subroutine; these attributes reflect that usage. These
705 attributes are not relevant for languages that do not support
706 similar keywords or syntax. In particular, the \livelink{chap:DWATrecursive}{DW\-\_AT\-\_recursive}
707 attribute is neither needed nor appropriate in languages such
708 as C where functions support recursion by default.
712 \hypertarget{chap:DWATelementalelementalpropertyofasubroutine}
714 \livelink{chap:DWATelemental}{DW\-\_AT\-\_elemental} attribute, which
715 is a \livelink{chap:flag}{flag}.
716 The attribute indicates whether the subroutine
717 or entry point was declared with the ``elemental'' keyword
721 \hypertarget{chap:DWATpurepurepropertyofasubroutine}
722 subprogram entry may have a
723 \livelink{chap:DWATpure}{DW\-\_AT\-\_pure} attribute, which is
724 a \livelink{chap:flag}{flag}.
725 The attribute indicates whether the subroutine was
726 declared with the ``pure'' keyword or property.
729 \hypertarget{chap:DWATrecursiverecursivepropertyofasubroutine}
730 subprogram entry may have a
731 \livelink{chap:DWATrecursive}{DW\-\_AT\-\_recursive} attribute, which
732 is a \livelink{chap:flag}{flag}.
733 The attribute indicates whether the subroutine
734 or entry point was declared with the ``recursive'' keyword
739 \subsection{Subroutine and Entry Point Return Types}
740 \label{chap:subroutineandentrypointreturntypes}
743 \hypertarget{chap:DWATtypetypeofsubroutinereturn}
744 the subroutine or entry point is a function that returns a
745 value, then its debugging information entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type}
746 attribute to denote the type returned by that function.
748 \textit{Debugging information entries for C void functions should
749 not have an attribute for the return type. }
752 \subsection{Subroutine and Entry Point Locations}
753 \label{chap:subroutineandentrypointlocations}
755 A subroutine entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
756 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
757 whose values encode the contiguous or non\dash contiguous address
758 ranges, respectively, of the machine instructions generated
759 for the subroutine (see
760 Section \refersec{chap:codeaddressesandranges}).
763 \hypertarget{chap:DWATentrypcentryaddressofsubprogram}
764 subroutine entry may also have a
765 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute
766 whose value is the address of the first executable instruction
767 of the subroutine (see
768 Section \refersec{chap:entryaddress}).
770 An entry point has a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute whose value is the
771 relocated address of the first machine instruction generated
774 \textit{While the \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} attribute might also seem appropriate
775 for this purpose, historically the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute
776 was used before the \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc} was introduced (in DWARF
777 Version 3). There is insufficient reason to change this.}
783 \addtoindexx{address class!attribute}
785 \hypertarget{chap:DWATaddressclasssubroutineorsubroutinetype}
787 \livelink{chap:DWATsegment}{DW\-\_AT\-\_segment}
789 \livelink{chap:DWATaddressclass}{DW\-\_AT\-\_address\-\_class} attributes,
790 as appropriate, to specify
791 which segments the code for the subroutine resides in and
792 the addressing mode to be used in calling that subroutine.
794 A subroutine entry representing a subroutine declaration
795 that is not also a definition does not have code address or
799 \subsection{Declarations Owned by Subroutines and Entry Points}
800 \label{chap:declarationsownedbysubroutinesandentrypoints}
802 The declarations enclosed by a subroutine or entry point are
803 represented by debugging information entries that are owned
804 by the subroutine or entry point entry. Entries representing
805 the formal parameters of the subroutine or entry point appear
806 in the same order as the corresponding declarations in the
809 \textit{There is no ordering requirement for entries for declarations
810 that are children of subroutine or entry point entries but
811 that do not represent formal parameters. The formal parameter
812 entries may be interspersed with other entries used by formal
813 parameter entries, such as type entries.}
815 The unspecified parameters of a variable parameter list are
816 represented by a debugging information entry with the tag
817 \livetarg{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters}.
819 The entry for a subroutine that includes a
820 Fortran \livelink{chap:fortrancommonblock}{common} \livelink{chap:commonblockentry}{block}
821 \index{common block|see{Fortran common block}}
822 has a child entry with the
823 tag \livetarg{chap:DWTAGcommoninclusion}{DW\-\_TAG\-\_common\-\_inclusion}.
825 \hypertarget{chap:commonreferencecommonblockusage}
826 common inclusion entry has a
827 \livelink{chap:DWATcommonreference}{DW\-\_AT\-\_common\-\_reference} attribute
828 whose value is a reference to the debugging information entry
829 for the common \nolink{block} being included
830 (see Section \refersec{chap:commonblockentries}).
832 \subsection{Low-Level Information}
833 \label{chap:lowlevelinformation}
836 \hypertarget{chap:DWATreturnaddrsubroutinereturnaddresssavelocation}
837 subroutine or entry point entry may have a
838 \livelink{chap:DWATreturnaddr}{DW\-\_AT\-\_return\-\_addr}
839 attribute, whose value is a location description. The location
840 calculated is the place where the return address for the
841 subroutine or entry point is stored.
844 \hypertarget{chap:DWATframebasesubroutineframebaseaddress}
845 subroutine or entry point entry may also have a
846 \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute, whose value is a location
847 description that computes the “frame base” for the
848 subroutine or entry point. If the location description is
849 a simple register location description, the given register
850 contains the frame base address. If the location description is
851 a DWARF expression, the result of evaluating that expression
852 is the frame base address. Finally, for a location list,
853 this interpretation applies to each location description
854 contained in the list of location list entries.
856 \textit{The use of one of the \livelink{chap:DWOPreg}{DW\-\_OP\-\_reg}~\textless~n~\textgreater
858 context is equivalent to using
859 \livelink{chap:DWOPbreg}{DW\-\_OP\-\_breg}~\textless~n~\textgreater(0)
861 compact. However, these are not equivalent in general.}
863 \textit{The frame base for a procedure is typically an address fixed
864 relative to the first unit of storage allocated for the
865 procedure’s stack frame. The \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute
866 can be used in several ways:}
868 \begin{enumerate}[1.]
869 \item \textit{In procedures that need location lists to locate local
870 variables, the \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} can hold the needed location
871 list, while all variables’ location descriptions can be
872 simpler ones involving the frame base.}
874 \item \textit{It can be used in resolving ``up\dash level'' addressing
875 within nested routines.
876 (See also \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link}, below)}
877 %The -See also- here is ok, the DW\-\_AT should be
878 %a hyperref to the def itself, which is earlier in this document.
881 \textit{Some languages support nested subroutines. In such languages,
882 it is possible to reference the local variables of an
883 outer subroutine from within an inner subroutine. The
884 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} and \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attributes allow
885 debuggers to support this same kind of referencing.}
888 \hypertarget{chap:DWATstaticlinklocationofuplevelframe}
890 \addtoindexx{address!uplevel|see{static link attribute}}
891 subroutine or entry point is nested, it may have a
892 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link}
893 attribute, whose value is a location
894 description that computes the frame base of the relevant
895 instance of the subroutine that immediately encloses the
896 subroutine or entry point.
898 In the context of supporting nested subroutines, the
899 \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} attribute value should obey the following
902 \begin{enumerate}[1.]
903 \item It should compute a value that does not change during the
904 life of the procedure, and
906 \item The computed value should be unique among instances of
907 the same subroutine. (For typical \livelink{chap:DWATframebase}{DW\-\_AT\-\_frame\-\_base} use, this
908 means that a recursive subroutine’s stack frame must have
912 \textit{If a debugger is attempting to resolve an up\dash level reference
913 to a variable, it uses the nesting structure of DWARF to
914 determine which subroutine is the lexical parent and the
915 \livelink{chap:DWATstaticlink}{DW\-\_AT\-\_static\-\_link} value to identify the appropriate active
916 frame of the parent. It can then attempt to find the reference
917 within the context of the parent.}
921 \subsection{Types Thrown by Exceptions}
922 \label{chap:typesthrownbyexceptions}
924 \textit{In C++ a subroutine may declare a set of types which
925 it may validly throw.}
927 If a subroutine explicitly declares that it may throw
928 an exception for one or more types, each such type is
929 represented by a debugging information entry with the tag
930 \livetarg{chap:DWTAGthrowntype}{DW\-\_TAG\-\_thrown\-\_type}.
931 Each such entry is a child of the entry
932 representing the subroutine that may throw this type. Each
933 thrown type entry contains a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, whose
934 value is a reference to an entry describing the type of the
935 exception that may be thrown.
937 \subsection{Function Template Instantiations}
938 \label{chap:functiontemplateinstantiations}
940 \textit{In C++, a function template is a generic definition of
941 a function that is instantiated differently when called with
942 values of different types. DWARF does not represent the generic
943 template definition, but does represent each instantiation.}
945 A template instantiation is represented by a debugging
946 information entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. With four
947 exceptions, such an entry will contain the same attributes and
948 will have the same types of child entries as would an entry
949 for a subroutine defined explicitly using the instantiation
950 types. The exceptions are:
952 \begin{enumerate}[1.]
953 \item Each formal parameterized type declaration appearing in the
954 template definition is represented by a debugging information
956 tag \livetarg{chap:DWTAGtemplatetypeparameter}{DW\-\_TAG\-\_template\-\_type\-\_parameter}.
958 such entry has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, whose value is a
959 null\dash terminated string containing the name of the formal
960 type parameter as it appears in the source program. The
961 template type parameter entry also has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute
962 describing the actual type by which the formal is replaced
963 for this instantiation.
965 \item The subprogram entry and each of its child entries reference
966 a template type parameter entry in any circumstance where
967 the template definition referenced a formal parameterized type.
969 \item If the compiler has generated a special compilation unit
970 to hold the template instantiation and that compilation unit
971 has a different name from the compilation unit containing
972 the template definition, the name attribute for the debugging
973 information entry representing that compilation unit is empty
976 \item If the subprogram entry representing the template
977 instantiation or any of its child entries contain declaration
978 coordinate attributes, those attributes refer to the source
979 for the template definition, not to any source generated
980 artificially by the compiler for this instantiation.
985 \subsection{Inlinable and Inlined Subroutines}
986 A declaration or a definition of an inlinable subroutine
987 is represented by a debugging information entry with the
989 \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}.
990 The entry for a subroutine that is
991 \hypertarget{chap:DWATinlineinlinedsubroutine}
992 explicitly declared to be available for inline expansion or
993 that was expanded inline implicitly by the compiler has a
994 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is an integer constant. The
995 set of values for the \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute is given in
996 Figure \refersec{fig:inlinecodes}.
1000 \caption{Inline codes}
1001 \label{fig:inlinecodes}
1002 \begin{tabular}{lp{9cm}}
1003 Name&Meaning\\ \hline
1004 \livetarg{chap:DWINLnotinlined}{DW\-\_INL\-\_not\-\_inlined} & Not delared inline nor inlined by the
1005 compiler(equivalent to the absense of the containing
1006 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute) \\
1007 \livetarg{chap:DWINLinlined}{DW\-\_INL\-\_inlined} & Not declared inline but inlined by the compiler \\
1008 \livetarg{chap:DWINLdeclarednotinlined}{DW\-\_INL\-\_declared\-\_not\-\_inlined} & Declared inline but
1009 not inlined by the compiler \\
1010 \livetarg{chap:DWINLdeclaredinlined}{DW\-\_INL\-\_declared\-\_inlined} & Declared inline and inlined by the compiler \\
1014 \textit{In C++, a function or a constructor declared with
1015 constexpr is implicitly declared inline. The abstract inline
1016 instance (see below) is represented by a debugging information
1017 entry with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}. Such an entry has a
1018 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is \livelink{chap:DWINLinlined}{DW\-\_INL\-\_inlined}.}
1021 \paragraph{Abstract Instances}
1022 \label{chap:abstractinstances}
1023 Any debugging information entry that is owned (either
1024 \hypertarget{chap:DWATinlineabstracttinstance}
1025 directly or indirectly) by a debugging information entry
1027 \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute is referred to
1028 as an ``abstract instance entry.'' Any subroutine entry
1029 that contains a \livelink{chap:DWATinline}{DW\-\_AT\-\_inline} attribute whose value is other
1030 than \livelink{chap:DWINLnotinlined}{DW\-\_INL\-\_not\-\_inlined} is known as
1031 an ``abstract instance root.''
1032 Any set of abstract instance entries that are all
1033 children (either directly or indirectly) of some abstract
1034 instance root, together with the root itself, is known as
1035 an ``abstract instance tree.'' However, in the case where
1036 an abstract instance tree is nested within another abstract
1037 instance tree, the entries in the nested abstract instance
1038 tree are not considered to be entries in the outer abstract
1041 Each abstract instance root is either part of a larger
1042 tree (which gives a context for the root) or uses
1043 \livelink{chap:DWATspecification}{DW\-\_AT\-\_specification} to refer to the declaration in context.
1045 \textit{For example, in C++ the context might be a namespace
1046 declaration or a class declaration.}
1048 \textit{Abstract instance trees are defined so that no entry is part
1049 of more than one abstract instance tree. This simplifies the
1050 following descriptions.}
1052 A debugging information entry that is a member of an abstract
1053 instance tree should not contain any attributes which describe
1054 aspects of the subroutine which vary between distinct inlined
1055 expansions or distinct out\dash of\dash line expansions. For example,
1056 the \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc},
1057 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc}, \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges},
1058 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc}, \livelink{chap:DWATlocation}{DW\-\_AT\-\_location},
1059 \livelink{chap:DWATreturnaddr}{DW\-\_AT\-\_return\-\_addr}, \livelink{chap:DWATstartscope}{DW\-\_AT\-\_start\-\_scope}, and
1060 \livelink{chap:DWATsegment}{DW\-\_AT\-\_segment}
1061 attributes typically should be omitted; however, this list
1064 \textit{It would not make sense normally to put these attributes into
1065 abstract instance entries since such entries do not represent
1066 actual (concrete) instances and thus do not actually exist at
1067 run\dash time. However,
1068 see Appendix \refersec{app:inlineouteronenormalinner}
1069 for a contrary example.}
1071 The rules for the relative location of entries belonging to
1072 abstract instance trees are exactly the same as for other
1073 similar types of entries that are not abstract. Specifically,
1074 the rule that requires that an entry representing a declaration
1075 be a direct child of the entry representing the scope of the
1076 declaration applies equally to both abstract and non\dash abstract
1077 entries. Also, the ordering rules for formal parameter entries,
1078 member entries, and so on, all apply regardless of whether
1079 or not a given entry is abstract.
1081 \paragraph{Concrete Inlined Instances}
1082 \label{chap:concreteinlinedinstances}
1084 Each inline expansion of a subroutine is represented
1085 by a debugging information entry with the
1086 tag \livetarg{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}.
1087 Each such entry should be a direct
1088 child of the entry that represents the scope within which
1089 the inlining occurs.
1091 Each inlined subroutine entry may have either a
1092 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc}
1093 and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges}
1094 attribute whose values encode the contiguous or non\dash contiguous
1095 address ranges, respectively, of the machine instructions
1096 generated for the inlined subroutine (see
1097 Section \refersec{chap:codeaddressesandranges}).
1099 \hypertarget{chap:DWATentrypcentryaddressofinlinedsubprogram}
1100 inlined subroutine entry may also contain a
1101 \livelink{chap:DWATentrypc}{DW\-\_AT\-\_entry\-\_pc}
1102 attribute, representing the first executable instruction of
1103 the inline expansion (see
1104 Section \refersec{chap:entryaddress}).
1106 % Positions of the 3 targets here is a bit arbitrary.
1108 \hypertarget{chap:DWATcalllinelinenumberofinlinedsubroutinecall}
1110 \hypertarget{chap:DWATcallcolumncolumnpositionofinlinedsubroutinecall}
1112 \hypertarget{chap:DWATcallfilefilecontaininginlinedsubroutinecall}
1113 may also have \livelink{chap:DWATcallfile}{DW\-\_AT\-\_call\-\_file},
1114 \livelink{chap:DWATcallline}{DW\-\_AT\-\_call\-\_line} and \livelink{chap:DWATcallcolumn}{DW\-\_AT\-\_call\-\_column} attributes,
1116 value is an integer constant. These attributes represent the
1117 source file, source line number, and source column number,
1118 respectively, of the first character of the statement or
1119 expression that caused the inline expansion. The call file,
1120 call line, and call column attributes are interpreted in
1121 the same way as the declaration file, declaration line, and
1122 declaration column attributes, respectively (see
1123 Section \refersec{chap:declarationcoordinates}).
1125 The call file, call line and call column coordinates do not
1126 describe the coordinates of the subroutine declaration that
1127 was inlined, rather they describe the coordinates of the call.
1129 An inlined subroutine entry
1130 \hypertarget{chap:DWATconstexprcompiletimeconstantfunction}
1132 \livelink{chap:DWATconstexpr}{DW\-\_AT\-\_const\-\_expr}
1133 attribute, which is a \livelink{chap:flag}{flag}
1134 whose presence indicates that the
1135 subroutine has been evaluated as a compile\dash time constant. Such
1136 an entry may also have a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute,
1137 whose value may be of any form that is appropriate for the
1138 representation of the subroutine's return value. The value of
1139 this attribute is the actual return value of the subroutine,
1140 represented as it would be on the target architecture.
1142 \textit{In C++, if a function or a constructor declared with constexpr
1143 is called with constant expressions, then the corresponding
1144 concrete inlined instance has a \livelink{chap:DWATconstexpr}{DW\-\_AT\-\_const\-\_expr} attribute,
1145 as well as a \livelink{chap:DWATconstvalue}{DW\-\_AT\-\_const\-\_value} attribute whose value represents
1146 the actual return value of the concrete inlined instance.}
1148 Any debugging information entry that is owned (either
1149 directly or indirectly) by a debugging information entry
1150 with the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine} is referred to as a
1151 ``concrete inlined instance entry.'' Any entry that has
1152 the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}
1153 is known as a ``concrete inlined instance root.'' Any set of concrete inlined instance
1154 entries that are all children (either directly or indirectly)
1155 of some concrete inlined instance root, together with the root
1156 itself, is known as a ``concrete inlined instance tree.''
1157 However, in the case where a concrete inlined instance tree
1158 is nested within another concrete instance tree, the entries
1159 in the nested concrete instance tree are not considered to
1160 be entries in the outer concrete instance tree.
1162 \textit{Concrete inlined instance trees are defined so that no entry
1163 is part of more than one concrete inlined instance tree. This
1164 simplifies later descriptions.}
1166 Each concrete inlined instance tree is uniquely associated
1167 with one (and only one) abstract instance tree.
1169 \textit{Note, however, that the reverse is not true. Any given abstract
1170 instance tree may be associated with several different concrete
1171 inlined instance trees, or may even be associated with zero
1172 concrete inlined instance trees.}
1174 Concrete inlined instance entries may omit attributes that
1175 are not specific to the concrete instance (but present in
1176 the abstract instance) and need include only attributes that
1177 are specific to the concrete instance (but omitted in the
1178 abstract instance). In place of these omitted attributes, each
1179 \hypertarget{chap:DWATabstractorigininlineinstance}
1180 concrete inlined instance entry
1182 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin}
1183 attribute that may be used to obtain the missing information
1184 (indirectly) from the associated abstract instance entry. The
1185 value of the abstract origin attribute is a reference to the
1186 associated abstract instance entry.
1188 If an entry within a concrete inlined instance tree contains
1189 attributes describing the declaration coordinates of that
1190 entry, then those attributes should refer to the file, line
1191 and column of the original declaration of the subroutine,
1192 not to the point at which it was inlined. As a consequence,
1193 they may usually be omitted from any entry that has an abstract
1196 For each pair of entries that are associated via a
1197 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attribute, both members of the pair
1198 have the same tag. So, for example, an entry with the tag
1199 \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable} can only be associated with another entry
1200 that also has the tag \livelink{chap:DWTAGvariable}{DW\-\_TAG\-\_variable}. The only exception
1201 to this rule is that the root of a concrete instance tree
1202 (which must always have the tag \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine})
1203 can only be associated with the root of its associated abstract
1204 instance tree (which must have the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram}).
1206 In general, the structure and content of any given concrete
1207 inlined instance tree will be closely analogous to the
1208 structure and content of its associated abstract instance
1209 tree. There are a few exceptions:
1211 \begin{enumerate}[1.]
1212 \item An entry in the concrete instance tree may be omitted if
1213 it contains only a \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attribute and either
1214 has no children, or its children are omitted. Such entries
1215 would provide no useful information. In C\dash like languages,
1216 such entries frequently include types, including structure,
1217 union, class, and interface types; and members of types. If any
1218 entry within a concrete inlined instance tree needs to refer
1219 to an entity declared within the scope of the relevant inlined
1220 subroutine and for which no concrete instance entry exists,
1221 the reference should refer to the abstract instance entry.
1223 \item Entries in the concrete instance tree which are associated
1224 with entries in the abstract instance tree such that neither
1225 has a \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute, and neither is referenced by
1226 any other debugging information entry, may be omitted. This
1227 may happen for debugging information entries in the abstract
1228 instance trees that became unnecessary in the concrete instance
1229 tree because of additional information available there. For
1230 example, an anonymous variable might have been created and
1231 described in the abstract instance tree, but because of
1232 the actual parameters for a particular inlined expansion,
1233 it could be described as a constant value without the need
1234 for that separate debugging information entry.
1236 \item A concrete instance tree may contain entries which do
1237 not correspond to entries in the abstract instance tree
1238 to describe new entities that are specific to a particular
1239 inlined expansion. In that case, they will not have associated
1240 entries in the abstract instance tree, should not contain
1241 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin} attributes, and must contain all their
1242 own attributes directly. This allows an abstract instance tree
1243 to omit debugging information entries for anonymous entities
1244 that are unlikely to be needed in most inlined expansions. In
1245 any expansion which deviates from that expectation, the
1246 entries can be described in its concrete inlined instance tree.
1250 \paragraph{Out-of-Line Instances of Inlined Subroutines}
1251 \label{chap:outoflineinstancesofinlinedsubroutines}
1252 Under some conditions, compilers may need to generate concrete
1253 executable instances of inlined subroutines other than at
1254 points where those subroutines are actually called. Such
1255 concrete instances of inlined subroutines are referred to as
1256 ``concrete out\dash of\dash line instances.''
1258 \textit{In C++, for example, taking the address of a function declared
1259 to be inline can necessitate the generation of a concrete
1260 out\dash of\dash line instance of the given function.}
1262 The DWARF representation of a concrete out\dash of\dash line instance
1263 of an inlined subroutine is essentially the same as for a
1264 concrete inlined instance of that subroutine (as described in
1265 the preceding section). The representation of such a concrete
1266 % It is critical that the hypertarget and livelink be
1267 % separated to avoid problems with latex.
1268 out\dash of\dash line instance
1269 \hypertarget{chap:DWATabstractoriginoutoflineinstance}
1271 \livelink{chap:DWATabstractorigin}{DW\-\_AT\-\_abstract\-\_origin}
1272 attributes in exactly the same way as they are used for
1273 a concrete inlined instance (that is, as references to
1274 corresponding entries within the associated abstract instance
1277 The differences between the DWARF representation of a
1278 concrete out\dash of\dash line instance of a given subroutine and the
1279 representation of a concrete inlined instance of that same
1280 subroutine are as follows:
1282 \begin{enumerate}[1.]
1283 \item The root entry for a concrete out\dash of\dash line instance
1284 of a given inlined subroutine has the same tag as does its
1285 associated (abstract) inlined subroutine entry (that is, tag
1286 \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} rather than \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}).
1288 \item The root entry for a concrete out\dash of\dash line instance tree
1289 is normally owned by the same parent entry that also owns
1290 the root entry of the associated abstract instance. However,
1291 it is not required that the abstract and out\dash of\dash line instance
1292 trees be owned by the same parent entry.
1296 \paragraph{Nested Inlined Subroutines}
1297 \label{nestedinlinedsubroutines}
1298 Some languages and compilers may permit the logical nesting of
1299 a subroutine within another subroutine, and may permit either
1300 the outer or the nested subroutine, or both, to be inlined.
1302 For a non\dash inlined subroutine nested within an inlined
1303 subroutine, the nested subroutine is described normally in
1304 both the abstract and concrete inlined instance trees for
1305 the outer subroutine. All rules pertaining to the abstract
1306 and concrete instance trees for the outer subroutine apply
1307 also to the abstract and concrete instance entries for the
1310 For an inlined subroutine nested within another inlined
1311 subroutine, the following rules apply to their abstract and
1312 concrete instance trees:
1314 \begin{enumerate}[1.]
1315 \item The abstract instance tree for the nested subroutine is
1316 described within the abstract instance tree for the outer
1317 subroutine according to the rules in
1318 Section \refersec{chap:abstractinstances}, and
1319 without regard to the fact that it is within an outer abstract
1322 \item Any abstract instance tree for a nested subroutine is
1323 always omitted within the concrete instance tree for an
1326 \item A concrete instance tree for a nested subroutine is
1327 always omitted within the abstract instance tree for an
1330 \item The concrete instance tree for any inlined or out-of-line
1331 expansion of the nested subroutine is described within a
1332 concrete instance tree for the outer subroutine according
1334 Sections \refersec{chap:concreteinlinedinstances} or
1335 \refersec{chap:outoflineinstancesofinlinedsubroutines}
1337 and without regard to the fact that it is within an outer
1338 concrete instance tree.
1341 See Appendix \refersec{app:inliningexamples}
1342 for discussion and examples.
1344 \subsection{Trampolines}
1345 \label{chap:trampolines}
1347 \textit{A trampoline is a compiler\dash generated subroutine that serves as
1348 \hypertarget{chap:DWATtrampolinetargetsubroutine}
1349 an intermediary in making a call to another subroutine. It may
1350 adjust parameters and/or the result (if any) as appropriate
1351 to the combined calling and called execution contexts.}
1353 A trampoline is represented by a debugging information entry
1354 with the tag \livelink{chap:DWTAGsubprogram}{DW\-\_TAG\-\_subprogram} or \livelink{chap:DWTAGinlinedsubroutine}{DW\-\_TAG\-\_inlined\-\_subroutine}
1355 that has a \livelink{chap:DWATtrampoline}{DW\-\_AT\-\_trampoline} attribute. The value of that
1356 attribute indicates the target subroutine of the trampoline,
1357 that is, the subroutine to which the trampoline passes
1358 control. (A trampoline entry may but need not also have a
1359 \livelink{chap:DWATartificial}{DW\-\_AT\-\_artificial} attribute.)
1361 The value of the trampoline attribute may be represented
1362 using any of the following forms, which are listed in order
1366 \item If the value is of class reference, then the value
1367 specifies the debugging information entry of the target
1370 \item If the value is of class address, then the value is
1371 the relocated address of the target subprogram.
1373 \item If the value is of class string, then the value is the
1374 (possibly mangled) name of the target subprogram.
1376 \item If the value is of class \livelink{chap:flag}{flag}, then the value true
1377 indicates that the containing subroutine is a trampoline but
1378 that the target subroutine is not known.
1382 The target subprogram may itself be a trampoline. (A sequence
1383 of trampolines necessarily ends with a non\dash trampoline
1386 \textit{In C++, trampolines may be used to implement derived virtual
1387 member functions; such trampolines typically adjust the
1388 implicit this pointer parameter in the course of passing
1389 control. Other languages and environments may use trampolines
1390 in a manner sometimes known as transfer functions or transfer
1393 \textit{Trampolines may sometimes pass control to the target
1394 subprogram using a branch or jump instruction instead of a
1395 call instruction, thereby leaving no trace of their existence
1396 in the subsequent execution context. }
1398 \textit{This attribute helps make it feasible for a debugger to arrange
1399 that stepping into a trampoline or setting a breakpoint in
1400 a trampoline will result in stepping into or setting the
1401 breakpoint in the target subroutine instead. This helps to
1402 hide the compiler generated subprogram from the user. }
1404 \textit{If the target subroutine is not known, a debugger may choose
1405 to repeatedly step until control arrives in a new subroutine
1406 which can be assumed to be the target subroutine. }
1410 \section{Lexical Block Entries}
1411 \label{chap:lexicalblockentries}
1413 \textit{A lexical \livetargi{chap:lexicalblock}{block}{lexical block} is a bracketed sequence of source statements
1414 that may contain any number of declarations. In some languages
1415 (including C and C++), \nolink{blocks} can be nested within other
1416 \nolink{blocks} to any depth.}
1418 % We do not need to link to the preceeding paragraph.
1419 A lexical \nolink{block} is represented by a debugging information
1421 tag \livetarg{chap:DWTAGlexicalblock}{DW\-\_TAG\-\_lexical\-\_block}.
1423 The lexical \livetargi{chap:lexicalblockentry}{block}{lexical block entry} entry
1425 either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
1426 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of
1427 attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
1428 whose values encode the contiguous or non-contiguous address
1429 ranges, respectively, of the machine instructions generated
1430 for the lexical \livelink{chap:lexicalblock}{block}
1431 (see Section \refersec{chap:codeaddressesandranges}).
1433 If a name has been given to the
1434 lexical \livelink{chap:lexicalblock}{block}
1436 program, then the corresponding
1437 lexical \livelink{chap:lexicalblockentry}{block} entry has a
1438 \livelink{chap:DWATname}{DW\-\_AT\-\_name} attribute whose
1439 value is a null\dash terminated string
1440 containing the name of the lexical \livelink{chap:lexicalblock}{block}
1444 \textit{This is not the same as a C or C++ label (see below).}
1446 The lexical \livelink{chap:lexicalblockentry}{block} entry owns
1447 debugging information entries that
1448 describe the declarations within that lexical \livelink{chap:lexicalblock}{block}.
1450 one such debugging information entry for each local declaration
1451 of an identifier or inner lexical \livelink{chap:lexicalblock}{block}.
1453 \section{Label Entries}
1454 \label{chap:labelentries}
1456 A label is a way of identifying a source statement. A labeled
1457 statement is usually the target of one or more ``go to''
1460 A label is represented by a debugging information entry with
1462 tag \livetarg{chap:DWTAGlabel}{DW\-\_TAG\-\_label}.
1463 The entry for a label should be owned by
1464 the debugging information entry representing the scope within
1465 which the name of the label could be legally referenced within
1468 The label entry has a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} attribute whose value
1469 is the relocated address of the first machine instruction
1470 generated for the statement identified by the label in
1471 the source program. The label entry also has a \livelink{chap:DWATname}{DW\-\_AT\-\_name}
1472 attribute whose value is a null-terminated string containing
1473 the name of the label as it appears in the source program.
1476 \section{With Statement Entries}
1477 \label{chap:withstatemententries}
1479 \textit{Both Pascal and Modula\dash 2 support the concept of a ``with''
1480 statement. The with statement specifies a sequence of
1481 executable statements within which the fields of a record
1482 variable may be referenced, unqualified by the name of the
1485 A with statement is represented by a debugging information
1486 entry with the tag \livetarg{chap:DWTAGwithstmt}{DW\-\_TAG\-\_with\-\_stmt}.
1488 A with statement entry may have either a \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and
1489 \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute
1490 whose values encode the contiguous or non\dash contiguous address
1491 ranges, respectively, of the machine instructions generated
1492 for the with statement
1493 (see Section \refersec{chap:codeaddressesandranges}).
1495 The with statement entry has a \livelink{chap:DWATtype}{DW\-\_AT\-\_type} attribute, denoting
1496 the type of record whose fields may be referenced without full
1497 qualification within the body of the statement. It also has
1498 a \livelink{chap:DWATlocation}{DW\-\_AT\-\_location} attribute, describing how to find the base
1499 address of the record object referenced within the body of
1502 \section{Try and Catch Block Entries}
1503 \label{chap:tryandcatchblockentries}
1505 \textit{In C++ a lexical \livelink{chap:lexicalblock}{block} may be
1506 designated as a ``catch \nolink{block}.''
1507 A catch \livetargi{chap:catchblock}{block}{catch block} is an
1508 exception handler that handles
1509 exceptions thrown by an immediately
1510 preceding ``try \livelink{chap:tryblock}{block}.''
1511 A catch \livelink{chap:catchblock}{block}
1512 designates the type of the exception that it
1515 A try \livetargi{chap:tryblock}{block}{try block} is represented
1516 by a debugging information entry
1517 with the tag \livetarg{chap:DWTAGtryblock}{DW\-\_TAG\-\_try\-\_block}.
1518 A catch \livelink{chap:catchblock}{block} is represented by
1519 a debugging information entry with
1520 the tag \livetarg{chap:DWTAGcatchblock}{DW\-\_TAG\-\_catch\-\_block}.
1522 % nolink as we have links just above and do not have a combo link for both
1523 Both try and catch \nolink{block} entries may have either a
1524 \livelink{chap:DWATlowpc}{DW\-\_AT\-\_low\-\_pc} and \livelink{chap:DWAThighpc}{DW\-\_AT\-\_high\-\_pc} pair of attributes or a
1525 \livelink{chap:DWATranges}{DW\-\_AT\-\_ranges} attribute whose values encode the contiguous
1526 or non\dash contiguous address ranges, respectively, of the
1527 machine instructions generated for the \livelink{chap:lexicalblock}{block}
1529 \refersec{chap:codeaddressesandranges}).
1531 Catch \livelink{chap:catchblock}{block} entries have at
1532 least one child entry, an
1533 entry representing the type of exception accepted by
1534 that catch \livelink{chap:catchblock}{block}.
1536 This child entry has one of the
1537 \addtoindexx{unspecified parameters entry!in catch block}
1539 \livelink{chap:DWTAGformalparameter}{DW\-\_TAG\-\_formal\-\_parameter} or \livelink{chap:DWTAGunspecifiedparameters}{DW\-\_TAG\-\_unspecified\-\_parameters},
1540 and will have the same form as other parameter entries.
1542 The siblings immediately following
1543 a try \livelink{chap:tryblock}{block} entry are its
1544 corresponding catch \livelink{chap:catchblock}{block} entries.