00001 '\"#ident "%W%"
00002 '\" $Source: /proj/osprey/CVS/open64/osprey1.0/libdwarf/libdwarf/dwarf.v2.mm,v $
00003 '\"
00004 '\" $Revision: 1.1.1.1 $
00005 '\"
00006 '\" DESCRIPTION
00007 '\"
00008 '\" Requirements for
00009 '\"
00010 '\" COMPILATION
00011 '\"
00012 '\" pic file.mm | tbl | troff -mm
00013 '\"
00014 '\" local mileage may vary
00015 '\"
00016 '\" AUTHOR
00017 '\"
00018 '\" UNIX International Programming Languages SIG
00019 '\"
00020 '\" COPYRIGHT
00021 '\"
00022 '\" Copyright (c) 1992,1993, UNIX International
00023 '\"
00024 '\" Permission to use, copy, modify, and distribute this documentation for
00025 '\" any purpose and without fee is hereby granted, provided that the above
00026 '\" copyright notice appears in all copies and that both that copyright
00027 '\" notice and this permission notice appear in supporting documentation,
00028 '\" and that the name UNIX International not be used in advertising or
00029 '\" publicity pertaining to distribution of the software without specific,
00030 '\" written prior permission. UNIX International makes no representations
00031 '\" about the suitability of this documentation for any purpose. It is
00032 '\" provided "as is" without express or implied warranty.
00033 '\"
00034 '\" UNIX INTERNATIONAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
00035 '\" DOCUMENTATION, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
00036 '\" FITNESS. IN NO EVENT SHALL UNIX INTERNATIONAL BE LIABLE FOR ANY
00037 '\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
00038 '\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
00039 '\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00040 '\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS DOCUMENTATION.
00041 '\"
00042 '\" NOTICE:
00043 '\"
00044 '\" UNIX International is making this documentation available as a
00045 '\" reference point for the industry. While UNIX International believes
00046 '\" that this specification is well defined in this first release of the
00047 '\" document, minor changes may be made prior to products meeting this
00048 '\" specification being made available from UNIX System Laboratories or
00049 '\" UNIX International members.
00050 '\"
00051 '\" $Log: dwarf.v2.mm,v $
00052 '\" Revision 1.1.1.1 2005/10/21 19:00:00 marcel
00053 '\" Import of PathScale, version 2.2.1
00054 '\"
00055 '\"
00056 '\" Revision 1.1 1994/05/18 18:50:42 davea
00057 '\" Initial revision
00058 '\"
00059 '\"
00060 '\" Abbrevs for funny typeset words
00061 .pl-0.25i
00062 .ds aX U\s-2NIX\s+2
00063 .ds iX \*(aX International
00064 .ds uL \s-2AT&T\ USL\s+2
00065 '\"
00066 '\" uI should be set to 1 if the publication and copyright page is needed.
00067 .nr uI 1
00068 '\"
00069 '\" Make the appropriate replacements in this section!
00070 '\"
00071 '\" Set the ND date to the current date.
00072 '\" tT is the formal document title
00073 '\" tP is the name of the Project (if appropriate)
00074 '\" tD is the short document title
00075 '\" tE is the work group name (may be the same as the project name)
00076 .ds tT DWARF Debugging Information Format
00077 .ds tP
00078 '\" Document name (i.e., without project name)
00079 .ds tD DWARF Debugging Information Format
00080 .ds tE Programming Languages SIG
00081 '\"
00082 '\" Define headers and footers macro
00083 '\"
00084 .ds fA Revision: 2.0.0
00085 '\"
00086 '\" fB null to remove page numbers on cover page
00087 .ds fB
00088 .ds fC July 27, 1993
00089 .ds fE Industry Review Draft
00090 .ds fF \*(tD
00091 .PH "''''"
00092 .PF "''\*(fE''"
00093 .tr ~
00094 .SA 1
00095 .S 10
00096 .nr Ej 1
00097 .nr Hs 5
00098 .nr Hu 1
00099 .nr Hb 5
00100 .ds HP +2 +2 +1 +0 +0 +0 +0
00101 .ds HF 3 3 3 3 3 1 1
00102 .if n .ds HF 1 1 1 1 1 1 1 1
00103 '\"
00104 '\" First page, print title and authors
00105 '\"
00106 .S +4
00107 .DS C
00108
00109
00110
00111
00112
00113
00114 \fB\*(tT
00115
00116 \s-2\*(tP\s+2\fP
00117
00118 .DE
00119 .S
00120 .sp 3i
00121 \*(iX
00122 .br
00123 \*(tE
00124 .br
00125 \*(fA (\*(fC)
00126 .SK
00127 .if \n(uI\{
00128 .DS C
00129 .in -.25i
00130 .B "Published by:"
00131 .R
00132
00133 \*(iX
00134 Waterview Corporate Center
00135 20 Waterview Boulevard
00136 Parsippany, NJ 07054
00137
00138 for further information, contact:
00139 Vice President of Marketing
00140
00141 Phone: +1 201-263-8400
00142 Fax: +1 201-263-8401
00143 .DE
00144 .P
00145 Copyright \(co 1992, 1993 \*(iX, Inc.
00146 .P
00147 Permission to use, copy, modify, and distribute this
00148 documentation for any purpose and without fee is hereby granted, provided
00149 that the above copyright notice appears in all copies and that both that
00150 copyright notice and this permission notice appear in supporting
00151 documentation, and that the name \*(iX not be used in
00152 advertising or publicity pertaining to distribution of the software
00153 without specific, written prior permission. \*(iX makes
00154 no representations about the suitability of this documentation for any
00155 purpose. It is provided "as is" without express or implied warranty.
00156 .P
00157 UNIX INTERNATIONAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS DOCUMENTATION,
00158 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
00159 EVENT SHALL UNIX INTERNATIONAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
00160 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
00161 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
00162 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00163 PERFORMANCE OF THIS DOCUMENTATION.
00164 .sp 2l
00165 .if \n(uI\{
00166 NOTICE:
00167 .P
00168 \*(iX is making this documentation available as a
00169 reference point for the industry.
00170 While \*(iX believes that this specification is well
00171 defined in this first release of the document,
00172 minor changes may be made prior to products meeting this specification
00173 being made available from \*(aX System Laboratories or \*(iX members.
00174 .sp 1l \}
00175 Trademarks:
00176 .P
00177 Intel386 is a trademark of Intel Corporation.
00178 .br
00179 \*(aX\(rg is a registered trademark of \*(aX System Laboratories
00180 in the United States and other countries.
00181 .br
00182 .OH "'''\s10\\\\*(tE\s0'"
00183 .EH "'\s10\\\\*(tD\s0'''"
00184 .SK
00185 '\".VM 0 2
00186 .PF "''\s10\\\\*(fE\s0''"
00187 .OF "'\s10\\\\*(fA'\\\\*(fB'\\\\*(fC\s0'"
00188 .EF "'\s10\\\\*(fA'\\\\*(fB'\\\\*(fC\s0'"
00189 '\" -----------------------------------------------------------------------
00190 '\".
00191 '\" Reset page numbers
00192 '\"
00193 .nr P 1
00194 .nr % 1
00195 '\"
00196 '\" Define headers and footers
00197 '\"
00198 .FH
00199 '\" Turn on the page numbering in the footers
00200 .ds fB Page %
00201 '\"
00202 '\" MACROEND
00203 '\"
00204 .if n .fp 2 R
00205 .if n .fp 3 R
00206 .tr ~
00207 \fR
00208 .S 11
00209 .SA 1
00210 .tr ~
00211 .OP
00212 .ds | |
00213 .ds ~ ~
00214 .ds ' '
00215 .if t .ds Cw \&\f(CW
00216 .if n .ds Cw \fB
00217 .de Cf \" Place every other arg in Cw font, beginning with first
00218 .if \\n(.$=1 \&\*(Cw\\$1\fP
00219 .if \\n(.$=2 \&\*(Cw\\$1\fP\\$2
00220 .if \\n(.$=3 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP
00221 .if \\n(.$=4 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4
00222 .if \\n(.$=5 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP
00223 .if \\n(.$=6 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6
00224 .if \\n(.$=7 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP
00225 .if \\n(.$=8 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8
00226 .if \\n(.$=9 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8\*(Cw
00227 ..
00228 '\" macros used by index generating tool
00229 .deIX
00230 .ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 \\n%
00231 .el \\!.ix \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
00232 ..
00233 .deix
00234 .ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 \\n%
00235 .el \\!.ix \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
00236 ..
00237 .ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i
00238 .HU "FOREWORD"
00239 This document specifies the second generation of symbolic debugging
00240 information based on the DWARF format that
00241 has been developed by the \*(iX
00242 Programming Languages Special Interest Group (SIG).
00243 It is being circulated for industry review.
00244 The first version of the DWARF specification was published
00245 by \*(iX in January, 1992. The current version adds significant
00246 new functionality, but its main thrust is to achieve a much
00247 denser encoding of the DWARF information. Because of the new
00248 encoding, DWARF Version 2 is not binary compatible with
00249 DWARF Version 1.
00250 .P
00251 At this point, the SIG believes that this document sufficiently
00252 supports the debugging needs of C, C++, FORTRAN 77,
00253 Fortran90, Modula2 and Pascal, and we have
00254 released it for public comment. We will accept comments on this
00255 document until September 30, 1994. Comments may be directed via email
00256 to the SIG mailing list (plsig@ui.org). If you are unable
00257 to send email, paper mail, FAX, or machine readable copy
00258 on \*(aX, MS-DOS, or Macintosh compatible media can be
00259 sent to \*(iX at the address listed below,
00260 and will be forwarded to the SIG.
00261 .SP
00262 .SP
00263 .SP
00264 .in +20
00265 UNIX International
00266 .br
00267 Waterview Corporate Center
00268 .br
00269 20 Waterview Boulevard
00270 .br
00271 Parsippany, NJ 07054
00272 .br
00273 Phone: +1 201-263-8400
00274 .br
00275 Fax: +1 201-263-8401
00276 .br
00277 .in -20
00278 .nr H1 0
00279 .OP
00280 .H 1 "INTRODUCTION"
00281 \fR
00282 This document defines the format for the information generated by
00283 compilers, assemblers and linkage editors that is necessary for symbolic,
00284 source-level debugging. The debugging information format does not favor the
00285 design of any compiler or debugger. Instead, the goal is to create a method of
00286 communicating an accurate picture of the source program to any debugger in a
00287 form that is economically extensible to different languages while retaining
00288 backward compatibility.
00289 .P
00290 The design of the debugging information format is open-ended, allowing for the
00291 addition of new debugging information to accommodate new languages or
00292 debugger capabilities while remaining compatible with other languages or
00293 different debuggers.
00294 .H 2 "Purpose and Scope"
00295 The debugging information format described in this document is designed to
00296 meet the symbolic, source-level debugging needs of
00297 different languages in a unified fashion by
00298 requiring language independent debugging information whenever possible.
00299 .IX C++ %caa
00300 .IX virtual functions
00301 .IX Fortran
00302 Individual needs, such as C++ virtual functions or Fortran common blocks are
00303 accommodated by creating attributes that are used only for those
00304 languages. The \*(iX \*(tE believes
00305 that this document sufficiently covers the
00306 .IX languages
00307 debugging information needs of C, C++, FORTRAN77, Fortran90,
00308 Modula2 and Pascal.
00309 .IX C %c
00310 .IX Modula2
00311 .IX Pascal
00312 .IX FORTRAN77
00313 .IX Fortran90
00314 .P
00315 This document describes DWARF Version 2, the second generation of debugging
00316 .IX Version 2
00317 information based on the DWARF format. While DWARF Version 2 provides
00318 new debugging information not available in Version 1, the primary focus
00319 of the changes for Version 2 is the representation of the information,
00320 rather than the information content itself. The basic structure of
00321 the Version 2 format remains as in Version 1: the debugging information
00322 is represented as a series of debugging information entries, each containing
00323 one or more attributes (name/value pairs).
00324 .IX debugging information entries
00325 .IX attributes
00326 The Version 2 representation, however,
00327 is much more compact than the Version 1 representation.
00328 .IX Version 1
00329 In some cases, this greater density has been achieved at the expense
00330 of additional complexity or greater difficulty in producing and processing
00331 the DWARF information. We believe that the reduction in I/O and in
00332 memory paging should more than make up for any increase in processing time.
00333 .P
00334 Because the representation of information has changed from Version 1 to
00335 Version 2, Version 2 DWARF information is not binary compatible
00336 .IX compatibility
00337 with Version 1 information. To make it easier for consumers to
00338 support both Version 1 and Version 2 DWARF information, the Version
00339 2 information has been moved to a different object file section,
00340 .Cf .debug_info .
00341 .IX \f(CW.debug_info\fP %debugai
00342 .P
00343 The intended audience for this document are the developers of
00344 both producers and consumers of debugging information, typically
00345 language compilers, debuggers and other tools that need to interpret
00346 a binary program in terms of its original source.
00347 .H 2 "Overview"
00348 There are two major pieces to the description of the DWARF format in
00349 this document. The first piece is the informational content
00350 of the debugging entries. The second piece
00351 is the way the debugging information is encoded and
00352 represented in an object file.
00353 .P
00354 The informational content is described in sections two
00355 through six.
00356 Section two describes the overall structure of
00357 the information and attributes that are common to many or all of
00358 the different debugging information entries.
00359 Sections three, four and five describe the specific debugging
00360 information entries and how they communicate the
00361 necessary information about the source program to a debugger.
00362 Section six describes debugging information contained
00363 outside of the debugging information entries, themselves.
00364 The encoding of the DWARF information is
00365 presented in section seven.
00366 .P
00367 Section eight describes some future directions for the DWARF
00368 specification.
00369 .P
00370 In the following sections, text in normal font describes required aspects
00371 of the DWARF format. Text in \fIitalics\fP is explanatory or supplementary
00372 material, and not part of the format definition itself.
00373 .H 2 "Vendor Extensibility"
00374 .IX vendor extensions
00375 This document does not attempt to cover all interesting languages or even
00376 to cover all of the interesting debugging information needs for its primary
00377 target languages (C, C++, FORTRAN77, Fortran90, Modula2, Pascal).
00378 Therefore the document provides
00379 vendors a way to define their own debugging information tags, attributes,
00380 base type encodings, location operations, language names,
00381 calling conventions and call frame instructions
00382 by reserving a portion of the name space and valid values
00383 for these constructs for vendor specific additions. Future versions
00384 of this document will not use names or values reserved for vendor specific
00385 additions. All names and values not reserved for vendor additions, however,
00386 are reserved for future versions of this document. See section 7 for
00387 details.
00388 .H 2 "Changes from Version 1"
00389 The following is a list of the major changes made to the DWARF Debugging
00390 Information Format since Version 1 of the format was published (January
00391 .IX Version 1
00392 20, 1992). The list is not meant to be exhaustive.
00393 .BL
00394 .LI
00395 Debugging information entries have been moved from the
00396 .Cf .debug
00397 .IX \f(CW.debug\fP %debugaaa
00398 to the
00399 .Cf .debug_info
00400 .IX \f(CW.debug_info\fP %debugai
00401 section of an object file.
00402 .LI
00403 .IX tags
00404 .IX attributes, names
00405 .IX attributes, forms
00406 The tag, attribute names and attribute forms encodings have been moved
00407 out of the debugging information itself to a separate abbreviations table.
00408 .IX abbreviations table
00409 .LI
00410 Explicit sibling pointers have been made optional. Each
00411 .IX debugging information entries, siblings
00412 entry now specifies (through the abbreviations table) whether
00413 or not it has children.
00414 .IX debugging information entries, child entries
00415 .LI
00416 New more compact attribute forms have been added, including a variable
00417 length constant data form. Attribute values may now have any
00418 .IX variable length data
00419 .IX attributes, forms
00420 .IX attributes, values
00421 form within a given class of forms.
00422 .LI
00423 Location descriptions have been replaced by a new, more compact
00424 and more expressive format.
00425 .IX locations, descriptions
00426 There is now a way of expressing multiple locations for an object
00427 whose location changes during its lifetime.
00428 .IX locations, lists
00429 .LI
00430 There is a new format for line number information
00431 that provides information
00432 for code contributed to a compilation unit from an included file.
00433 Line number information is now in the
00434 .IX line number information
00435 .Cf .debug_line
00436 .IX \f(CW.debug_line\fP %debugali
00437 section of an object file.
00438 .LI
00439 The representation of the type of a declaration has been
00440 reworked.
00441 .IX declarations, types of
00442 .LI
00443 A new section provides an encoding for pre-processor macro information.
00444 .IX macro information
00445 .IX pre-processor
00446 .LI
00447 Debugging information entries now provide for the representation
00448 of non-defining declarations of objects, functions or types.
00449 .IX declarations, non-defining
00450 .LI
00451 More complete support for Modula2 and Pascal has been added.
00452 .LI
00453 There is now a way of describing locations for segmented address spaces.
00454 .IX segmented address space
00455 .IX address space, segmented
00456 .LI
00457 A new section provides an encoding for information about call
00458 frame activations.
00459 .IX call frame information
00460 .IX activations
00461 .LI
00462 The representation of enumeration and array types has been
00463 .IX enumerations
00464 .IX arrays
00465 reworked so that DWARF presents only a single way of
00466 representing lists of items.
00467 .LI
00468 Support has been added for C++ templates and exceptions.
00469 .IX C++ %caa
00470 .IX templates
00471 .IX exceptions
00472 .LE
00473 .OP
00474 .H 1 "GENERAL DESCRIPTION"
00475 .H 2 "The Debugging Information Entry"
00476 DWARF uses a series of debugging information entries to define a
00477 .IX debugging information entries
00478 low-level representation of a source program. Each debugging
00479 information entry is described by an identifying tag and
00480 contains a series of attributes.
00481 The tag specifies the class to which an entry
00482 belongs, and the attributes define the specific characteristics
00483 of the entry.
00484 .P
00485 .nr aX \n(Fg+1
00486 The set of required tag names is listed in Figure \n(aX.
00487 .IX tags
00488 The debugging information entries they identify are described in sections three, four and five.
00489 .P
00490 The debugging information entries in DWARF Version 2 are intended
00491 to exist in the
00492 .Cf .debug_info
00493 section of an object file.
00494 .IX \f(CW.debug_info\fP %debugai
00495 .DF
00496 .TS
00497 center box;
00498 lf(CW) lf(CW)
00499 .
00500 DW_TAG_access_declaration DW_TAG_array_type
00501 DW_TAG_base_type DW_TAG_catch_block
00502 DW_TAG_class_type DW_TAG_common_block
00503 DW_TAG_common_inclusion DW_TAG_compile_unit
00504 DW_TAG_const_type DW_TAG_constant
00505 DW_TAG_entry_point DW_TAG_enumeration_type
00506 DW_TAG_enumerator DW_TAG_file_type
00507 DW_TAG_formal_parameter DW_TAG_friend
00508 DW_TAG_imported_declaration DW_TAG_inheritance
00509 DW_TAG_inlined_subroutine DW_TAG_label
00510 DW_TAG_lexical_block DW_TAG_member
00511 DW_TAG_module DW_TAG_namelist
00512 DW_TAG_namelist_item DW_TAG_packed_type
00513 DW_TAG_pointer_type DW_TAG_ptr_to_member_type
00514 DW_TAG_reference_type DW_TAG_set_type
00515 DW_TAG_string_type DW_TAG_structure_type
00516 DW_TAG_subprogram DW_TAG_subrange_type
00517 DW_TAG_subroutine_type DW_TAG_template_type_param
00518 DW_TAG_template_value_param DW_TAG_thrown_type
00519 DW_TAG_try_block DW_TAG_typedef
00520 DW_TAG_union_type DW_TAG_unspecified_parameters
00521 DW_TAG_variable DW_TAG_variant
00522 DW_TAG_variant_part DW_TAG_volatile_type
00523 DW_TAG_with_stmt
00524 .TE
00525 .FG "Tag names"
00526 .DE
00527 .H 2 "Attribute Types"
00528 Each attribute value is characterized by an attribute name.
00529 .IX attributes
00530 .IX attributes, names
00531 The set of attribute names is
00532 .nr aX \n(Fg+1
00533 listed in Figure \n(aX.
00534 .DF
00535 .TS
00536 center box;
00537 lf(CW) lf(CW)
00538 .
00539 DW_AT_abstract_origin DW_AT_accessibility
00540 DW_AT_address_class DW_AT_artificial
00541 DW_AT_base_types DW_AT_bit_offset
00542 DW_AT_bit_size DW_AT_byte_size
00543 DW_AT_calling_convention DW_AT_common_reference
00544 DW_AT_comp_dir DW_AT_const_value
00545 DW_AT_containing_type DW_AT_count
00546 DW_AT_data_member_location DW_AT_decl_column
00547 DW_AT_decl_file DW_AT_decl_line
00548 DW_AT_declaration DW_AT_default_value
00549 DW_AT_discr DW_AT_discr_list
00550 DW_AT_discr_value DW_AT_encoding
00551 DW_AT_external DW_AT_frame_base
00552 DW_AT_friend DW_AT_high_pc
00553 DW_AT_identifier_case DW_AT_import
00554 DW_AT_inline DW_AT_is_optional
00555 DW_AT_language DW_AT_location
00556 DW_AT_low_pc DW_AT_lower_bound
00557 DW_AT_macro_info DW_AT_name
00558 DW_AT_namelist_item DW_AT_ordering
00559 DW_AT_priority DW_AT_producer
00560 DW_AT_prototyped DW_AT_return_addr
00561 DW_AT_segment DW_AT_sibling
00562 DW_AT_specification DW_AT_start_scope
00563 DW_AT_static_link DW_AT_stmt_list
00564 DW_AT_stride_size DW_AT_string_length
00565 DW_AT_type DW_AT_upper_bound
00566 DW_AT_use_location DW_AT_variable_parameter
00567 DW_AT_virtuality DW_AT_visibility
00568 DW_AT_vtable_elem_location
00569 .TE
00570 .FG "Attribute names"
00571 .DE
00572 .P
00573 The permissible values for an attribute belong to one or more classes
00574 .IX attributes, values
00575 .IX attributes, forms
00576 of attribute value forms. Each form class may be represented in one or more
00577 ways. For instance, some attribute values consist of a single piece
00578 of constant data. ``Constant data'' is the class of attribute value
00579 that those attributes may have. There are several representations
00580 of constant data, however (one, two, four, eight bytes and variable
00581 length data). The particular representation for any given instance
00582 of an attribute is encoded along with the attribute name as part
00583 of the information that guides the interpretation of a debugging
00584 information entry. Attribute value forms may belong
00585 to one of the following classes.
00586 .VL 18
00587 .LI address
00588 .IX attributes, addresses
00589 Refers to some location in the address space of the described program.
00590 .LI block
00591 .IX attributes, blocks
00592 An arbitrary number of uninterpreted bytes of data.
00593 .LI constant
00594 .IX attributes, constants
00595 One, two, four or eight bytes of uninterpreted data, or data encoded
00596 in the variable length format known as LEB128 (see section 7.6).
00597 .IX variable length data
00598 .IX LEB128
00599 .LI flag
00600 .IX attributes, flags
00601 A small constant that indicates the presence or absence of an attribute.
00602 .LI reference
00603 .IX attributes, references
00604 Refers to some member of the set of debugging information entries that describe
00605 the program. There are two types of reference. The first is an
00606 offset relative to the beginning of the compilation unit in
00607 which the reference occurs and must refer to an entry within
00608 that same compilation unit. The second type of reference
00609 is the address of any debugging information entry within
00610 the same executable or shared object; it may refer to an entry
00611 in a different compilation unit from the unit containing the
00612 reference.
00613 .LI string
00614 .IX attributes, strings
00615 A null-terminated sequence of zero or more (non-null) bytes.
00616 Data in this form are generally printable strings. Strings
00617 may be represented directly in the debugging information entry
00618 or as an offset in a separate string table.
00619 .LE
00620 .P
00621 There are no limitations on the ordering of attributes within a debugging
00622 .IX attributes, ordering
00623 information entry, but to prevent ambiguity,
00624 no more than one attribute with a given name may appear in any debugging
00625 information entry.
00626 .H 2 "Relationship of Debugging Information Entries"
00627 .I
00628 A variety of needs can be met by permitting a single debugging
00629 information entry to ``own'' an arbitrary number of other debugging
00630 entries and by permitting the same debugging information entry to be
00631 one of many owned by another debugging information entry.
00632 This makes it possible to describe, for example,
00633 the static block structure within
00634 a source file, show the members of a structure, union, or class, and associate
00635 declarations with source files or source files with shared objects.
00636 .P
00637 .R
00638 The ownership relation
00639 of debugging information entries is achieved naturally
00640 .IX debugging information entries
00641 because the debugging information is represented as a tree.
00642 The nodes of the tree are the debugging information entries
00643 themselves. The child entries of any node are exactly those
00644 .IX debugging information entries, child entries
00645 debugging information entries owned by that node.\*F
00646 .FS
00647 While the ownership relation of the debugging information
00648 entries is represented as a tree, other relations among
00649 the entries exist, for example, a pointer from an entry
00650 representing a variable to another entry representing
00651 the type of that variable. If all such relations are
00652 taken into account, the debugging entries form a graph,
00653 not a tree.
00654 .FE
00655 .P
00656 The tree itself is represented by flattening it in prefix
00657 order. Each debugging information entry
00658 is defined either to have child entries or not to have child entries
00659 (see section 7.5.3).
00660 If an entry is defined not to have children, the next physically
00661 succeeding entry is the sibling of the prior entry. If an entry
00662 .IX debugging information entries, siblings
00663 is defined to have children, the next physically succeeding entry
00664 is the first child of the prior entry. Additional children of the parent
00665 entry are represented as siblings of the first child. A chain
00666 of sibling entries is terminated by a null entry.
00667 .IX debugging information entries, null entries
00668 .P
00669 In cases where a producer of debugging information
00670 feels that it will be important for consumers of that information
00671 to quickly scan chains of sibling entries, ignoring the children
00672 of individual siblings, that producer may attach an
00673 .Cf AT_sibling
00674 attribute to any debugging information entry. The value of
00675 this attribute is a reference to the sibling entry of the
00676 entry to which the attribute is attached.
00677 .H 2 "Location Descriptions"
00678 .I
00679 The debugging information must provide consumers a way to find the location
00680 of program variables, determine the bounds of dynamic arrays and strings
00681 and possibly to find the base address of a subroutine's stack frame or
00682 the return address of a subroutine. Furthermore, to meet the needs
00683 of recent computer architectures and optimization techniques, the debugging
00684 information must be able to describe the location of an object
00685 whose location changes over the object's lifetime.
00686 .P
00687 .R
00688 Information about the location of program objects is provided by
00689 location descriptions. Location
00690 .IX locations, descriptions
00691 descriptions can be either of two forms:
00692 .AL
00693 .LI
00694 \fILocation expressions\fP which are a language independent representation of
00695 addressing rules
00696 .IX locations, expressions
00697 of arbitrary complexity built from a few basic
00698 building blocks, or \fIoperations\fP. They are sufficient for describing
00699 the location of any object as long as its lifetime is either static
00700 or the same as the lexical block that owns it, and it does not move throughout
00701 its lifetime.
00702 .LI
00703 \fILocation lists\fP which are used to describe objects that
00704 .IX locations, lists
00705 have a limited lifetime or change their location throughout their
00706 lifetime. Location lists are more completely described below.
00707 .LE
00708 .P
00709 The two forms are distinguished in a context sensitive manner. As the value
00710 of an attribute, a location expression is
00711 encoded as a block and a location list is encoded as a constant offset into
00712 a location list table.
00713 .P
00714 .I
00715 Note: The Version 1 concept of "location descriptions" was replaced in Version 2
00716 with this new abstraction because it is denser and more descriptive.
00717 .IX Version 1
00718 .IX Version 2
00719 .R
00720 .H 3 "Location Expressions"
00721 A location expression consists of zero or more location operations.
00722 .IX locations, expressions
00723 An expression with zero operations
00724 is used to denote an object that is
00725 present in the source code but not present in the object code
00726 (perhaps because of optimization).
00727 .IX optimized code
00728 The location operations fall into two categories, register names and
00729 addressing operations. Register names always appear alone and indicate
00730 that the referred object is contained inside a particular
00731 register. Addressing operations are memory address computation
00732 rules. All location operations are encoded as a stream of opcodes that
00733 are each followed by zero or more literal operands. The number of operands
00734 is determined by the opcode.
00735 .H 3 "Register Name Operators"
00736 .IX locations, register name operators
00737 The following operations can be used to name a register.
00738 .P
00739 .I
00740 Note that the
00741 register number represents a DWARF specific mapping of numbers onto
00742 the actual registers of a given architecture.
00743 The mapping should be chosen to gain optimal density and
00744 should be shared by all users of a given architecture.
00745 The \*(tE recommends
00746 that this mapping be defined by the ABI\*F
00747 .IX ABI
00748 .FS
00749 \fISystem V Application Binary Interface\fP, consisting of the generic
00750 interface and processor supplements for each target architecture.
00751 .FE
00752 authoring committee for each
00753 architecture.
00754 .R
00755 .AL
00756 .LI
00757 .Cf DW_OP_reg0 , " DW_OP_reg1" ", ..., " DW_OP_reg31
00758 .br
00759 The
00760 \f(CWDW_OP_reg\fP\fIn\fP
00761 operations encode the names of up to 32 registers, numbered from
00762 0 through 31, inclusive. The object addressed is in register \fIn\fP.
00763 .LI
00764 .Cf DW_OP_regx
00765 .br
00766 The
00767 .Cf DW_OP_regx
00768 operation has a single unsigned LEB128 literal operand that encodes the
00769 name of a register.
00770 .LE
00771 .H 3 "Addressing Operations"
00772 .IX locations, stack
00773 Each addressing operation represents a postfix operation on a simple stack
00774 machine. Each element of the stack is the size of an
00775 address on the target machine.
00776 The value on the top of the stack after
00777 ``executing'' the location expression is taken to be the result (the address
00778 of the object, or the value of the array bound, or the length of a
00779 dynamic string). In the case of locations used for structure members,
00780 .IX members, locations
00781 the computation assumes that the base address of the containing structure
00782 has been pushed on the stack before evaluation of the addressing operation.
00783 .R
00784 .H 4 "Literal Encodings"
00785 .IX locations, literal encodings
00786 The following operations all push a value onto the addressing stack.
00787 .AL
00788 .LI
00789 .Cf DW_OP_lit0 , " DW_OP_lit1" ", ..., " DW_OP_lit31
00790 .br
00791 The
00792 \f(CWDW_OP_lit\fP\fIn\fP operations encode the unsigned
00793 literal values from 0 through 31, inclusive.
00794 .LI
00795 .Cf DW_OP_addr
00796 .br
00797 The
00798 .Cf DW_OP_addr
00799 operation has a single operand that encodes a
00800 machine address and whose size is the size of an address on the
00801 target machine.
00802 .LI
00803 .Cf DW_OP_const1u
00804 .br
00805 The single operand of the
00806 .Cf DW_OP_const1u
00807 operation provides a 1-byte unsigned integer constant.
00808 .LI
00809 .Cf DW_OP_const1s
00810 .br
00811 The single operand of the
00812 .Cf DW_OP_const1s
00813 operation provides a
00814 1-byte signed integer constant.
00815 .LI
00816 .Cf DW_OP_const2u
00817 .br
00818 The single operand of the
00819 .Cf DW_OP_const2u
00820 operation provides a
00821 2-byte unsigned integer constant.
00822 .LI
00823 .Cf DW_OP_const2s
00824 .br
00825 The single operand of the
00826 .Cf DW_OP_const2s
00827 operation provides a
00828 2-byte signed integer constant.
00829 .LI
00830 .Cf DW_OP_const4u
00831 .br
00832 The single operand of the
00833 .Cf DW_OP_const4u
00834 operation provides a
00835 4-byte unsigned integer constant.
00836 .LI
00837 .Cf DW_OP_const4s
00838 .br
00839 The single operand of the
00840 .Cf DW_OP_const4s
00841 operation provides a
00842 4-byte signed integer constant.
00843 .LI
00844 .Cf DW_OP_const8u
00845 .br
00846 The single operand of the
00847 .Cf DW_OP_const8u
00848 operation provides an
00849 8-byte unsigned integer constant.
00850 .LI
00851 .Cf DW_OP_const8s
00852 .br
00853 The single operand of the
00854 .Cf DW_OP_const8s
00855 operation provides an
00856 8-byte signed integer constant.
00857 .LI
00858 .Cf DW_OP_constu
00859 .br
00860 The single operand of the
00861 .Cf DW_OP_constu
00862 operation provides an
00863 unsigned LEB128 integer constant.
00864 .LI
00865 .Cf DW_OP_consts
00866 .br
00867 The single operand of the
00868 .Cf DW_OP_consts
00869 operation provides a
00870 signed LEB128 integer constant.
00871 .LE
00872 .H 4 "Register Based Addressing"
00873 .IX locations, register based addressing
00874 The following operations push a value onto the stack that
00875 is the result of adding the contents of a register with
00876 a given signed offset.
00877 .AL
00878 .LI
00879 .Cf DW_OP_fbreg
00880 .br
00881 The
00882 \f(CWDW_OP_fbreg\fP
00883 operation provides a signed LEB128 offset from the address specified
00884 by the location descriptor in the
00885 .Cf DW_AT_frame_base
00886 attribute of the current
00887 .IX subroutines, frame base
00888 function. \fI(This is typically a "stack pointer" register
00889 plus or minus some
00890 offset. On more sophisticated systems it might be a location list that
00891 adjusts the offset according to changes in the stack pointer as
00892 the PC changes.)\fP
00893 .LI
00894 .Cf DW_OP_breg0 , " DW_OP_breg1" ", ..., " DW_OP_breg31
00895 .br
00896 The single operand of the
00897 \f(CWDW_OP_breg\fP\fIn\fP
00898 operations provides a signed LEB128 offset from the specified register.
00899 .LI
00900 .Cf DW_OP_bregx
00901 .br
00902 The
00903 .Cf DW_OP_bregx
00904 operation has two operands: a signed LEB128 offset from the specified register
00905 which is defined with an unsigned LEB128 number.
00906 .LE
00907 .H 4 "Stack Operations"
00908 .IX locations, stack
00909 The following operations
00910 manipulate the ``location stack.''
00911 Location operations that index the location stack assume that
00912 the top of the stack (most recently added entry) has index 0.
00913 .AL
00914 .LI
00915 .Cf DW_OP_dup
00916 .br
00917 The
00918 .Cf DW_OP_dup
00919 operation duplicates the value at the top of the location stack.
00920 .LI
00921 .Cf DW_OP_drop
00922 .br
00923 The
00924 .Cf DW_OP_drop
00925 operation pops the value at the top of the stack.
00926 .LI
00927 .Cf DW_OP_pick
00928 .br
00929 The single operand of the
00930 .Cf DW_OP_pick
00931 operation provides a 1-byte index. The stack entry with the specified index
00932 (0 through 255, inclusive) is pushed on the stack.
00933 .LI
00934 .Cf DW_OP_over
00935 .br
00936 The
00937 .Cf DW_OP_over
00938 operation duplicates the entry currently second in the stack
00939 at the top of the stack. This is equivalent to an
00940 .Cf DW_OP_pick
00941 operation, with index 1.
00942 .LI
00943 .Cf DW_OP_swap
00944 .br
00945 The
00946 .Cf DW_OP_swap
00947 operation swaps the top two stack entries. The entry at
00948 the top of the stack becomes the second stack entry, and
00949 the second entry becomes the top of the stack.
00950 .LI
00951 .Cf DW_OP_rot
00952 .br
00953 The
00954 .Cf DW_OP_rot
00955 operation rotates the first three stack entries. The entry at
00956 the top of the stack becomes the third stack entry, the second entry
00957 becomes the top of the stack, and the third entry becomes the second
00958 entry.
00959 .LI
00960 .Cf DW_OP_deref
00961 .br
00962 The
00963 .Cf DW_OP_deref
00964 operation pops the top stack entry and treats it as an address.
00965 The value retrieved from that address is pushed. The size of the
00966 data retrieved from the dereferenced address is the size of an address
00967 on the target machine.
00968 .LI
00969 .Cf DW_OP_deref_size
00970 .br
00971 The
00972 .Cf DW_OP_deref_size
00973 operation behaves like the
00974 .Cf DW_OP_deref
00975 operation: it
00976 pops the top stack entry and treats it as an address.
00977 The value retrieved from that address is pushed.
00978 In the
00979 .Cf DW_OP_deref_size
00980 operation, however,
00981 the size in bytes of the
00982 data retrieved from the dereferenced address is specified by the
00983 single operand. This operand is a 1-byte unsigned integral constant
00984 whose value may not be larger than the size of an address on
00985 the target machine. The data retrieved is zero extended to the size
00986 of an address on the target machine before being pushed on
00987 the expression stack.
00988 .LI
00989 .Cf DW_OP_xderef
00990 .br
00991 The
00992 .Cf DW_OP_xderef
00993 .IX address space, multiple
00994 operation provides an extended dereference mechanism. The entry at the
00995 top of the stack is treated as an address. The second stack entry
00996 is treated as an ``address space identifier'' for those architectures
00997 that support multiple address spaces. The top two stack elements
00998 are popped, a data item is retrieved through an implementation-defined
00999 address calculation and pushed as the new stack top. The size of the
01000 data retrieved from the dereferenced address is the size of an address
01001 on the target machine.
01002 .LI
01003 .Cf DW_OP_xderef_size
01004 .br
01005 The
01006 .Cf DW_OP_xderef_size
01007 operation behaves like the
01008 .Cf DW_OP_xderef
01009 operation: the entry at the
01010 top of the stack is treated as an address. The second stack entry
01011 is treated as an ``address space identifier'' for those architectures
01012 that support multiple address spaces. The top two stack elements
01013 are popped, a data item is retrieved through an implementation-defined
01014 address calculation and pushed as the new stack top.
01015 In the
01016 .Cf DW_OP_xderef_size
01017 operation, however,
01018 the size in bytes of the
01019 data retrieved from the dereferenced address is specified by the
01020 single operand. This operand is a 1-byte unsigned integral constant
01021 whose value may not be larger than the size of an address on
01022 the target machine. The data retrieved is zero extended to the size
01023 of an address on the target machine before being pushed on
01024 the expression stack.
01025 .LE
01026 .H 4 "Arithmetic and Logical Operations"
01027 .IX locations, arithmetic operations
01028 .IX locations, logical operations
01029 The following provide arithmetic and logical operations.
01030 The arithmetic operations perform ``addressing arithmetic,''
01031 that is, unsigned arithmetic that wraps on an address-sized
01032 boundary. The operations do not cause an exception on overflow.
01033 .AL
01034 .LI
01035 .Cf DW_OP_abs
01036 .br
01037 The
01038 .Cf DW_OP_abs
01039 operation pops the top stack entry and pushes its absolute value.
01040 .LI
01041 .Cf DW_OP_and
01042 .br
01043 The
01044 .Cf DW_OP_and
01045 operation pops the top two stack values, performs a bitwise \fIand\fP
01046 operation on the two, and pushes the result.
01047 .LI
01048 .Cf DW_OP_div
01049 .br
01050 The
01051 .Cf DW_OP_div
01052 operation pops the top two stack values, divides the former second entry
01053 by the former top of the stack
01054 using signed division,
01055 and pushes the result.
01056 .LI
01057 .Cf DW_OP_minus
01058 .br
01059 The
01060 .Cf DW_OP_minus
01061 operation pops the top two stack values, subtracts the former top of the stack
01062 from the former second entry, and pushes the result.
01063 .LI
01064 .Cf DW_OP_mod
01065 .br
01066 The
01067 .Cf DW_OP_mod
01068 operation pops the top two stack values and pushes the result of the
01069 calculation: former second stack entry modulo the former top of the
01070 stack.
01071 .LI
01072 .Cf DW_OP_mul
01073 .br
01074 The
01075 .Cf DW_OP_mul
01076 operation pops the top two stack entries, multiplies them together,
01077 and pushes the result.
01078 .LI
01079 .Cf DW_OP_neg
01080 .br
01081 The
01082 .Cf DW_OP_neg
01083 operation pops the top stack entry, and pushes its negation.
01084 .LI
01085 .Cf DW_OP_not
01086 .br
01087 The
01088 .Cf DW_OP_not
01089 operation pops the top stack entry, and pushes its bitwise complement.
01090 .LI
01091 .Cf DW_OP_or
01092 .br
01093 The
01094 .Cf DW_OP_or
01095 operation pops the top two stack entries, performs a bitwise \fIor\fP
01096 operation on the two, and pushes the result.
01097 .LI
01098 .Cf DW_OP_plus
01099 .br
01100 The
01101 .Cf DW_OP_plus
01102 operation pops the top two stack entries, adds them together,
01103 and pushes the result.
01104 .LI
01105 .Cf DW_OP_plus_uconst
01106 .br
01107 The
01108 .Cf DW_OP_plus_uconst
01109 operation pops the top stack entry, adds it to the unsigned LEB128
01110 constant operand and pushes the result.
01111 .I
01112 This operation is supplied specifically to be able to encode more field
01113 offsets in two bytes than can be done with "\f(CWDW_OP_lit\fP\fIn\fP\f(CW DW_OP_add\fP".
01114 .R
01115 .LI
01116 .Cf DW_OP_shl
01117 .br
01118 The
01119 .Cf DW_OP_shl
01120 operation pops the top two stack entries, shifts the former second
01121 entry left by the number of bits specified by the former top of
01122 the stack, and pushes the result.
01123 .LI
01124 .Cf DW_OP_shr
01125 .br
01126 The
01127 .Cf DW_OP_shr
01128 operation pops the top two stack entries, shifts the former second
01129 entry right (logically) by the number of bits specified by the former top of
01130 the stack, and pushes the result.
01131 .LI
01132 .Cf DW_OP_shra
01133 .br
01134 The
01135 .Cf DW_OP_shra
01136 operation pops the top two stack entries, shifts the former second
01137 entry right (arithmetically) by the number of bits specified by the former top of
01138 the stack, and pushes the result.
01139 .LI
01140 .Cf DW_OP_xor
01141 .br
01142 The
01143 .Cf DW_OP_xor
01144 operation pops the top two stack entries, performs the logical
01145 \fIexclusive-or\fP operation on the two, and pushes the result.
01146 .LE
01147 .H 4 "Control Flow Operations"
01148 .IX locations, control flow operations
01149 The following operations provide simple control of the flow of a location
01150 expression.
01151 .AL
01152 .LI
01153 Relational operators
01154 .br
01155 The six relational operators each pops the top two stack values,
01156 compares the former top of the stack with the former second entry,
01157 and pushes the constant value 1 onto the stack if the result of the
01158 operation is true or the constant value 0 if the result of the operation
01159 is false. The comparisons are done as signed operations. The six
01160 operators are
01161 .Cf DW_OP_le
01162 (less than or equal to),
01163 .Cf DW_OP_ge
01164 (greater than or equal to),
01165 .Cf DW_OP_eq
01166 (equal to),
01167 .Cf DW_OP_lt
01168 (less than),
01169 .Cf DW_OP_gt
01170 (greater than) and
01171 .Cf DW_OP_ne
01172 (not equal to).
01173 .LI
01174 .Cf DW_OP_skip
01175 .br
01176 .Cf DW_OP_skip
01177 is an unconditional branch. Its
01178 single operand is a 2-byte signed integer constant.
01179 The 2-byte constant is the number of bytes of the location
01180 expression to skip from the current operation, beginning after the
01181 2-byte constant.
01182 .LI
01183 .Cf DW_OP_bra
01184 .br
01185 .Cf DW_OP_bra
01186 is a conditional branch. Its
01187 single operand is a 2-byte signed integer constant.
01188 This operation pops the top of stack. If the value
01189 popped is not the constant 0, the 2-byte constant operand is the number
01190 of bytes of the location
01191 expression to skip from the current operation, beginning after the
01192 2-byte constant.
01193 .LE
01194 .H 4 "Special Operations"
01195 .IX locations, special operations
01196 There are two special operations currently defined:
01197 .AL
01198 .LI
01199 .Cf DW_OP_piece
01200 .br
01201 .I
01202 Many compilers store a single variable in sets of registers, or store
01203 a variable partially in memory and partially in registers.
01204 .Cf DW_OP_piece
01205 provides a way of describing how large a part of a variable
01206 a particular addressing expression refers to.
01207 .R
01208 .P
01209 .Cf DW_OP_piece
01210 takes a single argument which is an unsigned LEB128 number. The number
01211 describes the size in bytes of the piece of the object referenced
01212 by the addressing expression whose result is at the top of
01213 the stack.
01214 .LI
01215 .Cf DW_OP_nop
01216 .br
01217 The
01218 .Cf DW_OP_nop
01219 operation is a place holder. It has no effect on the location stack or
01220 any of its values.
01221 .LE
01222 .H 3 "Sample Stack Operations"
01223 .IX locations, examples
01224 .I
01225 The stack operations defined in section 2.4.3.3 are fairly
01226 .IX locations, stack
01227 conventional, but the following examples illustrate their behavior
01228 graphically.
01229 .R
01230 .DS
01231 .TS
01232 box expand center tab(;);
01233 l s l l s
01234 lf(CW) lf(CW) lf(CW) lf(CW) lf(CW)
01235 .
01236 Before;Operation;After;
01237 _
01238 0;17;DW_OP_dup;0;17
01239 1;29;;1;17
01240 2;1000;;2;29
01241 ;;;3;1000
01242 _
01243 0;17;DW_OP_drop;0;29
01244 1;29;;1;1000
01245 2;1000;;;;
01246 _
01247 0;17;DW_OP_pick 2;0;1000
01248 1;29;;1;17
01249 2;1000;;2;29
01250 ;;;3;1000
01251 _
01252 0;17;DW_OP_over;0;29
01253 1;29;;1;17
01254 2;1000;;2;29
01255 ;;;3;1000
01256 _
01257 0;17;DW_OP_swap;0;29
01258 1;29;;1;17
01259 2;1000;;2;1000
01260 _
01261 0;17;DW_OP_rot;0;29
01262 1;29;;1;1000
01263 2;1000;;2;17
01264 .TE
01265 .DE
01266 .H 3 "Example Location Expressions"
01267 .I
01268 .IX locations, examples
01269 The addressing expression represented by a location expression,
01270 if evaluated, generates the
01271 runtime address of the value of a symbol except where the
01272 .Cf DW_OP_reg n,
01273 or
01274 .Cf DW_OP_regx
01275 operations are used.
01276 .P
01277 Here are some examples of how location operations are used to form location
01278 expressions:
01279 .R
01280 .DS
01281 \f(CWDW_OP_reg3\fI
01282 The value is in register 3.
01283
01284 \f(CWDW_OP_regx 54\fI
01285 The value is in register 54.
01286
01287 \f(CWDW_OP_addr 0x80d0045c\fI
01288 The value of a static variable is
01289 at machine address 0x80d0045c.
01290
01291 \f(CWDW_OP_breg11 44\fI
01292 Add 44 to the value in
01293 register 11 to get the address of an
01294 automatic variable instance.
01295
01296 \f(CWDW_OP_fbreg -50\fI
01297 Given an \f(CWDW_AT_frame_base\fI value of
01298 "\f(CWOPBREG31 64\fI," this example
01299 computes the address of a local variable
01300 that is -50 bytes from a logical frame
01301 pointer that is computed by adding
01302 64 to the current stack pointer (register 31).
01303
01304 \f(CWDW_OP_bregx 54 32 DW_OP_deref\fI
01305 A call-by-reference parameter
01306 whose address is in the
01307 word 32 bytes from where register
01308 54 points.
01309
01310 \f(CWDW_OP_plus_uconst 4\fI
01311 A structure member is four bytes
01312 from the start of the structure
01313 instance. The base address is
01314 assumed to be already on the stack.
01315
01316 \f(CWDW_OP_reg3 DW_OP_piece 4 DW_OP_reg10 DW_OP_piece 2\fI
01317 A variable whose first four bytes reside
01318 in register 3 and whose next two bytes
01319 reside in register 10.\fR
01320 .DE
01321 .H 3 "Location Lists"
01322 .IX locations, lists
01323 Location lists are used in place of location expressions whenever
01324 the object whose location is being described can change location
01325 during its lifetime. Location lists are contained in a separate
01326 object file section called
01327 .Cf .debug_loc.
01328 .IX \f(CW.debug_loc\fP %debugalo
01329 A location list is indicated by a location
01330 attribute whose value is represented as a
01331 constant offset from the beginning of the
01332 .Cf .debug_loc
01333 section to the first byte of the list for the object in question.
01334 .P
01335 Each entry in a location list consists of:
01336 .AL
01337 .LI
01338 A beginning address. This address is relative to the base address
01339 of the compilation unit referencing this location list. It marks
01340 the beginning of the address range over which the location is valid.
01341 .LI
01342 An ending address, again relative to the base address
01343 of the compilation unit referencing this location list. It marks
01344 the first address past the end of the address range over
01345 which the location is valid.
01346 .LI
01347 A location expression describing the location of the object over the
01348 range specified by the beginning and end addresses.
01349 .LE
01350 .P
01351 Address ranges may overlap. When they do, they describe a situation
01352 in which an object exists simultaneously in more than one place.
01353 If all of the address ranges
01354 in a given location list do not collectively cover the entire
01355 range over which the object in question is defined, it is assumed
01356 that the object is not available for the portion of the range that is not
01357 covered.
01358 .IX optimized code
01359 .P
01360 The end of any given location list is marked by a 0 for the beginning
01361 address and a 0 for the end address; no location description is present.
01362 A location list containing
01363 only such a 0 entry describes an object that exists in the source
01364 code but not in the executable program.
01365 .H 2 "Types of Declarations"
01366 .IX declarations, types of
01367 Any debugging information entry describing a declaration that
01368 has a type has a
01369 .Cf DW_AT_type
01370 attribute, whose value is a reference to another debugging
01371 information entry. The entry referenced may describe
01372 .IX base types
01373 .IX types, base
01374 a base type, that is, a type that is not defined in terms
01375 .IX user-defined types
01376 .IX types, user-defined
01377 of other data types, or it may describe a user-defined type,
01378 such as an array, structure or enumeration. Alternatively,
01379 the entry referenced may describe a type modifier: constant,
01380 packed, pointer, reference or volatile, which in turn will reference
01381 another entry describing a type or type modifier (using a
01382 .IX type modifiers
01383 .IX types, modifiers
01384 .IX types, packed
01385 .IX types, constant
01386 .IX types, pointer
01387 .IX types, reference
01388 .IX types, volatile
01389 .Cf DW_AT_type
01390 attribute of its own). See section 5 for descriptions of
01391 the entries describing base types, user-defined types and
01392 type modifiers.
01393 .H 2 "Accessibility of Declarations"
01394 .I
01395 .IX accessibility
01396 .IX declarations, accessibility
01397 Some languages, notably C++ and Ada, have the concept of
01398 .IX C++ %caa
01399 the accessibility of an object or of some other program entity.
01400 The accessibility specifies which classes of other program objects
01401 are permitted access to the object in question.
01402 .R
01403 .P
01404 The accessibility of a declaration is represented by a
01405 .Cf DW_AT_accessibility
01406 attribute, whose value is a constant drawn from the set of codes
01407 .nr aX \n(Fg+1
01408 listed in Figure \n(aX.
01409 .DF
01410 .TS
01411 box center;
01412 lf(CW)
01413 .
01414 DW_ACCESS_public
01415 DW_ACCESS_private
01416 DW_ACCESS_protected
01417 .TE
01418 .FG "Accessibility codes"
01419 .DE
01420 .H 2 "Visibility of Declarations"
01421 .I
01422 .IX Modula2
01423 .IX visibility
01424 .IX declarations, visibility
01425 Modula2 has the concept of the visibility of a declaration.
01426 The visibility specifies which declarations are to be visible outside
01427 of the module in which they are declared.
01428 .R
01429 .P
01430 The visibility of a declaration is represented by a
01431 .Cf DW_AT_visibility
01432 attribute, whose value is a constant drawn from the set of codes
01433 .nr aX \n(Fg+1
01434 listed in Figure \n(aX.
01435 .DF
01436 .TS
01437 box center;
01438 lf(CW)
01439 .
01440 DW_VIS_local
01441 DW_VIS_exported
01442 DW_VIS_qualified
01443 .TE
01444 .FG "Visibility codes"
01445 .DE
01446 .H 2 "Virtuality of Declarations"
01447 .I
01448 .IX C++ %caa
01449 .IX virtuality
01450 .IX virtual functions
01451 C++ provides for virtual and pure virtual structure or class
01452 member functions and for virtual base classes.
01453 .P
01454 .R
01455 The virtuality of a declaration is represented by a
01456 .Cf DW_AT_virtuality
01457 attribute, whose value is a constant drawn from the set of codes
01458 .nr aX \n(Fg+1
01459 listed in Figure \n(aX.
01460 .DF
01461 .TS
01462 box center;
01463 lf(CW)
01464 .
01465 DW_VIRTUALITY_none
01466 DW_VIRTUALITY_virtual
01467 DW_VIRTUALITY_pure_virtual
01468 .TE
01469 .FG "Virtuality codes"
01470 .DE
01471 .H 2 "Artificial Entries"
01472 .I
01473 .IX artificial entries
01474 A compiler may wish to generate debugging information entries
01475 for objects or types that were not actually declared
01476 in the source of the application. An example is a formal parameter
01477 entry to represent the hidden
01478 .Cf this
01479 parameter that most C++ implementations pass as the first argument
01480 to non-static member functions.
01481 .R
01482 .P
01483 Any debugging information entry representing the declaration of an
01484 object or type artificially generated by a compiler and
01485 not explicitly declared by the source program may have a
01486 .Cf DW_AT_artificial
01487 attribute. The value of this attribute is a flag.
01488 .H 2 "Target-Specific Addressing Information"
01489 .I
01490 .IX segmented address space
01491 .IX address space, segmented
01492 In some systems, addresses are specified as offsets within a given
01493 segment rather than as locations within a single flat address space.
01494 .R
01495 .P
01496 Any debugging information entry that contains a description of the
01497 location of an object or subroutine may have a
01498 .Cf DW_AT_segment
01499 attribute, whose value is a location description. The description
01500 evaluates to the segment value of the item being described. If
01501 the entry containing the
01502 .Cf DW_AT_segment
01503 attribute has a
01504 .Cf DW_AT_low_pc
01505 or
01506 .Cf DW_AT_high_pc
01507 attribute, or a location description that evaluates to an address,
01508 .IX locations, descriptions
01509 .IX addresses, offset portion
01510 then those values represent the offset portion of the address
01511 within the segment specified by
01512 .Cf DW_AT_segment .
01513 .P
01514 If an entry has no
01515 .Cf DW_AT_segment
01516 attribute, it inherits the segment value from its parent entry.
01517 If none of the entries in the chain of parents for this entry
01518 back to its containing compilation unit entry have
01519 .Cf DW_AT_segment
01520 attributes, then the entry is assumed to exist within a flat
01521 address space. Similarly, if the entry has a
01522 .IX flat address space
01523 .IX address space, flat
01524 .Cf DW_AT_segment
01525 attribute containing an empty location description, that entry
01526 is assumed to exist within a flat address space.
01527 .P
01528 .I
01529 Some systems support different classes of addresses. The address
01530 class may affect the way a pointer is dereferenced or the way
01531 a subroutine is called.
01532 .P
01533 .R
01534 Any debugging information entry representing a pointer or reference
01535 type or a subroutine or subroutine type may have a
01536 .IX types, pointer
01537 .IX types, reference
01538 .IX subroutines
01539 .IX subroutines, types
01540 .Cf DW_AT_address_class
01541 .IX addresses, class
01542 attribute, whose value is a constant. The set of permissible
01543 values is specific to each target architecture. The value
01544 .Cf DW_ADDR_none ,
01545 however, is common to all encodings, and means that no address class
01546 has been specified.
01547 .P
01548 .I
01549 For example, the Intel386\(tm processor might use the following
01550 values:
01551 .R
01552 .DF
01553 .TS
01554 box center;
01555 l l l
01556 lf(CW) lf(CW) l
01557 .
01558 Name Value Meaning
01559 _
01560 DW_ADDR_none 0 no class specified
01561 DW_ADDR_near16 1 16-bit offset, no segment
01562 DW_ADDR_far16 2 16-bit offset, 16-bit segment
01563 DW_ADDR_huge16 3 16-bit offset, 16-bit segment
01564 DW_ADDR_near32 4 32-bit offset, no segment
01565 DW_ADDR_far32 5 32-bit offset, 16-bit segment
01566 .TE
01567 .FG "Example address class codes"
01568 .DE
01569 .H 2 "Non-Defining Declarations"
01570 .IX declarations, non-defining
01571 .IX declarations, defining
01572 A debugging information entry representing a program object or type
01573 typically represents the defining declaration of that object or type. In
01574 certain contexts, however, a debugger might need information about a
01575 declaration of a subroutine, object or type that is not also a
01576 definition to evaluate an expression correctly.
01577 .P
01578 .I
01579 As an example, consider the following fragment of C code:
01580 .DS
01581 \f(CWvoid myfunc()
01582 {
01583 int x;
01584 {
01585 extern float x;
01586 g(x);
01587 }
01588 }\fP
01589 .DE
01590 .P
01591 ANSI-C scoping rules require that the value of the variable \f(CWx\fP
01592 passed to the function \f(CWg\fP is the value of the global variable
01593 \f(CWx\fP rather than of the local version.
01594 .R
01595 .P
01596 Debugging information entries that represent non-defining declarations
01597 of a program object or type have a
01598 .Cf DW_AT_declaration
01599 attribute, whose value is a flag.
01600 .H 2 "Declaration Coordinates"
01601 .I
01602 It is sometimes useful in a debugger to be able to associate a declaration
01603 with its occurrence in the program source.
01604 .P
01605 .R
01606 .IX declarations, coordinates
01607 Any debugging information entry representing the declaration of
01608 an object, module, subprogram or type may have
01609 .Cf DW_AT_decl_file ,
01610 .Cf DW_AT_decl_line
01611 and
01612 .Cf DW_AT_decl_column
01613 attributes, each of whose value is a constant.
01614 .P
01615 The value of the
01616 .Cf DW_AT_decl_file
01617 attribute corresponds
01618 to a file number from the statement information table for the compilation
01619 .IX line number information
01620 unit containing this debugging information entry and represents the
01621 source file in which the declaration appeared (see section 6.2).
01622 .IX source, files
01623 The value 0 indicates that no source file has been specified.
01624 .P
01625 The value of the
01626 .Cf DW_AT_decl_line
01627 attribute represents the source line number at which the first
01628 .IX source, lines
01629 character of the identifier of the declared object appears.
01630 The value 0 indicates that no source line has been specified.
01631 .P
01632 The value of the
01633 .Cf DW_AT_decl_column
01634 attribute represents the source column number at which the first
01635 .IX source, columns
01636 character of the identifier of the declared object appears.
01637 The value 0 indicates that no column has been specified.
01638 .H 2 "Identifier Names"
01639 .IX identifiers, names
01640 Any debugging information entry representing a program entity that
01641 has been given a name may have a
01642 .Cf DW_AT_name
01643 attribute, whose value is a string representing the name as it appears
01644 in the source program. A debugging information entry containing
01645 no name attribute, or containing a name attribute whose value consists
01646 of a name containing a single null byte,
01647 represents a program entity for which no name was given in the source.
01648 .I
01649 .P
01650 Note that since the names of program objects
01651 described by DWARF are the names as they appear in the source program,
01652 implementations of language translators that use some form of mangled
01653 name (as do many implementations of C++) should use the unmangled
01654 .IX C++ %caa
01655 form of the name in the DWARF
01656 .Cf DW_AT_name
01657 attribute, including the keyword
01658 .Cf operator ,
01659 if present. Sequences of multiple whitespace characters may be compressed.
01660 .R
01661 .OP
01662 .H 1 "PROGRAM SCOPE ENTRIES"
01663 This section describes debugging information entries that relate
01664 to different levels of program scope: compilation unit, module,
01665 subprogram, and so on. These entries may be thought of as
01666 bounded by ranges of text addresses within the program.
01667 .H 2 "Compilation Unit Entries"
01668 An object file may be derived from one or more compilation units. Each
01669 such compilation unit will be described by a debugging information
01670 entry with the tag \f(CWDW_TAG_compile_unit\fP.
01671 .I
01672 .P
01673 A compilation unit typically represents the text and data contributed
01674 .IX compilation units
01675 to an executable by a single relocatable object file. It may
01676 be derived from several source files, including pre-processed ``include
01677 files.''
01678 .R
01679 .P
01680 The compilation unit entry may have the following attributes:
01681 .AL
01682 .LI
01683 A
01684 .Cf DW_AT_low_pc
01685 attribute whose value is the
01686 relocated address of the first machine instruction generated for that
01687 compilation unit.
01688 .LI
01689 A
01690 .Cf DW_AT_high_pc
01691 attribute whose value is the
01692 relocated address of the first location
01693 past the last machine instruction generated for that compilation unit.
01694 .P
01695 .I
01696 The address may be beyond the last valid instruction in the executable,
01697 of course, for this and other similar attributes.
01698 .R
01699 .P
01700 The presence of low and high pc attributes in a compilation unit entry
01701 imply that the code generated for that compilation unit is
01702 contiguous and exists totally within the boundaries specified
01703 by those two attributes. If that is not the case, no low
01704 and high pc attributes should be produced.
01705 .IX address space, contiguous
01706 .LI
01707 A
01708 .Cf DW_AT_name
01709 attribute whose value is a
01710 null-terminated string containing the full or relative path name of
01711 the primary source file from which the compilation unit was derived.
01712 .IX source, files
01713 .LI
01714 A
01715 .Cf DW_AT_language
01716 attribute whose constant value is
01717 .IX languages
01718 a code indicating the source language of the compilation unit.
01719 .nr aX \n(Fg+1
01720 The set of language names and their meanings are
01721 given in Figure \n(aX.
01722 .DF
01723 .TS
01724 box center;
01725 lf(CW) lf(R)
01726 .
01727 DW_LANG_C Non-ANSI C, such as K&R
01728 DW_LANG_C89 ISO/ANSI C
01729 DW_LANG_C_plus_plus C++
01730 DW_LANG_Fortran77 FORTRAN77
01731 DW_LANG_Fortran90 Fortran90
01732 DW_LANG_Modula2 Modula2
01733 DW_LANG_Pascal83 ISO/ANSI Pascal
01734 .TE
01735 .FG "Language names"
01736 .DE
01737 .LI
01738 A
01739 .Cf DW_AT_stmt_list
01740 attribute whose value is a reference to
01741 line number information for this compilation unit.
01742 .IX line number information
01743 .P
01744 This information is placed in a separate object file section from the debugging
01745 information entries themselves. The value of the statement list attribute
01746 is the offset in the \f(CW.debug_line\fP section of the first byte of the
01747 line number information for this compilation unit. See section 6.2.
01748 .LI
01749 A
01750 .Cf DW_AT_macro_info
01751 attribute whose value is a reference to the macro information for this
01752 compilation unit.
01753 .IX macro information
01754 .P
01755 This information is placed in a separate object file section from the debugging
01756 information entries themselves. The value of the macro information attribute
01757 is the offset in the \f(CW.debug_macinfo\fP section of the first byte of the
01758 macro information for this compilation unit. See section 6.3.
01759 .LI
01760 A
01761 .Cf DW_AT_comp_dir
01762 attribute whose value is a null-terminated string containing
01763 the current working directory of the compilation command that
01764 produced this compilation unit in whatever form makes sense
01765 for the host system.
01766 .P
01767 .I
01768 The suggested form for the value of the \f(CWDW_AT_comp_dir\fP
01769 attribute on \*(aX systems is ``hostname\f(CW:\fPpathname''. If no
01770 hostname is available, the suggested form is ``\f(CW:\fPpathname''.
01771 .R
01772 .LI
01773 A
01774 .Cf DW_AT_producer
01775 attribute whose value is a null-terminated string containing information
01776 about the compiler that produced the compilation unit. The
01777 actual contents of the string will be specific to each producer,
01778 but should begin with the name of the compiler vendor or some
01779 other identifying character sequence that should avoid
01780 confusion with other producer values.
01781 .LI
01782 A
01783 .Cf DW_AT_identifier_case
01784 .IX identifiers, case
01785 attribute whose constant value is a code describing the treatment of
01786 identifiers within this compilation unit. The set of identifier case
01787 .nr aX \n(Fg+1
01788 codes is given in Figure \n(aX.
01789 .DF
01790 .TS
01791 box center;
01792 lf(CW)
01793 .
01794 DW_ID_case_sensitive
01795 DW_ID_up_case
01796 DW_ID_down_case
01797 DW_ID_case_insensitive
01798 .TE
01799 .FG "Identifier case codes"
01800 .DE
01801 .P
01802 .Cf DW_ID_case_sensitive
01803 is the default for all compilation units that do not have this attribute.
01804 It indicates that names given as the values of
01805 .Cf DW_AT_name
01806 attributes in debugging information entries for the compilation unit
01807 reflect the names as they appear in the source program.
01808 The debugger should be sensitive to the case of identifier names
01809 when doing identifier lookups.
01810 .P
01811 .Cf DW_ID_up_case
01812 means that the producer of the debugging information for this compilation
01813 unit converted all source names to upper case. The values of the
01814 name attributes may not reflect the names as they appear in the source
01815 program. The debugger should convert all names to upper case
01816 when doing lookups.
01817 .P
01818 .Cf DW_ID_down_case
01819 means that the producer of the debugging information for this compilation
01820 unit converted all source names to lower case. The values of the
01821 name attributes may not reflect the names as they appear in the source
01822 program. The debugger should convert all names to lower case when
01823 doing lookups.
01824 .P
01825 .Cf DW_ID_case_insensitive
01826 means that the values of the name attributes reflect the names
01827 as they appear in the source program but that a case insensitive
01828 lookup should be used to access those names.
01829 .LI
01830 A
01831 .Cf DW_AT_base_types
01832 .IX base types
01833 .IX types, base
01834 attribute whose value is a reference. This attribute points to
01835 a debugging information entry representing another compilation
01836 unit. It may be used to specify the compilation unit containing
01837 the base type entries used by entries in the current compilation
01838 unit (see section 5.1).
01839 .P
01840 .I
01841 This attribute provides a consumer a way to find the definition
01842 of base types for a compilation unit that does not itself
01843 contain such definitions. This allows a consumer, for example,
01844 to interpret a type conversion to a base type correctly.
01845 .R
01846 .LE
01847 .R
01848 .P
01849 A compilation unit entry
01850 owns debugging information entries that represent the declarations made in
01851 the corresponding compilation unit.
01852 .H 2 "Module Entries"
01853 .I
01854 Several languages have the concept of a ``module.''
01855 .IX modules
01856 .P
01857 .R
01858 A module is
01859 represented by a debugging information entry with the tag
01860 .Cf DW_TAG_module .
01861 Module entries may own other debugging information entries describing
01862 program entities whose declaration scopes end at the end of the module
01863 itself.
01864 .P
01865 If the module has a name, the module entry has a
01866 .Cf DW_AT_name
01867 attribute whose
01868 value is a null-terminated string containing the module name as it appears
01869 in the source program.
01870 .P
01871 If the module contains initialization code, the module entry
01872 has a
01873 .Cf DW_AT_low_pc
01874 attribute whose value is the
01875 relocated address of the first machine instruction generated for that
01876 initialization code. It also has a
01877 .Cf DW_AT_high_pc
01878 attribute whose value is
01879 the relocated address of the first location past the last machine
01880 instruction generated for the initialization code.
01881 .P
01882 If the module has been assigned a priority, it may have a
01883 .Cf DW_AT_priority
01884 attribute. The value of this attribute is a reference to another
01885 .IX modules, priority
01886 debugging information entry describing a variable with a constant
01887 value. The value of this variable is the actual constant
01888 value of the module's priority, represented as it would be on the
01889 target architecture.
01890 .P
01891 .I
01892 .IX Modula2
01893 .IX modules, definition
01894 A Modula2 definition module may be represented by a module entry
01895 containing a
01896 .Cf DW_AT_declaration
01897 attribute.
01898 .R
01899 .H 2 "Subroutine and Entry Point Entries"
01900 .IX subroutines
01901 .IX entry points
01902 The following tags exist to describe debugging information
01903 entries for subroutines and entry points:
01904 .VL 30
01905 .LI \f(CWDW_TAG_subprogram\fP
01906 A global or file static subroutine or function.
01907 .LI \f(CWDW_TAG_inlined_subroutine\fP
01908 A particular inlined instance of a subroutine or function.
01909 .LI \f(CWDW_TAG_entry_point\fP
01910 A Fortran entry point.
01911 .LE
01912 .H 3 "General Subroutine and Entry Point Information"
01913 The subroutine or entry point entry has a
01914 .Cf DW_AT_name
01915 attribute
01916 whose value is a null-terminated string containing the subroutine or entry
01917 point name as it appears in the source program.
01918 .P
01919 If the name of the subroutine described by an entry with the tag
01920 .Cf DW_TAG_subprogram
01921 is visible outside of its containing compilation unit, that
01922 entry has a
01923 .Cf DW_AT_external
01924 attribute, whose value is a flag.
01925 .IX declarations, external
01926 .I
01927 .P
01928 .IX members, functions
01929 .IX subroutines, members
01930 Additional attributes for functions that are members of a class or
01931 structure are described in section 5.5.5.
01932 .P
01933 A common debugger feature is to allow the debugger user to call a
01934 subroutine within the subject program. In certain cases, however,
01935 the generated code for a subroutine will not obey the standard calling
01936 conventions for the target architecture and will therefore not
01937 .IX calling conventions
01938 be safe to call from within a debugger.
01939 .R
01940 .P
01941 A subroutine entry may contain a
01942 .Cf DW_AT_calling_convention
01943 attribute, whose value is a constant. If this attribute is not
01944 present, or its value is the constant
01945 .Cf DW_CC_normal ,
01946 then the subroutine may be safely called by obeying the ``standard''
01947 calling conventions of the target architecture. If the value of
01948 the calling convention attribute is the constant
01949 .Cf DW_CC_nocall ,
01950 the subroutine does not obey standard calling conventions, and it
01951 may not be safe for the debugger to call this subroutine.
01952 .P
01953 If the semantics of the language of the compilation unit
01954 containing the subroutine entry distinguishes between ordinary subroutines
01955 .IX main programs
01956 and subroutines that can serve as the ``main program,'' that is, subroutines
01957 that cannot be called directly following the ordinary calling conventions,
01958 then the debugging information entry for such a subroutine may have a
01959 calling convention attribute whose value is the constant
01960 .Cf DW_CC_program .
01961 .P
01962 .I
01963 The
01964 .Cf DW_CC_program
01965 value is intended to support Fortran main programs.
01966 It is not intended as a way of finding the entry address for the program.
01967 .R
01968 .H 3 "Subroutine and Entry Point Return Types"
01969 .IX subroutines, return types
01970 .IX entry points, return types
01971 If the subroutine or entry point is a function that returns a value, then
01972 its debugging information entry has a
01973 .Cf DW_AT_type
01974 attribute to denote the type returned by that function.
01975 .P
01976 .I
01977 Debugging information entries for C
01978 .Cf void
01979 .IX C %c
01980 functions should not have an attribute for the return type.
01981 .P
01982 In ANSI-C there is a difference between the types of functions
01983 declared using function prototype style declarations and those
01984 declared using non-prototype declarations.
01985 .IX subroutines, prototypes
01986 .P
01987 .R
01988 A subroutine entry
01989 declared with a function prototype style declaration may have a
01990 .Cf DW_AT_prototyped
01991 attribute, whose value is a flag.
01992 .H 3 "Subroutine and Entry Point Locations"
01993 .IX subroutines, locations
01994 .IX entry points, locations
01995 A subroutine entry has a
01996 .Cf DW_AT_low_pc
01997 attribute whose value is the relocated address of the first machine instruction
01998 generated for the subroutine.
01999 It also has a
02000 .Cf DW_AT_high_pc
02001 attribute whose value is the relocated address of the
02002 first location past the last machine instruction generated
02003 for the subroutine.
02004 .P
02005 .I
02006 Note that for the low and high pc attributes to have meaning, DWARF
02007 makes the assumption that the code for a single subroutine is allocated
02008 in a single contiguous block of memory.
02009 .IX address space, contiguous
02010 .R
02011 .P
02012 An entry point has a
02013 .Cf DW_AT_low_pc
02014 attribute whose value is the relocated address of the first machine instruction
02015 generated for the entry point.
02016 .P
02017 Subroutines and entry points may also have
02018 .Cf DW_AT_segment
02019 and
02020 .Cf DW_AT_address_class
02021 .IX segmented address space
02022 .IX address space, segmented
02023 .IX addresses, class
02024 attributes, as appropriate, to specify which segments the code
02025 for the subroutine resides in and the addressing mode to be used
02026 in calling that subroutine.
02027 .P
02028 A subroutine entry representing a subroutine declaration
02029 that is not also a definition does not have low and high pc attributes.
02030 .IX declarations, non-defining
02031 .H 3 "Declarations Owned by Subroutines and Entry Points"
02032 .IX subroutines, declarations owned by
02033 .IX entry points, declarations owned by
02034 The declarations enclosed by a subroutine or entry point
02035 are represented by debugging information entries that are
02036 owned by the subroutine or entry point entry.
02037 Entries representing the formal parameters of the subroutine or
02038 entry point appear in
02039 the same order as the corresponding declarations in the source program.
02040 .IX attributes, ordering
02041 .IX parameters, formal
02042 .P
02043 .I
02044 There is no ordering requirement on entries for declarations that are
02045 children of subroutine or entry point entries but that do not represent
02046 formal parameters. The formal parameter entries may be interspersed
02047 with other entries used by formal parameter entries, such as type entries.
02048 .R
02049 .P
02050 The unspecified parameters of a variable parameter list
02051 .IX parameters, unspecified
02052 are represented by a debugging information entry with the tag
02053 .Cf DW_TAG_unspecified_parameters .
02054 .P
02055 The entry for a subroutine or entry point that includes a Fortran
02056 .IX Fortran
02057 .IX common blocks
02058 common block has a child entry with the tag
02059 .Cf DW_TAG_common_inclusion .
02060 The common inclusion entry has a
02061 .Cf DW_AT_common_reference
02062 attribute whose value is a reference to the debugging entry for
02063 the common block being included (see section 4.2).
02064 .H 3 "Low-Level Information"
02065 A subroutine or entry point entry may have a
02066 .Cf DW_AT_return_addr
02067 .IX subroutines, return addresses
02068 attribute, whose value is a location description.
02069 The location calculated is the place where the return address for
02070 the subroutine or entry point is stored.
02071 .P
02072 A subroutine or entry point entry may also have a
02073 .Cf DW_AT_frame_base
02074 .IX subroutines, frame base
02075 attribute, whose value is a location description that
02076 computes the ``frame base'' for the subroutine or entry point.
02077 .P
02078 .I
02079 The frame base for a procedure is typically an address fixed
02080 relative to the first unit of storage allocated for the procedure's
02081 stack frame. The
02082 .Cf DW_AT_frame_base
02083 attribute can be used in several ways:
02084 .AL
02085 .LI
02086 In procedures that need location lists to locate local variables, the
02087 .Cf DW_AT_frame_base
02088 can hold the needed location list, while all variables'
02089 location descriptions can be simpler location expressions involving the frame
02090 base.
02091 .LI
02092 It can be used as a key in resolving "up-level" addressing with nested
02093 routines. (See
02094 .Cf DW_AT_static_link ,
02095 below)
02096 .LE
02097 .P
02098 Some languages support nested subroutines. In such languages, it is possible
02099 .IX subroutines, nested
02100 to reference the local variables of an outer subroutine from within
02101 an inner subroutine. The
02102 .Cf DW_AT_static_link
02103 and
02104 .Cf DW_AT_frame_base
02105 attributes allow debuggers to support this same kind of referencing.
02106 .R
02107 .P
02108 If a subroutine or entry point is nested, it may have a
02109 .Cf DW_AT_static_link
02110 attribute, whose value is a location description that
02111 computes the frame base of the relevant instance of the subroutine
02112 that immediately encloses the subroutine or entry point.
02113 .P
02114 In the context of supporting nested subroutines, the
02115 .Cf DW_AT_frame_base
02116 attribute value should obey the following constraints:
02117 .AL
02118 .LI
02119 It should compute a value that does not change during the life of the procedure,
02120 and
02121 .LI
02122 The computed value should be unique among instances of the same subroutine.
02123 (For typical
02124 .Cf DW_AT_frame_base
02125 use, this means that a recursive
02126 subroutine's stack frame must have non-zero size.)
02127 .LE
02128 .P
02129 .I
02130 If a debugger is attempting to resolve an up-level reference to a variable, it
02131 uses the nesting structure of DWARF to determine which subroutine is the lexical
02132 parent and the
02133 .Cf DW_AT_static_link
02134 value to identify the appropriate active frame
02135 of the parent. It can then attempt to find the reference within the context
02136 of the parent.
02137 .R
02138 .H 3 "Types Thrown by Exceptions"
02139 .I
02140 In C++ a subroutine may declare a set of types for which
02141 .IX C++ %caa
02142 .IX exceptions
02143 that subroutine may generate or ``throw'' an exception.
02144 .P
02145 .R
02146 If a subroutine explicitly declares that it may throw an
02147 exception for one or more types, each such type is
02148 represented by a debugging information entry with the tag
02149 .Cf DW_TAG_thrown_type .
02150 Each such entry is a child of the entry representing the
02151 subroutine that may throw this type. All thrown type entries
02152 should follow all entries representing the formal parameters
02153 of the subroutine and precede all entries representing the
02154 local variables or lexical blocks contained in the subroutine.
02155 Each thrown type entry contains a
02156 .Cf DW_AT_type
02157 attribute, whose value is a reference to an entry describing
02158 the type of the exception that may be thrown.
02159 .H 3 "Function Template Instantiations"
02160 .I
02161 .IX C++ %caa
02162 .IX templates
02163 In C++ a function template is a generic
02164 definition of a function that
02165 is instantiated differently when called with values
02166 of different types. DWARF does not represent the generic
02167 template definition, but does represent each instantiation.
02168 .R
02169 .P
02170 A template instantiation is represented by a debugging information
02171 entry with the tag
02172 .Cf DW_TAG_subprogram .
02173 With three exceptions,
02174 such an entry will contain the same attributes and have the same
02175 types of child entries as would an entry for a subroutine
02176 defined explicitly
02177 using the instantiation types. The exceptions are:
02178 .AL
02179 .LI
02180 Each formal parameterized type declaration appearing in the
02181 template definition is represented by a debugging information entry
02182 with the tag
02183 .Cf DW_TAG_template_type_parameter .
02184 Each such entry has a
02185 .Cf DW_AT_name
02186 attribute, whose value is a null-terminated
02187 string containing the name of the formal type parameter as it
02188 appears in the source program. The template type parameter
02189 entry also has a
02190 .Cf DW_AT_type
02191 attribute describing the actual type by
02192 which the formal is replaced for this instantiation.
02193 All template type parameter entries should appear before
02194 the entries describing the instantiated formal parameters
02195 to the function.
02196 .LI
02197 .IX compilation units
02198 If the compiler has generated a special compilation unit
02199 to hold the template instantiation and that compilation unit
02200 has a different name
02201 from the compilation unit containing the template definition,
02202 the name attribute for the debugging entry representing
02203 that compilation unit should be empty or omitted.
02204 .LI
02205 .IX declarations, coordinates
02206 If the subprogram entry representing the template instantiation
02207 or any of its child entries
02208 contain declaration coordinate attributes, those attributes
02209 should refer to the source for the template definition, not
02210 to any source generated artificially by the compiler for this
02211 instantiation.
02212 .LE
02213 .H 3 "Inline Subroutines"
02214 .IX subroutines, inline
02215 A declaration or a definition of an inlinable subroutine
02216 is represented by a debugging information entry with the tag
02217 .Cf DW_TAG_subprogram .
02218 The entry for a subroutine that is explicitly declared
02219 to be available for inline expansion or that was expanded inline
02220 implicitly by the compiler has a
02221 .Cf DW_AT_inline
02222 attribute whose value is a constant. The set of values
02223 for the
02224 .Cf DW_AT_inline
02225 .nr aX \n(Fg+1
02226 attribute is given in Figure \n(aX.
02227 .DF
02228 .TS
02229 box center;
02230 l l
02231 lf(CW) l
02232 .
02233 Name Meaning
02234 _
02235 DW_INL_not_inlined Not declared inline nor inlined by the compiler
02236 DW_INL_inlined Not declared inline but inlined by the compiler
02237 DW_INL_declared_not_inlined Declared inline but not inlined by the compiler
02238 DW_INL_declared_inlined Declared inline and inlined by the compiler
02239 .TE
02240 .FG "Inline codes"
02241 .DE
02242 .H 4 "Abstract Instances"
02243 For the remainder of this discussion,
02244 any debugging information entry that is owned (either directly or
02245 indirectly) by a debugging information entry that contains the
02246 .Cf DW_AT_inline
02247 attribute will be referred to as an ``abstract instance entry.''
02248 Any subroutine entry that contains a
02249 .Cf DW_AT_inline
02250 attribute will be known as an ``abstract instance root.''
02251 Any set of abstract instance entries that are all children (either directly
02252 or indirectly) of some abstract instance root, together with the root itself,
02253 will be known as an ``abstract instance tree.''
02254 .P
02255 A debugging information entry that is a member of an abstract instance
02256 tree should not contain a
02257 .Cf DW_AT_high_pc ,
02258 .Cf DW_AT_low_pc ,
02259 .Cf DW_AT_location ,
02260 .Cf DW_AT_return_addr ,
02261 .Cf DW_AT_start_scope ,
02262 or
02263 .Cf DW_AT_segment
02264 attribute.
02265 .P
02266 .I
02267 It would not make sense to put these attributes
02268 into abstract instance entries since
02269 such entries do not represent actual (concrete) instances and thus
02270 do not actually exist at run-time.
02271 .P
02272 .R
02273 The rules for the relative location of entries belonging to abstract instance
02274 trees are exactly
02275 the same as for other similar types of entries that are not abstract.
02276 Specifically, the rule that requires that an entry representing a
02277 declaration be a direct child of the entry representing the scope of
02278 the declaration applies equally to both abstract and
02279 non-abstract entries. Also, the ordering rules for formal parameter entries,
02280 member entries, and so on, all apply regardless of whether or not a given entry
02281 is abstract.
02282 .H 4 "Concrete Inlined Instances"
02283 .IX subroutines, inlined
02284 Each inline expansion of an inlinable subroutine is represented
02285 by a debugging information entry with the tag
02286 .Cf DW_TAG_inlined_subroutine .
02287 Each such entry should be a direct child of the entry that represents the
02288 scope within which the inlining occurs.
02289 .P
02290 Each inlined subroutine entry contains a
02291 .Cf DW_AT_low_pc
02292 attribute, representing the address of the first
02293 instruction associated with the given inline
02294 expansion. Each inlined subroutine entry also contains a
02295 .Cf DW_AT_high_pc
02296 attribute, representing the
02297 address of the first location past the last instruction associated with
02298 the inline expansion.
02299 .P
02300 For the remainder of this discussion,
02301 any debugging information entry that is owned (either directly or indirectly)
02302 by a debugging information entry with the tag
02303 .Cf DW_TAG_inlined_subroutine
02304 will be referred to as a ``concrete inlined instance entry.''
02305 Any entry that has the tag
02306 .Cf DW_TAG_inlined_subroutine
02307 will be known as
02308 a ``concrete inlined instance root.''
02309 Any set of concrete inlined instance entries that are all children (either
02310 directly or indirectly) of some concrete inlined instance root, together
02311 with the root itself, will be known as a ``concrete inlined instance
02312 tree.''
02313 .P
02314 Each concrete inlined instance tree is uniquely associated with one (and
02315 only one) abstract instance tree.
02316 .P
02317 .I
02318 Note, however, that the reverse is not true. Any given abstract instance
02319 tree may be associated with several different concrete inlined instance
02320 trees, or may even be associated with zero concrete inlined instance
02321 trees.
02322 .P
02323 .R
02324 Also, each separate entry within a given concrete inlined instance tree is
02325 uniquely associated with one particular entry in the associated abstract
02326 instance tree. In other words, there is a one-to-one mapping from entries
02327 in a given concrete inlined instance tree to the entries in the associated
02328 abstract instance tree.
02329 .P
02330 .I
02331 Note, however, that the reverse is not true. A given abstract instance
02332 tree that is associated with a given concrete inlined instance tree
02333 may (and quite probably will) contain more entries than the associated
02334 concrete inlined instance tree (see below).
02335 .R
02336 .P
02337 Concrete inlined instance entries do not have most of the attributes (except
02338 for
02339 .Cf DW_AT_low_pc ,
02340 .Cf DW_AT_high_pc ,
02341 .Cf DW_AT_location ,
02342 .Cf DW_AT_return_addr ,
02343 .Cf DW_AT_start_scope
02344 and
02345 .Cf DW_AT_segment )
02346 that such entries
02347 would otherwise normally have. In place of these omitted attributes,
02348 each concrete inlined instance entry has a
02349 .Cf DW_AT_abstract_origin
02350 attribute that
02351 may be used to obtain the missing information (indirectly) from
02352 the associated abstract instance entry. The value of the abstract
02353 origin attribute is a reference to the associated abstract instance entry.
02354 .P
02355 For each pair of entries that are associated via a
02356 .Cf DW_AT_abstract_origin
02357 attribute, both members of the pair will have the same tag. So, for
02358 example, an entry with the tag
02359 .Cf DW_TAG_local_variable
02360 can only be associated
02361 with another entry that also has the tag
02362 .Cf DW_TAG_local_variable.
02363 The only exception to this rule is that the root of a concrete
02364 instance tree (which must always have the tag
02365 .Cf DW_TAG_inlined_subroutine )
02366 can only be associated with the root of its associated abstract
02367 instance tree (which must have the tag
02368 .Cf DW_TAG_subprogram ).
02369 .P
02370 In general, the structure and content of any given concrete
02371 instance tree will be directly analogous to the structure and content
02372 of its associated abstract instance tree.
02373 There are two exceptions to this general rule however.
02374 .AL
02375 .LI
02376 .IX anonymous types
02377 No entries representing anonymous types are ever made a part
02378 of any concrete instance inlined tree.
02379 .LI
02380 .IX members
02381 No entries representing members of structure, union or class
02382 types are ever made a part of any concrete inlined instance tree.
02383 .LE
02384 .P
02385 .I
02386 Entries that represent members and anonymous types are omitted from concrete
02387 inlined instance trees because they would simply be redundant duplicates of
02388 the corresponding entries in the associated abstract instance trees. If
02389 any entry within a concrete inlined instance tree needs to refer to an
02390 anonymous type that was declared within the scope of the
02391 relevant inline function, the reference should simply refer to the abstract
02392 instance entry for the given anonymous type.
02393 .R
02394 .P
02395 .IX declarations, coordinates
02396 If an entry within a concrete inlined instance tree contains
02397 attributes describing the declaration coordinates of
02398 that entry,
02399 then those attributes should refer to the file, line and column
02400 of the original declaration of the subroutine, not to the
02401 point at which it was inlined.
02402 .H 4 "Out-of-Line Instances of Inline Subroutines"
02403 .IX subroutines, out-of-line
02404 Under some conditions, compilers may need to generate concrete executable
02405 instances of inline subroutines other than at points where those subroutines
02406 are actually called. For the remainder of this discussion,
02407 such concrete instances of inline subroutines will
02408 be referred to as ``concrete out-of-line instances.''
02409 .P
02410 .I
02411 In C++, for example, taking the address of a function declared to be inline
02412 can necessitate the generation of a concrete out-of-line
02413 instance of the given function.
02414 .P
02415 .R
02416 The DWARF representation of a concrete out-of-line instance of an inline
02417 subroutine is essentially the same as for a concrete inlined instance of
02418 that subroutine (as described in the preceding section). The representation
02419 of such a concrete out-of-line instance makes use of
02420 .Cf DW_AT_abstract_origin
02421 attributes in exactly the same way as they are used for a concrete inlined
02422 instance (that is, as references to corresponding entries
02423 within the associated
02424 abstract instance tree) and, as for concrete instance trees, the
02425 entries for anonymous types and for all members are omitted.
02426 .P
02427 The differences between the DWARF representation of a concrete out-of-line
02428 instance of a given subroutine and the representation of a concrete inlined
02429 instance of that same subroutine are as follows:
02430 .AL
02431 .LI
02432 The root entry for a concrete out-of-line instance of a given
02433 inline subroutine has the same tag as does its associated
02434 (abstract) inline subroutine entry (that is, it does not have the
02435 tag
02436 .Cf DW_TAG_inlined_subroutine ).
02437 .LI
02438 The root entry for a concrete out-of-line instance tree is
02439 always directly owned by the same parent entry that
02440 also owns the root entry of the associated abstract instance.
02441 .LE
02442 .H 2 "Lexical Block Entries"
02443 .I
02444 .IX lexical blocks
02445 A lexical block is a bracketed sequence of source statements that may
02446 contain any number of declarations. In some languages (C and C++)
02447 blocks can be nested within other blocks to any depth.
02448 .P
02449 .R
02450 A lexical block is represented by a debugging information entry
02451 with the tag
02452 .Cf DW_TAG_lexical_block .
02453 .P
02454 The lexical block entry has a
02455 .Cf DW_AT_low_pc
02456 attribute whose value is the
02457 relocated address of the first machine instruction generated for the lexical
02458 block.
02459 The lexical block entry also has a
02460 .Cf DW_AT_high_pc
02461 attribute whose value is the
02462 relocated address of the first location
02463 past the last machine instruction generated for the lexical block.
02464 .P
02465 If a name has been given to the lexical block in the source program,
02466 then the corresponding lexical block entry has a
02467 .Cf DW_AT_name
02468 attribute
02469 whose value is a null-terminated string containing the name of the
02470 lexical block as it appears in the source program.
02471 .P
02472 .I
02473 This is not the
02474 same as a C or C++ label (see below).
02475 .R
02476 .P
02477 The lexical block entry owns debugging information entries that
02478 describe the declarations within that lexical block.
02479 There is one such debugging information entry for each local declaration
02480 of an identifier or inner lexical block.
02481 .H 2 "Label Entries"
02482 .I
02483 .IX labels
02484 A label is a way of identifying a source statement. A labeled statement
02485 is usually the target of one or more ``go to'' statements.
02486 .P
02487 .R
02488 A label is represented by a debugging information entry
02489 with the tag
02490 .Cf DW_TAG_label .
02491 The entry for a label should be owned by
02492 the debugging information entry representing the scope within which the name
02493 of the label could be legally referenced within the source program.
02494 .P
02495 The label entry has a
02496 .Cf DW_AT_low_pc
02497 attribute whose value is the
02498 relocated address of the first machine instruction generated for the
02499 statement identified by the label in the source program.
02500 The label entry also has a
02501 .Cf DW_AT_name
02502 attribute
02503 whose value is a null-terminated string containing the name of the
02504 label as it appears in the source program.
02505 .H 2 "With Statement Entries"
02506 .I
02507 .IX with statements
02508 .IX Pascal
02509 .IX Modula2
02510 Both Pascal and Modula support the concept of a ``with'' statement.
02511 The with statement specifies a sequence of executable statements
02512 within which the fields of a record variable may be referenced, unqualified
02513 by the name of the record variable.
02514 .P
02515 .R
02516 A with statement is represented by a debugging information entry with
02517 the tag
02518 .Cf DW_TAG_with_stmt .
02519 A with statement entry has a
02520 .Cf DW_AT_low_pc
02521 attribute whose value is the relocated
02522 address of the first machine instruction generated for the body of
02523 the with statement. A with statement entry also has a
02524 .Cf DW_AT_high_pc
02525 attribute whose value is the relocated
02526 address of the first location after the last machine instruction generated for the body of
02527 the statement.
02528 .P
02529 The with statement entry has a
02530 .Cf DW_AT_type
02531 attribute, denoting
02532 the type of record whose fields may be referenced without full qualification
02533 within the body of the statement. It also has a
02534 .Cf DW_AT_location
02535 attribute, describing how to find the base address
02536 of the record object referenced within the body of the with statement.
02537 .H 2 "Try and Catch Block Entries"
02538 .I
02539 .IX C++ %caa
02540 .IX exceptions
02541 .IX try blocks
02542 .IX catch blocks
02543 In C++ a lexical block may be designated as a ``catch block.''
02544 A catch block is an exception handler that handles exceptions
02545 thrown by an immediately preceding ``try block.'' A catch block
02546 designates the type of the exception that it can handle.
02547 .R
02548 .P
02549 A try block is represented by a debugging information entry
02550 with the tag
02551 .Cf DW_TAG_try_block .
02552 A catch block is represented by a debugging information entry
02553 with the tag
02554 .Cf DW_TAG_catch_block .
02555 Both try and catch block entries contain a
02556 .Cf DW_AT_low_pc
02557 attribute whose value is the
02558 relocated address of the first machine instruction generated for that
02559 block. These entries also contain a
02560 .Cf DW_AT_high_pc
02561 attribute whose value is the
02562 relocated address of the first location
02563 past the last machine instruction generated for that block.
02564 .P
02565 Catch block entries have at least one child entry,
02566 an entry representing the type of exception accepted
02567 by that catch block. This child entry will have one of the tags
02568 .Cf DW_TAG_formal_parameter
02569 or
02570 .Cf DW_TAG_unspecified_parameters ,
02571 .IX parameters, formal
02572 .IX parameters, unspecified
02573 and will have the same form as other parameter entries.
02574 .P
02575 The first sibling of each try block entry will be a catch block
02576 entry.
02577 .OP
02578 .H 1 "DATA OBJECT AND OBJECT LIST ENTRIES"
02579 This section presents the debugging information entries that
02580 describe individual data objects: variables, parameters and
02581 constants, and lists of those objects that may be grouped
02582 in a single declaration, such as a common block.
02583 .H 2 "Data Object Entries"
02584 .IX variables
02585 .IX parameters, formal
02586 .IX constants
02587 Program variables, formal parameters and constants are represented
02588 by debugging information entries with the tags
02589 .Cf DW_TAG_variable ,
02590 .Cf DW_TAG_formal_parameter
02591 and
02592 .Cf DW_TAG_constant ,
02593 respectively.
02594 .P
02595 .I
02596 The tag
02597 .Cf DW_TAG_constant
02598 is used for languages that distinguish between variables
02599 that may have constant value and true named constants.
02600 .R
02601 .P
02602 The debugging information entry for a program variable, formal
02603 parameter or constant may have the following attributes:
02604 .AL
02605 .LI
02606 A
02607 .Cf DW_AT_name
02608 attribute whose value is a null-terminated
02609 string containing the data object name as it appears in the source program.
02610 .P
02611 .IX anonymous unions
02612 .IX unions, anonymous
02613 .IX C++ %caa
02614 If a variable entry describes a C++ anonymous union, the name
02615 attribute is omitted or consists of a single zero byte.
02616 .LI
02617 If the name of a variable is visible outside of its enclosing
02618 compilation unit, the variable entry has a
02619 .Cf DW_AT_external
02620 .IX declarations, external
02621 attribute, whose value is a flag.
02622 .I
02623 .P
02624 .IX members, static data
02625 The definitions of C++ static data members
02626 of structures or classes are represented by variable entries flagged
02627 as external.
02628 .IX C %c
02629 .IX C++ %caa
02630 Both file static and local variables in C and C++ are represented
02631 by non-external variable entries.
02632 .R
02633 .LI
02634 A
02635 .Cf DW_AT_location
02636 attribute, whose value describes the location of a variable or parameter
02637 at run-time.
02638 .P
02639 .IX declarations, non-defining
02640 A data object entry representing a non-defining declaration of the object
02641 will not have a location attribute, and will have the
02642 .Cf DW_AT_declaration
02643 attribute.
02644 .P
02645 In a variable entry representing the definition of the variable
02646 (that is, with no
02647 .Cf DW_AT_declaration
02648 attribute)
02649 if no location attribute is present, or if
02650 the location attribute is present but describes
02651 a null entry (as described in section 2.4), the variable
02652 is assumed to exist in the source code but not in the executable
02653 program (but see number 9, below).
02654 .IX optimized code
02655 .P
02656 The location of a variable may be further specified with a
02657 .Cf DW_AT_segment
02658 attribute, if appropriate.
02659 .IX segmented address space
02660 .IX address space, segmented
02661 .LI
02662 A
02663 .Cf DW_AT_type
02664 attribute describing the type of the variable, constant or formal
02665 parameter.
02666 .LI
02667 .IX members, static data
02668 .IX declarations, defining
02669 If the variable entry represents the defining declaration for a C++ static
02670 data member of a structure, class or union, the entry has a
02671 .Cf DW_AT_specification
02672 attribute, whose value is a reference to the debugging information
02673 entry representing the declaration of this data member. The
02674 referenced entry will be a child of some class, structure or
02675 union type entry.
02676 .IX classes
02677 .IX structures
02678 .IX unions
02679 .P
02680 Variable entries containing the
02681 .Cf DW_AT_specification
02682 attribute do not need to duplicate information provided by the
02683 declaration entry referenced by the specification attribute.
02684 In particular, such variable entries do not need to contain
02685 attributes for the name or type of the data member whose
02686 definition they represent.
02687 .LI
02688 .I
02689 Some languages distinguish between parameters whose value in the
02690 calling function can be modified by the callee (variable parameters),
02691 and parameters whose value in the calling function cannot be modified
02692 by the callee (constant parameters).
02693 .P
02694 .R
02695 If a formal parameter entry represents a parameter whose value
02696 in the calling function may be modified by the callee, that entry
02697 may have a
02698 .Cf DW_AT_variable_parameter
02699 attribute, whose value is a flag. The absence of this attribute
02700 implies that the parameter's value in the calling function cannot
02701 be modified by the callee.
02702 .IX parameters, variable
02703 .LI
02704 .I
02705 Fortran90 has the concept of an optional parameter.
02706 .IX Fortran90
02707 .P
02708 .R
02709 .IX parameters, optional
02710 If a parameter entry represents an optional parameter, it has a
02711 .Cf DW_AT_is_optional
02712 attribute, whose value is a flag.
02713 .LI
02714 .IX parameters, default value
02715 A formal parameter entry describing a formal parameter that has a default
02716 value may have a
02717 .Cf DW_AT_default_value
02718 attribute. The value of this attribute is a reference to the
02719 debugging information entry for a variable or subroutine. The
02720 default value of the parameter is the value of the variable (which
02721 may be constant) or the value returned by the subroutine. If the
02722 value of the
02723 .Cf DW_AT_default_value
02724 attribute is 0, it means that no default value has been specified.
02725 .LI
02726 .IX constants
02727 An entry describing a variable whose value is constant
02728 and not represented by an object in the address space of the program,
02729 or an entry describing a named constant,
02730 does not have a location attribute. Such entries have a
02731 .Cf DW_AT_const_value
02732 attribute, whose value may be a string or any of the constant
02733 data or data block forms, as appropriate for the representation
02734 of the variable's value. The value of this attribute is the actual
02735 constant value of the variable, represented as it would be
02736 on the target architecture.
02737 .LI
02738 .IX scope
02739 .IX declarations, scope
02740 If the scope of an object begins sometime after the low pc value
02741 for the scope most closely enclosing the object, the
02742 object entry may have a
02743 .Cf DW_AT_start_scope
02744 attribute. The value of this attribute is the offset in bytes of the beginning
02745 of the scope for the object from the low pc value of the debugging
02746 information entry that defines its scope.
02747 .P
02748 .I
02749 The scope of a variable may begin somewhere in the middle of a lexical
02750 block in a language that allows executable code in a
02751 block before a variable declaration, or where one declaration
02752 containing initialization code may change the scope of a subsequent
02753 declaration. For example, in the following C code:
02754 .DS
02755 \f(CWfloat x = 99.99;
02756
02757 int myfunc()
02758 {
02759 float f = x;
02760 float x = 88.99;
02761
02762 return 0;
02763 }\fP
02764 .DE
02765 .P
02766 ANSI-C scoping rules require that the value of the variable \f(CWx\fP
02767 assigned to the variable \f(CWf\fP in the initialization sequence
02768 is the value of the global variable \f(CWx\fP, rather than the local \f(CWx\fP,
02769 because the scope of the local variable \f(CWx\fP only starts after the full
02770 declarator for the local \f(CWx\fP.
02771 .R
02772 .LE
02773 .P
02774 .H 2 "Common Block Entries"
02775 .IX common blocks
02776 .IX Fortran
02777 A Fortran common block may be described by a debugging information
02778 entry with the tag
02779 .Cf DW_TAG_common_block .
02780 The common block entry has a
02781 .Cf DW_AT_name
02782 attribute whose value is a null-terminated
02783 string containing the common block name as it appears in the source program.
02784 It also has a
02785 .Cf DW_AT_location
02786 attribute whose value describes the location of the beginning of the
02787 common block. The common block entry owns debugging information
02788 entries describing the variables contained within the common block.
02789 .H 2 "Imported Declaration Entries"
02790 .I
02791 .IX declarations, imported
02792 .IX imports
02793 Some languages support the concept of importing into a given
02794 module declarations made in a different module.
02795 .R
02796 .P
02797 An imported declaration is represented by a debugging information
02798 entry with the tag
02799 .Cf DW_TAG_imported_declaration .
02800 The entry for the imported declaration has a
02801 .Cf DW_AT_name
02802 attribute whose value
02803 is a null-terminated string containing the name of the entity
02804 whose declaration is being imported as it appears in the source
02805 program. The imported declaration entry also has a
02806 .Cf DW_AT_import
02807 attribute, whose value is a reference to the debugging information
02808 entry representing the declaration that is being imported.
02809 .H 2 "Namelist Entries"
02810 .I
02811 .IX namelists
02812 .IX Fortran90
02813 At least one language, Fortran90, has the concept of a namelist.
02814 A namelist is an ordered list of the names of some set of declared objects.
02815 The namelist object itself may be used as a replacement for the
02816 list of names in various contexts.
02817 .R
02818 .P
02819 A namelist is represented by a debugging information entry with
02820 the tag
02821 .Cf DW_TAG_namelist .
02822 If the namelist itself has a name, the namelist entry has a
02823 .Cf DW_AT_name
02824 attribute, whose value is a null-terminated string containing the namelist's
02825 name as it appears in the source program.
02826 .P
02827 Each name that is part of the namelist is represented by a debugging
02828 information entry with the tag
02829 .Cf DW_TAG_namelist_item .
02830 Each such entry is a child of the namelist entry, and all of
02831 the namelist item entries for a given namelist are ordered as were
02832 the list of names they correspond to in the source program.
02833 .P
02834 Each namelist item entry contains a
02835 .Cf DW_AT_namelist_item
02836 attribute whose value is a reference to the debugging information
02837 entry representing the declaration of the item whose name
02838 appears in the namelist.
02839 .OP
02840 .H 1 "TYPE ENTRIES"
02841 This section presents the debugging information entries
02842 that describe program types: base types, modified types
02843 and user-defined types.
02844 .P
02845 If the scope of the declaration of a named type begins sometime after
02846 .IX scope
02847 .IX declarations, scope
02848 the low pc value
02849 for the scope most closely enclosing the declaration, the
02850 declaration may have a
02851 .Cf DW_AT_start_scope
02852 attribute. The value of this attribute is the offset in bytes of the beginning
02853 of the scope for the declaration from the low pc value of the debugging
02854 information entry that defines its scope.
02855 .H 2 "Base Type Entries"
02856 .I
02857 .IX base types
02858 .IX types, base
02859 A base type is a data type that is not defined in terms of
02860 other data types. Each programming language has a set of
02861 base types that are considered to be built into that language.
02862 .R
02863 .P
02864 A base type is represented by a debugging information entry
02865 with the tag
02866 .Cf DW_TAG_base_type .
02867 A base type entry has a
02868 .Cf DW_AT_name
02869 attribute whose value is a null-terminated
02870 string describing the name of the base type as recognized by
02871 the programming language of the compilation unit containing
02872 the base type entry.
02873 .P
02874 A base type entry also has a
02875 .Cf DW_AT_encoding
02876 attribute describing how the base type is encoded and is
02877 to be interpreted. The value of this attribute is a constant.
02878 The set of values and their meanings for the
02879 .Cf DW_AT_encoding
02880 .nr aX \n(Fg+1
02881 attribute is given in Figure \n(aX.
02882 .DF
02883 .TS
02884 box center;
02885 l l
02886 lf(CW) l
02887 .
02888 Name Meaning
02889 _
02890 DW_ATE_address linear machine address
02891 DW_ATE_boolean true or false
02892 DW_ATE_complex_float complex floating-point number
02893 DW_ATE_float floating-point number
02894 DW_ATE_signed signed binary integer
02895 DW_ATE_signed_char signed character
02896 DW_ATE_unsigned unsigned binary integer
02897 DW_ATE_unsigned_char unsigned character
02898 .TE
02899 .FG "Encoding attribute values"
02900 .DE
02901 .P
02902 All encodings assume the representation that is ``normal'' for
02903 the target architecture.
02904 .P
02905 A base type entry has a
02906 .Cf DW_AT_byte_size
02907 attribute, whose value is a constant,
02908 describing the size in bytes of the storage
02909 unit used to represent an object of the given type.
02910 .P
02911 If the value of an object of the given type does not
02912 fully occupy the storage unit described by the byte size attribute,
02913 the base type entry may have a
02914 .Cf DW_AT_bit_size
02915 attribute and a
02916 .Cf DW_AT_bit_offset
02917 attribute, both of whose values are constants.
02918 The bit size attribute describes the actual size in bits used
02919 to represent a value of the given type. The bit offset
02920 attribute describes the offset in bits of the high order
02921 bit of a value of the given type from the high order bit
02922 of the storage unit used to contain that value.
02923 .I
02924 .P
02925 For example, the C type
02926 .Cf int
02927 on a machine that uses 32-bit integers would be
02928 represented by a base type entry with a name
02929 attribute whose value was ``\f(CWint\fP,'' an
02930 encoding attribute whose value was
02931 .Cf DW_ATE_signed
02932 and a byte size attribute whose value was
02933 .Cf 4 .
02934 .R
02935 .H 2 "Type Modifier Entries"
02936 .IX type modifiers
02937 .IX types, modifiers
02938 A base or user-defined type may be modified in different
02939 ways in different languages. A type modifier is represented
02940 in DWARF by a debugging information entry with one of the
02941 .nr aX \n(Fg+1
02942 tags given in Figure \n(aX.
02943 .DF
02944 .TS
02945 box center;
02946 l l
02947 lf(CW) l
02948 .
02949 Tag Meaning
02950 _
02951 DW_TAG_const_type C or C++ const qualified type
02952 DW_TAG_packed_type Pascal packed type
02953 DW_TAG_pointer_type The address of the object whose type is being modified
02954 DW_TAG_reference_type A C++ reference to the object whose type is being modified
02955 DW_TAG_volatile_type C or C++ volatile qualified type
02956 .TE
02957 .FG "Type modifier tags"
02958 .DE
02959 .P
02960 .IX types, constant
02961 .IX types, packed
02962 .IX types, volatile
02963 .IX types, pointer
02964 .IX types, reference
02965 Each of the type modifier entries has a
02966 .Cf DW_AT_type
02967 attribute, whose value is a reference to a debugging information
02968 entry describing a base type, a user-defined type or another type
02969 modifier.
02970 .P
02971 A modified type entry describing a pointer or reference type
02972 may have a
02973 .IX addresses, class
02974 .Cf DW_AT_address_class
02975 attribute
02976 to describe how objects having the given pointer or reference type
02977 ought to be dereferenced.
02978 .P
02979 When multiple type modifiers are chained together to modify
02980 a base or user-defined type, they are ordered as if part of
02981 a right-associative expression involving the base or user-defined
02982 type.
02983 .I
02984 .P
02985 As examples of how type modifiers are ordered, take the following
02986 C declarations:
02987 .R
02988 .DS
02989 .ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i
02990 \f(CWconst char * volatile p;\fP
02991 \fIwhich represents a volatile pointer to a constant character.\fP
02992 \fIThis is encoded in DWARF as:\fP
02993 \f(CWDW_TAG_volatile_type \(->
02994 DW_TAG_pointer_type \(->
02995 DW_TAG_const_type \(->
02996 DW_TAG_base_type\fP
02997
02998 \f(CWvolatile char * const p;\fP
02999 \fIon the other hand, represents a constant pointer
03000 to a volatile character.\fP
03001 \fIThis is encoded as:\fP
03002 \f(CWDW_TAG_const_type \(->
03003 DW_TAG_pointer_type \(->
03004 DW_TAG_volatile_type \(->
03005 DW_TAG_base_type\fP
03006
03007 .DE
03008 .R
03009 .H 2 "Typedef Entries"
03010 .IX typedefs
03011 Any arbitrary type named via a typedef is represented
03012 by a debugging information entry with the tag
03013 .Cf DW_TAG_typedef .
03014 The typedef entry has a
03015 .Cf DW_AT_name
03016 attribute whose value is a null-terminated
03017 string containing the name of the typedef as it appears in the
03018 source program.
03019 The typedef entry also contains a
03020 .Cf DW_AT_type
03021 attribute.
03022 .P
03023 If the debugging information entry for a typedef represents a
03024 declaration of the type that is not also a definition,
03025 it does not contain a type attribute.
03026 .IX declarations, non-defining
03027 .H 2 "Array Type Entries"
03028 .I
03029 .IX arrays
03030 Many languages share the concept of an ``array,'' which is a
03031 table of components of identical type.
03032 .P
03033 .R
03034 An array type is represented by a debugging information entry with
03035 the tag
03036 .Cf DW_TAG_array_type .
03037 .P
03038 If a name has been given to the array type in the source program, then the
03039 corresponding array type entry has a
03040 .Cf DW_AT_name
03041 attribute whose value is a
03042 null-terminated string containing the array type name as it appears in the
03043 source program.
03044 .P
03045 .IX arrays, ordering
03046 The array type entry describing a multidimensional array may have a
03047 .Cf DW_AT_ordering
03048 attribute whose constant value is interpreted to mean either
03049 row-major or column-major ordering of array elements.
03050 The set of values and their meanings for the ordering attribute
03051 .nr aX \n(Fg+1
03052 are listed in Figure \n(aX.
03053 If no ordering attribute is present, the default ordering for
03054 the source language (which is indicated by the
03055 .Cf DW_AT_language
03056 attribute of the enclosing compilation unit entry)
03057 is assumed.
03058 .DF
03059 .TS
03060 box center;
03061 lf(CW)
03062 .
03063 DW_ORD_col_major
03064 DW_ORD_row_major
03065 .TE
03066 .FG "Array ordering"
03067 .DE
03068 .P
03069 The ordering attribute may optionally appear on one-dimensional arrays; it
03070 will be ignored.
03071 .P
03072 An array type entry has a
03073 .Cf DW_AT_type
03074 attribute describing the type
03075 of each element of the array.
03076 .P
03077 .IX arrays, stride
03078 If the amount of storage allocated to hold each element of an object of
03079 the given array type is different from the amount of storage that is normally
03080 allocated to hold an individual object of the indicated element type, then
03081 the array type entry has a
03082 .Cf DW_AT_stride_size
03083 attribute, whose constant value
03084 represents the size in bits of each element of the array.
03085 .P
03086 If the size of the entire array can be determined statically at compile
03087 time, the array type entry may have a
03088 .Cf DW_AT_byte_size
03089 attribute, whose constant value represents the total size in bytes of an
03090 instance of the array type.
03091 .P
03092 .I
03093 Note that if the size of the array can be determined statically at
03094 compile time, this value can usually be computed by multiplying
03095 the number of array elements by the size of each element.
03096 .P
03097 .R
03098 Each array dimension is described by a debugging information
03099 entry with either the tag
03100 .IX subranges
03101 .IX enumerations
03102 .IX arrays, dimensions
03103 .Cf DW_TAG_subrange_type
03104 or the tag
03105 .Cf DW_TAG_enumeration_type .
03106 These entries are children of the array type entry and are
03107 ordered to reflect the appearance of the dimensions in the source
03108 program (i.e. leftmost dimension first, next to leftmost second,
03109 and so on).
03110 .P
03111 .I
03112 .IX C %c
03113 In languages, such as ANSI-C, in which there is no concept of a
03114 ``multidimensional array,''
03115 an array of arrays may be represented by a debugging information entry
03116 for a multidimensional array.
03117 .R
03118 .H 2 "Structure, Union, and Class Type Entries"
03119 .I
03120 The languages C, C++, and Pascal, among others,
03121 allow the programmer to define types that
03122 are collections of related components. In C and C++, these collections are
03123 called ``structures.'' In Pascal, they are called ``records.'' The components
03124 may be of different types. The components are called ``members'' in C and
03125 C++, and ``fields'' in Pascal.
03126 .P
03127 .IX structures
03128 .IX classes
03129 .IX unions
03130 .IX records
03131 .IX C %c
03132 .IX C++ %caa
03133 .IX Pascal
03134 The components of these collections each exist in their own space in
03135 computer memory. The components of a C or C++ ``union'' all coexist in
03136 the same memory.
03137 .P
03138 Pascal and other languages have a ``discriminated union,'' also called a
03139 .IX variants
03140 .IX discriminated unions
03141 ``variant record.'' Here, selection of a number of alternative substructures
03142 (``variants'') is based on the value of a component that is not part of any of
03143 those substructures (the ``discriminant'').
03144 .P
03145 Among the languages discussed in this document,
03146 the ``class'' concept is unique to C++. A class is similar to a structure.
03147 A C++ class or structure may have ``member functions'' which are subroutines
03148 that are within the scope of a class or structure.
03149 .R
03150 .H 3 "General Structure Description"
03151 Structure, union, and class types are represented by
03152 debugging information entries with the tags
03153 .Cf DW_TAG_structure_type ,
03154 .Cf DW_TAG_union_type
03155 and
03156 .Cf DW_TAG_class_type ,
03157 respectively.
03158 If a name has been given to the structure, union, or class in the source
03159 program, then the corresponding structure type, union type, or class type
03160 entry has a
03161 .Cf DW_AT_name
03162 attribute whose value is a null-terminated string
03163 containing the type name as it appears in the source program.
03164 .P
03165 If the size of an instance of the
03166 structure type, union type, or class type entry can be determined
03167 statically at compile time, the entry has a
03168 .Cf DW_AT_byte_size
03169 attribute whose constant value is the number of bytes required to
03170 hold an instance of the structure, union, or class, and any padding bytes.
03171 .I
03172 .P
03173 .IX structures, incomplete
03174 .IX classes, incomplete
03175 .IX unions, incomplete
03176 For C and C++, an incomplete structure, union or class type is represented
03177 by a structure, union or class entry that does not have
03178 a byte size attribute and that has a
03179 .Cf DW_AT_declaration
03180 attribute.
03181 .R
03182 .P
03183 The members of a structure, union, or class are represented by
03184 debugging information entries that are owned by the corresponding
03185 structure type, union type, or class type entry and appear in the same
03186 order as the corresponding declarations in the source program.
03187 .P
03188 .I
03189 .IX declarations, defining
03190 .IX members, static data
03191 .IX members, data
03192 .IX members, functions
03193 Data member declarations occurring within the declaration of a structure,
03194 union or class type are considered to be ``definitions'' of those members,
03195 with the exception of C++ ``static'' data members, whose definitions
03196 appear outside of the declaration of the enclosing structure, union
03197 or class type. Function member declarations appearing within a structure,
03198 union or class type declaration are definitions only if the body
03199 of the function also appears within the type declaration.
03200 .R
03201 .P
03202 .IX declarations, non-defining
03203 If the definition for a given member of the structure, union or class
03204 does not appear within the body of the declaration, that member
03205 also has a debugging information entry describing its definition.
03206 That entry will have a
03207 .Cf DW_AT_specification
03208 attribute referencing
03209 the debugging entry owned by the
03210 body of the structure, union or class debugging entry and representing
03211 a non-defining declaration of the data or function member. The
03212 referenced entry will
03213 not have information about the location of that member (low and high
03214 pc attributes for function members, location descriptions for data
03215 members) and will have a
03216 .Cf DW_AT_declaration
03217 attribute.
03218 .H 3 "Derived Classes and Structures"
03219 .IX classes, derived
03220 .IX structures, derived
03221 .IX inheritance
03222 The class type or structure type entry that describes a derived class
03223 or structure owns debugging information entries describing each of
03224 the classes or structures it is derived from, ordered as they were
03225 in the source program. Each such entry has the tag
03226 .Cf DW_TAG_inheritance .
03227 .P
03228 An inheritance entry has a
03229 .Cf DW_AT_type
03230 attribute whose
03231 value is a reference to the debugging information entry describing
03232 the structure or class from which the parent structure or class
03233 of the inheritance entry is derived. It also has a
03234 .Cf DW_AT_data_member_location
03235 attribute, whose value is a location description describing
03236 the location of the beginning of
03237 the data members contributed to the entire class by this
03238 subobject relative to the beginning address of the data members of the
03239 entire class.
03240 .P
03241 .IX accessibility
03242 .IX virtuality
03243 .IX classes, virtual base
03244 An inheritance entry may have a
03245 .Cf DW_AT_accessibility
03246 attribute.
03247 If no accessibility attribute is present,
03248 private access is assumed.
03249 If the structure or class referenced by the inheritance entry serves
03250 as a virtual base class, the inheritance entry has a
03251 .Cf DW_AT_virtuality
03252 attribute.
03253 .P
03254 .I
03255 In C++, a derived class may contain access declarations that
03256 change the accessibility of individual class members from
03257 the overall accessibility specified by the inheritance declaration.
03258 A single access declaration may refer to a set of overloaded
03259 names.
03260 .R
03261 .P
03262 If a derived class or structure contains access declarations,
03263 .IX access declarations
03264 .IX C++ %caa
03265 each such declaration may be represented by a debugging information
03266 entry with the tag
03267 .Cf DW_TAG_access_declaration .
03268 Each such entry is a child of the structure or class type entry.
03269 .P
03270 An access declaration entry has a
03271 .Cf DW_AT_name
03272 attribute, whose value
03273 is a null-terminated string representing the name used in the
03274 declaration in the source program, including any class or structure
03275 qualifiers.
03276 .P
03277 An access declaration entry also has a
03278 .Cf DW_AT_accessibility
03279 attribute
03280 describing the declared accessibility of the named entities.
03281 .H 3 "Friends"
03282 .IX friends
03283 .IX classes, friends
03284 Each ``friend'' declared by
03285 a structure, union or class type may be represented by
03286 a debugging information entry that is a child of the structure,
03287 union or class type entry; the friend entry has the tag
03288 .Cf DW_TAG_friend.
03289 .P
03290 A friend entry has a
03291 .Cf DW_AT_friend
03292 attribute, whose value is a reference to the debugging information
03293 entry describing the declaration of the friend.
03294 .H 3 "Structure Data Member Entries"
03295 .IX members, data
03296 A data member (as opposed to a member function) is represented by
03297 a debugging information entry with the tag
03298 .Cf DW_TAG_member .
03299 The member entry for a named member has a
03300 .Cf DW_AT_name
03301 attribute
03302 whose value is a null-terminated string containing the member name
03303 as it appears in the source program. If the member entry describes
03304 a C++ anonymous union, the name attribute is omitted or consists
03305 of a single zero byte.
03306 .IX unions, anonymous
03307 .IX anonymous unions
03308 .P
03309 The structure data member entry has a
03310 .Cf DW_AT_type
03311 attribute
03312 to denote the type of that member.
03313 .P
03314 If the member entry is defined in the structure or class body, it has a
03315 .Cf DW_AT_data_member_location
03316 attribute whose value is a location
03317 description that describes the location of that
03318 member relative to the base address of the structure, union, or class that
03319 most closely encloses the corresponding member declaration.
03320 .I
03321 .P
03322 .IX locations, expressions
03323 .IX locations, descriptions
03324 The addressing expression represented by the location
03325 description for a structure data member expects the base address
03326 of the structure data member to be on the expression stack
03327 before being evaluated.
03328 .P
03329 .IX unions
03330 The location description for a data member of a union may be omitted,
03331 since all data members of a union begin at the same address.
03332 .R
03333 .P
03334 .IX bit fields
03335 .IX members, bit fields
03336 If the member entry describes a bit field, then that entry has the following
03337 attributes:
03338 .AL
03339 .LI
03340 A
03341 .Cf DW_AT_byte_size
03342 attribute whose constant value is the number of bytes that
03343 contain an instance of the bit field and any padding bits.
03344 .P
03345 .I
03346 The byte size attribute may be omitted if the size of the object containing
03347 the bit field can be inferred from the type attribute of the data
03348 member containing the bit field.
03349 .R
03350 .LI
03351 A
03352 .Cf DW_AT_bit_offset
03353 attribute whose constant value is the number of bits
03354 to the left of the leftmost (most significant) bit of the bit field value.
03355 .LI
03356 A
03357 .Cf DW_AT_bit_size
03358 attribute whose constant value is the number of bits occupied
03359 by the bit field value.
03360 .LE
03361 .P
03362 The location description for a bit field calculates the address of
03363 an anonymous object containing the bit field. The address is
03364 relative to the structure, union, or class that
03365 most closely encloses the bit field declaration. The number
03366 of bytes in this anonymous object is the value of the byte
03367 size attribute of the bit field. The offset (in bits)
03368 from the most significant bit of the
03369 anonymous object to the most significant bit of the bit field is the
03370 value of the bit offset attribute.
03371 .I
03372 .P
03373 For example, take one possible representation of the following
03374 structure definition in both big and little endian byte orders:
03375 .DS
03376 \f(CW
03377 struct S {
03378 int j:5;
03379 int k:6;
03380 int m:5;
03381 int n:8;
03382 };\fP
03383 .DE
03384 .P
03385 In both cases, the location descriptions for the debugging information
03386 entries for \f(CWj\fP, \f(CWk\fP, \f(CWm\fP and \f(CWn\fP
03387 describe the address of
03388 the same 32-bit word that contains all three members.
03389 (In the big-endian case,
03390 the location description addresses the most significant byte, in
03391 the little-endian case, the least significant).
03392 The following diagram shows the structure layout and lists the bit
03393 offsets for each case. The offsets
03394 are from the most significant bit of the object addressed by the location
03395 description.
03396 .PS
03397 bitht = .3
03398 boxht = bitht
03399 bitwid = .11
03400 nibwid = .75 * bitwid
03401 bytewid = 8 * bitwid
03402 boxwid = bytewid
03403 define nibble X # nibble(len, "label", hi-left, hi-right, lo-left, lo-right, any)
03404 N: box width $1*nibwid $2 $7
03405 { if $3 >= 0 then % "\s-4\|$3\s0" at N.w + (0,bitht/3) ljust %
03406 } # curly on separate line for pic bug
03407 { if $4 >= 0 then % "\s-4\|$4\s0" at N.e + (0,bitht/3) rjust %
03408 }
03409 { if $5 >= 0 then % "\s-4\|$5\s0" at N.w - (0,bitht/3) ljust %
03410 }
03411 { if $6 >= 0 then % "\s-4$6\|\s0" at N.e - (0,bitht/3) rjust %
03412 }
03413 X
03414 define tbox X # tbox(width,"label", any)
03415 T: box width $1*nibwid ht 1/6 $3 invis
03416 { $2 at T.w ljust
03417 }
03418 X
03419 .PE
03420 .DS
03421 .PS
03422 down
03423 H: tbox(20,"Bit Offsets:")
03424 tbox(20,"\f(CW j:0\fP")
03425 tbox(20,"\f(CW k:5\fP")
03426 tbox(20,"\f(CW m:11\fP")
03427 tbox(20,"\f(CW n:16\fP")
03428 right
03429 H: tbox(32, "Big-Endian", with .w at H.e)
03430 H: nibble(5,"\f(CWj\fP",0,-1,31,-1,with .nw at H.sw)
03431 H: nibble(6,"\f(CWk\fP",-1,-1,26,-1)
03432 H: nibble(5,"\f(CWm\fP",-1,-1,20,-1)
03433 H: nibble(8,"\f(CWn\fP",-1,-1,15,-1)
03434 H: nibble(8,"\fIpad\fP",-1,-1,7,0)
03435 .PE
03436 .DE
03437 .DS
03438 .PS
03439 down
03440 H: tbox(20,"Bit Offsets:")
03441 tbox(20,"\f(CW j:27\fP")
03442 tbox(20,"\f(CW k:21\fP")
03443 tbox(20,"\f(CW m:16\fP")
03444 tbox(20,"\f(CW n:8\fP")
03445 right
03446 H: tbox(32, "Little-Endian", with .w at H.e)
03447 H: nibble(8,"\f2pad\fP",-1,-1,31,-1, with .nw at H.sw)
03448 H: nibble(8,"\f(CWn\fP",-1,-1,23,-1)
03449 H: nibble(5,"\f(CWm\fP",-1,-1,15,-1)
03450 H: nibble(6,"\f(CWk\fP",-1,-1,10,-1)
03451 H: nibble(5,"\f(CWj\fP",-1,0,4,0)
03452 .PE
03453 .DE
03454 .R
03455 .H 3 "Structure Member Function Entries"
03456 .IX subroutines, members
03457 .IX members, functions
03458 .IX members, locations
03459 A member function is represented in the debugging information by a
03460 debugging information entry with the tag
03461 .Cf DW_TAG_subprogram .
03462 The member function entry may contain the same attributes and follows
03463 the same rules as non-member global subroutine entries (see section 3.3).
03464 .P
03465 .IX virtuality
03466 .IX virtual functions
03467 If the member function entry describes a virtual function, then that entry
03468 has a
03469 .Cf DW_AT_virtuality
03470 attribute.
03471 .P
03472 An entry for a virtual function also has a
03473 .Cf DW_AT_vtable_elem_location
03474 attribute whose value contains a location
03475 description yielding the address of the slot for the function
03476 within the virtual function table for the enclosing class or structure.
03477 .P
03478 .IX declarations, defining
03479 If a subroutine entry represents the defining declaration
03480 of a member function and that definition appears outside
03481 of the body of the enclosing class or structure declaration,
03482 the subroutine entry has a
03483 .Cf DW_AT_specification
03484 attribute, whose value is a reference to the debugging information
03485 entry representing the declaration of this function member. The
03486 referenced entry will be a child of some class or structure
03487 type entry.
03488 .P
03489 Subroutine entries containing the
03490 .Cf DW_AT_specification
03491 attribute do not need to duplicate information provided by the
03492 declaration entry referenced by the specification attribute.
03493 In particular, such entries do not need to contain
03494 attributes for the name or return type of the function member whose
03495 definition they represent.
03496 .H 3 "Class Template Instantiations"
03497 .I
03498 .IX C++ %caa
03499 .IX templates
03500 In C++ a class template is a generic
03501 definition of a class type that
03502 is instantiated differently when an instance of the class
03503 is declared or defined. The generic description of the class
03504 may include both parameterized types and parameterized constant
03505 values. DWARF does not represent the generic
03506 template definition, but does represent each instantiation.
03507 .R
03508 .P
03509 A class template instantiation is represented by a debugging information
03510 with the tag
03511 .Cf DW_TAG_class_type .
03512 With four exceptions,
03513 such an entry will contain the same attributes and have the same
03514 types of child entries as would an entry for a class type defined
03515 explicitly using the instantiation types and values.
03516 The exceptions are:
03517 .AL
03518 .LI
03519 Each formal parameterized type declaration appearing in the
03520 template definition is represented by a debugging information entry
03521 with the tag
03522 .Cf DW_TAG_template_type_parameter .
03523 Each such entry has a
03524 .Cf DW_AT_name
03525 attribute, whose value is a null-terminated
03526 string containing the name of the formal type parameter as it
03527 appears in the source program. The template type parameter
03528 entry also has a
03529 .Cf DW_AT_type
03530 attribute describing the actual type by
03531 which the formal is replaced for this instantiation.
03532 .LI
03533 Each formal parameterized value declaration appearing
03534 in the templated definition is represented by a debugging information
03535 entry with the tag
03536 .Cf DW_TAG_template_value_parameter .
03537 Each such entry has a
03538 .Cf DW_AT_name
03539 attribute, whose value is a null-terminated
03540 string containing the name of the formal value parameter as it
03541 appears in the source program. The template value parameter
03542 entry also has a
03543 .Cf DW_AT_type
03544 attribute describing the type of the parameterized
03545 value. Finally, the template value parameter entry has a
03546 .Cf DW_AT_const_value
03547 attribute, whose value is the actual constant value of the value
03548 parameter for this instantiation as represented on the target
03549 architecture.
03550 .LI
03551 .IX compilation units
03552 If the compiler has generated a special compilation unit
03553 to hold the template instantiation and that compilation unit
03554 has a different name
03555 from the compilation unit containing the template definition,
03556 the name attribute for the debugging entry representing
03557 that compilation unit should be empty or omitted.
03558 .LI
03559 .IX declarations, coordinates
03560 If the class type entry representing the template instantiation
03561 or any of its child entries
03562 contain declaration coordinate attributes, those attributes
03563 should refer to the source for the template definition, not
03564 to any source generated artificially by the compiler.
03565 .LE
03566 .H 3 "Variant Entries"
03567 .IX variants
03568 .IX discriminated unions
03569 A variant part of a structure is represented by a debugging
03570 information entry with the tag
03571 .Cf DW_TAG_variant_part
03572 and is owned by the corresponding structure type
03573 entry.
03574 .P
03575 .IX discriminants
03576 If the variant part has a discriminant, the discriminant is represented
03577 by a separate debugging information entry which is a child of
03578 the variant part entry. This entry has the form of a structure data member
03579 entry.
03580 The variant part entry will have a
03581 .Cf DW_AT_discr
03582 attribute whose value is a
03583 reference to the member entry for the discriminant.
03584 .P
03585 If the variant part
03586 does not have a discriminant (tag field), the variant part entry has a
03587 .Cf DW_AT_type
03588 attribute to represent the tag type.
03589 .P
03590 Each variant of a particular variant part is represented by a debugging
03591 information entry with the tag
03592 .Cf DW_TAG_variant
03593 and is a child of the variant part entry. The value that selects a
03594 given variant may be represented in one of three ways. The
03595 variant entry may have a
03596 .Cf DW_AT_discr_value
03597 attribute whose value represents a single case label.
03598 The value of this attribute
03599 is encoded as an LEB128 number. The number is signed if the tag
03600 type for the variant part containing this variant is
03601 a signed type. The number is unsigned if the tag type is an unsigned type.
03602 .P
03603 Alternatively, the variant entry may contain a
03604 .Cf DW_AT_discr_list
03605 attribute, whose value represents a list of discriminant values.
03606 This list is represented by any of the block forms and may contain
03607 a mixture of case labels and label ranges. Each item on the list
03608 is prefixed with a discriminant value descriptor that determines whether
03609 the list item represents a single label or a label range.
03610 A single case label is represented as an LEB128
03611 number as defined above
03612 for the
03613 .Cf DW_AT_discr_value
03614 attribute. A label range is represented by two LEB128 numbers,
03615 the low value of the range followed by the high value. Both values
03616 follow the rules for signedness just described.
03617 The discriminant value descriptor is a constant that may have
03618 .nr aX \n(Fg+1
03619 one of the values given in Figure \n(aX.
03620 .DF
03621 .TS
03622 center box;
03623 lf(CW)
03624 .
03625 DW_DSC_label
03626 DW_DSC_range
03627 .TE
03628 .FG "Discriminant descriptor values"
03629 .DE
03630 .P
03631 If a variant entry has neither a
03632 .Cf DW_AT_discr_value
03633 attribute nor a
03634 .Cf DW_AT_discr_list
03635 attribute, or if it has a
03636 .Cf DW_AT_discr_list
03637 attribute with 0 size, the variant is a default variant.
03638 .P
03639 The components selected by a particular variant are represented
03640 by debugging information entries owned by the corresponding variant
03641 entry and appear in the same order as the corresponding declarations in
03642 the source program.
03643 .H 2 "Enumeration Type Entries"
03644 .I
03645 .IX enumerations
03646 An ``enumeration type'' is a scalar that can assume one of a fixed number of
03647 symbolic values.
03648 .P
03649 .R
03650 An enumeration type is represented by a debugging information entry
03651 with the tag
03652 .Cf DW_TAG_enumeration_type .
03653 .P
03654 If a name has been given to the enumeration type in the source program,
03655 then the corresponding enumeration type entry has a
03656 .Cf DW_AT_name
03657 attribute
03658 whose value is a null-terminated string containing the enumeration type
03659 name as it appears in the source program.
03660 These entries also have a
03661 .Cf DW_AT_byte_size
03662 attribute whose
03663 constant value is the number of bytes required to hold an
03664 instance of the enumeration.
03665 .P
03666 Each enumeration literal is represented by a debugging information
03667 entry with the tag
03668 .Cf DW_TAG_enumerator .
03669 Each such entry is a child of the enumeration type entry, and
03670 the enumerator entries appear in the same order as the declarations of
03671 the enumeration literals in the source program.
03672 .P
03673 Each enumerator entry has a
03674 .Cf DW_AT_name
03675 attribute, whose value is
03676 a null-terminated string containing the name of the enumeration
03677 literal as it appears in the source program. Each enumerator
03678 entry also has a
03679 .Cf DW_AT_const_value
03680 attribute, whose value is the actual numeric value of the enumerator
03681 as represented on the target system.
03682 .H 2 "Subroutine Type Entries"
03683 .I
03684 .IX subroutines, types
03685 It is possible in C to declare pointers to subroutines that return a value
03686 of a specific type. In both ANSI C and C++, it is possible to declare
03687 pointers to subroutines that not only return a value of a specific type,
03688 but accept only arguments of specific types. The type of such pointers
03689 would be described with a ``pointer to'' modifier applied to a user-defined
03690 type.
03691 .R
03692 .P
03693 A subroutine type is represented by a debugging information entry
03694 with the tag
03695 .Cf DW_TAG_subroutine_type .
03696 If a name has been given to the subroutine type in the source program,
03697 then the corresponding subroutine type entry has a
03698 .Cf DW_AT_name
03699 attribute
03700 whose value is a null-terminated string containing the subroutine type
03701 name as it appears in the source program.
03702 .P
03703 .IX subroutines, return types
03704 If the subroutine type describes a function that returns a value, then
03705 the subroutine type entry has a
03706 .Cf DW_AT_type
03707 attribute
03708 to denote the type returned by the subroutine.
03709 If the types of the arguments are necessary to describe the subroutine type,
03710 then the corresponding subroutine type entry owns debugging
03711 information entries that describe the arguments.
03712 These debugging information entries appear in the order
03713 that the corresponding argument types appear in the source program.
03714 .P
03715 .I
03716 .IX C %c
03717 .IX subroutines, prototypes
03718 In ANSI-C there is a difference between the types of functions
03719 declared using function prototype style declarations and those
03720 declared using non-prototype declarations.
03721 .P
03722 .R
03723 A subroutine entry
03724 declared with a function prototype style declaration may have a
03725 .Cf DW_AT_prototyped
03726 attribute, whose value is a flag.
03727 .P
03728 Each debugging information entry
03729 owned by a subroutine type entry has a tag whose value has one of
03730 two possible interpretations.
03731 .AL
03732 .LI
03733 .IX parameters, formal
03734 Each debugging information entry that is owned by a subroutine type entry and
03735 that defines a single argument of a specific type has the tag
03736 .Cf DW_TAG_formal_parameter .
03737 .P
03738 The formal parameter entry has a type attribute
03739 to denote the type of the corresponding formal parameter.
03740 .LI
03741 The unspecified parameters of a variable parameter list are represented by a
03742 debugging information entry owned by the subroutine type entry with the tag
03743 .Cf DW_TAG_unspecified_parameters .
03744 .IX parameters, unspecified
03745 .LE
03746 .H 2 "String Type Entries"
03747 .I
03748 .IX string types
03749 .IX Fortran
03750 A ``string'' is a sequence of characters that have specific semantics and
03751 operations that separate them from arrays of characters.
03752 Fortran is one of
03753 the languages that has a string type.
03754 .R
03755 .P
03756 A string type is represented by a debugging information entry
03757 with the tag
03758 .Cf DW_TAG_string_type .
03759 If a name has been given to the string type in the source program,
03760 then the corresponding string type entry has a
03761 .Cf DW_AT_name
03762 attribute
03763 whose value is a null-terminated string containing the string type
03764 name as it appears in the source program.
03765 .P
03766 The string type entry may have a
03767 .Cf DW_AT_string_length
03768 attribute whose value is a location description
03769 yielding the location where the length of the string
03770 is stored in the program. The string type entry may also have a
03771 .Cf DW_AT_byte_size
03772 attribute, whose constant value is the size in bytes of the data
03773 to be retrieved from the location referenced by the string length
03774 attribute. If no byte size attribute is present, the size of the
03775 data to be retrieved is the same as the size of an address on
03776 the target machine.
03777 .P
03778 If no string length attribute is present, the string type entry may have
03779 a
03780 .Cf DW_AT_byte_size
03781 attribute, whose constant value is the length in bytes of
03782 the string.
03783 .H 2 "Set Entries"
03784 .I
03785 Pascal provides the concept of a ``set,'' which represents a group of
03786 values of ordinal type.
03787 .P
03788 .R
03789 .IX Pascal
03790 .IX set types
03791 A set is represented by a debugging information entry
03792 with the tag
03793 .Cf DW_TAG_set_type .
03794 If a name has been given to the set type,
03795 then the set type entry has a
03796 .Cf DW_AT_name
03797 attribute
03798 whose value is a null-terminated string containing the set type name
03799 as it appears in the source program.
03800 .P
03801 The set type entry has a
03802 .Cf DW_AT_type
03803 attribute to denote the type
03804 of an element of the set.
03805 .P
03806 If the amount of storage allocated to hold each element of an object of
03807 the given set type is different from the amount of storage that is normally
03808 allocated to hold an individual object of the indicated element type, then
03809 the set type entry has a
03810 .Cf DW_AT_byte_size
03811 attribute, whose constant value
03812 represents the size in bytes of an instance of the set type.
03813 .H 2 "Subrange Type Entries"
03814 .I
03815 Several languages support the concept of a ``subrange'' type object.
03816 These objects can represent a subset of the values that an
03817 object of the basis type for the subrange can represent.
03818 Subrange type entries may also be used to represent the bounds
03819 of array dimensions.
03820 .R
03821 .P
03822 .IX subranges
03823 A subrange type is represented by a debugging information entry
03824 with the tag
03825 .Cf DW_TAG_subrange_type .
03826 If a name has been given to the subrange type,
03827 then the subrange type entry has a
03828 .Cf DW_AT_name
03829 attribute
03830 whose value is a null-terminated string containing the subrange type name
03831 as it appears in the source program.
03832 .P
03833 The subrange entry may have a
03834 .Cf DW_AT_type
03835 attribute to describe
03836 the type of object of whose values this subrange is a subset.
03837 .P
03838 If the amount of storage allocated to hold each element of an object of
03839 the given subrange type is different from the amount of storage that is normally
03840 allocated to hold an individual object of the indicated element type, then
03841 the subrange type entry has a
03842 .Cf DW_AT_byte_size
03843 attribute, whose constant value
03844 represents the size in bytes of each element of the subrange type.
03845 .P
03846 The subrange entry may have the attributes
03847 .Cf DW_AT_lower_bound
03848 and
03849 .Cf DW_AT_upper_bound
03850 to describe, respectively, the lower and upper bound values
03851 of the subrange.
03852 The
03853 .Cf DW_AT_upper_bound
03854 attribute may be replaced by a
03855 .Cf DW_AT_count
03856 attribute, whose value describes the number of elements in
03857 the subrange rather than the value of the last element.
03858 If a bound or count value is described by a constant
03859 not represented in the program's address space and can
03860 be represented by one of the constant attribute forms, then the value
03861 of the lower or upper bound or count attribute may be one of the constant
03862 types. Otherwise, the value of the lower or upper bound or count
03863 attribute is a reference to a debugging information entry describing
03864 an object containing the bound value or itself describing a constant
03865 value.
03866 .P
03867 If either the lower or upper bound or count values are missing, the
03868 bound value is assumed to be a language-dependent default
03869 constant.
03870 .P
03871 .I
03872 .IX C %c
03873 .IX C++ %caa
03874 .IX Fortran
03875 The default lower bound value for C or C++ is 0. For Fortran,
03876 it is 1. No other default values are currently defined by DWARF.
03877 .R
03878 .P
03879 If the subrange entry has no type attribute describing the basis
03880 type, the basis type is assumed to be the same as the object
03881 described by the lower bound attribute (if it references an object).
03882 If there is no lower bound attribute, or it does not reference
03883 an object, the basis type is the type of the upper bound or count
03884 attribute
03885 (if it references an object). If there is no upper bound or count attribute
03886 or it does not reference an object, the type is assumed to be
03887 the same type, in the source language
03888 of the compilation unit containing the subrange entry,
03889 as a signed integer with the same size
03890 as an address on the target machine.
03891 .H 2 "Pointer to Member Type Entries"
03892 .I
03893 In C++, a pointer to a data or function member of a class or
03894 structure is a unique type.
03895 .P
03896 .R
03897 .IX C++ %caa
03898 .IX members, pointers to
03899 .IX pointers to members
03900 A debugging information entry
03901 representing the type of an object that is a pointer to a structure
03902 or class member has the tag
03903 .Cf DW_TAG_ptr_to_member_type .
03904 .P
03905 If the pointer to member type has a name, the pointer to member entry
03906 has a
03907 .Cf DW_AT_name
03908 attribute, whose value is a null-terminated string
03909 containing the type name as it appears in the source program.
03910 .P
03911 The pointer to member entry has a
03912 .Cf DW_AT_type
03913 attribute to describe
03914 the type of the class or structure member to which objects
03915 of this type may point.
03916 .P
03917 The pointer to member entry also has a
03918 .Cf DW_AT_containing_type
03919 attribute, whose value is a reference to a debugging information
03920 entry for the class or structure to whose members objects of
03921 this type may point.
03922 .P
03923 Finally, the pointer to member entry has a
03924 .Cf DW_AT_use_location
03925 attribute whose value is a location description that computes
03926 the address of the member of the class or structure to which the
03927 pointer to member type entry can point.
03928 .P
03929 .I
03930 The method used to find the address of a given member
03931 of a class or structure is common to any instance of that
03932 class or structure and to any instance of the pointer or
03933 member type. The method is thus associated
03934 with the type entry, rather than with each instance of the type.
03935 .P
03936 The
03937 .Cf DW_AT_use_location
03938 expression, however, cannot be used on its own, but must
03939 be used in conjunction with the location expressions for
03940 a particular object of the given pointer to member type
03941 and for a particular structure or class instance. The
03942 .Cf DW_AT_use_location
03943 attribute expects two values to be pushed onto the location expression
03944 stack before the
03945 .Cf DW_AT_use_location
03946 expression is evaluated. The first value pushed should be
03947 the value of the pointer to member object itself.
03948 The second value pushed should be the base address of the entire
03949 structure or union instance containing the member whose
03950 address is being calculated.
03951 .P
03952 So, for an expression like
03953 .DS
03954 \f(CWobject.*mbr_ptr\fP
03955 .DE
03956 where \f(CWmbr_ptr\fP has some pointer to member type,
03957 a debugger should:
03958 .AL
03959 .LI
03960 Push the value of
03961 .Cf mbr_ptr
03962 onto the location expression stack.
03963 .LI
03964 Push the base address of
03965 .Cf object
03966 onto the location expression stack.
03967 .LI
03968 Evaluate the
03969 .Cf DW_AT_use_location
03970 expression for the type of
03971 .Cf mbr_ptr .
03972 .LE
03973 .R
03974 .H 2 "File Type Entries"
03975 .I
03976 Some languages, such as Pascal, provide a first class data type
03977 to represent files.
03978 .R
03979 .P
03980 .IX Pascal
03981 .IX file types
03982 A file type is represented by a debugging information entry
03983 with the tag
03984 .Cf DW_TAG_file_type.
03985 If the file type has a name, the file type entry
03986 has a
03987 .Cf DW_AT_name
03988 attribute, whose value is a null-terminated string
03989 containing the type name as it appears in the source program.
03990 .P
03991 The file type entry has a
03992 .Cf DW_AT_type
03993 attribute describing the type
03994 of the objects contained in the file.
03995 .P
03996 The file type entry also has a
03997 .Cf DW_AT_byte_size
03998 attribute, whose value
03999 is a constant representing the size in bytes of an instance
04000 of this file type.
04001 .OP
04002 .H 1 "OTHER DEBUGGING INFORMATION"
04003 This section describes debugging information that
04004 is not represented in the form of debugging information
04005 entries and is not contained within the
04006 .Cf .debug_info
04007 section.
04008 .H 2 "Accelerated Access"
04009 .I
04010 .IX accelerated access
04011 A debugger frequently needs to find the debugging information for
04012 a program object defined outside of the compilation unit
04013 where the debugged program is currently stopped. Sometimes
04014 it will know only the name of the object; sometimes only the address.
04015 To find the debugging information
04016 associated with a global object by name, using the DWARF debugging information
04017 entries alone, a debugger would need
04018 to run through all entries at the highest scope within each
04019 compilation unit. For lookup by address, for a subroutine,
04020 a debugger can use the low and high pc attributes
04021 of the compilation unit entries to quickly narrow down the search,
04022 but these attributes only cover
04023 the range of addresses for the text associated with a compilation
04024 unit entry. To find the debugging information associated with a
04025 data object, an exhaustive search would be needed.
04026 Furthermore, any search through debugging information entries for
04027 different compilation units within a large program
04028 would potentially require the access of many memory pages,
04029 probably hurting debugger performance.
04030 .R
04031 .P
04032 To make lookups of program objects by name or by address faster,
04033 a producer of DWARF information may provide two different types
04034 of tables containing information about the debugging information
04035 entries owned by a particular compilation unit entry in a more condensed
04036 format.
04037 .H 3 "Lookup by Name"
04038 .IX lookup, by name
04039 For lookup by name, a table is maintained in a separate
04040 object file section called
04041 .Cf .debug_pubnames .
04042 .IX \f(CW.debug_pubnames\fP %debugap
04043 The table consists of sets of variable length entries, each
04044 set describing the names of global objects whose definitions
04045 or declarations are represented by debugging information entries
04046 owned by a single compilation unit. Each set begins
04047 with a header containing four values: the total length of the entries
04048 for that set, not including the length field itself, a version number,
04049 the offset from the beginning of the
04050 .Cf .debug_info
04051 .IX \f(CW.debug_info\fP %debugai
04052 section of the compilation unit entry referenced by the set and
04053 the size in bytes of the contents of the
04054 .Cf .debug_info
04055 section generated to represent that compilation unit. This
04056 header is followed by a variable number of offset/name pairs.
04057 Each pair consists of the offset from the beginning of the compilation
04058 unit entry corresponding to the current set to the
04059 debugging information entry for
04060 the given object, followed by a null-terminated character
04061 string representing the name of the object as given by
04062 the
04063 .Cf DW_AT_name
04064 attribute of the referenced debugging entry.
04065 Each set of names is terminated by zero.
04066 .P
04067 .IX C++ %caa
04068 .IX members, static data
04069 In the case of the name of a static data member or function member
04070 of a C++ structure, class or union, the name presented
04071 in the
04072 .Cf .debug_pubnames
04073 section is not the simple name given by the
04074 .Cf DW_AT_name
04075 attribute of the referenced debugging entry, but rather
04076 the fully class qualified name of the data or function member.
04077 .IX identifiers, names
04078 .H 3 "Lookup by Address"
04079 .IX lookup, by address
04080 For lookup by address, a table is maintained in a separate
04081 object file section called
04082 .Cf .debug_aranges .
04083 .IX \f(CW.debug_aranges\fP %debugaar
04084 The table consists of sets of variable length entries, each
04085 set describing the portion of the program's address space that
04086 is covered by a single compilation unit. Each set begins
04087 with a header containing five values:
04088 .AL
04089 .LI
04090 The total length of the entries
04091 for that set, not including the length field itself.
04092 .LI
04093 A version number.
04094 .LI
04095 The offset from the beginning of the
04096 .Cf .debug_info
04097 .IX \f(CW.debug_info\fP %debugai
04098 section of the compilation unit entry referenced by the set.
04099 .LI
04100 The size in bytes of an address on the target architecture. For
04101 segmented addressing, this is the size of the offset portion of the
04102 .IX addresses, offset portion
04103 .IX addresses, size of
04104 address.
04105 .LI
04106 .IX address space, segmented
04107 .IX segmented address space
04108 The size in bytes of a segment descriptor on the target architecture.
04109 If the target system uses a flat address space, this value is 0.
04110 .LE
04111 .P
04112 This
04113 header is followed by a variable number of address
04114 range descriptors. Each descriptor is a pair consisting of
04115 the beginning address
04116 of a range of text or data covered by some entry owned
04117 by the corresponding compilation unit entry, followed by the length
04118 of that range. A particular set is terminated by an entry consisting
04119 of two zeroes. By scanning the table, a debugger can quickly
04120 decide which compilation unit to look in to find the debugging information
04121 for an object that has a given address.
04122 .H 2 "Line Number Information"
04123 .I
04124 .IX line number information
04125 A source-level debugger will need to know how to associate statements in
04126 the source files with the corresponding machine instruction addresses in
04127 the executable object or the shared objects used by that executable
04128 object. Such an association would make it possible for the debugger user
04129 to specify machine instruction addresses in terms of source statements.
04130 This would be done by specifying the line number and the source file
04131 containing the statement. The debugger can also use this information to
04132 display locations in terms of the source files and to single step from
04133 statement to statement.
04134 .R
04135 .P
04136 As mentioned in section 3.1, above,
04137 the line number information generated for a compilation unit
04138 is represented in the \f(CW.debug_line\fP section of an object file and is
04139 referenced by a corresponding compilation unit debugging information entry
04140 in the \f(CW.debug_info\fP section.
04141 .IX \f(CW.debug_info\fP %debugai
04142 .IX \f(CW.debug_line\fP %debugali
04143 .I
04144 .P
04145 If space were not a consideration, the information
04146 provided in the
04147 .Cf .debug_line
04148 section could be represented as a large matrix,
04149 with one row for each instruction in the emitted
04150 object code. The matrix would have columns for:
04151 .DL
04152 .LI
04153 the source file name
04154 .LI
04155 the source line number
04156 .LI
04157 the source column number
04158 .LI
04159 whether this instruction is the beginning of a source statement
04160 .LI
04161 whether this instruction is the beginning of a basic block.
04162 .LE
04163 .P
04164 Such a matrix, however, would be impractically large. We shrink it with
04165 two techniques. First, we delete from the matrix each row whose file,
04166 line and source column information is identical with that of its predecessors.
04167 Second, we design a byte-coded language for a state machine and store a stream
04168 of bytes in the object file instead of the matrix. This language can be
04169 much more compact than the matrix. When a consumer of the statement
04170 information executes, it must ``run'' the state machine to generate
04171 the matrix for each compilation unit it is interested in. The concept
04172 of an encoded matrix also leaves room for expansion. In the future,
04173 columns can be added to the matrix to encode other things that are
04174 related to individual instruction addresses.
04175 .R
04176 .H 3 "Definitions"
04177 .IX line number information, definitions
04178 The following terms are used in the description of the line number information
04179 format:
04180 .VL 20
04181 .LI "state machine"
04182 The hypothetical machine used by a consumer of the line number information
04183 to expand the byte-coded instruction stream into a
04184 matrix of line number information.
04185 .LI "statement program"
04186 A series of byte-coded line number information instructions representing one
04187 compilation unit.
04188 .LI "basic block"
04189 A sequence of instructions that is entered only at the first instruction
04190 and exited only at the last instruction. We define a procedure invocation
04191 to be an exit from a basic block.
04192 .LI "sequence"
04193 A series of contiguous target machine instructions. One compilation
04194 unit may emit multiple sequences (that is, not all instructions within
04195 a compilation unit are assumed to be contiguous).
04196 .LI "sbyte"
04197 Small signed integer.
04198 .LI "ubyte"
04199 Small unsigned integer.
04200 .LI "uhalf"
04201 Medium unsigned integer.
04202 .LI "sword"
04203 Large signed integer.
04204 .LI "uword"
04205 Large unsigned integer.
04206 .LI "LEB128"
04207 .IX LEB128
04208 Variable length signed and unsigned data. See section 7.6.
04209 .LE
04210 .H 3 "State Machine Registers"
04211 .IX line number information, state machine registers
04212 The statement information state machine has the following registers:
04213 .VL 20
04214 .LI "\f(CWaddress\fP"
04215 The program-counter value corresponding to a machine instruction generated
04216 by the compiler.
04217 .LI "\f(CWfile\fP"
04218 An unsigned integer indicating the identity of the source file corresponding
04219 to a machine instruction.
04220 .IX source, files
04221 .LI "\f(CWline\fP"
04222 .IX source, lines
04223 An unsigned integer indicating a source line number. Lines are numbered
04224 beginning at 1. The compiler may emit the value 0 in cases where an
04225 instruction cannot be attributed to any source line.
04226 .LI "\f(CWcolumn\fP"
04227 .IX source, columns
04228 An unsigned integer indicating a column number within a source line.
04229 Columns are numbered beginning at 1. The value 0 is reserved to indicate
04230 that a statement begins at the ``left edge'' of the line.
04231 .LI "\f(CWis_stmt\fP"
04232 A boolean indicating that the current instruction is the beginning of a
04233 statement.
04234 .LI "\f(CWbasic_block\fP"
04235 A boolean indicating that the current instruction is the beginning of
04236 a basic block.
04237 .LI "\f(CWend_sequence\fP"
04238 A boolean indicating that the current address is that of the first
04239 byte after the end of a sequence of target machine instructions.
04240 .LE
04241 .P
04242 At the beginning of each sequence within a statement program, the
04243 state of the registers is:
04244 .DS
04245 .TS
04246 ;
04247 lf(CW) l.
04248 address 0
04249 file 1
04250 line 1
04251 column 0
04252 is_stmt determined by \f(CWdefault_is_stmt\fP in the statement program prologue
04253 basic_block ``false''
04254 end_sequence ``false''
04255 .TE
04256 .DE
04257 .H 3 "Statement Program Instructions"
04258 The state machine instructions in a statement program belong to one
04259 of three categories:
04260 .VL 20
04261 .LI "special opcodes"
04262 .IX line number information, special opcodes
04263 These have a ubyte opcode field and no arguments.
04264 Most of the instructions in a statement program are special opcodes.
04265 .LI "standard opcodes"
04266 .IX line number information, standard opcodes
04267 These have a ubyte opcode field which may be followed by zero or more
04268 LEB128 arguments (except for
04269 .Cf DW_LNS_fixed_advance_pc ,
04270 see below).
04271 The opcode implies the number of arguments and their
04272 meanings, but the statement program prologue also specifies the number
04273 of arguments for each standard opcode.
04274 .LI "extended opcodes"
04275 .IX line number information, extended opcodes
04276 These have a multiple byte format. The first byte is zero;
04277 the next bytes are an unsigned LEB128 integer giving the number of bytes
04278 in the instruction itself (does not include the first zero byte or the size).
04279 The remaining bytes are the instruction itself.
04280 .LE
04281 .H 3 "The Statement Program Prologue"
04282 .IX line number information, prologue
04283 The optimal encoding of line number information depends to a certain
04284 degree upon the architecture of the target machine. The statement program
04285 prologue provides information used by consumers in decoding the statement
04286 program instructions for a particular compilation unit and also provides
04287 information used throughout the rest of the statement program. The statement
04288 program for each compilation unit begins with a prologue containing the
04289 following fields in order:
04290 .AL
04291 .LI
04292 .Cf total_length
04293 (uword)
04294 .br
04295 The size in bytes of the statement information for this compilation unit
04296 (not including the
04297 .Cf total_length
04298 field itself).
04299 .LI
04300 .Cf version
04301 (uhalf)
04302 .br
04303 Version identifier for the statement information format.
04304 .LI
04305 .Cf prologue_length
04306 (uword)
04307 .br
04308 The number of bytes following the
04309 .Cf prologue_length
04310 field to the beginning of the first byte of the statement program itself.
04311 .LI
04312 .Cf minimum_instruction_length
04313 (ubyte)
04314 .br
04315 The size in bytes of the smallest target machine instruction. Statement
04316 program opcodes that alter the
04317 .Cf address
04318 register first multiply their operands by this value.
04319 .LI
04320 .Cf default_is_stmt
04321 (ubyte)
04322 .br
04323 The initial value of the
04324 .Cf is_stmt
04325 register.
04326 .P
04327 .I
04328 A simple code generator
04329 that emits machine instructions in the order implied by the source program
04330 would set this to ``true,'' and every entry in the matrix would represent
04331 a statement boundary. A pipeline scheduling code generator would set
04332 this to ``false'' and emit a specific statement program opcode for each
04333 instruction that represented a statement boundary.
04334 .R
04335 .LI
04336 .Cf line_base
04337 (sbyte)
04338 .br
04339 This parameter affects the meaning of the special opcodes. See below.
04340 .LI
04341 .Cf line_range
04342 (ubyte)
04343 .br
04344 This parameter affects the meaning of the special opcodes. See below.
04345 .LI
04346 .Cf opcode_base
04347 (ubyte)
04348 .br
04349 The number assigned to the first special opcode.
04350 .LI
04351 .Cf standard_opcode_lengths
04352 (array of ubyte)
04353 .br
04354 This array specifies the number of LEB128 operands for each of
04355 the standard opcodes. The first element of the array corresponds
04356 to the opcode whose value is 1, and the last element corresponds
04357 to the opcode whose value is
04358 .Cf "opcode_base - 1" .
04359 By increasing
04360 .Cf opcode_base ,
04361 and adding elements to this array, new standard opcodes
04362 can be added, while allowing consumers who do not know about these
04363 new opcodes to be able to skip them.
04364 .LI
04365 .Cf include_directories
04366 (sequence of path names)
04367 .br
04368 The sequence contains an entry for each path that was searched
04369 for included source files in this compilation. (The paths include
04370 those directories specified explicitly by the user for the compiler
04371 to search and those the compiler searches without explicit direction).
04372 Each path entry is either a full
04373 path name or is relative to the current directory of the compilation.
04374 The current directory of the compilation is understood to be the first entry
04375 and is not explicitly represented.
04376 Each entry is a null-terminated
04377 string containing a full path name. The last entry is followed by
04378 a single null byte.
04379 .LI
04380 .Cf file_names
04381 (sequence of file entries)
04382 .br
04383 .IX source, files
04384 The sequence contains an entry for each source file that contributed
04385 to the statement information for this compilation unit or is
04386 used in other contexts, such as in a declaration coordinate
04387 or a macro file inclusion. Each entry
04388 has a null-terminated string containing the file name,
04389 an unsigned LEB128 number representing the directory index of the
04390 directory in which the file was found,
04391 an unsigned LEB128 number representing the time of last modification for
04392 the file and an unsigned LEB128 number representing the length in
04393 bytes of the file. A compiler may choose to emit LEB128(0) for the
04394 time and length fields to indicate that this information is not
04395 available. The last entry is followed by a single null byte.
04396 .P
04397 The directory index represents an entry in the
04398 .Cf include_directories
04399 section. The index is LEB128(0) if the file was found in
04400 the current directory of the compilation, LEB128(1) if it was
04401 found in the first directory in the
04402 .Cf include_directories
04403 section, and so on. The directory index is ignored for file names
04404 that represent full path names.
04405 .P
04406 The statement program assigns numbers to each of the file entries
04407 in order, beginning with 1, and uses those numbers instead of file
04408 names in the
04409 .Cf file
04410 register.
04411 .P
04412 A compiler may generate a single null byte for the file names field
04413 and define file names using the extended opcode
04414 .Cf DEFINE_FILE .
04415 .LE
04416 .H 3 "The Statement Program"
04417 As stated before, the goal of a statement program is to build a
04418 matrix representing
04419 one compilation unit, which may have produced multiple sequences of
04420 target-machine instructions. Within a sequence, addresses may only increase.
04421 (Line numbers may decrease in cases of pipeline scheduling.)
04422 .H 4 "Special Opcodes"
04423 .IX line number information, special opcodes
04424 Each 1-byte special opcode has the following effect on the state machine:
04425 .AL
04426 .LI
04427 Add a signed integer to the
04428 .Cf line
04429 register.
04430 .LI
04431 Multiply an unsigned integer by the
04432 .Cf minimum_instruction_length
04433 field of the statement program prologue and
04434 add the result to the
04435 .Cf address
04436 register.
04437 .LI
04438 Append a row to the matrix using the current values of the state machine
04439 registers.
04440 .LI
04441 Set the
04442 .Cf basic_block
04443 register to ``false.''
04444 .LE
04445 .P
04446 All of the special opcodes do those same four things;
04447 they differ from one another
04448 only in what values they add to the
04449 .Cf line
04450 and
04451 .Cf address
04452 registers.
04453 .P
04454 .I
04455 Instead of assigning a fixed meaning to each special opcode, the statement
04456 program uses several
04457 parameters in the prologue to configure the instruction set. There are two
04458 reasons for this.
04459 First, although the opcode space available for special opcodes now
04460 ranges from 10 through 255, the lower bound may increase if one adds new
04461 standard opcodes. Thus, the
04462 .Cf opcode_base
04463 field of the statement program
04464 prologue gives the value of the first special opcode.
04465 Second, the best choice of special-opcode meanings depends on the target
04466 architecture. For example, for a RISC machine where the compiler-generated code
04467 interleaves instructions from different lines to schedule the pipeline,
04468 it is important to be able to add a negative value to the
04469 .Cf line
04470 register
04471 to express the fact that a later instruction may have been emitted for an
04472 earlier source line. For a machine where pipeline scheduling never occurs,
04473 it is advantageous to trade away the ability to decrease the
04474 .Cf line
04475 register
04476 (a standard opcode provides an alternate way to decrease the line number) in
04477 return for the ability to add larger positive values to the
04478 .Cf address
04479 register. To permit this variety of strategies, the statement program prologue
04480 defines a
04481 .Cf line_base
04482 field that specifies the minimum value which a special opcode can add
04483 to the
04484 .Cf line
04485 register and a
04486 .Cf line_range
04487 field that defines the range of
04488 values it can add to the
04489 .Cf line
04490 register.
04491 .R
04492 .P
04493 A special opcode value is chosen based on the amount that needs to
04494 be added to the
04495 .Cf line
04496 and
04497 .Cf address
04498 registers. The maximum line increment
04499 for a special opcode is the value of the
04500 .Cf line_base
04501 field in the
04502 prologue, plus the value of the
04503 .Cf line_range
04504 field, minus 1
04505 (\f(CWline base + line range - 1\fP). If the desired line increment
04506 is greater than the maximum line increment, a standard opcode
04507 must be used instead of a special opcode.
04508 The ``address advance'' is calculated by dividing the desired address
04509 increment by the
04510 .Cf minimum_instruction_length
04511 field from the
04512 prologue. The special opcode is then calculated using the following
04513 formula:
04514 .br
04515 \f(CWopcode = (desired line increment - line_base) +
04516 .br
04517 (line_range * address advance) + opcode_base\fP
04518 .br
04519 If the resulting opcode is greater than 255, a standard opcode
04520 must be used instead.
04521 .P
04522 To decode a special opcode, subtract the
04523 .Cf opcode_base
04524 from
04525 the opcode itself. The amount to increment the
04526 .Cf address
04527 register is
04528 the adjusted opcode divided by the
04529 .Cf line_range .
04530 The amount to
04531 increment the
04532 .Cf line
04533 register is the
04534 .Cf line_base
04535 plus the result
04536 of the adjusted opcode modulo the
04537 .Cf line_range .
04538 That is,
04539 .br
04540 \f(CWline increment = line_base + (adjusted opcode % line_range)\fP
04541 .br
04542 .P
04543 .I
04544 As an example, suppose that the
04545 .Cf opcode_base
04546 is 16,
04547 .Cf line_base
04548 is -1 and
04549 .Cf line_range
04550 is 4.
04551 This means that we can use a special opcode whenever two successive
04552 rows in the matrix have source line numbers differing by any value within
04553 the range [-1, 2] (and, because of the limited number of opcodes available,
04554 when the difference between addresses is within the range [0, 59]).
04555 .P
04556 The opcode mapping would be:
04557 .R
04558 .DS
04559 .TS
04560 box center;
04561 l l l
04562 nf(CW) nf(CW) nf(CW)
04563 .
04564 Opcode Line advance Address advance
04565 _
04566 16 -1 0
04567 17 0 0
04568 18 1 0
04569 19 2 0
04570 20 -1 1
04571 21 0 1
04572 22 1 1
04573 23 2 1
04574 ... ... ...
04575 253 0 59
04576 254 1 59
04577 255 2 59
04578 .TE
04579 .DE
04580 .P
04581 There is no requirement that the expression \f(CW255 - line_base + 1\fP be an
04582 integral multiple of
04583 .Cf line_range .
04584 .H 4 "Standard Opcodes"
04585 .IX line number information, standard opcodes
04586 There are currently 9 standard ubyte opcodes. In the future
04587 additional ubyte opcodes may be defined by setting the
04588 .Cf opcode_base
04589 field in the statement program
04590 prologue to a value greater than 10.
04591 .AL
04592 .LI
04593 .Cf DW_LNS_copy
04594 .br
04595 Takes no arguments. Append a row to the matrix using the current values of
04596 the state-machine registers. Then set the
04597 .Cf basic_block
04598 register to ``false.''
04599 .LI
04600 .Cf DW_LNS_advance_pc
04601 .br
04602 Takes a single unsigned LEB128 operand,
04603 multiplies it by the
04604 .Cf minimum_instruction_length
04605 field of the prologue, and adds the result to the
04606 .Cf address
04607 register of the state machine.
04608 .LI
04609 .Cf DW_LNS_advance_line
04610 .br
04611 Takes a single signed LEB128 operand and adds
04612 that value to the
04613 .Cf line
04614 register of the state machine.
04615 .LI
04616 .Cf DW_LNS_set_file
04617 .br
04618 Takes a single unsigned LEB128 operand and stores
04619 it in the
04620 .Cf file
04621 register of the state machine.
04622 .LI
04623 .Cf DW_LNS_set_column
04624 .br
04625 Takes a single unsigned LEB128 operand and stores
04626 it in the
04627 .Cf column
04628 register of the state machine.
04629 .LI
04630 .Cf DW_LNS_negate_stmt
04631 .br
04632 Takes no arguments.
04633 Set the
04634 .Cf is_stmt
04635 register of the state machine to the
04636 logical negation of its current value.
04637 .LI
04638 .Cf DW_LNS_set_basic_block
04639 .br
04640 Takes no arguments. Set the
04641 .Cf basic_block
04642 register of the state machine to ``true.''
04643 .LI
04644 .Cf DW_LNS_const_add_pc
04645 .br
04646 Takes no arguments.
04647 Add to the
04648 .Cf address
04649 register of the state machine the
04650 address increment value corresponding to special
04651 opcode 255.
04652 .P
04653 .I
04654 The motivation for
04655 .Cf DW_LNS_const_add_pc
04656 is this: when the statement program needs
04657 to advance the address by a small amount, it can use a single special
04658 opcode, which occupies a single byte. When it needs to advance the
04659 address by up to twice the range of the last special opcode, it can use
04660 .Cf DW_LNS_const_add_pc
04661 followed by a special opcode, for a total of two bytes.
04662 Only if it needs to advance the address by more than twice that range
04663 will it need to use both
04664 .Cf DW_LNS_advance_pc
04665 and a special opcode, requiring three or more bytes.
04666 .R
04667 .LI
04668 .Cf DW_LNS_fixed_advance_pc
04669 .br
04670 Takes a single uhalf operand. Add to the
04671 .Cf address
04672 register of the state machine the value of the (unencoded) operand.
04673 This is the only extended opcode that takes an argument that is not
04674 a variable length number.
04675 .P
04676 .I
04677 The motivation for
04678 .Cf DW_LNS_fixed_advance_pc
04679 is this: existing assemblers cannot emit
04680 .Cf DW_LNS_advance_pc
04681 or special opcodes because they cannot encode LEB128 numbers
04682 or judge when the computation of a special opcode overflows and requires
04683 the use of
04684 .Cf DW_LNS_advance_pc .
04685 Such assemblers, however, can use
04686 .Cf DW_LNS_fixed_advance_pc
04687 instead, sacrificing compression.
04688 .R
04689 .LE
04690 .H 4 "Extended Opcodes"
04691 .IX line number information, extended opcodes
04692 There are three extended opcodes currently defined. The first byte
04693 following the length field of the encoding for each contains a sub-opcode.
04694 .AL
04695 .LI
04696 \f(CWDW_LNE_end_sequence\fP
04697 .br
04698 Set the
04699 .Cf end_sequence
04700 register of the state machine
04701 to ``true'' and append a row to the matrix using the
04702 current values of the state-machine registers. Then
04703 reset the registers to the initial values specified
04704 above.
04705 .P
04706 Every statement program sequence must end with a
04707 .Cf DW_LNE_end_sequence
04708 instruction which creates a
04709 row whose address is that of the byte after the last target machine instruction
04710 of the sequence.
04711 .LI
04712 \f(CWDW_LNE_set_address\fP
04713 .br
04714 Takes a single relocatable address as an operand. The size of the
04715 operand is the size appropriate to hold an address on the target machine.
04716 Set the
04717 .Cf address
04718 register to the value given by the
04719 relocatable address.
04720 .P
04721 .I
04722 All of the other statement program opcodes that affect the
04723 .Cf address
04724 register add a delta to it.
04725 This instruction stores a relocatable value into it instead.
04726 .R
04727 .LI
04728 \f(CWDW_LNE_define_file\fP
04729 .br
04730 .IX source, files
04731 Takes 4 arguments. The first is a null terminated string containing a
04732 source file name. The second is an
04733 unsigned LEB128 number representing the directory index of the
04734 directory in which the file was found.
04735 The third is an unsigned LEB128 number representing
04736 the time of last modification of the file. The fourth is an unsigned
04737 LEB128 number representing the length in bytes of the file.
04738 The time and length fields may contain LEB128(0) if the information is
04739 not available.
04740 .P
04741 The directory index represents an entry in the
04742 .Cf include_directories
04743 section of the statement program prologue.
04744 The index is LEB128(0) if the file was found in
04745 the current directory of the compilation, LEB128(1) if it was
04746 found in the first directory in the
04747 .Cf include_directories
04748 section, and so on. The directory index is ignored for file names
04749 that represent full path names.
04750 .P
04751 The files are numbered, starting at 1,
04752 in the order in which they appear; the names in the prologue
04753 come before names defined by the
04754 .Cf DW_LNE_define_file
04755 instruction.
04756 These numbers are used in the the
04757 .Cf file
04758 register of the state machine.
04759 .LE
04760 .P
04761 .I
04762 Appendix 3 gives some sample statement programs.
04763 .R
04764 .H 2 "Macro Information"
04765 .I
04766 .IX macro information
04767 .IX pre-processor
04768 .IX C %c
04769 .IX C++ %caa
04770 Some languages, such as C and C++, provide a way to replace text
04771 in the source program with macros defined either in the source
04772 file itself, or in another file included by the source file.
04773 Because these macros are not themselves defined in the target
04774 language, it is difficult to represent their definitions
04775 using the standard language constructs of DWARF. The debugging
04776 information therefore reflects the state of the source after
04777 the macro definition has been expanded, rather than as the
04778 programmer wrote it.
04779 The macro information table provides a way of preserving the original
04780 source in the debugging information.
04781 .R
04782 .P
04783 As described in section 3.1, the macro information for a given
04784 compilation unit is represented in the
04785 .Cf .debug_macinfo
04786 .IX \f(CW.debug_macinfo\fP %debugam
04787 section of an object file. The macro information for each compilation
04788 unit is represented as a series of ``macinfo'' entries. Each
04789 macinfo entry consists of a ``type code'' and up to two additional
04790 operands. The series of entries for a given compilation unit
04791 ends with an entry containing a type code of 0.
04792 .H 3 "Macinfo Types"
04793 The valid macinfo types are as follows:
04794 .VL 30
04795 .LI \f(CWDW_MACINFO_define\fP
04796 A macro definition.
04797 .LI \f(CWDW_MACINFO_undef\fP
04798 A macro un-definition.
04799 .LI \f(CWDW_MACINFO_start_file\fP
04800 The start of a new source file inclusion.
04801 .LI \f(CWDW_MACINFO_end_file\fP
04802 The end of the current source file inclusion.
04803 .LI \f(CWDW_MACINFO_vendor_ext\fP
04804 Vendor specific macro information directives that do not fit
04805 into one of the standard categories.
04806 .LE
04807 .H 4 "Define and Undefine Entries"
04808 .IX macro information, define and undefine entries
04809 All
04810 .Cf DW_MACINFO_define
04811 and
04812 .Cf DW_MACINFO_undef
04813 entries have two operands.
04814 The first operand encodes the line number of the source line
04815 .IX source, lines
04816 on which the relevant defining or undefining
04817 pre-processor directives appeared.
04818 .P
04819 The second operand consists of a null-terminated character string.
04820 In the case of a
04821 .Cf DW_MACINFO_undef
04822 entry, the value of this
04823 string will be simply the name of the pre-processor
04824 symbol which was undefined at the indicated source line.
04825 .P
04826 In the case of a
04827 .Cf DW_MACINFO_define
04828 entry, the value of this
04829 string will be the name of the pre-processor symbol
04830 that was defined at the indicated source line,
04831 followed immediately by the macro formal parameter
04832 list including the surrounding parentheses (in the
04833 case of a function-like macro) followed by the
04834 definition string for the macro. If there is no
04835 formal parameter list, then the name of the defined
04836 macro is followed directly by its definition string.
04837 .P
04838 In the case of a function-like macro definition, no
04839 whitespace characters should appear between the
04840 name of the defined macro and the following left
04841 parenthesis. Also, no whitespace characters should
04842 appear between successive formal parameters in the
04843 formal parameter list. (Successive formal parameters
04844 should, however, be separated by commas.) Also, exactly
04845 one space character
04846 should separate the right parenthesis which terminates
04847 the formal parameter list and the following definition
04848 string.
04849 .P
04850 In the case of a ``normal'' (i.e. non-function-like)
04851 macro definition, exactly one space character
04852 should separate the name of the defined macro from the following definition
04853 text.
04854 .H 4 "Start File Entries"
04855 .IX macro information, start file entries
04856 Each
04857 .Cf DW_MACINFO_start_file
04858 entry also has two operands. The first operand
04859 encodes the line number of the
04860 source line on which the inclusion pre-processor
04861 directive occurred.
04862 .P
04863 .IX source, files
04864 The second operand encodes a
04865 source file name index. This index corresponds to a file
04866 number in the statement information table for the relevant
04867 compilation unit. This index
04868 indicates (indirectly) the name of the file
04869 which is being included by the inclusion directive on
04870 the indicated source line.
04871 .H 4 "End File Entries"
04872 .IX macro information, end file entries
04873 A
04874 .Cf DW_MACINFO_end_file
04875 entry has no operands. The presence of the entry marks the end of
04876 the current source file inclusion.
04877 .H 4 "Vendor Extension Entries"
04878 .IX macro information, vendor extensions
04879 .IX vendor extensions
04880 A
04881 .Cf DW_MACINFO_vendor_ext
04882 entry has two operands.
04883 The first is a constant. The second is a null-terminated
04884 character string.
04885 The meaning and/or significance of these operands is
04886 intentionally left undefined by this specification.
04887 .P
04888 A consumer must be able to totally ignore all
04889 .Cf DW_MACINFO_vendor_ext
04890 entries that it does not understand.
04891 .H 3 "Base Source Entries"
04892 .IX macro information, base source entries
04893 In addition to producing a matched pair of
04894 .Cf DW_MACINFO_start_file
04895 and
04896 .Cf DW_MACINFO_end_file
04897 entries for
04898 each inclusion directive actually processed during
04899 compilation, a producer should generate such a matched
04900 pair also for the ``base'' source file submitted to the
04901 compiler for compilation. If the base source file
04902 .IX source, files
04903 for a compilation is submitted to the compiler via
04904 some means other than via a named disk file (e.g. via
04905 the standard input \fIstream\fP on a UNIX system) then the
04906 compiler should still produce this matched pair of
04907 .Cf DW_MACINFO_start_file
04908 and
04909 .Cf DW_MACINFO_end_file
04910 entries for
04911 the base source file, however, the file name indicated
04912 (indirectly) by the
04913 .Cf DW_MACINFO_start_file
04914 entry of the
04915 pair should reference a statement information file name entry consisting
04916 of a null string.
04917 .H 3 "Macinfo Entries for Command Line Options"
04918 .IX macro information, command line options
04919 In addition to producing
04920 .Cf DW_MACINFO_define
04921 and
04922 .Cf DW_MACINFO_undef
04923 entries for each of the define and
04924 undefine directives processed during compilation, the
04925 DWARF producer should generate a
04926 .Cf DW_MACINFO_define
04927 or
04928 .Cf DW_MACINFO_undef
04929 entry for each pre-processor symbol
04930 which is defined or undefined by some
04931 means other than via a define or undefine directive
04932 within the compiled source text. In particular,
04933 pre-processor symbol definitions and un-definitions
04934 which occur as a result of command line options
04935 (when invoking the compiler) should be represented by
04936 their own
04937 .Cf DW_MACINFO_define
04938 and
04939 .Cf DW_MACINFO_undef
04940 entries.
04941 .P
04942 All such
04943 .Cf DW_MACINFO_define
04944 and
04945 .Cf DW_MACINFO_undef
04946 entries representing compilation options should appear
04947 before the first
04948 .Cf DW_MACINFO_start_file
04949 entry for that compilation unit and should encode the value
04950 0 in their line number operands.
04951 .H 3 " General Rules and Restrictions"
04952 .IX line number information, general rules
04953 All macinfo entries within a
04954 .Cf .debug_macinfo
04955 section for a given compilation unit should appear in the same order
04956 in which the directives were processed by the compiler.
04957 .P
04958 All macinfo entries representing command line options
04959 should appear in the same order as the relevant command
04960 line options were given to the compiler. In the case
04961 where the compiler itself implicitly supplies one or
04962 more macro definitions or un-definitions in addition
04963 to those which may be specified on the command line,
04964 macinfo entries should also be produced for these
04965 implicit definitions and un-definitions, and
04966 these entries should also appear in the proper order
04967 relative to each other and to any definitions or
04968 undefinitions given explicitly by the user on the
04969 command line.
04970 .H 2 "Call Frame Information"
04971 .IX call frame information
04972 .IX activations
04973 .I
04974 Debuggers often need to be able to view and modify the state of any
04975 subroutine activation that is on the call stack. An activation
04976 consists of:
04977 .BL
04978 .LI
04979 A code location that is within the subroutine. This location is
04980 either the place where the program stopped when the debugger got
04981 control (e.g. a breakpoint), or is a place where a subroutine
04982 made a call or was interrupted by an asynchronous event (e.g. a
04983 signal).
04984 .LI
04985 An area of memory that is allocated on a stack called a ``call
04986 frame.'' The call frame is identified by an address on the
04987 stack. We refer to this address as the Canonical Frame Address or CFA.
04988 .LI
04989 A set of registers that are in use by the subroutine at the code
04990 location.
04991 .LE
04992 .P
04993 Typically, a set of registers are designated to be preserved across a
04994 call. If a callee wishes to use such a register, it saves the value
04995 that the register had at entry time in its call frame and restores it
04996 on exit. The code that allocates space on the call frame stack and
04997 performs the save operation is called the subroutine's prologue, and the
04998 code that performs the restore operation and deallocates the frame is
04999 called its epilogue. Typically, the prologue code is physically at the
05000 beginning of a subroutine and the epilogue code is at the end.
05001 .P
05002 To be able to view or modify an activation that is not on the top of
05003 the call frame stack, the debugger must ``virtually unwind'' the stack of
05004 activations until it finds the activation of interest.
05005 A debugger unwinds a
05006 stack in steps. Starting with the current activation it restores any
05007 registers that were preserved by the current activation and computes the
05008 predecessor's CFA and code location. This has the logical effect of
05009 returning from the current subroutine to its predecessor. We say that
05010 the debugger virtually unwinds the stack because it preserves enough
05011 information to be able to ``rewind'' the stack back to the state it was
05012 in before it attempted to unwind it.
05013 .P
05014 The unwinding operation needs to know where registers are saved and how
05015 to compute the predecessor's CFA and code location. When considering
05016 an architecture-independent way of encoding this information one has to
05017 consider a number of special things.
05018 .BL
05019 .LI
05020 Prologue and epilogue code is not always in distinct blocks at the
05021 beginning and end of a subroutine. It is common to duplicate the
05022 epilogue code at the site of each return from the code. Sometimes
05023 a compiler breaks up the register save/unsave operations and moves
05024 them into the body of the subroutine to just where they are needed.
05025 .LI
05026 Compilers use different ways to manage the call frame. Sometimes
05027 they use a frame pointer register, sometimes not.
05028 .LI
05029 The algorithm to compute the CFA changes as you progress through
05030 the prologue and epilogue code. (By definition, the CFA value
05031 does not change.)
05032 .LI
05033 Some subroutines have no call frame.
05034 .LI
05035 Sometimes a register is saved in another register that by
05036 convention does not need to be saved.
05037 .LI
05038 Some architectures have special instructions that
05039 perform some or all of the register management in one instruction,
05040 leaving special information on the stack that indicates how
05041 registers are saved.
05042 .LI
05043 Some architectures treat return address values
05044 specially. For example, in one architecture,
05045 the call instruction guarantees that the low order two
05046 bits will be zero and the return instruction ignores those bits.
05047 This leaves two bits of storage that are available to other uses
05048 that must be treated specially.
05049 .LE
05050 .R
05051 .H 3 "Structure of Call Frame Information"
05052 .IX call frame information, structure
05053 DWARF supports virtual unwinding by defining an architecture independent
05054 basis for recording how procedures save and restore registers throughout
05055 their lifetimes. This basis must be augmented on some machines with
05056 specific information that is defined by either an architecture specific
05057 ABI authoring committee, a hardware vendor, or a compiler producer.
05058 .IX ABI
05059 .IX vendor extensions
05060 The body defining a specific augmentation is referred to
05061 below as the ``augmenter.''
05062 .P
05063 Abstractly, this mechanism describes a very large table that has the
05064 following structure:
05065 .TS
05066 center;
05067 l l l l l l
05068 l s s s s s.
05069 LOC CFA R0 R1 ... RN
05070 L0
05071 L1
05072 \...
05073 LN
05074 .TE
05075 .P
05076 The first column indicates an address for every location that contains
05077 code in a program. (In shared objects, this is an object-relative
05078 offset.) The remaining columns contain virtual unwinding rules that are
05079 associated with the indicated location. The first column of the rules
05080 defines the CFA rule which is a register and a signed offset that are
05081 added together to compute the CFA value.
05082 .P
05083 The remaining columns are labeled by register number. This includes
05084 some registers that have special designation on some architectures such
05085 as the PC and the stack pointer register. (The actual mapping of
05086 registers for a particular architecture is performed by the augmenter.)
05087 The register columns contain rules that describe
05088 whether a given register has been saved and the rule to find
05089 the value for the register in the previous frame.
05090 .P
05091 The register rules are:
05092 .IX call frame information, register rules
05093 .VL 20
05094 .LI "undefined"
05095 A register that has this rule has no value in the
05096 previous frame. (By convention, it is not preserved by a callee.)
05097 .LI "same value"
05098 This register has not been modified from the
05099 previous frame. (By convention, it is preserved by the callee,
05100 but the callee has not modified it.)
05101 .LI "offset(N)"
05102 The previous value of this register is saved at the address CFA+N where
05103 CFA is the current CFA value and N is a signed offset.
05104 .LI "register(R)"
05105 The previous value of this register is stored in
05106 another register numbered R.
05107 .LI "architectural"
05108 The rule is defined externally to this specification by the augmenter.
05109 .LE
05110 .P
05111 .I
05112 This table would be extremely large if actually constructed as
05113 described. Most of the entries at any point in the table are identical
05114 to the ones above them. The whole table can be represented quite
05115 compactly by recording just the differences starting at the beginning
05116 address of each subroutine in the program.
05117 .R
05118 .P
05119 The virtual unwind information is encoded in a self-contained section
05120 called
05121 .Cf .debug_frame .
05122 .IX \f(CW.debug_frame\fP %debugaf
05123 Entries in a
05124 .Cf .debug_frame
05125 section are aligned on
05126 .IX call frame information, Common Information Entry
05127 an addressing unit boundary and come in two forms: A Common Information
05128 Entry (CIE) and a Frame Description Entry (FDE).
05129 Sizes of data objects used in the encoding of the
05130 .Cf .debug_frame
05131 section are described in terms of the same data definitions
05132 used for the line number information (see section 6.2.1).
05133 .P
05134 A Common Information Entry holds information that is shared among many
05135 Frame Descriptors. There is at least one CIE in every non-empty
05136 .Cf .debug_frame
05137 section. A CIE contains the following fields, in order:
05138 .AL
05139 .LI
05140 \f(CWlength\fP
05141 .br
05142 A uword constant that gives the number of bytes of the CIE
05143 structure, not including the length field, itself
05144 (length mod <addressing unit size> == 0).
05145 .LI
05146 \f(CWCIE_id\fP
05147 .br
05148 A uword constant that is used to distinguish CIEs
05149 from FDEs.
05150 .LI
05151 \f(CWversion\fP
05152 .br
05153 A ubyte version number. This number is specific to the call frame
05154 information and is independent of the DWARF version number.
05155 .LI
05156 \f(CWaugmentation\fP
05157 .br
05158 A null terminated string that identifies the
05159 augmentation to this CIE or to the FDEs that use
05160 it. If a reader encounters an augmentation string that is
05161 unexpected, then only the following fields can be read:
05162 CIE:
05163 .Cf length ,
05164 .Cf CIE_id ,
05165 .Cf version ,
05166 .Cf augmentation ;
05167 FDE:
05168 .Cf length ,
05169 .Cf CIE_pointer ,
05170 .Cf initial_location ,
05171 .Cf address_range .
05172 If there is no augmentation, this value is a zero byte.
05173 .LI
05174 \f(CWcode_alignment_factor\fP
05175 .br
05176 An unsigned LEB128 constant that is factored out
05177 of all advance location instructions (see below).
05178 .LI
05179 \f(CWdata_alignment_factor\fP
05180 .br
05181 A signed LEB128 constant that is factored out
05182 of all offset instructions (see below.)
05183 .LI
05184 \f(CWreturn_address_register\fP
05185 .br
05186 A ubyte constant that indicates
05187 which column in the rule table represents the return address
05188 of the function. Note that this column might not correspond
05189 to an actual machine register.
05190 .LI
05191 \f(CWinitial_instructions\fP
05192 .br
05193 A sequence of rules that are interpreted to
05194 create the initial setting of each column in the table.
05195 .LI
05196 \f(CWpadding\fP
05197 .br
05198 Enough
05199 .Cf DW_CFA_nop
05200 instructions to make the size of this entry
05201 match the
05202 .Cf length
05203 value above.
05204 .LE
05205 .P
05206 An FDE contains the following fields, in order:
05207 .IX call frame information, Frame Description Entry
05208 .AL
05209 .LI
05210 \f(CWlength\fP
05211 .br
05212 A uword constant that gives the number of bytes of the header
05213 and instruction stream for this function (not including the length
05214 field itself) (length mod <addressing unit size> == 0).
05215 .LI
05216 \f(CWCIE_pointer\fP
05217 .br
05218 A uword constant offset into the
05219 .Cf .debug_frame
05220 section that denotes the CIE that is associated with this FDE.
05221 .LI
05222 \f(CWinitial_location\fP
05223 An addressing-unit sized constant indicating
05224 the address of the first location associated with this table entry.
05225 .LI
05226 \f(CWaddress_range\fP
05227 .br
05228 An addressing unit sized constant indicating the
05229 number of bytes of program instructions described by this entry.
05230 .LI
05231 \f(CWinstructions\fP
05232 .br
05233 A sequence of table defining instructions that are
05234 described below.
05235 .LE
05236 .H 3 "Call Frame Instructions"
05237 .IX call frame information, instructions
05238 Each call frame instruction is defined to
05239 take 0 or more operands. Some of the operands may be
05240 encoded as part of the opcode (see section 7.23).
05241 The instructions are as follows:
05242 .AL
05243 .LI
05244 .Cf DW_CFA_advance_loc
05245 takes a single argument that represents a constant delta.
05246 The required action is to
05247 create a new table row with a location value that
05248 is computed by taking the current entry's location value and
05249 adding (delta * \f(CWcode_alignment_factor\fP). All other values in the
05250 new row are initially identical to the current row.
05251 .LI
05252 .Cf DW_CFA_offset
05253 takes two arguments:
05254 an unsigned LEB128 constant representing a factored offset
05255 and a register number. The required action is
05256 to change the rule for the register indicated by the register
05257 number to be an offset(N) rule with a value of
05258 (N = factored offset * \f(CWdata_alignment_factor\fP).
05259 .LI
05260 .Cf DW_CFA_restore
05261 takes a single argument that represents a register number.
05262 The required action is
05263 to change the rule for the indicated register
05264 to the rule assigned it by the \f(CWinitial_instructions\fP in the CIE.
05265 .LI
05266 .Cf DW_CFA_set_loc
05267 takes a single argument that represents an address.
05268 The required action is to create a new table row
05269 using the specified address as the location.
05270 All other values in the
05271 new row are initially identical to the current row.
05272 The new location value should always be greater than the current
05273 one.
05274 .LI
05275 .Cf DW_CFA_advance_loc1
05276 takes a single ubyte argument that represents a constant delta.
05277 This instruction is identical to
05278 .Cf DW_CFA_advance_loc
05279 except for the encoding and size of the delta argument.
05280 .LI
05281 .Cf DW_CFA_advance_loc2
05282 takes a single uhalf argument that represents a constant delta.
05283 This instruction is identical to
05284 .Cf DW_CFA_advance_loc
05285 except for the encoding and size of the delta argument.
05286 .LI
05287 .Cf DW_CFA_advance_loc4
05288 takes a single uword argument that represents a constant delta.
05289 This instruction is identical to
05290 .Cf DW_CFA_advance_loc
05291 except for the encoding and size of the delta argument.
05292 .LI
05293 .Cf DW_CFA_offset_extended
05294 takes two unsigned LEB128 arguments representing a register number
05295 and a factored offset.
05296 This instruction is identical to
05297 .Cf DW_CFA_offset
05298 except for the encoding and size of the register argument.
05299 .LI
05300 .Cf DW_CFA_restore_extended
05301 takes a single unsigned LEB128 argument that represents a register number.
05302 This instruction is identical to
05303 .Cf DW_CFA_restore
05304 except for the encoding and size of the register argument.
05305 .LI
05306 .Cf DW_CFA_undefined
05307 takes a single unsigned LEB128 argument that represents a register number.
05308 The required action is to set the rule for the specified register
05309 to ``undefined.''
05310 .LI
05311 .Cf DW_CFA_same_value
05312 takes a single unsigned LEB128 argument that represents a register number.
05313 The required action is to set the rule for the specified register
05314 to ``same value.''
05315 .LI
05316 .Cf DW_CFA_register
05317 takes two unsigned LEB128 arguments representing register numbers.
05318 The required action is to set the rule for the first register
05319 to be the second register.
05320 .LI
05321 \f(CWDW_CFA_remember_state\fP
05322 .LI
05323 \f(CWDW_CFA_restore_state\fP
05324 .br
05325 These instructions define a stack of information. Encountering the
05326 .Cf DW_CFA_remember_state
05327 instruction means to save the rules for every register
05328 on the current row on the stack. Encountering the
05329 .Cf DW_CFA_restore_state
05330 instruction means to pop the set of rules
05331 off the stack and place them in the current row.
05332 .I
05333 (This
05334 operation is useful for compilers that move epilogue
05335 code into the body of a function.)
05336 .R
05337 .LI
05338 .Cf DW_CFA_def_cfa
05339 takes two unsigned LEB128 arguments representing a
05340 register number and an offset.
05341 The required action is to define the current CFA rule
05342 to use the provided register and offset.
05343 .LI
05344 .Cf DW_CFA_def_cfa_register
05345 takes a single unsigned LEB128 argument representing a register
05346 number. The required action is to define the current CFA
05347 rule to use the provided register (but to keep the old offset).
05348 .LI
05349 .Cf DW_CFA_def_cfa_offset
05350 takes a single unsigned LEB128 argument representing an offset.
05351 The required action is to define the current CFA
05352 rule to use the provided offset (but to keep the old register).
05353 .LI
05354 .Cf DW_CFA_nop
05355 has no arguments and no required actions. It is used as padding
05356 to make the FDE an appropriate size.
05357 .LE
05358 .H 3 "Call Frame Instruction Usage"
05359 .IX call frame information, usage
05360 .I
05361 To determine the virtual unwind rule set for a given location (L1), one
05362 searches through the FDE headers looking at the
05363 .Cf initial_location
05364 and
05365 .Cf address_range
05366 values to see if L1 is contained in the FDE. If so, then:
05367 .AL
05368 .LI
05369 Initialize a register set by reading the
05370 .Cf initial_instructions
05371 field of the associated CIE.
05372 .LI
05373 Read and process the FDE's instruction sequence until a
05374 .Cf DW_CFA_advance_loc ,
05375 .Cf DW_CFA_set_loc ,
05376 or the end of the instruction stream is
05377 encountered.
05378 .LI
05379 If a
05380 .Cf DW_CFA_advance_loc
05381 or
05382 .Cf DW_CFA_set_loc
05383 instruction was encountered, then
05384 compute a new location value (L2). If L1 >= L2 then process the
05385 instruction and go back to step 2.
05386 .LI
05387 The end of the instruction stream can be thought of as a
05388 .br
05389 \f(CWDW_CFA_set_loc( initial_location + address_range )\fP
05390 .br
05391 instruction.
05392 Unless the FDE is ill-formed, L1 should be less than L2 at this point.
05393 .LE
05394 .P
05395 The rules in the register set now apply to location L1.
05396 .P
05397 For an example, see Appendix 5.
05398 .R
05399 .OP
05400 .H 1 "DATA REPRESENTATION"
05401 This section describes the binary representation of the debugging
05402 information entry itself, of the
05403 attribute types and of other fundamental elements described above.
05404 .H 2 "Vendor Extensibility"
05405 .IX vendor extensions
05406 To reserve a portion of the DWARF name space and ranges of
05407 enumeration values for use for vendor specific extensions,
05408 .IX tags
05409 .IX types, base
05410 .IX base types
05411 .IX locations, expressions
05412 .IX calling conventions
05413 .IX call frame information
05414 special labels are reserved for tag names, attribute names,
05415 base type encodings, location operations, language names,
05416 calling conventions and call frame instructions.
05417 The labels denoting the beginning and end of the reserved value
05418 range for vendor specific extensions consist of the appropriate prefix (
05419 .Cf DW_TAG ,
05420 .Cf DW_AT ,
05421 .Cf DW_ATE ,
05422 .Cf DW_OP ,
05423 .Cf DW_LANG ,
05424 .CF DW_CC
05425 or
05426 .Cf DW_CFA
05427 respectively) followed by
05428 .Cf _lo_user
05429 or
05430 .Cf _hi_user .
05431 For example, for entry tags, the special labels are
05432 .Cf DW_TAG_lo_user
05433 and
05434 .Cf DW_TAG_hi_user .
05435 Values in the range between \fIprefix\fP\f(CW_lo_user\fP and
05436 \fIprefix\fP\f(CW_hi_user\fP
05437 inclusive, are reserved for vendor specific extensions.
05438 Vendors may use values in this range without
05439 conflicting with current or future system-defined values.
05440 All other values are reserved for use by the system.
05441 .P
05442 Vendor defined tags, attributes, base type encodings, location atoms,
05443 language names, calling conventions and call frame instructions,
05444 conventionally use the form
05445 \fIprefix\f(CW_\fIvendor_id\f(CW_\fIname\fR, where \fIvendor_id\fP is some
05446 identifying character sequence chosen so as to avoid conflicts with other
05447 vendors.
05448 .P
05449 .IX compatibility
05450 To ensure that extensions added by one vendor may be safely ignored
05451 by consumers that do not understand those extensions,
05452 the following rules should be followed:
05453 .AL
05454 .LI
05455 New attributes should be added in such a way that a debugger may recognize
05456 the format of a new attribute value without knowing the content of that
05457 attribute value.
05458 .LI
05459 The semantics of any new attributes should not alter the semantics of
05460 previously existing attributes.
05461 .LI
05462 The semantics of any new tags
05463 should not conflict with the semantics of previously existing tags.
05464 .LE
05465 .H 2 "Reserved Error Values"
05466 .IX error values
05467 As a convenience for consumers of DWARF information,
05468 the value 0 is reserved in the encodings for attribute names, attribute
05469 forms, base type encodings, location operations, languages,
05470 statement program opcodes, macro information entries and tag names
05471 to represent an error condition or unknown value. DWARF does
05472 not specify names for these reserved values, since they do not
05473 represent valid encodings for the given type and should not appear
05474 in DWARF debugging information.
05475 .H 2 "Executable Objects and Shared Objects"
05476 The relocated addresses in the debugging information for an executable
05477 object are virtual addresses and the relocated addresses in the
05478 debugging information for a shared object are offsets relative to
05479 the start of the lowest segment used by that shared object.
05480 .P
05481 .I
05482 This requirement makes the debugging information for shared objects
05483 position independent.
05484 Virtual addresses in a shared object may be calculated by adding the
05485 offset to the base address at which the object was attached.
05486 This offset is available in the run-time linker's data structures.
05487 .H 2 "File Constraints"
05488 All debugging information entries in a relocatable object file,
05489 executable object or shared
05490 object are required to be physically contiguous.
05491 .H 2 "Format of Debugging Information"
05492 .IX Version 2
05493 For each compilation unit compiled with a DWARF Version 2 producer,
05494 .IX compilation units
05495 .IX compilation units, header
05496 a contribution is made to the
05497 .Cf .debug_info
05498 .IX \f(CW.debug_info\fP %debugai
05499 section of the object file. Each such contribution consists of
05500 a compilation unit header followed by a series of debugging information
05501 entries. Unlike the information encoding for DWARF Version 1, Version 2
05502 .IX Version 1
05503 debugging information entries do not themselves contain the debugging
05504 information entry tag or the attribute name and form encodings for
05505 each attribute. Instead, each debugging information entry begins with
05506 a code that represents an entry in a separate abbreviations table.
05507 This code is followed directly by a series of attribute values.
05508 The appropriate entry in the abbreviations table guides the interpretation
05509 of the information contained directly in the
05510 .Cf .debug_info
05511 section. Each compilation unit is associated with a particular
05512 abbreviation table, but multiple compilation units may share
05513 the same table.
05514 .IX abbreviations table
05515 .I
05516 .P
05517 This encoding was based on the observation that typical DWARF producers
05518 produce a very limited number of different types of debugging information
05519 entries. By extracting the common information from those entries
05520 into a separate table, we are able to compress the generated information.
05521 .R
05522 .H 3 "Compilation Unit Header"
05523 .IX compilation units, header
05524 The header for the series of debugging information entries contributed
05525 by a single compilation unit consists of the following information:
05526 .AL
05527 .LI
05528 A 4-byte unsigned integer representing the length of the
05529 .Cf .debug_info
05530 contribution for that compilation unit, not including the length field itself.
05531 .LI
05532 A 2-byte unsigned integer representing the version of the DWARF information
05533 for that compilation unit. For DWARF Version 2, the value in this field is 2.
05534 .IX Version 2
05535 .LI
05536 A 4-byte unsigned offset into the
05537 .Cf .debug_abbrev
05538 .IX \f(CW.debug_abbrev\fP %debugaab
05539 section. This offset associates the compilation unit with a particular
05540 set of debugging information entry abbreviations.
05541 .LI
05542 .IX segmented address space
05543 .IX address space, segmented
05544 .IX addresses, size of
05545 A 1-byte unsigned integer representing the size in bytes of an address
05546 on the target architecture. If the system uses segmented addressing,
05547 this value represents the size of the offset portion of an address.
05548 .IX addresses, offset portion
05549 .LE
05550 .P
05551 .I
05552 The compilation unit header does not replace the
05553 .Cf DW_TAG_compile_unit
05554 debugging information entry. It is additional information that
05555 is represented outside the standard DWARF tag/attributes format.
05556 .R
05557 .H 3 "Debugging Information Entry"
05558 Each debugging information entry begins with an unsigned LEB128
05559 .IX debugging information entries
05560 number containing the abbreviation code for the entry.
05561 This code represents an entry within the abbreviation table associated
05562 with the compilation unit containing this entry. The abbreviation
05563 .IX abbreviations table
05564 code is followed by a series of attribute values.
05565 .IX attributes, values
05566 .P
05567 On some architectures, there are alignment constraints on section boundaries.
05568 To make it easier to pad debugging information sections to satisfy
05569 such constraints, the abbreviation code 0 is reserved. Debugging
05570 information entries consisting of only the 0 abbreviation code are considered
05571 null entries.
05572 .IX debugging information entries, null entries
05573 .H 3 "Abbreviation Tables"
05574 .IX abbreviations table
05575 The abbreviation tables for all compilation units are contained in
05576 a separate object file section called
05577 .Cf .debug_abbrev .
05578 .IX \f(CW.debug_abbrev\fP %debugaab
05579 As mentioned before, multiple compilation units may share the same
05580 abbreviation table.
05581 .P
05582 The abbreviation table for a single compilation
05583 unit consists of a series of abbreviation declarations.
05584 Each declaration specifies the tag and attributes for a particular
05585 .IX tags
05586 .IX attributes
05587 form of debugging information entry. Each declaration begins with
05588 an unsigned LEB128 number representing the abbreviation code itself.
05589 It is this code that appears at the beginning of a debugging information
05590 entry in the
05591 .Cf .debug_info
05592 section. As described above, the abbreviation code 0 is reserved for null
05593 debugging information entries.
05594 The abbreviation code is followed by another unsigned LEB128
05595 number that encodes the entry's tag.
05596 .IX tags
05597 .nr aX \n(Fg+1
05598 .nr bX \n(Fg+2
05599 The encodings for the tag names are given in Figures \n(aX
05600 and \n(bX.
05601 .DF
05602 .TS
05603 box center;
05604 l l
05605 lf(CW) lf(CW)
05606 .
05607 Tag name Value
05608 _
05609 DW_TAG_array_type 0x01
05610 DW_TAG_class_type 0x02
05611 DW_TAG_entry_point 0x03
05612 DW_TAG_enumeration_type 0x04
05613 DW_TAG_formal_parameter 0x05
05614 DW_TAG_imported_declaration 0x08
05615 DW_TAG_label 0x0a
05616 DW_TAG_lexical_block 0x0b
05617 DW_TAG_member 0x0d
05618 DW_TAG_pointer_type 0x0f
05619 DW_TAG_reference_type 0x10
05620 DW_TAG_compile_unit 0x11
05621 DW_TAG_string_type 0x12
05622 DW_TAG_structure_type 0x13
05623 DW_TAG_subroutine_type 0x15
05624 DW_TAG_typedef 0x16
05625 DW_TAG_union_type 0x17
05626 DW_TAG_unspecified_parameters 0x18
05627 DW_TAG_variant 0x19
05628 DW_TAG_common_block 0x1a
05629 DW_TAG_common_inclusion 0x1b
05630 DW_TAG_inheritance 0x1c
05631 DW_TAG_inlined_subroutine 0x1d
05632 DW_TAG_module 0x1e
05633 DW_TAG_ptr_to_member_type 0x1f
05634 DW_TAG_set_type 0x20
05635 DW_TAG_subrange_type 0x21
05636 DW_TAG_with_stmt 0x22
05637 DW_TAG_access_declaration 0x23
05638 DW_TAG_base_type 0x24
05639 DW_TAG_catch_block 0x25
05640 DW_TAG_const_type 0x26
05641 DW_TAG_constant 0x27
05642 DW_TAG_enumerator 0x28
05643 DW_TAG_file_type 0x29
05644 .TE
05645 .FG "Tag encodings (part 1)"
05646 .DE
05647 .DF
05648 .TS
05649 box center;
05650 l l
05651 lf(CW) lf(CW)
05652 .
05653 Tag name Value
05654 _
05655 DW_TAG_friend 0x2a
05656 DW_TAG_namelist 0x2b
05657 DW_TAG_namelist_item 0x2c
05658 DW_TAG_packed_type 0x2d
05659 DW_TAG_subprogram 0x2e
05660 DW_TAG_template_type_param 0x2f
05661 DW_TAG_template_value_param 0x30
05662 DW_TAG_thrown_type 0x31
05663 DW_TAG_try_block 0x32
05664 DW_TAG_variant_part 0x33
05665 DW_TAG_variable 0x34
05666 DW_TAG_volatile_type 0x35
05667 DW_TAG_lo_user 0x4080
05668 DW_TAG_hi_user 0xffff
05669 .TE
05670 .FG "Tag encodings (part 2)"
05671 .DE
05672 .P
05673 Following the tag encoding is a 1-byte value that determines
05674 whether a debugging information entry using this abbreviation
05675 has child entries or not. If the value is
05676 .Cf DW_CHILDREN_yes ,
05677 the next physically succeeding entry of any debugging information
05678 entry using this abbreviation is the first child of the prior entry.
05679 If the 1-byte value following the abbreviation's tag encoding
05680 is
05681 .Cf DW_CHILDREN_no ,
05682 the next physically succeeding entry of any debugging information entry
05683 using this abbreviation is a sibling of the prior entry. (Either
05684 the first child or sibling entries may be null entries).
05685 .IX debugging information entries, siblings
05686 .IX debugging information entries, child entries
05687 .IX debugging information entries, null entries
05688 .nr aX \n(Fg+1
05689 The encodings for the child determination byte are given in Figure \n(aX.
05690 (As mentioned in section 2.3, each chain of sibling entries is
05691 terminated by a null entry).
05692 .IX debugging information entries, null entries
05693 .DF
05694 .TS
05695 box center;
05696 l l
05697 lf(CW) lf(CW)
05698 .
05699 Child determination name Value
05700 _
05701 DW_CHILDREN_no 0
05702 DW_CHILDREN_yes 1
05703 .TE
05704 .FG "Child determination encodings"
05705 .DE
05706 .P
05707 Finally, the child encoding is followed by a series of attribute specifications.
05708 .IX attributes
05709 Each attribute specification consists of two parts. The first part
05710 is an unsigned LEB128 number representing the attribute's name.
05711 .IX attributes, names
05712 The second part is an unsigned LEB128 number representing the
05713 attribute's form. The series of attribute specifications ends
05714 .IX attributes, forms
05715 with an entry containing 0 for the name and 0 for the form.
05716 .P
05717 The attribute form
05718 .Cf DW_FORM_indirect
05719 is a special case. For attributes with this form, the attribute value
05720 itself in the
05721 .Cf .debug_info
05722 section begins with an unsigned LEB128 number that represents its form.
05723 This allows producers to choose forms for particular attributes dynamically,
05724 without having to add a new entry to the abbreviation table.
05725 .P
05726 The abbreviations for a given compilation unit end with an entry
05727 consisting of a 0 byte for the abbreviation code.
05728 .I
05729 .P
05730 See Appendix 2 for a depiction of the organization
05731 of the debugging information.
05732 .R
05733 .H 3 "Attribute Encodings"
05734 .nr aX \n(Fg+1
05735 .nr bX \n(Fg+2
05736 The encodings for the attribute names are given in Figures \n(aX
05737 and \n(bX.
05738 .DF
05739 .TS
05740 box center;
05741 l l l
05742 lf(CW) lf(CW) l
05743 .
05744 Attribute name Value Classes
05745 _
05746 DW_AT_sibling 0x01 reference
05747 DW_AT_location 0x02 block, constant
05748 DW_AT_name 0x03 string
05749 DW_AT_ordering 0x09 constant
05750 DW_AT_byte_size 0x0b constant
05751 DW_AT_bit_offset 0x0c constant
05752 DW_AT_bit_size 0x0d constant
05753 DW_AT_stmt_list 0x10 constant
05754 DW_AT_low_pc 0x11 address
05755 DW_AT_high_pc 0x12 address
05756 DW_AT_language 0x13 constant
05757 DW_AT_discr 0x15 reference
05758 DW_AT_discr_value 0x16 constant
05759 DW_AT_visibility 0x17 constant
05760 DW_AT_import 0x18 reference
05761 DW_AT_string_length 0x19 block, constant
05762 DW_AT_common_reference 0x1a reference
05763 DW_AT_comp_dir 0x1b string
05764 DW_AT_const_value 0x1c string, constant, block
05765 DW_AT_containing_type 0x1d reference
05766 DW_AT_default_value 0x1e reference
05767 DW_AT_inline 0x20 constant
05768 DW_AT_is_optional 0x21 flag
05769 DW_AT_lower_bound 0x22 constant, reference
05770 DW_AT_producer 0x25 string
05771 DW_AT_prototyped 0x27 flag
05772 DW_AT_return_addr 0x2a block, constant
05773 DW_AT_start_scope 0x2c constant
05774 DW_AT_stride_size 0x2e constant
05775 DW_AT_upper_bound 0x2f constant, reference
05776 .TE
05777 .FG "Attribute encodings, part 1"
05778 .DE
05779 .DF
05780 .TS
05781 box center;
05782 l l l
05783 lf(CW) lf(CW) l
05784 .
05785 Attribute name Value Classes
05786 _
05787 DW_AT_abstract_origin 0x31 reference
05788 DW_AT_accessibility 0x32 constant
05789 DW_AT_address_class 0x33 constant
05790 DW_AT_artificial 0x34 flag
05791 DW_AT_base_types 0x35 reference
05792 DW_AT_calling_convention 0x36 constant
05793 DW_AT_count 0x37 constant, reference
05794 DW_AT_data_member_location 0x38 block, reference
05795 DW_AT_decl_column 0x39 constant
05796 DW_AT_decl_file 0x3a constant
05797 DW_AT_decl_line 0x3b constant
05798 DW_AT_declaration 0x3c flag
05799 DW_AT_discr_list 0x3d block
05800 DW_AT_encoding 0x3e constant
05801 DW_AT_external 0x3f flag
05802 DW_AT_frame_base 0x40 block, constant
05803 DW_AT_friend 0x41 reference
05804 DW_AT_identifier_case 0x42 constant
05805 DW_AT_macro_info 0x43 constant
05806 DW_AT_namelist_item 0x44 block
05807 DW_AT_priority 0x45 reference
05808 DW_AT_segment 0x46 block, constant
05809 DW_AT_specification 0x47 reference
05810 DW_AT_static_link 0x48 block, constant
05811 DW_AT_type 0x49 reference
05812 DW_AT_use_location 0x4a block, constant
05813 DW_AT_variable_parameter 0x4b flag
05814 DW_AT_virtuality 0x4c constant
05815 DW_AT_vtable_elem_location 0x4d block, reference
05816 DW_AT_lo_user 0x2000 \(em
05817 DW_AT_hi_user 0x3fff \(em
05818 .TE
05819 .FG "Attribute encodings, part 2"
05820 .DE
05821 .P
05822 .IX attributes, forms
05823 The attribute form governs how the value of the attribute is encoded.
05824 The possible forms may belong to one of the following
05825 form classes:
05826 .VL 18
05827 .LI address
05828 .IX attributes, addresses
05829 Represented as an object of appropriate size to hold an
05830 address on the target machine (\f(CWDW_FORM_addr\fP).
05831 This address is relocatable in
05832 a relocatable object file and is relocated in an
05833 executable file or shared object.
05834 .LI "block"
05835 .IX attributes, blocks
05836 Blocks come in four forms. The first consists of a 1-byte length
05837 followed by 0 to 255 contiguous information bytes (\f(CWDW_FORM_block1\fP).
05838 The second consists of a 2-byte length
05839 followed by 0 to 65,535 contiguous information bytes (\f(CWDW_FORM_block2\fP).
05840 The third consists of a 4-byte length
05841 followed by 0 to 4,294,967,295 contiguous information bytes (\f(CWDW_FORM_block4\fP).
05842 The fourth consists of an unsigned LEB128 length followed by the number
05843 of bytes specified by the length (\f(CWDW_FORM_block\fP).
05844 In all forms, the length is the number of information bytes that follow.
05845 The information bytes may contain any mixture of relocated (or
05846 relocatable) addresses, references to other debugging information entries or
05847 data bytes.
05848 .LI "constant"
05849 .IX attributes, constants
05850 There are six forms of constants:
05851 one, two, four and eight byte values (respectively,
05852 .Cf DW_FORM_data1 ,
05853 .Cf DW_FORM_data2 ,
05854 .Cf DW_FORM_data4 ,
05855 and
05856 .Cf DW_FORM_data8 ).
05857 .IX variable length data
05858 .IX LEB128
05859 There are also variable length constant data forms encoded
05860 using LEB128 numbers (see below). Both signed (\f(CWDW_FORM_sdata\fP)
05861 and unsigned (\f(CWDW_FORM_udata\fP) variable length constants are available.
05862 .LI flag
05863 .IX attributes, flags
05864 A flag is represented as a single byte of data (\f(CWDW_FORM_flag\fP).
05865 If the flag has value zero, it indicates the absence of the attribute.
05866 If the flag has a non-zero value, it indicates the presence of
05867 the attribute.
05868 .LI reference
05869 .IX attributes, references
05870 There are two types of reference. The first is an
05871 offset relative to the first byte of the compilation unit header
05872 for the compilation unit containing the reference.
05873 The offset must refer to an entry within
05874 that same compilation unit. There are five forms for this
05875 type of reference:
05876 one, two, four and eight byte offsets (respectively,
05877 .Cf DW_FORM_ref1 ,
05878 .Cf DW_FORM_ref2 ,
05879 .Cf DW_FORM_ref4 ,
05880 and
05881 .Cf DW_FORM_ref8 ).
05882 There are is also an unsigned variable length offset encoded
05883 using LEB128 numbers (\f(CWDW_FORM_ref_udata\fP).
05884 .P
05885 The second type of reference
05886 is the address of any debugging information entry within
05887 the same executable or shared object; it may refer to an entry
05888 in a different compilation unit from the unit containing the
05889 reference. This type of reference (\f(CWDW_FORM_ref_addr\fP) is the
05890 size of an address on the target architecture; it is relocatable
05891 in a relocatable object file and relocated in an executable file
05892 or shared object.
05893 .P
05894 .I
05895 The use of compilation unit relative references will reduce
05896 the number of link-time relocations and so speed up linking.
05897 .P
05898 The use of address-type references allows for the commonization
05899 of information, such as types, across compilation units.
05900 .R
05901 .LI string
05902 .IX attributes, strings
05903 A string is a sequence of contiguous non-null bytes followed by one null
05904 byte. A string may be represented immediately in the debugging information
05905 entry itself (\f(CWDW_FORM_string\fP), or may be represented as a 4-byte offset
05906 into a string table contained in the
05907 .Cf .debug_str
05908 .IX \f(CW.debug_str\fP %debugas
05909 .IX string table
05910 section of the object file (\f(CWDW_FORM_strp\fP).
05911 .LE
05912 .P
05913 .nr aX \n(Fg+1
05914 The form encodings are listed in Figure \n(aX.
05915 .DF
05916 .TS
05917 box center;
05918 l l l
05919 lf(CW) lf(CW) l
05920 .
05921 Form name Value Class
05922 _
05923 DW_FORM_addr 0x01 address
05924 DW_FORM_block2 0x03 block
05925 DW_FORM_block4 0x04 block
05926 DW_FORM_data2 0x05 constant
05927 DW_FORM_data4 0x06 constant
05928 DW_FORM_data8 0x07 constant
05929 DW_FORM_string 0x08 string
05930 DW_FORM_block 0x09 block
05931 DW_FORM_block1 0x0a block
05932 DW_FORM_data1 0x0b constant
05933 DW_FORM_flag 0x0c flag
05934 DW_FORM_sdata 0x0d constant
05935 DW_FORM_strp 0x0e string
05936 DW_FORM_udata 0x0f constant
05937 DW_FORM_ref_addr 0x10 reference
05938 DW_FORM_ref1 0x11 reference
05939 DW_FORM_ref2 0x12 reference
05940 DW_FORM_ref4 0x13 reference
05941 DW_FORM_ref8 0x14 reference
05942 DW_FORM_ref_udata 0x15 reference
05943 DW_FORM_indirect 0x16 (see section 7.5.3)
05944 .TE
05945 .FG "Attribute form encodings"
05946 .DE
05947 .H 2 "Variable Length Data"
05948 .IX variable length data
05949 .IX LEB128
05950 The special constant data forms
05951 .Cf DW_FORM_sdata
05952 and
05953 .Cf DW_FORM_udata
05954 are encoded using ``Little Endian Base 128'' (LEB128)
05955 numbers. LEB128 is a scheme for encoding integers densely that
05956 exploits the assumption that most integers are small in magnitude.
05957 (This encoding is equally suitable whether the target machine
05958 architecture represents data in big-endian or little-endian order.
05959 It is ``little endian'' only in the sense that it avoids using space
05960 to represent the ``big'' end of an unsigned integer, when the big
05961 end is all zeroes or sign extension bits).
05962 .P
05963 .Cf DW_FORM_udata
05964 (unsigned LEB128) numbers are encoded as follows:
05965 start at the
05966 low order end of an unsigned integer and chop it into 7-bit chunks.
05967 Place each chunk into the low order 7 bits of a byte. Typically,
05968 several of the high order bytes will be zero; discard them. Emit the
05969 remaining bytes in a stream, starting with the low order byte;
05970 set the high order bit on each byte except the last emitted byte.
05971 The high bit of zero on the last byte indicates to the decoder
05972 that it has encountered the last byte.
05973 .P
05974 The integer zero is a special case, consisting of a single zero byte.
05975 .P
05976 .I
05977 .nr aX \n(Fg+1
05978 Figure \n(aX gives some examples of
05979 .Cf DW_FORM_udata
05980 numbers. The
05981 .Cf 0x80
05982 in each case is the high order bit of the byte, indicating that
05983 an additional byte follows:
05984 .R
05985 .DF
05986 .TS
05987 box center;
05988 l l l
05989 nf(CW) lf(CW) lf(CW)
05990 .
05991 Number First byte Second byte
05992 _
05993 2 2 \(em
05994 127 127 \(em
05995 128 0+0x80 1
05996 129 1+0x80 1
05997 130 2+0x80 1
05998 12857 57+0x80 100
05999 .TE
06000 .FG "Examples of unsigned LEB128 encodings"
06001 .DE
06002 .P
06003 The encoding for
06004 .Cf DW_FORM_sdata
06005 (signed, 2s complement LEB128) numbers is similar, except that the
06006 criterion for discarding high order bytes is not whether they are
06007 zero, but whether they consist entirely of sign extension bits.
06008 Consider the 32-bit integer
06009 .Cf -2 .
06010 The three high level bytes of the number are sign extension, thus LEB128
06011 would represent it as a single byte containing the low order 7 bits,
06012 with the high order bit cleared to indicate the end of the byte
06013 stream. Note that there is nothing within the LEB128 representation
06014 that indicates whether an encoded number is signed or unsigned.
06015 The decoder must know what type of number to expect.
06016 .P
06017 .I
06018 .nr aX \n(Fg+1
06019 Figure \n(aX gives some examples of
06020 .Cf DW_FORM_sdata
06021 numbers.
06022 .R
06023 .P
06024 .I
06025 Appendix 4 gives algorithms for encoding and decoding these forms.
06026 .R
06027 .DF
06028 .TS
06029 box center;
06030 l l l
06031 nf(CW) lf(CW) lf(CW)
06032 .
06033 Number First byte Second byte
06034 _
06035 2 2 \(em
06036 -2 0x7e \(em
06037 127 127+0x80 0
06038 -127 1+0x80 0x7f
06039 128 0+0x80 1
06040 -128 0+0x80 0x7f
06041 129 1+0x80 1
06042 -129 0x7f+0x80 0x7e
06043 .TE
06044 .FG "Examples of signed LEB128 encodings"
06045 .DE
06046 .H 2 "Location Descriptions"
06047 .H 3 "Location Expressions"
06048 .IX locations, descriptions
06049 .IX locations, expressions
06050 A location expression is stored in a block of contiguous bytes.
06051 The bytes form a set of operations.
06052 Each location operation has a 1-byte code
06053 that identifies that operation. Operations can be followed
06054 by one or more bytes of additional data. All operations in a
06055 location expression are concatenated from left to right.
06056 The encodings for the operations in a location expression
06057 .IX locations, expressions
06058 .nr aX \n(Fg+1
06059 .nr bX \n(Fg+2
06060 are described in Figures \n(aX and \n(bX.
06061 .DS
06062 .TS
06063 center box;
06064 l l l l
06065 lf(CW) lf(CW) l l
06066 .
06067 Operation Code No. of Operands Notes
06068 _
06069 DW_OP_addr 0x03 1 constant address (size target specific)
06070 DW_OP_deref 0x06 0
06071 DW_OP_const1u 0x08 1 1-byte constant
06072 DW_OP_const1s 0x09 1 1-byte constant
06073 DW_OP_const2u 0x0a 1 2-byte constant
06074 DW_OP_const2s 0x0b 1 2-byte constant
06075 DW_OP_const4u 0x0c 1 4-byte constant
06076 DW_OP_const4s 0x0d 1 4-byte constant
06077 DW_OP_const8u 0x0e 1 8-byte constant
06078 DW_OP_const8s 0x0f 1 8-byte constant
06079 DW_OP_constu 0x10 1 ULEB128 constant
06080 DW_OP_consts 0x11 1 SLEB128 constant
06081 DW_OP_dup 0x12 0
06082 DW_OP_drop 0x13 0
06083 DW_OP_over 0x14 0
06084 DW_OP_pick 0x15 1 1-byte stack index
06085 DW_OP_swap 0x16 0
06086 DW_OP_rot 0x17 0
06087 DW_OP_xderef 0x18 0
06088 DW_OP_abs 0x19 0
06089 DW_OP_and 0x1a 0
06090 DW_OP_div 0x1b 0
06091 DW_OP_minus 0x1c 0
06092 DW_OP_mod 0x1d 0
06093 DW_OP_mul 0x1e 0
06094 DW_OP_neg 0x1f 0
06095 DW_OP_not 0x20 0
06096 DW_OP_or 0x21 0
06097 DW_OP_plus 0x22 0
06098 DW_OP_plus_uconst 0x23 1 ULEB128 addend
06099 DW_OP_shl 0x24 0
06100 DW_OP_shr 0x25 0
06101 DW_OP_shra 0x26 0
06102 .TE
06103 .FG "Location operation encodings, part 1"
06104 .DE
06105 .DS
06106 .TS
06107 center box;
06108 l l l l
06109 lf(CW) lf(CW) l l
06110 .
06111 Operation Code No. of Operands Notes
06112 _
06113 DW_OP_xor 0x27 0
06114 DW_OP_skip 0x2f 1 signed 2-byte constant
06115 DW_OP_bra 0x28 1 signed 2-byte constant
06116 DW_OP_eq 0x29 0
06117 DW_OP_ge 0x2a 0
06118 DW_OP_gt 0x2b 0
06119 DW_OP_le 0x2c 0
06120 DW_OP_lt 0x2d 0
06121 DW_OP_ne 0x2e 0
06122 DW_OP_lit0 0x30 0 literals 0..31 = (DW_OP_LIT0|literal)
06123 DW_OP_lit1 0x31 0
06124 \.\.\.
06125 DW_OP_lit31 0x4f 0
06126 DW_OP_reg0 0x50 0 reg 0..31 = (DW_OP_REG0|regnum)
06127 DW_OP_reg1 0x51 0
06128 \.\.\.
06129 DW_OP_reg31 0x6f 0
06130 DW_OP_breg0 0x70 1 SLEB128 offset
06131 DW_OP_breg1 0x71 1 base reg 0..31 = (DW_OP_BREG0|regnum)
06132 \.\.\.
06133 DW_OP_breg31 0x8f 1
06134 DW_OP_regx 0x90 1 ULEB128 register
06135 DW_OP_fbreg 0x91 1 SLEB128 offset
06136 DW_OP_bregx 0x92 2 ULEB128 register followed by SLEB128 offset
06137 DW_OP_piece 0x93 1 ULEB128 size of piece addressed
06138 DW_OP_deref_size 0x94 1 1-byte size of data retrieved
06139 DW_OP_xderef_size 0x95 1 1-byte size of data retrieved
06140 DW_OP_nop 0x96 0
06141 DW_OP_lo_user 0xe0
06142 DW_OP_hi_user 0xff
06143 .TE
06144 .FG "Location operation encodings, part 2"
06145 .DE
06146 .H 3 "Location Lists"
06147 .IX locations, lists
06148 Each entry in a location list consists of two relative addresses
06149 followed by a 2-byte length, followed by a block of contiguous
06150 bytes. The length specifies the number of bytes in the block
06151 that follows. The two addresses are the same size as used by
06152 .Cf DW_FORM_addr
06153 on the target machine.
06154 .H 2 "Base Type Encodings"
06155 .nr aX \n(Fg+1
06156 .IX base types
06157 .IX types, base
06158 The values of the constants used in the
06159 .Cf DW_AT_encoding
06160 attribute are given in Figure \n(aX.
06161 .DF
06162 .TS
06163 box center;
06164 l l
06165 lf(CW) lf(CW)
06166 .
06167 Base type encoding name Value
06168 _
06169 DW_ATE_address 0x1
06170 DW_ATE_boolean 0x2
06171 DW_ATE_complex_float 0x3
06172 DW_ATE_float 0x4
06173 DW_ATE_signed 0x5
06174 DW_ATE_signed_char 0x6
06175 DW_ATE_unsigned 0x7
06176 DW_ATE_unsigned_char 0x8
06177 DW_ATE_lo_user 0x80
06178 DW_ATE_hi_user 0xff
06179 .TE
06180 .FG "Base type encoding values"
06181 .DE
06182 .H 2 "Accessibility Codes"
06183 .nr aX \n(Fg+1
06184 .IX accessibility
06185 .IX declarations, accessibility
06186 The encodings of the constants used in the
06187 .Cf DW_AT_accessibility
06188 attribute are given in Figure \n(aX.
06189 .DF
06190 .TS
06191 box center;
06192 l l
06193 lf(CW) lf(CW)
06194 .
06195 Accessibility code name Value
06196 _
06197 DW_ACCESS_public 1
06198 DW_ACCESS_protected 2
06199 DW_ACCESS_private 3
06200 .TE
06201 .FG "Accessibility encodings"
06202 .DE
06203 .H 2 "Visibility Codes"
06204 .nr aX \n(Fg+1
06205 The encodings of the constants used in the
06206 .Cf DW_AT_visibility
06207 .IX visibility
06208 .IX declarations, visibility
06209 attribute are given in Figure \n(aX.
06210 .DF
06211 .TS
06212 box center;
06213 l l
06214 lf(CW) lf(CW)
06215 .
06216 Visibility code name Value
06217 _
06218 DW_VIS_local 1
06219 DW_VIS_exported 2
06220 DW_VIS_qualified 3
06221 .TE
06222 .FG "Visibility encodings"
06223 .DE
06224 .H 2 "Virtuality Codes"
06225 .nr aX \n(Fg+1
06226 .IX virtuality
06227 The encodings of the constants used in the
06228 .Cf DW_AT_virtuality
06229 attribute are given in Figure \n(aX.
06230 .DF
06231 .TS
06232 box center;
06233 l l
06234 lf(CW) lf(CW)
06235 .
06236 Virtuality code name Value
06237 _
06238 DW_VIRTUALITY_none 0
06239 DW_VIRTUALITY_virtual 1
06240 DW_VIRTUALITY_pure_virtual 2
06241 .TE
06242 .FG "Virtuality encodings"
06243 .DE
06244 .H 2 "Source Languages"
06245 .nr aX \n(Fg+1
06246 .IX languages
06247 The encodings for source languages are given in Figure \n(aX.
06248 Names marked with \(dg and their associated
06249 values are reserved, but the languages
06250 they represent are not supported in DWARF Version 2.
06251 .DF
06252 .TS
06253 box center;
06254 l l
06255 lf(CW) lf(CW)
06256 .
06257 Language name Value
06258 _
06259 DW_LANG_C89 0x0001
06260 DW_LANG_C 0x0002
06261 DW_LANG_Ada83\(dg 0x0003
06262 DW_LANG_C_plus_plus 0x0004
06263 DW_LANG_Cobol74\(dg 0x0005
06264 DW_LANG_Cobol85\(dg 0x0006
06265 DW_LANG_Fortran77 0x0007
06266 DW_LANG_Fortran90 0x0008
06267 DW_LANG_Pascal83 0x0009
06268 DW_LANG_Modula2 0x000a
06269 DW_LANG_lo_user 0x8000
06270 DW_LANG_hi_user 0xffff
06271 .TE
06272 .FG "Language encodings"
06273 .DE
06274 .H 2 "Address Class Encodings"
06275 .IX addresses, class
06276 The value of the common address class encoding
06277 .Cf DW_ADDR_none
06278 is 0.
06279 .H 2 "Identifier Case"
06280 .IX identifiers, case
06281 The encodings of the constants used in the
06282 .Cf DW_AT_identifier_case
06283 .nr aX \n(Fg+1
06284 attribute are given in Figure \n(aX.
06285 .DF
06286 .TS
06287 box center;
06288 l l
06289 lf(CW) lf(CW)
06290 .
06291 Identifier Case Name Value
06292 _
06293 DW_ID_case_sensitive 0
06294 DW_ID_up_case 1
06295 DW_ID_down_case 2
06296 DW_ID_case_insensitive 3
06297 .TE
06298 .FG "Identifier case encodings"
06299 .DE
06300 .H 2 "Calling Convention Encodings"
06301 .IX calling conventions
06302 The encodings for the values of the
06303 .Cf DW_AT_calling_convention
06304 .nr aX \n(Fg+1
06305 attribute are given in Figure \n(aX.
06306 .DF
06307 .TS
06308 box center;
06309 l l
06310 lf(CW) lf(CW)
06311 .
06312 Calling Convention Name Value
06313 _
06314 DW_CC_normal 0x1
06315 DW_CC_program 0x2
06316 DW_CC_nocall 0x3
06317 DW_CC_lo_user 0x40
06318 DW_CC_hi_user 0xff
06319 .TE
06320 .FG "Calling convention encodings"
06321 .DE
06322 .H 2 "Inline Codes"
06323 .IX subroutines, inline
06324 The encodings of the constants used in the
06325 .Cf DW_AT_inline
06326 .nr aX \n(Fg+1
06327 attribute are given in Figure \n(aX.
06328 .DF
06329 .TS
06330 box center;
06331 l l
06332 lf(CW) lf(CW)
06333 .
06334 Inline Code Name Value
06335 _
06336 DW_INL_not_inlined 0
06337 DW_INL_inlined 1
06338 DW_INL_declared_not_inlined 2
06339 DW_INL_declared_inlined 3
06340 .TE
06341 .FG "Inline encodings"
06342 .DE
06343 .H 2 "Array Ordering"
06344 .IX arrays, ordering
06345 The encodings for the values of the order attributes of arrays
06346 .nr aX \n(Fg+1
06347 is given in Figure \n(aX.
06348 .DF
06349 .TS
06350 box center;
06351 l l
06352 lf(CW) lf(CW)
06353 .
06354 Ordering name Value
06355 _
06356 DW_ORD_row_major 0
06357 DW_ORD_col_major 1
06358 .TE
06359 .FG "Ordering encodings"
06360 .DE
06361 .H 2 "Discriminant Lists"
06362 .IX variants
06363 .IX discriminated unions
06364 .IX discriminants
06365 The descriptors used in the
06366 .Cf DW_AT_dicsr_list
06367 attribute are encoded as 1-byte constants.
06368 .nr aX \n(Fg+1
06369 The defined values are presented in Figure \n(aX.
06370 .DF
06371 .TS
06372 box center;
06373 l l
06374 lf(CW) lf(CW)
06375 .
06376 Descriptor Name Value
06377 _
06378 DW_DSC_label 0
06379 DW_DSC_range 1
06380 .TE
06381 .FG "Discriminant descriptor encodings"
06382 .DE
06383 .H 2 "Name Lookup Table"
06384 .IX lookup, by name
06385 Each set of entries in the table of global names contained in the
06386 .Cf .debug_pubnames
06387 .IX \f(CW.debug_pubnames\fP %debugap
06388 section begins with a header consisting of: a 4-byte length containing
06389 the length of the set of entries for this compilation unit, not including
06390 the length field itself; a 2-byte version identifier containing
06391 the value 2 for DWARF Version 2; a 4-byte offset into the
06392 .Cf .debug_info
06393 section; and a 4-byte length containing the size in bytes
06394 of the contents of the
06395 .Cf .debug_info
06396 section generated to represent this compilation unit.
06397 This header is followed by a series of tuples.
06398 Each tuple consists of a 4-byte offset
06399 followed by a string of non-null bytes terminated by one null byte.
06400 Each set is terminated by a 4-byte word containing the value 0.
06401 .H 2 "Address Range Table"
06402 .IX lookup, by address
06403 Each set of entries in the table of address ranges contained in the
06404 .Cf .debug_aranges
06405 .IX \f(CW.debug_aranges\fP %debugaar
06406 section begins with a header consisting of: a 4-byte length containing
06407 the length of the set of entries for this compilation unit, not including
06408 the length field itself; a 2-byte version identifier containing
06409 the value 2 for DWARF Version 2; a 4-byte offset into the
06410 .Cf .debug_info
06411 section; a 1-byte unsigned integer containing the size in bytes of an
06412 address (or the offset portion of an address for segmented addressing)
06413 .IX addresses, offset portion
06414 .IX addresses, size of
06415 on the target system; and a 1-byte unsigned integer containing the
06416 size in bytes of a segment descriptor on the target system.
06417 This header is followed by a series of tuples.
06418 Each tuple consists of an address and a length, each
06419 in the size appropriate for an address on the target architecture.
06420 The first tuple following the header in each set begins at
06421 an offset that is a multiple of the size of a single tuple
06422 (that is, twice the size of an address). The header is
06423 padded, if necessary, to the appropriate boundary.
06424 Each set of tuples is terminated by a 0 for the address and 0 for the length.
06425 .H 2 "Line Number Information"
06426 .IX line number information
06427 .IX line number information, definitions
06428 The sizes of the integers used in the line number and
06429 call frame information sections are as follows:
06430 .VL 15
06431 .LI "sbyte"
06432 Signed 1-byte value.
06433 .LI "ubyte"
06434 Unsigned 1-byte value.
06435 .LI "uhalf"
06436 Unsigned 2-byte value.
06437 .LI "sword"
06438 Signed 4-byte value.
06439 .LI "uword"
06440 Unsigned 4-byte value.
06441 .LI
06442 .LE
06443 .P
06444 .IX Version 2
06445 The version number in the statement program prologue is 2 for
06446 DWARF Version 2.
06447 The boolean values ``true'' and ``false'' used by the statement
06448 information program are encoded as a single byte containing the
06449 value 0 for ``false,'' and a non-zero value for ``true.''
06450 The encodings for the pre-defined standard opcodes are given
06451 .IX line number information, standard opcodes
06452 .nr aX \n(Fg+1
06453 in Figure \n(aX.
06454 .DF
06455 .TS
06456 box center;
06457 l l
06458 lf(CW) lf(CW)
06459 .
06460 Opcode Name Value
06461 _
06462 DW_LNS_copy 1
06463 DW_LNS_advance_pc 2
06464 DW_LNS_advance_line 3
06465 DW_LNS_set_file 4
06466 DW_LNS_set_column 5
06467 DW_LNS_negate_stmt 6
06468 DW_LNS_set_basic_block 7
06469 DW_LNS_const_add_pc 8
06470 DW_LNS_fixed_advance_pc 9
06471 .TE
06472 .FG "Standard Opcode Encodings"
06473 .DE
06474 The encodings for the pre-defined extended opcodes are given
06475 .IX line number information, extended opcodes
06476 .nr aX \n(Fg+1
06477 in Figure \n(aX.
06478 .DF
06479 .TS
06480 box center;
06481 l l
06482 lf(CW) lf(CW)
06483 .
06484 Opcode Name Value
06485 _
06486 DW_LNE_end_sequence 1
06487 DW_LNE_set_address 2
06488 DW_LNE_define_file 3
06489 .TE
06490 .FG "Extended Opcode Encodings"
06491 .DE
06492 .H 2 "Macro Information"
06493 .IX macro information
06494 .IX source, files
06495 The source line numbers and source file indices encoded in the
06496 macro information section are represented as unsigned LEB128 numbers
06497 as are the constants in an
06498 .Cf DW_MACINFO_vendor_ext
06499 entry.
06500 The macinfo type is encoded as a single byte. The encodings are given
06501 .nr aX \n(Fg+1
06502 in Figure \n(aX.
06503 .DF
06504 .TS
06505 box center;
06506 l l
06507 lf(CW) lf(CW)
06508 .
06509 Macinfo Type Name Value
06510 _
06511 DW_MACINFO_define 1
06512 DW_MACINFO_undef 2
06513 DW_MACINFO_start_file 3
06514 DW_MACINFO_end_file 4
06515 DW_MACINFO_vendor_ext 255
06516 .TE
06517 .FG "Macinfo Type Encodings"
06518 .DE
06519 .H 2 "Call Frame Information"
06520 .IX call frame information
06521 The value of the CIE id in the CIE header is
06522 .Cf 0xffffffff .
06523 The initial value of the CIE version number is 1.
06524 .P
06525 Call frame instructions are encoded in one or more bytes.
06526 .IX call frame information, instructions
06527 The primary opcode is encoded in the high order two bits of
06528 the first byte (that is, opcode = byte >> 6).
06529 An operand or extended opcode may be encoded in the low order
06530 6 bits. Additional operands are encoded in subsequent bytes.
06531 The instructions and their encodings are presented
06532 .nr aX \n(Fg+1
06533 in Figure \n(aX.
06534 .DS
06535 .TS
06536 center box;
06537 l l l l l
06538 lf(CW) lf(CW) l l
06539 lf(CW) lf(CW) l l
06540 lf(CW) lf(CW) l l
06541 lf(CW) lf(CW) lf(CW) l.
06542 Instruction High 2 Bits Low 6 Bits Operand 1 Operand 2
06543 _
06544 DW_CFA_advance_loc 0x1 delta
06545 DW_CFA_offset 0x2 register ULEB128 offset
06546 DW_CFA_restore 0x3 register
06547 DW_CFA_set_loc 0 0x01 address
06548 DW_CFA_advance_loc1 0 0x02 1-byte delta
06549 DW_CFA_advance_loc2 0 0x03 2-byte delta
06550 DW_CFA_advance_loc4 0 0x04 4-byte delta
06551 DW_CFA_offset_extended 0 0x05 ULEB128 register ULEB128 offset
06552 DW_CFA_restore_extended 0 0x06 ULEB128 register
06553 DW_CFA_undefined 0 0x07 ULEB128 register
06554 DW_CFA_same_value 0 0x08 ULEB128 register
06555 DW_CFA_register 0 0x09 ULEB128 register ULEB128 register
06556 DW_CFA_remember_state 0 0x0a
06557 DW_CFA_restore_state 0 0x0b
06558 DW_CFA_def_cfa 0 0x0c ULEB128 register ULEB128 offset
06559 DW_CFA_def_cfa_register 0 0x0d ULEB128 register
06560 DW_CFA_def_cfa_offset 0 0x0e ULEB128 offset
06561 DW_CFA_nop 0 0
06562 DW_CFA_lo_user 0 0x1c
06563 DW_CFA_hi_user 0 0x3f
06564 .TE
06565 .FG "Call frame instruction encodings"
06566 .DE
06567 .H 2 "Dependencies"
06568 The debugging information in this format is intended to exist in the
06569 .Cf .debug_abbrev ,
06570 .Cf .debug_aranges ,
06571 .Cf .debug_frame ,
06572 .Cf .debug_info ,
06573 .Cf .debug_line ,
06574 .Cf .debug_loc ,
06575 .Cf .debug_macinfo ,
06576 .Cf .debug_pubnames
06577 and
06578 .Cf .debug_str
06579 .IX \f(CW.debug_abbrev\fP %debugaab
06580 .IX \f(CW.debug_aranges\fP %debugaar
06581 .IX \f(CW.debug_frame\fP %debugaf
06582 .IX \f(CW.debug_info\fP %debugai
06583 .IX \f(CW.debug_line\fP %debugali
06584 .IX \f(CW.debug_loc\fP %debugalo
06585 .IX \f(CW.debug_macinfo\fP %debugam
06586 .IX \f(CW.debug_pubnames\fP %debugap
06587 .IX \f(CW.debug_str\fP %debugas
06588 sections of an object file.
06589 The information is not word-aligned, so the assembler must provide a
06590 way for the compiler to produce 2-byte and 4-byte quantities without
06591 alignment restrictions, and the linker must be able to
06592 relocate a 4-byte reference at an arbitrary alignment.
06593 In target architectures with 64-bit addresses, the assembler and linker
06594 must similarly handle 8-byte references at arbitrary alignments.
06595 .OP
06596 .H 1 "FUTURE DIRECTIONS"
06597 The \*(iX \*(tE is working on a specification for a set of interfaces
06598 for reading DWARF information, that will hide changes in the
06599 representation of that information from its consumers. It is
06600 hoped that using these interfaces will make the transition from
06601 DWARF Version 1 to Version 2 much simpler and will make it
06602 easier for a single consumer to support objects using either
06603 Version 1 or Version 2 DWARF.
06604 .P
06605 A draft of this specification is available for review from
06606 \*(iX. The \*(tE wishes to stress, however, that the specification
06607 is still in flux.
06608 .OP
06609 .HU "Appendix 1 -- Current Attributes by Tag Value"
06610 .P
06611 The list below enumerates the attributes that are most applicable to each type
06612 of debugging information entry.
06613 DWARF does not in general require that a given debugging information
06614 entry contain a particular attribute or set of attributes. Instead, a
06615 DWARF producer is free to generate any, all, or none of the attributes
06616 described in the text as being applicable to a given entry. Other
06617 attributes (both those defined within this document but not explicitly
06618 associated with the entry in question, and new, vendor-defined ones)
06619 may also appear in a given debugging entry.
06620 Therefore, the list may be
06621 taken as instructive, but cannot be considered definitive.
06622 .sp
06623 .sp
06624 .DS
06625 .TS
06626 box, tab(:) ;
06627 lfB lfB
06628 lf(CW) lf(CW) .
06629 TAG NAME:APPLICABLE ATTRIBUTES
06630 _
06631 DW_TAG_access_declaration:DECL\(dg
06632 :DW_AT_accessibility
06633 :DW_AT_name
06634 :DW_AT_sibling
06635 _
06636 DW_TAG_array_type:DECL
06637 :DW_AT_abstract_origin
06638 :DW_AT_accessibility
06639 :DW_AT_byte_size
06640 :DW_AT_declaration
06641 :DW_AT_name
06642 :DW_AT_ordering
06643 :DW_AT_sibling
06644 :DW_AT_start_scope
06645 :DW_AT_stride_size
06646 :DW_AT_type
06647 :DW_AT_visibility
06648 _
06649 DW_TAG_base_type:DW_AT_bit_offset
06650 :DW_AT_bit_size
06651 :DW_AT_byte_size
06652 :DW_AT_encoding
06653 :DW_AT_name
06654 :DW_AT_sibling
06655 _
06656 DW_TAG_catch_block:DW_AT_abstract_origin
06657 :DW_AT_high_pc
06658 :DW_AT_low_pc
06659 :DW_AT_segment
06660 :DW_AT_sibling
06661 .TE
06662 .DE
06663 .br
06664 \(dg
06665 .Cf DW_AT_decl_column ,
06666 .Cf DW_AT_decl_file ,
06667 .Cf DW_AT_decl_line .
06668 .SK
06669 .DS
06670 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
06671
06672
06673
06674 .TS
06675 box, tab(:) ;
06676 lfB lfB
06677 lf(CW) lf(CW) .
06678 TAG NAME:APPLICABLE ATTRIBUTES
06679 _
06680 DW_TAG_class_type:DECL
06681 :DW_AT_abstract_origin
06682 :DW_AT_accessibility
06683 :DW_AT_byte_size
06684 :DW_AT_declaration
06685 :DW_AT_name
06686 :DW_AT_sibling
06687 :DW_AT_start_scope
06688 :DW_AT_visibility
06689 _
06690 DW_TAG_common_block:DECL
06691 :DW_AT_declaration
06692 :DW_AT_location
06693 :DW_AT_name
06694 :DW_AT_sibling
06695 :DW_AT_visibility
06696 _
06697 DW_TAG_common_inclusion:DECL
06698 :DW_AT_common_reference
06699 :DW_AT_declaration
06700 :DW_AT_sibling
06701 :DW_AT_visibility
06702 _
06703 DW_TAG_compile_unit:DW_AT_base_types
06704 :DW_AT_comp_dir
06705 :DW_AT_identifier_case
06706 :DW_AT_high_pc
06707 :DW_AT_language
06708 :DW_AT_low_pc
06709 :DW_AT_macro_info
06710 :DW_AT_name
06711 :DW_AT_producer
06712 :DW_AT_sibling
06713 :DW_AT_stmt_list
06714 _
06715 DW_TAG_const_type:DW_AT_sibling
06716 :DW_AT_type
06717 .TE
06718 .DE
06719 .br
06720 .SK
06721 .DS
06722 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
06723
06724
06725
06726 .TS
06727 box, tab(:) ;
06728 lfB lfB
06729 lf(CW) lf(CW) .
06730 TAG NAME:APPLICABLE ATTRIBUTES
06731 _
06732 DW_TAG_constant:DECL
06733 :DW_AT_accessibility
06734 :DW_AT_constant_value
06735 :DW_AT_declaration
06736 :DW_AT_external
06737 :DW_AT_name
06738 :DW_AT_sibling
06739 :DW_AT_start_scope
06740 :DW_AT_type
06741 :DW_AT_visibility
06742 _
06743 DW_TAG_entry_point:DW_AT_address_class
06744 :DW_AT_low_pc
06745 :DW_AT_name
06746 :DW_AT_return_addr
06747 :DW_AT_segment
06748 :DW_AT_sibling
06749 :DW_AT_static_link
06750 :DW_AT_type
06751 _
06752 DW_TAG_enumeration_type:DECL
06753 :DW_AT_abstract_origin
06754 :DW_AT_accessibility
06755 :DW_AT_byte_size
06756 :DW_AT_declaration
06757 :DW_AT_name
06758 :DW_AT_sibling
06759 :DW_AT_start_scope
06760 :DW_AT_visibility
06761 _
06762 DW_TAG_enumerator:DECL
06763 :DW_AT_const_value
06764 :DW_AT_name
06765 :DW_AT_sibling
06766 _
06767 DW_TAG_file_type:DECL
06768 :DW_AT_abstract_origin
06769 :DW_AT_byte_size
06770 :DW_AT_name
06771 :DW_AT_sibling
06772 :DW_AT_start_scope
06773 :DW_AT_type
06774 :DW_AT_visibility
06775 .TE
06776 .DE
06777 .br
06778 .SK
06779 .DS
06780 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
06781
06782
06783
06784 .TS
06785 box, tab(:) ;
06786 lfB lfB
06787 lf(CW) lf(CW) .
06788 TAG NAME:APPLICABLE ATTRIBUTES
06789 _
06790 DW_TAG_formal_parameter:DECL
06791 :DW_AT_abstract_origin
06792 :DW_AT_artificial
06793 :DW_AT_default_value
06794 :DW_AT_is_optional
06795 :DW_AT_location
06796 :DW_AT_name
06797 :DW_AT_segment
06798 :DW_AT_sibling
06799 :DW_AT_type
06800 :DW_AT_variable_parameter
06801 _
06802 DW_TAG_friend:DECL
06803 :DW_AT_abstract_origin
06804 :DW_AT_friend
06805 :DW_AT_sibling
06806 _
06807 DW_TAG_imported_declaration:DECL
06808 :DW_AT_accessibility
06809 :DW_AT_import
06810 :DW_AT_name
06811 :DW_AT_sibling
06812 :DW_AT_start_scope
06813 _
06814 DW_TAG_inheritance:DECL
06815 :DW_AT_accessibility
06816 :DW_AT_data_member_location
06817 :DW_AT_sibling
06818 :DW_AT_type
06819 :DW_AT_virtuality
06820 _
06821 DW_TAG_inlined_subroutine:DECL
06822 :DW_AT_abstract_origin
06823 :DW_AT_high_pc
06824 :DW_AT_low_pc
06825 :DW_AT_segment
06826 :DW_AT_sibling
06827 :DW_AT_return_addr
06828 :DW_AT_start_scope
06829 _
06830 DW_TAG_label:DW_AT_abstract_origin
06831 :DW_AT_low_pc
06832 :DW_AT_name
06833 :DW_AT_segment
06834 :DW_AT_start_scope
06835 :DW_AT_sibling
06836 .TE
06837 .DE
06838 .br
06839 .SK
06840 .DS
06841 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
06842
06843
06844
06845 .TS
06846 box, tab(:) ;
06847 lfB lfB
06848 lf(CW) lf(CW) .
06849 TAG NAME:APPLICABLE ATTRIBUTES
06850 _
06851 DW_TAG_lexical_block:DW_AT_abstract_origin
06852 :DW_AT_high_pc
06853 :DW_AT_low_pc
06854 :DW_AT_name
06855 :DW_AT_segment
06856 :DW_AT_sibling
06857 _
06858 DW_TAG_member:DECL
06859 :DW_AT_accessibility
06860 :DW_AT_byte_size
06861 :DW_AT_bit_offset
06862 :DW_AT_bit_size
06863 :DW_AT_data_member_location
06864 :DW_AT_declaration
06865 :DW_AT_name
06866 :DW_AT_sibling
06867 :DW_AT_type
06868 :DW_AT_visibility
06869 _
06870 DW_TAG_module:DECL
06871 :DW_AT_accessibility
06872 :DW_AT_declaration
06873 :DW_AT_high_pc
06874 :DW_AT_low_pc
06875 :DW_AT_name
06876 :DW_AT_priority
06877 :DW_AT_segment
06878 :DW_AT_sibling
06879 :DW_AT_visibility
06880 _
06881 DW_TAG_namelist:DECL
06882 :DW_AT_accessibility
06883 :DW_AT_abstract_origin
06884 :DW_AT_declaration
06885 :DW_AT_sibling
06886 :DW_AT_visibility
06887 _
06888 DW_TAG_namelist_item:DECL
06889 :DW_AT_namelist_item
06890 :DW_AT_sibling
06891 _
06892 DW_TAG_packed_type:DW_AT_sibling
06893 :DW_AT_type
06894 .TE
06895 .DE
06896 .br
06897 .SK
06898 .DS
06899 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
06900
06901
06902
06903 .TS
06904 box, tab(:) ;
06905 lfB lfB
06906 lf(CW) lf(CW) .
06907 TAG NAME:APPLICABLE ATTRIBUTES
06908 _
06909 DW_TAG_pointer_type:DW_AT_address_class
06910 :DW_AT_sibling
06911 :DW_AT_type
06912 _
06913 DW_TAG_ptr_to_member_type:DECL
06914 :DW_AT_abstract_origin
06915 :DW_AT_address_class
06916 :DW_AT_containing_type
06917 :DW_AT_declaration
06918 :DW_AT_name
06919 :DW_AT_sibling
06920 :DW_AT_type
06921 :DW_AT_use_location
06922 :DW_AT_visibility
06923 _
06924 DW_TAG_reference_type:DW_AT_address_class
06925 :DW_AT_sibling
06926 :DW_AT_type
06927 _
06928 DW_TAG_set_type:DECL
06929 :DW_AT_abstract_origin
06930 :DW_AT_accessibility
06931 :DW_AT_byte_size
06932 :DW_AT_declaration
06933 :DW_AT_name
06934 :DW_AT_start_scope
06935 :DW_AT_sibling
06936 :DW_AT_type
06937 :DW_AT_visibility
06938 _
06939 DW_TAG_string_type:DECL
06940 :DW_AT_accessibility
06941 :DW_AT_abstract_origin
06942 :DW_AT_byte_size
06943 :DW_AT_declaration
06944 :DW_AT_name
06945 :DW_AT_segment
06946 :DW_AT_sibling
06947 :DW_AT_start_scope
06948 :DW_AT_string_length
06949 :DW_AT_visibility
06950 .TE
06951 .DE
06952 .SK
06953 .DS
06954 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
06955
06956
06957
06958 .TS
06959 box, tab(:) ;
06960 lfB lfB
06961 lf(CW) lf(CW) .
06962 TAG NAME:APPLICABLE ATTRIBUTES
06963 _
06964 DW_TAG_structure_type:DECL
06965 :DW_AT_abstract_origin
06966 :DW_AT_accessibility
06967 :DW_AT_byte_size
06968 :DW_AT_declaration
06969 :DW_AT_name
06970 :DW_AT_sibling
06971 :DW_AT_start_scope
06972 :DW_AT_visibility
06973 _
06974 DW_TAG_subprogram:DECL
06975 :DW_AT_abstract_origin
06976 :DW_AT_accessibility
06977 :DW_AT_address_class
06978 :DW_AT_artificial
06979 :DW_AT_calling_convention
06980 :DW_AT_declaration
06981 :DW_AT_external
06982 :DW_AT_frame_base
06983 :DW_AT_high_pc
06984 :DW_AT_inline
06985 :DW_AT_low_pc
06986 :DW_AT_name
06987 :DW_AT_prototyped
06988 :DW_AT_return_addr
06989 :DW_AT_segment
06990 :DW_AT_sibling
06991 :DW_AT_specification
06992 :DW_AT_start_scope
06993 :DW_AT_static_link
06994 :DW_AT_type
06995 :DW_AT_visibility
06996 :DW_AT_virtuality
06997 :DW_AT_vtable_elem_location
06998 .TE
06999 .DE
07000 .SK
07001 .DS
07002 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
07003
07004
07005
07006 .TS
07007 box, tab(:) ;
07008 lfB lfB
07009 lf(CW) lf(CW) .
07010 TAG NAME:APPLICABLE ATTRIBUTES
07011 _
07012 DW_TAG_subrange_type:DECL
07013 :DW_AT_abstract_origin
07014 :DW_AT_accessibility
07015 :DW_AT_byte_size
07016 :DW_AT_count
07017 :DW_AT_declaration
07018 :DW_AT_lower_bound
07019 :DW_AT_name
07020 :DW_AT_sibling
07021 :DW_AT_type
07022 :DW_AT_upper_bound
07023 :DW_AT_visibility
07024 _
07025 DW_TAG_subroutine_type:DECL
07026 :DW_AT_abstract_origin
07027 :DW_AT_accessibility
07028 :DW_AT_address_class
07029 :DW_AT_declaration
07030 :DW_AT_name
07031 :DW_AT_prototyped
07032 :DW_AT_sibling
07033 :DW_AT_start_scope
07034 :DW_AT_type
07035 :DW_AT_visibility
07036 _
07037 DW_TAG_template_type_param:DECL
07038 :DW_AT_name
07039 :DW_AT_sibling
07040 :DW_AT_type
07041 _
07042 DW_TAG_template_value_param:DECL
07043 :DW_AT_name
07044 :DW_AT_const_value
07045 :DW_AT_sibling
07046 :DW_AT_type
07047 _
07048 DW_TAG_thrown_type:DECL
07049 :DW_AT_sibling
07050 :DW_AT_type
07051 _
07052 DW_TAG_try_block:DW_AT_abstract_origin
07053 :DW_AT_high_pc
07054 :DW_AT_low_pc
07055 :DW_AT_segment
07056 :DW_AT_sibling
07057 .TE
07058 .DE
07059 .br
07060 .SK
07061 .DS
07062 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
07063
07064
07065
07066 .TS
07067 box, tab(:) ;
07068 lfB lfB
07069 lf(CW) lf(CW) .
07070 TAG NAME:APPLICABLE ATTRIBUTES
07071 _
07072 DW_TAG_typedef:DECL
07073 :DW_AT_abstract_origin
07074 :DW_AT_accessibility
07075 :DW_AT_declaration
07076 :DW_AT_name
07077 :DW_AT_sibling
07078 :DW_AT_start_scope
07079 :DW_AT_type
07080 :DW_AT_visibility
07081 _
07082 DW_TAG_union_type:DECL
07083 :DW_AT_abstract_origin
07084 :DW_AT_accessibility
07085 :DW_AT_byte_size
07086 :DW_AT_declaration
07087 :DW_AT_friends
07088 :DW_AT_name
07089 :DW_AT_sibling
07090 :DW_AT_start_scope
07091 :DW_AT_visibility
07092 _
07093 DW_TAG_unspecified_parameters:DECL
07094 :DW_AT_abstract_origin
07095 :DW_AT_artificial
07096 :DW_AT_sibling
07097 _
07098 DW_TAG_variable:DECL
07099 :DW_AT_accessibility
07100 :DW_AT_constant_value
07101 :DW_AT_declaration
07102 :DW_AT_external
07103 :DW_AT_location
07104 :DW_AT_name
07105 :DW_AT_segment
07106 :DW_AT_sibling
07107 :DW_AT_specification
07108 :DW_AT_start_scope
07109 :DW_AT_type
07110 :DW_AT_visibility
07111 .TE
07112 .DE
07113 .br
07114 .SK
07115 .DS
07116 .B "Appendix 1 (cont'd) -- Current Attributes by Tag Value"
07117
07118
07119
07120 .TS
07121 box, tab(:) ;
07122 lfB lfB
07123 lf(CW) lf(CW) .
07124 TAG NAME:APPLICABLE ATTRIBUTES
07125 _
07126 DW_TAG_variant:DECL
07127 :DW_AT_accessibility
07128 :DW_AT_abstract_origin
07129 :DW_AT_declaration
07130 :DW_AT_discr_list
07131 :DW_AT_discr_value
07132 :DW_AT_sibling
07133 _
07134 DW_TAG_variant_part:DECL
07135 :DW_AT_accessibility
07136 :DW_AT_abstract_origin
07137 :DW_AT_declaration
07138 :DW_AT_discr
07139 :DW_AT_sibling
07140 :DW_AT_type
07141 _
07142 DW_TAG_volatile_type:DW_AT_sibling
07143 :DW_AT_type
07144 _
07145 DW_TAG_with_statement:DW_AT_accessibility
07146 :DW_AT_address_class
07147 :DW_AT_declaration
07148 :DW_AT_high_pc
07149 :DW_AT_location
07150 :DW_AT_low_pc
07151 :DW_AT_segment
07152 :DW_AT_sibling
07153 :DW_AT_type
07154 :DW_AT_visibility
07155 .TE
07156 .DE
07157 .SK
07158 .OP
07159 .HU "Appendix 2 -- Organization of Debugging Information"
07160 The following diagram depicts the relationship of the abbreviation
07161 tables contained in the
07162 .Cf .debug_abbrev
07163 section to the information contained in the
07164 .Cf .debug_info
07165 section. Values are given in symbolic form, where possible.
07166 .DF
07167 .nf
07168 .PS
07169 scale=100
07170 define t201 |
07171 [ box invis ht 154 wid 295 with .sw at 0,0
07172 "\f(CW\s9\&1\f1\s0" at 0,147 ljust
07173 "\f(CW\s9\&DW_TAG_compile_unit\f1\s0" at 0,133 ljust
07174 "\f(CW\s9\&DW_CHILDREN_yes\f1\s0" at 0,119 ljust
07175 "\f(CW\s9\&DW_AT_name DW_FORM_string\f1\s0" at 0,105 ljust
07176 "\f(CW\s9\&DW_AT_producer DW_FORM_string\f1\s0" at 0,91 ljust
07177 "\f(CW\s9\&DW_AT_compdir DW_FORM_string\f1\s0" at 0,77 ljust
07178 "\f(CW\s9\&DW_AT_language DW_FORM_data1\f1\s0" at 0,63 ljust
07179 "\f(CW\s9\&DW_AT_low_poc DW_FORM_addr\f1\s0" at 0,49 ljust
07180 "\f(CW\s9\&DW_AT_high_pc DW_FORM_addr\f1\s0" at 0,35 ljust
07181 "\f(CW\s9\&DW_AT_stmt_list DW_FORM_indirect\f1\s0" at 0,21 ljust
07182 "\f(CW\s9\&0 0\f1\s0" at 0,7 ljust
07183 ] |
07184
07185 define t103 |
07186 [ box invis ht 42 wid 74 with .sw at 0,0
07187 "\f(CW\s9\&4\f1\s0" at 0,35 ljust
07188 "\f(CW\s9\&\"POINTER\"\f1\s0" at 0,21 ljust
07189 "\f(CW\s9\&\f1\s0" at 0,7 ljust
07190 ] |
07191
07192 define t177 |
07193 [ box invis ht 28 wid 13 with .sw at 0,0
07194 "\f(CW\s9\&3\f1\s0" at 0,21 ljust
07195 "\f(CW\s9\&\f1\s0" at 0,7 ljust
07196 ] |
07197
07198 define t224 |
07199 [ box invis ht 84 wid 280 with .sw at 0,0
07200 "\f(CW\s9\&4\f1\s0" at 0,77 ljust
07201 "\f(CW\s9\&DW_TAG_typedef\f1\s0" at 0,63 ljust
07202 "\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,49 ljust
07203 "\f(CW\s9\&DW_AT_name DW_FORM_string\f1\s0" at 0,35 ljust
07204 "\f(CW\s9\&DW_AT_type DW_FORM_ref4 \f1\s0" at 0,21 ljust
07205 "\f(CW\s9\&0 0 \f1\s0" at 0,7 ljust
07206 ] |
07207
07208 define t149 |
07209 [ box invis ht 28 wid 51 with .sw at 0,0
07210 "\f(CW\s9\&4\f1\s0" at 0,21 ljust
07211 "\f(CW\s9\&\"strp\"\f1\s0" at 0,7 ljust
07212 ] |
07213
07214 define t205 |
07215 [ box invis ht 98 wid 280 with .sw at 0,0
07216 "\f(CW\s9\&2\f1\s0" at 0,91 ljust
07217 "\f(CW\s9\&DW_TAG_base_type\f1\s0" at 0,77 ljust
07218 "\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,63 ljust
07219 "\f(CW\s9\&DW_AT_name DW_FORM_string\f1\s0" at 0,49 ljust
07220 "\f(CW\s9\&DW_AT_encoding DW_FORM_data1\f1\s0" at 0,35 ljust
07221 "\f(CW\s9\&DW_AT_byte_size DW_FORM_data1\f1\s0" at 0,21 ljust
07222 "\f(CW\s9\&0 0\f1\s0" at 0,7 ljust
07223 ] |
07224
07225 define t126 |
07226 [ box invis ht 126 wid 257 with .sw at 0,0
07227 "\f(CW\s9\&\"myfile.c\"\f1\s0" at 0,119 ljust
07228 "\f(CW\s9\&\"Best Compiler Corp: Version 1.3\"\f1\s0" at 0,105 ljust
07229 "\f(CW\s9\&\"mymachine:/home/mydir/src:\"\f1\s0" at 0,91 ljust
07230 "\f(CW\s9\&DW_LANG_C89\f1\s0" at 0,77 ljust
07231 "\f(CW\s9\&0x0\f1\s0" at 0,63 ljust
07232 "\f(CW\s9\&0x55\f1\s0" at 0,49 ljust
07233 "\f(CW\s9\&DW_FORM_data4\f1\s0" at 0,35 ljust
07234 "\f(CW\s9\&0x0\f1\s0" at 0,21 ljust
07235 "\f(CW\s9\&\f1\s0" at 0,7 ljust
07236 ] |
07237
07238 define t219 |
07239 [ box invis ht 70 wid 260 with .sw at 0,0
07240 "\f(CW\s9\&3\f1\s0" at 0,63 ljust
07241 "\f(CW\s9\&DW_TAG_pointer_type\f1\s0" at 0,49 ljust
07242 "\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,35 ljust
07243 "\f(CW\s9\&DW_AT_type DW_FORM_ref4\f1\s0" at 0,21 ljust
07244 "\f(CW\s9\&0 0\f1\s0" at 0,7 ljust
07245 ] |
07246
07247 define t109 |
07248 [ box invis ht 42 wid 165 with .sw at 0,0
07249 "\f(CW\s9\&\"char\"\f1\s0" at 0,35 ljust
07250 "\f(CW\s9\&DW_ATE_unsigned_char\f1\s0" at 0,21 ljust
07251 "\f(CW\s9\&1\f1\s0" at 0,7 ljust
07252 ] |
07253
07254 box invis ht 704 wid 680 with .sw at 0,0
07255 t201 with .nw at 376,657
07256 box ht 520 wid 320 with .nw at 360,672
07257 box ht 208 wid 280 with .nw at 24,208
07258 t103 with .nw at 40,353
07259 t177 with .nw at 40,398
07260 line from 360,176 to 680,176
07261 line from 360,280 to 680,280
07262 line from 360,368 to 680,368
07263 line from 360,488 to 680,488
07264 t224 with .nw at 376,270
07265 "\f(CW\s9\&0\f1\s0" at 376,164 ljust
07266 "\f(CW\s9\&0\f1\s0" at 40,289 ljust
07267 "\fI\s9\&e2\f1\s0" at 40,317 ljust
07268 "\fI\s9\&e2:\f1\s0" at 0,389 ljust
07269 "\f(CW\s9\&2\f1\s0" at 44,176 ljust
07270 line from 24,128 to 304,128
07271 "\f(CW\s9\&...\f1\s0" at 44,113 ljust
07272 t149 with .nw at 44,88
07273 "\fI\s9\&e2\f1\s0" at 44,49 ljust
07274 "\f(CW\s9\&...\f1\s0" at 44,17 ljust
07275 box ht 416 wid 280 with .nw at 24,688
07276 "\fI\s9\&length\f1\s0" at 44,192 ljust
07277 "\f(CW\s9\&4\f1\s0" at 48,140
07278 "\fI\s9\&a1 (abbreviation table offset)\f1\s0" at 44,160 ljust
07279 "\f(CW\s9\&4\f1\s0" at 44,624
07280 "\fI\s9\&a1 (abbreviation table offset)\f1\s0" at 40,640 ljust
07281 t205 with .nw at 376,477
07282 "\fI\s9\&a1:\f1\s0" at 348,657 rjust
07283 "\fI\s9\&length\f1\s0" at 40,672 ljust
07284 "\fR\s10\&Abbreviation Table - .debug_abbrev\f1\s0" at 384,678 ljust
07285 "\fR\s10\&Compilation Unit 1 - .debug_info\f1\s0" at 68,694 ljust
07286 "\fR\s10\&Compilation Unit 2 - .debug_info\f1\s0" at 64,218 ljust
07287 "\f(CW\s9\&2\f1\s0" at 44,656
07288 "\f(CW\s9\&1\f1\s0" at 44,605
07289 t126 with .nw at 36,599
07290 line from 24,616 to 304,616
07291 "\f(CW\s9\&2\f1\s0" at 40,461 ljust
07292 t219 with .nw at 376,359
07293 line from 24,96 to 304,96
07294 line from 24,32 to 304,32
07295 t109 with .nw at 40,449
07296 "\fI\s9\&e1\f1\s0" at 40,373 ljust
07297 "\fI\s9\&e1:\f1\s0" at 0,461 ljust
07298 line from 24,480 to 304,480
07299 line from 24,400 to 304,400
07300 line from 24,360 to 304,360
07301 line from 24,304 to 304,304
07302 .PE
07303 .fi
07304 .DE
07305 .SK
07306 .OP
07307 .HU "Appendix 3 -- Statement Program Examples"
07308 .P
07309 Consider this simple source file and the resulting machine code for
07310 the Intel 8086 processor:
07311 .DS
07312 .S -2
07313 .TS
07314 ;
07315 lf(CW) lf(CW) s
07316 lf(CW) lf(CW) s
07317 lf(CW) lf(CW) lf(CW)
07318 lf(CW) lf(CW) lf(CW)
07319 lf(CW) lf(CW) s
07320 lf(CW) lf(CW) s
07321 lf(CW) lf(CW) lf(CW)
07322 lf(CW) lf(CW) lf(CW)
07323 lf(CW) lf(CW) lf(CW)
07324 lf(CW) lf(CW) lf(CW)
07325 lf(CW) lf(CW) s
07326 lf(CW) lf(CW) lf(CW)
07327 lf(CW) lf(CW) lf(CW)
07328 lf(CW) lf(CW) lf(CW)
07329 lf(CW) lf(CW) lf(CW)
07330 lf(CW) lf(CW) s
07331 lf(CW) lf(CW) lf(CW)
07332 lf(CW) lf(CW) lf(CW)
07333 lf(CW) lf(CW) s
07334 lf(CW) lf(CW) lf(CW).
07335 1: int
07336 2: main()
07337 0x239: push pb
07338 0x23a: mov bp,sp
07339 3: {
07340 4: printf("Omit needless words\en");
07341 0x23c: mov ax,0xaa
07342 0x23f: push ax
07343 0x240: call _printf
07344 0x243: pop cx
07345 5: exit(0);
07346 0x244: xor ax,ax
07347 0x246: push ax
07348 0x247: call _exit
07349 0x24a: pop cx
07350 6: }
07351 0x24b: pop bp
07352 0x24c: ret
07353 7:
07354 0x24d:
07355 .TE
07356 .S +2
07357 .DE
07358 .P
07359 If the statement program prologue specifies the following:
07360 .DS
07361 .S -2
07362 .TS
07363 ;
07364 lf(CW) lf(CW).
07365 minimum_instruction_length 1
07366 opcode_base 10
07367 line_base 1
07368 line_range 15
07369 .TE
07370 .S +2
07371 .DE
07372 .P
07373 Then one encoding of the statement program would occupy 12 bytes
07374 (the opcode \f(CWSPECIAL(\fIm\fP, \fIn\fP)\fR indicates the special
07375 opcode generated for a line increment of \fIm\fP and an address increment
07376 of \fIn\fP):
07377 .DS
07378 .S -2
07379 .TS
07380 ;
07381 l l l
07382 lf(CW) lf(CW) lf(CW).
07383 Opcode Operand Byte Stream
07384 _
07385 DW_LNS_advance_pc LEB128(0x239) 0x2, 0xb9, 0x04
07386 SPECIAL(2, 0) 0xb
07387 SPECIAL(2, 3) 0x38
07388 SPECIAL(1, 8) 0x82
07389 SPECIAL(1, 7) 0x73
07390 DW_LNS_advance_pc LEB128(2) 0x2, 0x2
07391 DW_LNE_end_sequence 0x0, 0x1, 0x1
07392 .TE
07393 .S +2
07394 .DE
07395 .P
07396 An alternate encoding of the same program using standard opcodes to
07397 advance the program counter would occupy 22 bytes:
07398 .DS
07399 .S -2
07400 .TS
07401 ;
07402 l l l
07403 lf(CW) lf(CW) lf(CW).
07404 Opcode Operand Byte Stream
07405 _
07406 DW_LNS_fixed_advance_pc 0x239 0x9, 0x39, 0x2
07407 SPECIAL(2, 0) 0xb
07408 DW_LNS_fixed_advance_pc 0x3 0x9, 0x3, 0x0
07409 SPECIAL(2, 0) 0xb
07410 DW_LNS_fixed_advance_pc 0x8 0x9, 0x8, 0x0
07411 SPECIAL(1, 0) 0xa
07412 DW_LNS_fixed_advance_pc 0x7 0x9, 0x7, 0x0
07413 SPECIAL(1, 0) 0xa
07414 DW_LNS_fixed_advance_pc 0x2 0x9, 0x2, 0x0
07415 DW_LNE_end_sequence 0x0, 0x1, 0x1
07416 .TE
07417 .S +2
07418 .DE
07419 .SK
07420 .OP
07421 .HU "Appendix 4 -- Encoding and decoding variable length data"
07422 .ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i
07423 .P
07424 Here are algorithms expressed in a C-like pseudo-code to encode and decode
07425 signed and unsigned numbers in LEB128:
07426 .P
07427 \fBEncode an unsigned integer:\fP
07428 .br
07429 .DS
07430 .S -2
07431 \f(CWdo
07432 {
07433 byte = low order 7 bits of value;
07434 value >>= 7;
07435 if (value != 0) /* more bytes to come */
07436 set high order bit of byte;
07437 emit byte;
07438 } while (value != 0);\fP
07439 .S +2
07440 .DE
07441 .P
07442 \fBEncode a signed integer:\fP
07443 .br
07444 .DS
07445 .S -2
07446 \f(CWmore = 1;
07447 negative = (value < 0);
07448 size = no. of bits in signed integer;
07449 while(more)
07450 {
07451 byte = low order 7 bits of value;
07452 value >>= 7;
07453 /* the following is unnecessary if the implementation of >>=
07454 * uses an arithmetic rather than logical shift for a signed
07455 * left operand
07456 */
07457 if (negative)
07458 /* sign extend */
07459 value |= - (1 << (size - 7));
07460 /* sign bit of byte is 2nd high order bit (0x40) */
07461 if ((value == 0 && sign bit of byte is clear) ||
07462 (value == -1 && sign bit of byte is set))
07463 more = 0;
07464 else
07465 set high order bit of byte;
07466 emit byte;
07467 }\fP
07468 .S +2
07469 .DE
07470 .SK
07471 .ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i
07472 .P
07473 \fBDecode unsigned LEB128 number:\fP
07474 .br
07475 .DS
07476 .S -2
07477 \f(CWresult = 0;
07478 shift = 0;
07479 while(true)
07480 {
07481 byte = next byte in input;
07482 result |= (low order 7 bits of byte << shift);
07483 if (high order bit of byte == 0)
07484 break;
07485 shift += 7;
07486 }\fP
07487 .S +2
07488 .DE
07489 .P
07490 \fBDecode signed LEB128 number:\fP
07491 .br
07492 .DS
07493 .S -2
07494 \f(CWresult = 0;
07495 shift = 0;
07496 size = no. of bits in signed integer;
07497 while(true)
07498 {
07499 byte = next byte in input;
07500 result |= (low order 7 bits of byte << shift);
07501 shift += 7;
07502 /* sign bit of byte is 2nd high order bit (0x40) */
07503 if (high order bit of byte == 0)
07504 break;
07505 }
07506 if ((shift < size) && (sign bit of byte is set))
07507 /* sign extend */
07508 result |= - (1 << shift);\fP
07509 .S +2
07510 .DE
07511 .SK
07512 .OP
07513 .HU "Appendix 5 -- Call Frame Information Examples"
07514 The following example uses a hypothetical RISC machine in the style of
07515 the Motorola 88000.
07516 .BL
07517 .LI
07518 Memory is byte addressed.
07519 .LI
07520 Instructions are all 4-bytes each and word aligned.
07521 .LI
07522 Instruction operands are typically of the form:
07523 .br
07524 .DS
07525 <destination reg> <source reg> <constant>
07526 .DE
07527 .LI
07528 The address for the load and store instructions is computed by
07529 adding the contents of the source register with the constant.
07530 .LI
07531 There are 8 4-byte registers:
07532 .br
07533 .DS
07534 R0 always 0
07535 R1 holds return address on call
07536 R2-R3 temp registers (not preserved on call)
07537 R4-R6 preserved on call
07538 R7 stack pointer.
07539 .DE
07540 .LI
07541 The stack grows in the negative direction.
07542 .LE
07543 .P
07544 The following are two code fragments from a subroutine
07545 called \f(CWfoo\fP that
07546 uses a frame pointer (in addition to the stack pointer.) The first
07547 column values are byte addresses.
07548 .DS
07549 .S -2
07550 .TS
07551 ;
07552 lf(CW) lf(CW) s s
07553 lf(CW) lf(CW) lf(CW) lf(CW)
07554 lf(CW) lf(CW) lf(CW) lf(CW)
07555 lf(CW) lf(CW) lf(CW) lf(CW)
07556 lf(CW) lf(CW) lf(CW) lf(CW)
07557 lf(CW) lf(CW) lf(CW) lf(CW)
07558 lf(CW) lf(CW) s s
07559 lf(CW) lf(CW) s s
07560 lf(CW) lf(CW) s s
07561 lf(CW) lf(CW) lf(CW) lf(CW).
07562 ;; start prologue
07563 foo sub R7, R7, <fsize> ; Allocate frame
07564 foo+4 store R1, R7, (<fsize>-4) ; Save the return address
07565 foo+8 store R6, R7, (<fsize>-8) ; Save R6
07566 foo+12 add R6, R7, 0 ; R6 is now the Frame ptr
07567 foo+16 store R4, R6, (<fsize>-12) ; Save a preserve reg.
07568 ;; This subroutine does not change R5
07569 ...
07570 ;; Start epilogue (R7 has been returned to entry value)
07571 foo+64 load R4, R6, (<fsize>-12) ; Restore R4
07572 foo+68 load R6, R7, (<fsize>-8) ; Restore R6
07573 foo+72 load R1, R7, (<fsize>-4) ; Restore return address
07574 foo+76 add R7, R7, <fsize> ; Deallocate frame
07575 foo+80 jump R ; Return
07576 foo+84
07577 .TE
07578 .S +2
07579 .DE
07580 .SK
07581 The table for the \f(CWfoo\fP subroutine is as follows.
07582 It is followed by the
07583 corresponding fragments from the
07584 .Cf .debug_frame
07585 section.
07586 .DS
07587 .S -2
07588 .TS
07589 tab(|);
07590 lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW).
07591 Loc|CFA|R0|R1|R2|R3|R4|R5|R6|R7|R8
07592 foo|[R7]+0|s|u|u|u|s|s|s|s|r1
07593 foo+4|[R7]+fsize|s|u|u|u|s|s|s|s|r1
07594 foo+8|[R7]+fsize|s|u|u|u|s|s|s|s|c4
07595 foo+12|[R7]+fsize|s|u|u|u|s|s|c8|s|c4
07596 foo+16|[R6]+fsize|s|u|u|u|s|s|c8|s|c4
07597 foo+20|[R6]+fsize|s|u|u|u|c12|s|c8|s|c4
07598 ...
07599 foo+64|[R6]+fsize|s|u|u|u|c12|s|c8|s|c4
07600 foo+68|[R6]+fsize|s|u|u|u|s|s|c8|s|c4
07601 foo+72|[R7]+fsize|s|u|u|u|s|s|s|s|c4
07602 foo+76|[R7]+fsize|s|u|u|u|s|s|s|s|r1
07603 foo+80|[R7]+0|s|u|u|u|s|s|s|s|r1
07604 .TE
07605 .TS
07606 ;
07607 l s
07608 l l.
07609 notes:
07610 1. R8 is the return address
07611 2. s = same_value rule
07612 3. u = undefined rule
07613 4. rN = register(N) rule
07614 5. cN = offset(N) rule
07615 .sp
07616 .sp
07617 .TE
07618 .S +2
07619 .DE
07620 .P
07621 Common Information Entry (CIE):
07622 .DS
07623 .S -2
07624 .TS
07625 ;
07626 lf(CW) lf(CW) lf(CW).
07627 cie 32 ; length
07628 cie+4 0xffffffff ; CIE_id
07629 cie+8 1 ; version
07630 cie+9 0 ; augmentation
07631 cie+10 4 ; code_alignment_factor
07632 cie+11 4 ; data_alignment_factor
07633 cie+12 8 ; R8 is the return addr.
07634 cie+13 DW_CFA_def_cfa (7, 0) ; CFA = [R7]+0
07635 cie+16 DW_CFA_same_value (0) ; R0 not modified (=0)
07636 cie+18 DW_CFA_undefined (1) ; R1 scratch
07637 cie+20 DW_CFA_undefined (2) ; R2 scratch
07638 cie+22 DW_CFA_undefined (3) ; R3 scratch
07639 cie+24 DW_CFA_same_value (4) ; R4 preserve
07640 cie+26 DW_CFA_same_value (5) ; R5 preserve
07641 cie+28 DW_CFA_same_value (6) ; R6 preserve
07642 cie+30 DW_CFA_same_value (7) ; R7 preserve
07643 cie+32 DW_CFA_register (8, 1) ; R8 is in R1
07644 cie+35 DW_CFA_nop ; padding
07645 cie+36
07646 .TE
07647 .S +2
07648 .DE
07649 .SK
07650 .P
07651 Frame Description Entry (FDE):
07652 .DS
07653 .S -2
07654 .TS
07655 ;
07656 lf(CW) lf(CW) lf(CW).
07657 fde 40 ; length
07658 fde+4 cie ; CIE_ptr
07659 fde+8 foo ; initial_location
07660 fde+12 84 ; address_range
07661 fde+16 DW_CFA_advance_loc(1) ; instructions
07662 fde+17 DW_CFA_def_cfa_offset(<fsize>/4) ; assuming <fsize> < 512
07663 fde+19 DW_CFA_advance_loc(1)
07664 fde+20 DW_CFA_offset(8,1)
07665 fde+22 DW_CFA_advance_loc(1)
07666 fde+23 DW_CFA_offset(6,2)
07667 fde+25 DW_CFA_advance_loc(1)
07668 fde+26 DW_CFA_def_cfa_register(6)
07669 fde+28 DW_CFA_advance_loc(1)
07670 fde+29 DW_CFA_offset(4,3)
07671 fde+31 DW_CFA_advance_loc(11)
07672 fde+32 DW_CFA_restore(4)
07673 fde+33 DW_CFA_advance_loc(1)
07674 fde+34 DW_CFA_restore(6)
07675 fde+35 DW_CFA_def_cfa_register(7)
07676 fde+37 DW_CFA_advance_loc(1)
07677 fde+38 DW_CFA_restore(8)
07678 fde+39 DW_CFA_advance_loc(1)
07679 fde+40 DW_CFA_def_cfa_offset(0)
07680 fde+42 DW_CFA_nop ; padding
07681 fde+43 DW_CFA_nop ; padding
07682 fde+44
07683 .TE
07684 .S +2
07685 .DE
07686 .S +1
07687
07688 '\"
07689 '\" Table of Contents stuff
07690 '\"
07691 .de TP
07692 .sp 4
07693 ..
07694 .VM
07695 .de TY
07696 .ce 1
07697 Table of Contents
07698 .sp
07699 ..
07700 .nr Lf 1
07701 .ds Lf List of Figures
07702 .SK
07703 .TC 1 1 7 0