'\"#ident "%W%"'\" $Source: /plroot/cmplrs.src/v7.4.5m/.RCS/PL/libdwarf/RCS/dwarf.v2.mm,v $'\"'\" $Revision: 1.2 $'\"'\" DESCRIPTION'\"'\" Requirements for '\"'\" COMPILATION'\"'\" pic file.mm | tbl | troff -mm'\"'\" local mileage may vary'\"'\" AUTHOR'\"'\" UNIX International Programming Languages SIG'\"'\" COPYRIGHT'\"'\" Copyright (c) 1992,1993, UNIX International'\"'\" Permission to use, copy, modify, and distribute this documentation for'\" any purpose and without fee is hereby granted, provided that the above'\" copyright notice appears in all copies and that both that copyright'\" notice and this permission notice appear in supporting documentation,'\" and that the name UNIX International not be used in advertising or'\" publicity pertaining to distribution of the software without specific,'\" written prior permission. UNIX International makes no representations'\" about the suitability of this documentation for any purpose. It is'\" provided "as is" without express or implied warranty.'\" '\" UNIX INTERNATIONAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS'\" DOCUMENTATION, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND'\" FITNESS. IN NO EVENT SHALL UNIX INTERNATIONAL BE LIABLE FOR ANY'\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER'\" RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF'\" CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN'\" CONNECTION WITH THE USE OR PERFORMANCE OF THIS DOCUMENTATION.'\" '\" NOTICE:'\" '\" UNIX International is making this documentation available as a'\" reference point for the industry. While UNIX International believes'\" that this specification is well defined in this first release of the'\" document, minor changes may be made prior to products meeting this'\" specification being made available from UNIX System Laboratories or '\" UNIX International members.'\"'\" $Log$'\" Revision 1.1 1994/05/18 18:50:42 davea'\" Initial revision'\"'\"'\" Abbrevs for funny typeset words.pl-0.25i.ds aX U\s-2NIX\s+2.ds iX \*(aX International.ds uL \s-2AT&T\ USL\s+2'\"'\" uI should be set to 1 if the publication and copyright page is needed..nr uI 1'\"'\" Make the appropriate replacements in this section!'\"'\" Set the ND date to the current date.'\" tT is the formal document title'\" tP is the name of the Project (if appropriate)'\" tD is the short document title'\" tE is the work group name (may be the same as the project name).ds tT DWARF Debugging Information Format .ds tP '\" Document name (i.e., without project name).ds tD DWARF Debugging Information Format.ds tE Programming Languages SIG'\"'\" Define headers and footers macro'\".ds fA Revision: 2.0.0'\"'\" fB null to remove page numbers on cover page.ds fB.ds fC July 27, 1993.ds fE Industry Review Draft.ds fF \*(tD.PH "''''".PF "''\*(fE''".tr ~.SA 1.S 10.nr Ej 1.nr Hs 5.nr Hu 1.nr Hb 5.ds HP +2 +2 +1 +0 +0 +0 +0.ds HF 3 3 3 3 3 1 1.if n .ds HF 1 1 1 1 1 1 1 1'\"'\" First page, print title and authors'\".S +4.DS C\fB\*(tT\s-2\*(tP\s+2\fP.DE.S.sp 3i\*(iX.br\*(tE.br\*(fA (\*(fC).SK.if \n(uI\{ .DS C.in -.25i.B "Published by:".R\*(iXWaterview Corporate Center20 Waterview BoulevardParsippany, NJ 07054for further information, contact:Vice President of MarketingPhone: +1 201-263-8400Fax: +1 201-263-8401.DE.PCopyright \(co 1992, 1993 \*(iX, Inc..PPermission to use, copy, modify, and distribute thisdocumentation for any purpose and without fee is hereby granted, providedthat the above copyright notice appears in all copies and that both thatcopyright notice and this permission notice appear in supportingdocumentation, and that the name \*(iX not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. \*(iX makesno representations about the suitability of this documentation for any purpose. It is provided "as is" without express or implied warranty..PUNIX INTERNATIONAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS DOCUMENTATION, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL UNIX INTERNATIONAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS DOCUMENTATION..sp 2l.if \n(uI\{NOTICE:.P\*(iX is making this documentation available as areference point for the industry. While \*(iX believes that this specification is welldefined in this first release of the document,minor changes may be made prior to products meeting this specificationbeing made available from \*(aX System Laboratories or \*(iX members..sp 1l \}Trademarks:.PIntel386 is a trademark of Intel Corporation..br\*(aX\(rg is a registered trademark of \*(aX System Laboratories in the United States and other countries..br.OH "'''\s10\\\\*(tE\s0'".EH "'\s10\\\\*(tD\s0'''".SK'\".VM 0 2.PF "''\s10\\\\*(fE\s0''".OF "'\s10\\\\*(fA'\\\\*(fB'\\\\*(fC\s0'".EF "'\s10\\\\*(fA'\\\\*(fB'\\\\*(fC\s0'"'\" -----------------------------------------------------------------------'\".'\" Reset page numbers'\".nr P 1.nr % 1'\"'\" Define headers and footers'\".FH'\" Turn on the page numbering in the footers.ds fB Page %'\"'\" MACROEND'\".if n .fp 2 R.if n .fp 3 R.tr ~ \fR.S 11.SA 1.tr ~.OP.ds | |.ds ~ ~.ds ' '.if t .ds Cw \&\f(CW.if n .ds Cw \fB.de Cf \" Place every other arg in Cw font, beginning with first.if \\n(.$=1 \&\*(Cw\\$1\fP.if \\n(.$=2 \&\*(Cw\\$1\fP\\$2.if \\n(.$=3 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP.if \\n(.$=4 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4.if \\n(.$=5 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP.if \\n(.$=6 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6.if \\n(.$=7 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP.if \\n(.$=8 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8.if \\n(.$=9 \&\*(Cw\\$1\fP\\$2\*(Cw\\$3\fP\\$4\*(Cw\\$5\fP\\$6\*(Cw\\$7\fP\\$8\*(Cw..'\" macros used by index generating tool.deIX.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 \\n%.el \\!.ix \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9...deix.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 \\n%.el \\!.ix \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9...ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i.HU "FOREWORD"This document specifies the second generation of symbolic debugginginformation based on the DWARF format that has been developed by the \*(iXProgramming Languages Special Interest Group (SIG).It is being circulated for industry review. The first version of the DWARF specification was publishedby \*(iX in January, 1992. The current version adds significantnew functionality, but its main thrust is to achieve a muchdenser encoding of the DWARF information. Because of the newencoding, DWARF Version 2 is not binary compatible withDWARF Version 1..P At this point, the SIG believes that this document sufficientlysupports the debugging needs of C, C++, FORTRAN 77, Fortran90, Modula2 and Pascal, and we havereleased it for public comment. We will accept comments on thisdocument until September 30, 1994. Comments may be directed via emailto the SIG mailing list (plsig@ui.org). If you are unableto send email, paper mail, FAX, or machine readable copy on \*(aX, MS-DOS, or Macintosh compatible media can be sent to \*(iX at the address listed below, and will be forwarded to the SIG..SP.SP.SP.in +20UNIX International.brWaterview Corporate Center.br20 Waterview Boulevard.brParsippany, NJ 07054.brPhone: +1 201-263-8400.brFax: +1 201-263-8401.br.in -20.nr H1 0.OP.H 1 "INTRODUCTION"\fRThis document defines the format for the information generated bycompilers, assemblers and linkage editors that is necessary for symbolic,source-level debugging. The debugging information format does not favor thedesign of any compiler or debugger. Instead, the goal is to create a method ofcommunicating an accurate picture of the source program to any debugger in aform that is economically extensible to different languages while retainingbackward compatibility..PThe design of the debugging information format is open-ended, allowing for theaddition of new debugging information to accommodate new languages ordebugger capabilities while remaining compatible with other languages ordifferent debuggers..H 2 "Purpose and Scope"The debugging information format described in this document is designed tomeet the symbolic, source-level debugging needs of different languages in a unified fashion byrequiring language independent debugging information whenever possible..IX C++ %caa.IX virtual functions.IX FortranIndividual needs, such as C++ virtual functions or Fortran common blocks areaccommodated by creating attributes that are used only for thoselanguages. The \*(iX \*(tE believes that this document sufficiently covers the .IX languagesdebugging information needs of C, C++, FORTRAN77, Fortran90, Modula2 and Pascal..IX C %c.IX Modula2.IX Pascal.IX FORTRAN77.IX Fortran90.PThis document describes DWARF Version 2, the second generation of debugging.IX Version 2information based on the DWARF format. While DWARF Version 2 providesnew debugging information not available in Version 1, the primary focusof the changes for Version 2 is the representation of the information,rather than the information content itself. The basic structure of the Version 2 format remains as in Version 1: the debugging informationis represented as a series of debugging information entries, each containingone or more attributes (name/value pairs). .IX debugging information entries.IX attributesThe Version 2 representation, however,is much more compact than the Version 1 representation..IX Version 1In some cases, this greater density has been achieved at the expenseof additional complexity or greater difficulty in producing and processingthe DWARF information. We believe that the reduction in I/O and inmemory paging should more than make up for any increase in processing time..PBecause the representation of information has changed from Version 1 toVersion 2, Version 2 DWARF information is not binary compatible.IX compatibilitywith Version 1 information. To make it easier for consumers tosupport both Version 1 and Version 2 DWARF information, the Version2 information has been moved to a different object file section,.Cf .debug_info ..IX \f(CW.debug_info\fP %debugai.PThe intended audience for this document are the developers of both producers and consumers of debugging information, typicallylanguage compilers, debuggers and other tools that need to interpreta binary program in terms of its original source..H 2 "Overview"There are two major pieces to the description of the DWARF format inthis document. The first piece is the informational contentof the debugging entries. The second pieceis the way the debugging information is encoded and represented in an object file..PThe informational content is described in sections twothrough six.Section two describes the overall structure ofthe information and attributes that are common to many or all ofthe different debugging information entries. Sections three, four and five describe the specific debugginginformation entries and how they communicate thenecessary information about the source program to a debugger.Section six describes debugging information containedoutside of the debugging information entries, themselves.The encoding of the DWARF information ispresented in section seven..PSection eight describes some future directions for the DWARFspecification..PIn the following sections, text in normal font describes required aspectsof the DWARF format. Text in \fIitalics\fP is explanatory or supplementary material, and not part of the format definition itself..H 2 "Vendor Extensibility".IX vendor extensionsThis document does not attempt to cover all interesting languages or evento cover all of the interesting debugging information needs for its primarytarget languages (C, C++, FORTRAN77, Fortran90, Modula2, Pascal). Therefore the document providesvendors a way to define their own debugging information tags, attributes,base type encodings, location operations, language names,calling conventions and call frame instructionsby reserving a portion of the name space and valid values for these constructs for vendor specific additions. Future versionsof this document will not use names or values reserved for vendor specificadditions. All names and values not reserved for vendor additions, however,are reserved for future versions of this document. See section 7 fordetails..H 2 "Changes from Version 1"The following is a list of the major changes made to the DWARF DebuggingInformation Format since Version 1 of the format was published (January.IX Version 120, 1992). The list is not meant to be exhaustive..BL.LIDebugging information entries have been moved from the .Cf .debug.IX \f(CW.debug\fP %debugaaato the .Cf .debug_info.IX \f(CW.debug_info\fP %debugaisection of an object file..LI.IX tags.IX attributes, names.IX attributes, formsThe tag, attribute names and attribute forms encodings have been movedout of the debugging information itself to a separate abbreviations table..IX abbreviations table.LIExplicit sibling pointers have been made optional. Each.IX debugging information entries, siblingsentry now specifies (through the abbreviations table) whetheror not it has children..IX debugging information entries, child entries.LINew more compact attribute forms have been added, including a variablelength constant data form. Attribute values may now have any .IX variable length data.IX attributes, forms.IX attributes, valuesform within a given class of forms..LILocation descriptions have been replaced by a new, more compactand more expressive format..IX locations, descriptionsThere is now a way of expressing multiple locations for an objectwhose location changes during its lifetime..IX locations, lists.LIThere is a new format for line number informationthat provides informationfor code contributed to a compilation unit from an included file.Line number information is now in the .IX line number information.Cf .debug_line.IX \f(CW.debug_line\fP %debugalisection of an object file..LIThe representation of the type of a declaration has beenreworked..IX declarations, types of.LIA new section provides an encoding for pre-processor macro information..IX macro information.IX pre-processor.LIDebugging information entries now provide for the representationof non-defining declarations of objects, functions or types..IX declarations, non-defining.LIMore complete support for Modula2 and Pascal has been added..LIThere is now a way of describing locations for segmented address spaces..IX segmented address space.IX address space, segmented.LIA new section provides an encoding for information about callframe activations..IX call frame information.IX activations.LIThe representation of enumeration and array types has been.IX enumerations.IX arraysreworked so that DWARF presents only a single way ofrepresenting lists of items..LISupport has been added for C++ templates and exceptions..IX C++ %caa.IX templates.IX exceptions.LE.OP.H 1 "GENERAL DESCRIPTION".H 2 "The Debugging Information Entry"DWARF uses a series of debugging information entries to define a.IX debugging information entrieslow-level representation of a source program. Each debugginginformation entry is described by an identifying tag andcontains a series of attributes. The tag specifies the class to which an entrybelongs, and the attributes define the specific characteristicsof the entry..P.nr aX \n(Fg+1The set of required tag names is listed in Figure \n(aX..IX tagsThe debugging information entries they identify are described in sections three, four and five..PThe debugging information entries in DWARF Version 2 are intendedto exist in the .Cf .debug_infosection of an object file..IX \f(CW.debug_info\fP %debugai.DF.TScenter box;lf(CW) lf(CW). DW_TAG_access_declaration DW_TAG_array_typeDW_TAG_base_type DW_TAG_catch_blockDW_TAG_class_type DW_TAG_common_blockDW_TAG_common_inclusion DW_TAG_compile_unitDW_TAG_const_type DW_TAG_constantDW_TAG_entry_point DW_TAG_enumeration_typeDW_TAG_enumerator DW_TAG_file_typeDW_TAG_formal_parameter DW_TAG_friendDW_TAG_imported_declaration DW_TAG_inheritanceDW_TAG_inlined_subroutine DW_TAG_labelDW_TAG_lexical_block DW_TAG_memberDW_TAG_module DW_TAG_namelistDW_TAG_namelist_item DW_TAG_packed_typeDW_TAG_pointer_type DW_TAG_ptr_to_member_typeDW_TAG_reference_type DW_TAG_set_typeDW_TAG_string_type DW_TAG_structure_typeDW_TAG_subprogram DW_TAG_subrange_typeDW_TAG_subroutine_type DW_TAG_template_type_paramDW_TAG_template_value_param DW_TAG_thrown_typeDW_TAG_try_block DW_TAG_typedefDW_TAG_union_type DW_TAG_unspecified_parametersDW_TAG_variable DW_TAG_variantDW_TAG_variant_part DW_TAG_volatile_typeDW_TAG_with_stmt.TE.FG "Tag names".DE.H 2 "Attribute Types"Each attribute value is characterized by an attribute name..IX attributes.IX attributes, namesThe set of attribute names is .nr aX \n(Fg+1listed in Figure \n(aX..DF.TScenter box;lf(CW) lf(CW). DW_AT_abstract_origin DW_AT_accessibilityDW_AT_address_class DW_AT_artificialDW_AT_base_types DW_AT_bit_offsetDW_AT_bit_size DW_AT_byte_sizeDW_AT_calling_convention DW_AT_common_referenceDW_AT_comp_dir DW_AT_const_valueDW_AT_containing_type DW_AT_countDW_AT_data_member_location DW_AT_decl_columnDW_AT_decl_file DW_AT_decl_lineDW_AT_declaration DW_AT_default_valueDW_AT_discr DW_AT_discr_listDW_AT_discr_value DW_AT_encodingDW_AT_external DW_AT_frame_baseDW_AT_friend DW_AT_high_pcDW_AT_identifier_case DW_AT_importDW_AT_inline DW_AT_is_optionalDW_AT_language DW_AT_locationDW_AT_low_pc DW_AT_lower_boundDW_AT_macro_info DW_AT_nameDW_AT_namelist_item DW_AT_orderingDW_AT_priority DW_AT_producerDW_AT_prototyped DW_AT_return_addrDW_AT_segment DW_AT_siblingDW_AT_specification DW_AT_start_scopeDW_AT_static_link DW_AT_stmt_listDW_AT_stride_size DW_AT_string_lengthDW_AT_type DW_AT_upper_boundDW_AT_use_location DW_AT_variable_parameterDW_AT_virtuality DW_AT_visibilityDW_AT_vtable_elem_location.TE .FG "Attribute names".DE.PThe permissible values for an attribute belong to one or more classes.IX attributes, values.IX attributes, formsof attribute value forms. Each form class may be represented in one or moreways. For instance, some attribute values consist of a single pieceof constant data. ``Constant data'' is the class of attribute valuethat those attributes may have. There are several representationsof constant data, however (one, two, four, eight bytes and variablelength data). The particular representation for any given instanceof an attribute is encoded along with the attribute name as partof the information that guides the interpretation of a debugginginformation entry. Attribute value forms may belongto one of the following classes..VL 18.LI address.IX attributes, addressesRefers to some location in the address space of the described program..LI block.IX attributes, blocksAn arbitrary number of uninterpreted bytes of data..LI constant.IX attributes, constantsOne, two, four or eight bytes of uninterpreted data, or data encodedin the variable length format known as LEB128 (see section 7.6)..IX variable length data.IX LEB128.LI flag.IX attributes, flagsA small constant that indicates the presence or absence of an attribute..LI reference.IX attributes, referencesRefers to some member of the set of debugging information entries that describethe program. There are two types of reference. The first is anoffset relative to the beginning of the compilation unit inwhich the reference occurs and must refer to an entry withinthat same compilation unit. The second type of referenceis the address of any debugging information entry withinthe same executable or shared object; it may refer to an entryin a different compilation unit from the unit containing thereference..LI string.IX attributes, stringsA null-terminated sequence of zero or more (non-null) bytes.Data in this form are generally printable strings. Stringsmay be represented directly in the debugging information entryor as an offset in a separate string table..LE.PThere are no limitations on the ordering of attributes within a debugging.IX attributes, orderinginformation entry, but to prevent ambiguity,no more than one attribute with a given name may appear in any debugginginformation entry..H 2 "Relationship of Debugging Information Entries".IA variety of needs can be met by permitting a single debugginginformation entry to ``own'' an arbitrary number of other debuggingentries and by permitting the same debugging information entry to beone of many owned by another debugging information entry.This makes it possible to describe, for example,the static block structure withina source file, show the members of a structure, union, or class, and associatedeclarations with source files or source files with shared objects..P.RThe ownership relationof debugging information entries is achieved naturally.IX debugging information entriesbecause the debugging information is represented as a tree.The nodes of the tree are the debugging information entriesthemselves. The child entries of any node are exactly those.IX debugging information entries, child entriesdebugging information entries owned by that node.\*F.FSWhile the ownership relation of the debugging informationentries is represented as a tree, other relations amongthe entries exist, for example, a pointer from an entryrepresenting a variable to another entry representingthe type of that variable. If all such relations aretaken into account, the debugging entries form a graph,not a tree..FE.PThe tree itself is represented by flattening it in prefixorder. Each debugging information entryis defined either to have child entries or not to have child entries(see section 7.5.3).If an entry is defined not to have children, the next physicallysucceeding entry is the sibling of the prior entry. If an entry.IX debugging information entries, siblingsis defined to have children, the next physically succeeding entryis the first child of the prior entry. Additional children of the parententry are represented as siblings of the first child. A chainof sibling entries is terminated by a null entry..IX debugging information entries, null entries.PIn cases where a producer of debugging informationfeels that it will be important for consumers of that informationto quickly scan chains of sibling entries, ignoring the childrenof individual siblings, that producer may attach an.Cf AT_siblingattribute to any debugging information entry. The value ofthis attribute is a reference to the sibling entry of theentry to which the attribute is attached..H 2 "Location Descriptions".IThe debugging information must provide consumers a way to find the locationof program variables, determine the bounds of dynamic arrays and stringsand possibly to find the base address of a subroutine's stack frame orthe return address of a subroutine. Furthermore, to meet the needsof recent computer architectures and optimization techniques, the debugginginformation must be able to describe the location of an objectwhose location changes over the object's lifetime..P.RInformation about the location of program objects is provided bylocation descriptions. Location.IX locations, descriptionsdescriptions can be either of two forms: .AL.LI\fILocation expressions\fP which are a language independent representation of addressing rules.IX locations, expressionsof arbitrary complexity built from a few basicbuilding blocks, or \fIoperations\fP. They are sufficient for describingthe location of any object as long as its lifetime is either staticor the same as the lexical block that owns it, and it does not move throughout its lifetime. .LI\fILocation lists\fP which are used to describe objects that .IX locations, listshave a limited lifetime or change their location throughout theirlifetime. Location lists are more completely described below..LE.PThe two forms are distinguished in a context sensitive manner. As the valueof an attribute, a location expression is encoded as a block and a location list is encoded as a constant offset intoa location list table..P.INote: The Version 1 concept of "location descriptions" was replaced in Version 2 with this new abstraction because it is denser and more descriptive. .IX Version 1.IX Version 2.R.H 3 "Location Expressions"A location expression consists of zero or more location operations..IX locations, expressionsAn expression with zero operations is used to denote an object that ispresent in the source code but not present in the object code(perhaps because of optimization). .IX optimized codeThe location operations fall into two categories, register names andaddressing operations. Register names always appear alone and indicatethat the referred object is contained inside a particular register. Addressing operations are memory address computation rules. All location operations are encoded as a stream of opcodes thatare each followed by zero or more literal operands. The number of operandsis determined by the opcode..H 3 "Register Name Operators".IX locations, register name operatorsThe following operations can be used to name a register..P.INote that the register number represents a DWARF specific mapping of numbers ontothe actual registers of a given architecture.The mapping should be chosen to gain optimal density and should be shared by all users of a given architecture. The \*(tE recommendsthat this mapping be defined by the ABI\*F.IX ABI.FS\fISystem V Application Binary Interface\fP, consisting of the genericinterface and processor supplements for each target architecture..FEauthoring committee for eacharchitecture..R.AL.LI.Cf DW_OP_reg0 , " DW_OP_reg1" ", ..., " DW_OP_reg31.brThe\f(CWDW_OP_reg\fP\fIn\fPoperations encode the names of up to 32 registers, numbered from0 through 31, inclusive. The object addressed is in register \fIn\fP..LI.Cf DW_OP_regx.brThe.Cf DW_OP_regxoperation has a single unsigned LEB128 literal operand that encodes the name of a register..LE.H 3 "Addressing Operations".IX locations, stackEach addressing operation represents a postfix operation on a simple stack machine. Each element of the stack is the size of anaddress on the target machine.The value on the top of the stack after``executing'' the location expression is taken to be the result (the addressof the object, or the value of the array bound, or the length of adynamic string). In the case of locations used for structure members, .IX members, locationsthe computation assumes that the base address of the containing structurehas been pushed on the stack before evaluation of the addressing operation..R.H 4 "Literal Encodings".IX locations, literal encodingsThe following operations all push a value onto the addressing stack..AL.LI.Cf DW_OP_lit0 , " DW_OP_lit1" ", ..., " DW_OP_lit31.brThe\f(CWDW_OP_lit\fP\fIn\fP operations encode the unsigned literal values from 0 through 31, inclusive..LI.Cf DW_OP_addr.brThe.Cf DW_OP_addroperation has a single operand that encodes amachine address and whose size is the size of an address on thetarget machine..LI.Cf DW_OP_const1u.brThe single operand of the.Cf DW_OP_const1uoperation provides a 1-byte unsigned integer constant..LI.Cf DW_OP_const1s.brThe single operand of the.Cf DW_OP_const1soperation provides a1-byte signed integer constant..LI.Cf DW_OP_const2u.brThe single operand of the.Cf DW_OP_const2uoperation provides a2-byte unsigned integer constant..LI.Cf DW_OP_const2s.brThe single operand of the.Cf DW_OP_const2soperation provides a2-byte signed integer constant..LI.Cf DW_OP_const4u.brThe single operand of the.Cf DW_OP_const4uoperation provides a4-byte unsigned integer constant..LI.Cf DW_OP_const4s.brThe single operand of the.Cf DW_OP_const4soperation provides a4-byte signed integer constant..LI.Cf DW_OP_const8u.brThe single operand of the.Cf DW_OP_const8uoperation provides an8-byte unsigned integer constant..LI.Cf DW_OP_const8s.brThe single operand of the.Cf DW_OP_const8soperation provides an8-byte signed integer constant..LI.Cf DW_OP_constu.brThe single operand of the.Cf DW_OP_constuoperation provides anunsigned LEB128 integer constant..LI.Cf DW_OP_consts.brThe single operand of the.Cf DW_OP_constsoperation provides asigned LEB128 integer constant..LE.H 4 "Register Based Addressing".IX locations, register based addressingThe following operations push a value onto the stack that is the result of adding the contents of a register with a given signed offset. .AL.LI.Cf DW_OP_fbreg.brThe\f(CWDW_OP_fbreg\fPoperation provides a signed LEB128 offset from the address specified by the location descriptor in the .Cf DW_AT_frame_base attribute of the current .IX subroutines, frame basefunction. \fI(This is typically a "stack pointer" register plus or minus someoffset. On more sophisticated systems it might be a location list thatadjusts the offset according to changes in the stack pointer asthe PC changes.)\fP.LI.Cf DW_OP_breg0 , " DW_OP_breg1" ", ..., " DW_OP_breg31.brThe single operand of the\f(CWDW_OP_breg\fP\fIn\fPoperations provides a signed LEB128 offset from the specified register..LI.Cf DW_OP_bregx.brThe.Cf DW_OP_bregxoperation has two operands: a signed LEB128 offset from the specified registerwhich is defined with an unsigned LEB128 number..LE.H 4 "Stack Operations".IX locations, stackThe following operations manipulate the ``location stack.''Location operations that index the location stack assume thatthe top of the stack (most recently added entry) has index 0..AL.LI.Cf DW_OP_dup.brThe.Cf DW_OP_dup operation duplicates the value at the top of the location stack..LI.Cf DW_OP_drop.brThe.Cf DW_OP_drop operation pops the value at the top of the stack..LI.Cf DW_OP_pick.brThe single operand of the.Cf DW_OP_pickoperation provides a 1-byte index. The stack entry with the specified index(0 through 255, inclusive) is pushed on the stack..LI.Cf DW_OP_over.brThe.Cf DW_OP_overoperation duplicates the entry currently second in the stackat the top of the stack. This is equivalent to an.Cf DW_OP_pickoperation, with index 1..LI.Cf DW_OP_swap.brThe.Cf DW_OP_swapoperation swaps the top two stack entries. The entry atthe top of the stack becomes the second stack entry, andthe second entry becomes the top of the stack..LI.Cf DW_OP_rot.brThe.Cf DW_OP_rotoperation rotates the first three stack entries. The entry atthe top of the stack becomes the third stack entry, the second entrybecomes the top of the stack, and the third entry becomes the secondentry..LI.Cf DW_OP_deref.brThe.Cf DW_OP_derefoperation pops the top stack entry and treats it as an address.The value retrieved from that address is pushed. The size of thedata retrieved from the dereferenced address is the size of an addresson the target machine..LI.Cf DW_OP_deref_size.brThe.Cf DW_OP_deref_sizeoperation behaves like the .Cf DW_OP_derefoperation: it pops the top stack entry and treats it as an address.The value retrieved from that address is pushed. In the .Cf DW_OP_deref_sizeoperation, however,the size in bytes of thedata retrieved from the dereferenced address is specified by thesingle operand. This operand is a 1-byte unsigned integral constantwhose value may not be larger than the size of an address onthe target machine. The data retrieved is zero extended to the sizeof an address on the target machine before being pushed onthe expression stack..LI.Cf DW_OP_xderef.brThe.Cf DW_OP_xderef.IX address space, multipleoperation provides an extended dereference mechanism. The entry at thetop of the stack is treated as an address. The second stack entryis treated as an ``address space identifier'' for those architecturesthat support multiple address spaces. The top two stack elementsare popped, a data item is retrieved through an implementation-definedaddress calculation and pushed as the new stack top. The size of thedata retrieved from the dereferenced address is the size of an addresson the target machine..LI.Cf DW_OP_xderef_size.brThe.Cf DW_OP_xderef_sizeoperation behaves like the .Cf DW_OP_xderefoperation: the entry at thetop of the stack is treated as an address. The second stack entryis treated as an ``address space identifier'' for those architecturesthat support multiple address spaces. The top two stack elementsare popped, a data item is retrieved through an implementation-definedaddress calculation and pushed as the new stack top. In the .Cf DW_OP_xderef_sizeoperation, however,the size in bytes of thedata retrieved from the dereferenced address is specified by thesingle operand. This operand is a 1-byte unsigned integral constantwhose value may not be larger than the size of an address onthe target machine. The data retrieved is zero extended to the sizeof an address on the target machine before being pushed onthe expression stack..LE.H 4 "Arithmetic and Logical Operations".IX locations, arithmetic operations.IX locations, logical operationsThe following provide arithmetic and logical operations.The arithmetic operations perform ``addressing arithmetic,''that is, unsigned arithmetic that wraps on an address-sized boundary. The operations do not cause an exception on overflow..AL.LI.Cf DW_OP_abs.brThe.Cf DW_OP_absoperation pops the top stack entry and pushes its absolute value..LI.Cf DW_OP_and.brThe.Cf DW_OP_andoperation pops the top two stack values, performs a bitwise \fIand\fP operation on the two, and pushes the result..LI.Cf DW_OP_div.brThe.Cf DW_OP_divoperation pops the top two stack values, divides the former second entryby the former top of the stack using signed division, and pushes the result..LI.Cf DW_OP_minus.brThe.Cf DW_OP_minusoperation pops the top two stack values, subtracts the former top of the stackfrom the former second entry, and pushes the result..LI.Cf DW_OP_mod.brThe.Cf DW_OP_modoperation pops the top two stack values and pushes the result of the calculation: former second stack entry modulo the former top of thestack..LI.Cf DW_OP_mul.brThe.Cf DW_OP_muloperation pops the top two stack entries, multiplies them together,and pushes the result..LI.Cf DW_OP_neg.brThe.Cf DW_OP_negoperation pops the top stack entry, and pushes its negation..LI.Cf DW_OP_not.brThe.Cf DW_OP_notoperation pops the top stack entry, and pushes its bitwise complement..LI.Cf DW_OP_or.brThe.Cf DW_OP_oroperation pops the top two stack entries, performs a bitwise \fIor\fP operation on the two, and pushes the result..LI.Cf DW_OP_plus.brThe.Cf DW_OP_plusoperation pops the top two stack entries, adds them together,and pushes the result..LI.Cf DW_OP_plus_uconst.brThe.Cf DW_OP_plus_uconstoperation pops the top stack entry, adds it to the unsigned LEB128constant operand and pushes the result..IThis operation is supplied specifically to be able to encode more fieldoffsets in two bytes than can be done with "\f(CWDW_OP_lit\fP\fIn\fP\f(CW DW_OP_add\fP"..R.LI.Cf DW_OP_shl.brThe.Cf DW_OP_shloperation pops the top two stack entries, shifts the former secondentry left by the number of bits specified by the former top ofthe stack, and pushes the result..LI.Cf DW_OP_shr.brThe.Cf DW_OP_shroperation pops the top two stack entries, shifts the former secondentry right (logically) by the number of bits specified by the former top ofthe stack, and pushes the result..LI.Cf DW_OP_shra.brThe.Cf DW_OP_shraoperation pops the top two stack entries, shifts the former secondentry right (arithmetically) by the number of bits specified by the former top ofthe stack, and pushes the result..LI.Cf DW_OP_xor.brThe.Cf DW_OP_xoroperation pops the top two stack entries, performs the logical \fIexclusive-or\fP operation on the two, and pushes the result..LE.H 4 "Control Flow Operations".IX locations, control flow operationsThe following operations provide simple control of the flow of a locationexpression..AL.LI Relational operators.brThe six relational operators each pops the top two stack values,compares the former top of the stack with the former second entry,and pushes the constant value 1 onto the stack if the result of theoperation is true or the constant value 0 if the result of the operationis false. The comparisons are done as signed operations. The sixoperators are .Cf DW_OP_le(less than or equal to),.Cf DW_OP_ge(greater than or equal to),.Cf DW_OP_eq(equal to),.Cf DW_OP_lt(less than),.Cf DW_OP_gt(greater than) and.Cf DW_OP_ne(not equal to)..LI.Cf DW_OP_skip.br.Cf DW_OP_skipis an unconditional branch. Itssingle operand is a 2-byte signed integer constant.The 2-byte constant is the number of bytes of the locationexpression to skip from the current operation, beginning after the2-byte constant..LI.Cf DW_OP_bra.br.Cf DW_OP_brais a conditional branch. Itssingle operand is a 2-byte signed integer constant.This operation pops the top of stack. If the valuepopped is not the constant 0, the 2-byte constant operand is the numberof bytes of the location expression to skip from the current operation, beginning after the2-byte constant..LE.H 4 "Special Operations".IX locations, special operationsThere are two special operations currently defined:.AL.LI.Cf DW_OP_piece.br.IMany compilers store a single variable in sets of registers, or storea variable partially in memory and partially in registers. .Cf DW_OP_pieceprovides a way of describing how large a part of a variablea particular addressing expression refers to..R.P.Cf DW_OP_piecetakes a single argument which is an unsigned LEB128 number. The numberdescribes the size in bytes of the piece of the object referencedby the addressing expression whose result is at the top ofthe stack..LI.Cf DW_OP_nop.brThe .Cf DW_OP_nopoperation is a place holder. It has no effect on the location stack orany of its values..LE.H 3 "Sample Stack Operations".IX locations, examples.IThe stack operations defined in section 2.4.3.3 are fairly.IX locations, stackconventional, but the following examples illustrate their behaviorgraphically..R.DS.TSbox expand center tab(;);l s l l slf(CW) lf(CW) lf(CW) lf(CW) lf(CW).Before;Operation;After;_0;17;DW_OP_dup;0;171;29;;1;172;1000;;2;29;;;3;1000_0;17;DW_OP_drop;0;291;29;;1;10002;1000;;;;_0;17;DW_OP_pick 2;0;10001;29;;1;172;1000;;2;29;;;3;1000_0;17;DW_OP_over;0;291;29;;1;172;1000;;2;29;;;3;1000_0;17;DW_OP_swap;0;291;29;;1;172;1000;;2;1000_0;17;DW_OP_rot;0;291;29;;1;10002;1000;;2;17.TE.DE.H 3 "Example Location Expressions".I.IX locations, examplesThe addressing expression represented by a location expression, if evaluated, generates theruntime address of the value of a symbol except where the.Cf DW_OP_reg n,or.Cf DW_OP_regxoperations are used..PHere are some examples of how location operations are used to form locationexpressions:.R.DS\f(CWDW_OP_reg3\fI The value is in register 3.\f(CWDW_OP_regx 54\fI The value is in register 54.\f(CWDW_OP_addr 0x80d0045c\fI The value of a static variable is at machine address 0x80d0045c.\f(CWDW_OP_breg11 44\fI Add 44 to the value in register 11 to get the address of an automatic variable instance.\f(CWDW_OP_fbreg -50\fI Given an \f(CWDW_AT_frame_base\fI value of "\f(CWOPBREG31 64\fI," this example computes the address of a local variable that is -50 bytes from a logical frame pointer that is computed by adding 64 to the current stack pointer (register 31).\f(CWDW_OP_bregx 54 32 DW_OP_deref\fI A call-by-reference parameter whose address is in the word 32 bytes from where register 54 points. \f(CWDW_OP_plus_uconst 4\fI A structure member is four bytes from the start of the structure instance. The base address is assumed to be already on the stack.\f(CWDW_OP_reg3 DW_OP_piece 4 DW_OP_reg10 DW_OP_piece 2\fI A variable whose first four bytes reside in register 3 and whose next two bytes reside in register 10.\fR.DE.H 3 "Location Lists".IX locations, listsLocation lists are used in place of location expressions wheneverthe object whose location is being described can change locationduring its lifetime. Location lists are contained in a separateobject file section called.Cf .debug_loc..IX \f(CW.debug_loc\fP %debugaloA location list is indicated by a locationattribute whose value is represented as aconstant offset from the beginning of the .Cf .debug_locsection to the first byte of the list for the object in question..PEach entry in a location list consists of:.AL.LIA beginning address. This address is relative to the base addressof the compilation unit referencing this location list. It marksthe beginning of the address range over which the location is valid..LIAn ending address, again relative to the base addressof the compilation unit referencing this location list. It marksthe first address past the end of the address range over which the location is valid..LIA location expression describing the location of the object over therange specified by the beginning and end addresses..LE.PAddress ranges may overlap. When they do, they describe a situationin which an object exists simultaneously in more than one place.If all of the address ranges in a given location list do not collectively cover the entirerange over which the object in question is defined, it is assumedthat the object is not available for the portion of the range that is notcovered..IX optimized code.PThe end of any given location list is marked by a 0 for the beginningaddress and a 0 for the end address; no location description is present.A location list containingonly such a 0 entry describes an object that exists in the sourcecode but not in the executable program. .H 2 "Types of Declarations".IX declarations, types ofAny debugging information entry describing a declaration thathas a type has a.Cf DW_AT_typeattribute, whose value is a reference to another debugginginformation entry. The entry referenced may describe.IX base types.IX types, basea base type, that is, a type that is not defined in terms.IX user-defined types.IX types, user-definedof other data types, or it may describe a user-defined type,such as an array, structure or enumeration. Alternatively,the entry referenced may describe a type modifier: constant,packed, pointer, reference or volatile, which in turn will referenceanother entry describing a type or type modifier (using a.IX type modifiers.IX types, modifiers.IX types, packed.IX types, constant.IX types, pointer.IX types, reference.IX types, volatile.Cf DW_AT_typeattribute of its own). See section 5 for descriptions ofthe entries describing base types, user-defined types andtype modifiers..H 2 "Accessibility of Declarations".I.IX accessibility.IX declarations, accessibilitySome languages, notably C++ and Ada, have the concept of.IX C++ %caathe accessibility of an object or of some other program entity.The accessibility specifies which classes of other program objectsare permitted access to the object in question..R.PThe accessibility of a declaration is represented by a.Cf DW_AT_accessibilityattribute, whose value is a constant drawn from the set of codes.nr aX \n(Fg+1listed in Figure \n(aX..DF.TSbox center;lf(CW). DW_ACCESS_publicDW_ACCESS_privateDW_ACCESS_protected.TE.FG "Accessibility codes".DE.H 2 "Visibility of Declarations".I.IX Modula2.IX visibility.IX declarations, visibilityModula2 has the concept of the visibility of a declaration.The visibility specifies which declarations are to be visible outsideof the module in which they are declared..R.PThe visibility of a declaration is represented by a.Cf DW_AT_visibilityattribute, whose value is a constant drawn from the set of codes.nr aX \n(Fg+1listed in Figure \n(aX..DF.TSbox center;lf(CW). DW_VIS_localDW_VIS_exportedDW_VIS_qualified.TE.FG "Visibility codes".DE.H 2 "Virtuality of Declarations".I.IX C++ %caa.IX virtuality.IX virtual functionsC++ provides for virtual and pure virtual structure or classmember functions and for virtual base classes..P.RThe virtuality of a declaration is represented by a.Cf DW_AT_virtualityattribute, whose value is a constant drawn from the set of codes.nr aX \n(Fg+1listed in Figure \n(aX..DF.TSbox center;lf(CW). DW_VIRTUALITY_noneDW_VIRTUALITY_virtualDW_VIRTUALITY_pure_virtual.TE.FG "Virtuality codes".DE.H 2 "Artificial Entries".I.IX artificial entriesA compiler may wish to generate debugging information entriesfor objects or types that were not actually declaredin the source of the application. An example is a formal parameterentry to represent the hidden .Cf thisparameter that most C++ implementations pass as the first argumentto non-static member functions..R.PAny debugging information entry representing the declaration of anobject or type artificially generated by a compiler and not explicitly declared by the source program may have a.Cf DW_AT_artificial attribute. The value of this attribute is a flag..H 2 "Target-Specific Addressing Information".I.IX segmented address space.IX address space, segmentedIn some systems, addresses are specified as offsets within a givensegment rather than as locations within a single flat address space..R.PAny debugging information entry that contains a description of thelocation of an object or subroutine may have a.Cf DW_AT_segmentattribute, whose value is a location description. The descriptionevaluates to the segment value of the item being described. Ifthe entry containing the .Cf DW_AT_segmentattribute has a.Cf DW_AT_low_pcor .Cf DW_AT_high_pcattribute, or a location description that evaluates to an address,.IX locations, descriptions.IX addresses, offset portionthen those values represent the offset portion of the addresswithin the segment specified by.Cf DW_AT_segment ..PIf an entry has no.Cf DW_AT_segmentattribute, it inherits the segment value from its parent entry.If none of the entries in the chain of parents for this entryback to its containing compilation unit entry have .Cf DW_AT_segmentattributes, then the entry is assumed to exist within a flataddress space. Similarly, if the entry has a.IX flat address space.IX address space, flat.Cf DW_AT_segmentattribute containing an empty location description, that entryis assumed to exist within a flat address space..P.ISome systems support different classes of addresses. The addressclass may affect the way a pointer is dereferenced or the waya subroutine is called..P.RAny debugging information entry representing a pointer or referencetype or a subroutine or subroutine type may have a.IX types, pointer.IX types, reference.IX subroutines.IX subroutines, types.Cf DW_AT_address_class.IX addresses, classattribute, whose value is a constant. The set of permissiblevalues is specific to each target architecture. The value.Cf DW_ADDR_none ,however, is common to all encodings, and means that no address classhas been specified..P.IFor example, the Intel386\(tm processor might use the followingvalues:.R.DF.TSbox center;l l llf(CW) lf(CW) l. Name Value Meaning_DW_ADDR_none 0 no class specifiedDW_ADDR_near16 1 16-bit offset, no segmentDW_ADDR_far16 2 16-bit offset, 16-bit segmentDW_ADDR_huge16 3 16-bit offset, 16-bit segmentDW_ADDR_near32 4 32-bit offset, no segmentDW_ADDR_far32 5 32-bit offset, 16-bit segment.TE.FG "Example address class codes".DE.H 2 "Non-Defining Declarations".IX declarations, non-defining.IX declarations, definingA debugging information entry representing a program object or typetypically represents the defining declaration of that object or type. Incertain contexts, however, a debugger might need information about adeclaration of a subroutine, object or type that is not also a definition to evaluate an expression correctly. .P.IAs an example, consider the following fragment of C code:.DS\f(CWvoid myfunc(){ int x; { extern float x; g(x); }}\fP.DE.PANSI-C scoping rules require that the value of the variable \f(CWx\fPpassed to the function \f(CWg\fP is the value of the global variable\f(CWx\fP rather than of the local version..R.PDebugging information entries that represent non-defining declarationsof a program object or type have a.Cf DW_AT_declarationattribute, whose value is a flag..H 2 "Declaration Coordinates".IIt is sometimes useful in a debugger to be able to associate a declarationwith its occurrence in the program source. .P.R.IX declarations, coordinatesAny debugging information entry representing the declaration of an object, module, subprogram or type may have .Cf DW_AT_decl_file ,.Cf DW_AT_decl_line and.Cf DW_AT_decl_columnattributes, each of whose value is a constant..PThe value of the .Cf DW_AT_decl_file attribute correspondsto a file number from the statement information table for the compilation.IX line number informationunit containing this debugging information entry and represents thesource file in which the declaration appeared (see section 6.2)..IX source, filesThe value 0 indicates that no source file has been specified..PThe value of the.Cf DW_AT_decl_lineattribute represents the source line number at which the first.IX source, linescharacter of the identifier of the declared object appears.The value 0 indicates that no source line has been specified..PThe value of the.Cf DW_AT_decl_columnattribute represents the source column number at which the first.IX source, columnscharacter of the identifier of the declared object appears.The value 0 indicates that no column has been specified..H 2 "Identifier Names".IX identifiers, namesAny debugging information entry representing a program entity thathas been given a name may have a.Cf DW_AT_nameattribute, whose value is a string representing the name as it appearsin the source program. A debugging information entry containingno name attribute, or containing a name attribute whose value consistsof a name containing a single null byte,represents a program entity for which no name was given in the source..I.PNote that since the names of program objectsdescribed by DWARF are the names as they appear in the source program,implementations of language translators that use some form of mangledname (as do many implementations of C++) should use the unmangled.IX C++ %caaform of the name in the DWARF .Cf DW_AT_nameattribute, including the keyword.Cf operator ,if present. Sequences of multiple whitespace characters may be compressed..R.OP.H 1 "PROGRAM SCOPE ENTRIES"This section describes debugging information entries that relateto different levels of program scope: compilation unit, module,subprogram, and so on. These entries may be thought of asbounded by ranges of text addresses within the program..H 2 "Compilation Unit Entries"An object file may be derived from one or more compilation units. Eachsuch compilation unit will be described by a debugging information entry with the tag \f(CWDW_TAG_compile_unit\fP..I.PA compilation unit typically represents the text and data contributed.IX compilation unitsto an executable by a single relocatable object file. It maybe derived from several source files, including pre-processed ``includefiles.''.R.PThe compilation unit entry may have the following attributes:.AL.LIA .Cf DW_AT_low_pcattribute whose value is therelocated address of the first machine instruction generated for that compilation unit..LIA.Cf DW_AT_high_pcattribute whose value is therelocated address of the first locationpast the last machine instruction generated for that compilation unit..P.IThe address may be beyond the last valid instruction in the executable,of course, for this and other similar attributes..R.PThe presence of low and high pc attributes in a compilation unit entryimply that the code generated for that compilation unit iscontiguous and exists totally within the boundaries specifiedby those two attributes. If that is not the case, no lowand high pc attributes should be produced..IX address space, contiguous.LIA.Cf DW_AT_nameattribute whose value is anull-terminated string containing the full or relative path name ofthe primary source file from which the compilation unit was derived..IX source, files.LIA .Cf DW_AT_languageattribute whose constant value is.IX languagesa code indicating the source language of the compilation unit..nr aX \n(Fg+1The set of language names and their meanings are given in Figure \n(aX..DF.TSbox center;lf(CW) lf(R). DW_LANG_C Non-ANSI C, such as K&RDW_LANG_C89 ISO/ANSI CDW_LANG_C_plus_plus C++DW_LANG_Fortran77 FORTRAN77DW_LANG_Fortran90 Fortran90DW_LANG_Modula2 Modula2DW_LANG_Pascal83 ISO/ANSI Pascal.TE.FG "Language names".DE.LIA.Cf DW_AT_stmt_listattribute whose value is a reference toline number information for this compilation unit..IX line number information.PThis information is placed in a separate object file section from the debugginginformation entries themselves. The value of the statement list attributeis the offset in the \f(CW.debug_line\fP section of the first byte of the line number information for this compilation unit. See section 6.2..LIA.Cf DW_AT_macro_infoattribute whose value is a reference to the macro information for thiscompilation unit..IX macro information.PThis information is placed in a separate object file section from the debugginginformation entries themselves. The value of the macro information attributeis the offset in the \f(CW.debug_macinfo\fP section of the first byte of the macro information for this compilation unit. See section 6.3..LIA.Cf DW_AT_comp_dirattribute whose value is a null-terminated string containingthe current working directory of the compilation command thatproduced this compilation unit in whatever form makes sensefor the host system..P.IThe suggested form for the value of the \f(CWDW_AT_comp_dir\fPattribute on \*(aX systems is ``hostname\f(CW:\fPpathname''. If nohostname is available, the suggested form is ``\f(CW:\fPpathname''..R.LIA.Cf DW_AT_producerattribute whose value is a null-terminated string containing informationabout the compiler that produced the compilation unit. Theactual contents of the string will be specific to each producer,but should begin with the name of the compiler vendor or someother identifying character sequence that should avoidconfusion with other producer values..LIA.Cf DW_AT_identifier_case.IX identifiers, caseattribute whose constant value is a code describing the treatment ofidentifiers within this compilation unit. The set of identifier case.nr aX \n(Fg+1codes is given in Figure \n(aX..DF.TSbox center;lf(CW). DW_ID_case_sensitiveDW_ID_up_caseDW_ID_down_caseDW_ID_case_insensitive.TE.FG "Identifier case codes".DE.P.Cf DW_ID_case_sensitive is the default for all compilation units that do not have this attribute.It indicates that names given as the values of .Cf DW_AT_nameattributes in debugging information entries for the compilation unitreflect the names as they appear in the source program.The debugger should be sensitive to the case of identifier nameswhen doing identifier lookups..P.Cf DW_ID_up_casemeans that the producer of the debugging information for this compilationunit converted all source names to upper case. The values of thename attributes may not reflect the names as they appear in the sourceprogram. The debugger should convert all names to upper casewhen doing lookups..P.Cf DW_ID_down_casemeans that the producer of the debugging information for this compilationunit converted all source names to lower case. The values of thename attributes may not reflect the names as they appear in the sourceprogram. The debugger should convert all names to lower case whendoing lookups..P.Cf DW_ID_case_insensitive means that the values of the name attributes reflect the namesas they appear in the source program but that a case insensitivelookup should be used to access those names..LIA.Cf DW_AT_base_types.IX base types.IX types, baseattribute whose value is a reference. This attribute points toa debugging information entry representing another compilationunit. It may be used to specify the compilation unit containingthe base type entries used by entries in the current compilationunit (see section 5.1)..P.IThis attribute provides a consumer a way to find the definitionof base types for a compilation unit that does not itselfcontain such definitions. This allows a consumer, for example,to interpret a type conversion to a base type correctly..R.LE.R.PA compilation unit entry owns debugging information entries that represent the declarations made inthe corresponding compilation unit..H 2 "Module Entries".ISeveral languages have the concept of a ``module.'' .IX modules.P.RA module isrepresented by a debugging information entry with the tag.Cf DW_TAG_module .Module entries may own other debugging information entries describingprogram entities whose declaration scopes end at the end of the moduleitself..PIf the module has a name, the module entry has a .Cf DW_AT_name attribute whosevalue is a null-terminated string containing the module name as it appearsin the source program..PIf the module contains initialization code, the module entryhas a .Cf DW_AT_low_pcattribute whose value is therelocated address of the first machine instruction generated for that initialization code. It also has a .Cf DW_AT_high_pcattribute whose value isthe relocated address of the first location past the last machineinstruction generated for the initialization code..PIf the module has been assigned a priority, it may have a.Cf DW_AT_priorityattribute. The value of this attribute is a reference to another.IX modules, prioritydebugging information entry describing a variable with a constantvalue. The value of this variable is the actual constantvalue of the module's priority, represented as it would be on thetarget architecture..P.I.IX Modula2.IX modules, definitionA Modula2 definition module may be represented by a module entrycontaining a.Cf DW_AT_declarationattribute..R.H 2 "Subroutine and Entry Point Entries".IX subroutines.IX entry pointsThe following tags exist to describe debugging informationentries for subroutines and entry points:.VL 30.LI \f(CWDW_TAG_subprogram\fPA global or file static subroutine or function..LI \f(CWDW_TAG_inlined_subroutine\fPA particular inlined instance of a subroutine or function..LI \f(CWDW_TAG_entry_point\fPA Fortran entry point..LE.H 3 "General Subroutine and Entry Point Information"The subroutine or entry point entry has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the subroutine or entrypoint name as it appears in the source program..PIf the name of the subroutine described by an entry with the tag.Cf DW_TAG_subprogramis visible outside of its containing compilation unit, thatentry has a.Cf DW_AT_externalattribute, whose value is a flag..IX declarations, external.I.P.IX members, functions.IX subroutines, membersAdditional attributes for functions that are members of a class orstructure are described in section 5.5.5..PA common debugger feature is to allow the debugger user to call asubroutine within the subject program. In certain cases, however,the generated code for a subroutine will not obey the standard callingconventions for the target architecture and will therefore not.IX calling conventionsbe safe to call from within a debugger..R.PA subroutine entry may contain a.Cf DW_AT_calling_conventionattribute, whose value is a constant. If this attribute is notpresent, or its value is the constant.Cf DW_CC_normal ,then the subroutine may be safely called by obeying the ``standard''calling conventions of the target architecture. If the value ofthe calling convention attribute is the constant.Cf DW_CC_nocall ,the subroutine does not obey standard calling conventions, and itmay not be safe for the debugger to call this subroutine..PIf the semantics of the language of the compilation unit containing the subroutine entry distinguishes between ordinary subroutines.IX main programsand subroutines that can serve as the ``main program,'' that is, subroutinesthat cannot be called directly following the ordinary calling conventions,then the debugging information entry for such a subroutine may have acalling convention attribute whose value is the constant.Cf DW_CC_program ..P.IThe .Cf DW_CC_program value is intended to support Fortran main programs.It is not intended as a way of finding the entry address for the program..R.H 3 "Subroutine and Entry Point Return Types".IX subroutines, return types.IX entry points, return typesIf the subroutine or entry point is a function that returns a value, thenits debugging information entry has a.Cf DW_AT_typeattribute to denote the type returned by that function..P.IDebugging information entries for C .Cf void.IX C %cfunctions should not have an attribute for the return type..PIn ANSI-C there is a difference between the types of functionsdeclared using function prototype style declarations and thosedeclared using non-prototype declarations. .IX subroutines, prototypes.P.RA subroutine entrydeclared with a function prototype style declaration may have a.Cf DW_AT_prototypedattribute, whose value is a flag..H 3 "Subroutine and Entry Point Locations".IX subroutines, locations.IX entry points, locationsA subroutine entry has a.Cf DW_AT_low_pcattribute whose value is the relocated address of the first machine instructiongenerated for the subroutine.It also has a.Cf DW_AT_high_pcattribute whose value is the relocated address of thefirst location past the last machine instruction generatedfor the subroutine. .P.INote that for the low and high pc attributes to have meaning, DWARFmakes the assumption that the code for a single subroutine is allocatedin a single contiguous block of memory..IX address space, contiguous.R.PAn entry point has a.Cf DW_AT_low_pcattribute whose value is the relocated address of the first machine instructiongenerated for the entry point..PSubroutines and entry points may also have .Cf DW_AT_segment and .Cf DW_AT_address_class.IX segmented address space.IX address space, segmented.IX addresses, classattributes, as appropriate, to specify which segments the codefor the subroutine resides in and the addressing mode to be usedin calling that subroutine..PA subroutine entry representing a subroutine declarationthat is not also a definition does not have low and high pc attributes..IX declarations, non-defining.H 3 "Declarations Owned by Subroutines and Entry Points".IX subroutines, declarations owned by.IX entry points, declarations owned byThe declarations enclosed by a subroutine or entry pointare represented by debugging information entries that areowned by the subroutine or entry point entry.Entries representing the formal parameters of the subroutine orentry point appear inthe same order as the corresponding declarations in the source program..IX attributes, ordering.IX parameters, formal.P.IThere is no ordering requirement on entries for declarations that arechildren of subroutine or entry point entries but that do not representformal parameters. The formal parameter entries may be interspersedwith other entries used by formal parameter entries, such as type entries..R.PThe unspecified parameters of a variable parameter list.IX parameters, unspecifiedare represented by a debugging information entry with the tag .Cf DW_TAG_unspecified_parameters ..PThe entry for a subroutine or entry point that includes a Fortran .IX Fortran.IX common blockscommon block has a child entry with the tag.Cf DW_TAG_common_inclusion .The common inclusion entry has a.Cf DW_AT_common_referenceattribute whose value is a reference to the debugging entry forthe common block being included (see section 4.2)..H 3 "Low-Level Information"A subroutine or entry point entry may have a.Cf DW_AT_return_addr.IX subroutines, return addressesattribute, whose value is a location description.The location calculated is the place where the return address for the subroutine or entry point is stored..PA subroutine or entry point entry may also have a.Cf DW_AT_frame_base.IX subroutines, frame baseattribute, whose value is a location description thatcomputes the ``frame base'' for the subroutine or entry point..P.IThe frame base for a procedure is typically an address fixedrelative to the first unit of storage allocated for the procedure'sstack frame. The .Cf DW_AT_frame_baseattribute can be used in several ways:.AL.LIIn procedures that need location lists to locate local variables, the.Cf DW_AT_frame_basecan hold the needed location list, while all variables'location descriptions can be simpler location expressions involving the frame base..LIIt can be used as a key in resolving "up-level" addressing with nestedroutines. (See .Cf DW_AT_static_link ,below).LE.PSome languages support nested subroutines. In such languages, it is possible.IX subroutines, nestedto reference the local variables of an outer subroutine from withinan inner subroutine. The .Cf DW_AT_static_link and .Cf DW_AT_frame_base attributes allow debuggers to support this same kind of referencing..R.PIf a subroutine or entry point is nested, it may have a.Cf DW_AT_static_linkattribute, whose value is a location description thatcomputes the frame base of the relevant instance of the subroutinethat immediately encloses the subroutine or entry point..PIn the context of supporting nested subroutines, the .Cf DW_AT_frame_baseattribute value should obey the following constraints:.AL.LIIt should compute a value that does not change during the life of the procedure,and.LIThe computed value should be unique among instances of the same subroutine.(For typical .Cf DW_AT_frame_base use, this means that a recursivesubroutine's stack frame must have non-zero size.).LE.P.IIf a debugger is attempting to resolve an up-level reference to a variable, ituses the nesting structure of DWARF to determine which subroutine is the lexicalparent and the .Cf DW_AT_static_linkvalue to identify the appropriate active frameof the parent. It can then attempt to find the reference within the contextof the parent. .R.H 3 "Types Thrown by Exceptions".IIn C++ a subroutine may declare a set of types for which.IX C++ %caa.IX exceptionsthat subroutine may generate or ``throw'' an exception..P.RIf a subroutine explicitly declares that it may throw anexception for one or more types, each such type isrepresented by a debugging information entry with the tag.Cf DW_TAG_thrown_type .Each such entry is a child of the entry representing thesubroutine that may throw this type. All thrown type entriesshould follow all entries representing the formal parametersof the subroutine and precede all entries representing thelocal variables or lexical blocks contained in the subroutine.Each thrown type entry contains a.Cf DW_AT_typeattribute, whose value is a reference to an entry describingthe type of the exception that may be thrown..H 3 "Function Template Instantiations".I.IX C++ %caa.IX templatesIn C++ a function template is a genericdefinition of a function thatis instantiated differently when called with valuesof different types. DWARF does not represent the generictemplate definition, but does represent each instantiation..R.PA template instantiation is represented by a debugging informationentry with the tag.Cf DW_TAG_subprogram .With three exceptions,such an entry will contain the same attributes and have the sametypes of child entries as would an entry for a subroutine defined explicitlyusing the instantiation types. The exceptions are:.AL.LI Each formal parameterized type declaration appearing in thetemplate definition is represented by a debugging information entrywith the tag .Cf DW_TAG_template_type_parameter .Each such entry has a .Cf DW_AT_nameattribute, whose value is a null-terminatedstring containing the name of the formal type parameter as itappears in the source program. The template type parameterentry also has a .Cf DW_AT_typeattribute describing the actual type bywhich the formal is replaced for this instantiation.All template type parameter entries should appear beforethe entries describing the instantiated formal parametersto the function..LI.IX compilation unitsIf the compiler has generated a special compilation unitto hold the template instantiation and that compilation unithas a different namefrom the compilation unit containing the template definition,the name attribute for the debugging entry representingthat compilation unit should be empty or omitted..LI.IX declarations, coordinatesIf the subprogram entry representing the template instantiationor any of its child entriescontain declaration coordinate attributes, those attributesshould refer to the source for the template definition, notto any source generated artificially by the compiler for thisinstantiation..LE.H 3 "Inline Subroutines".IX subroutines, inlineA declaration or a definition of an inlinable subroutineis represented by a debugging information entry with the tag.Cf DW_TAG_subprogram .The entry for a subroutine that is explicitly declaredto be available for inline expansion or that was expanded inlineimplicitly by the compiler has a.Cf DW_AT_inline attribute whose value is a constant. The set of values for the .Cf DW_AT_inline.nr aX \n(Fg+1attribute is given in Figure \n(aX..DF.TSbox center;l llf(CW) l. Name Meaning_DW_INL_not_inlined Not declared inline nor inlined by the compilerDW_INL_inlined Not declared inline but inlined by the compilerDW_INL_declared_not_inlined Declared inline but not inlined by the compilerDW_INL_declared_inlined Declared inline and inlined by the compiler.TE.FG "Inline codes".DE.H 4 "Abstract Instances"For the remainder of this discussion,any debugging information entry that is owned (either directly orindirectly) by a debugging information entry that contains the .Cf DW_AT_inlineattribute will be referred to as an ``abstract instance entry.''Any subroutine entry that contains a.Cf DW_AT_inline attribute will be known as an ``abstract instance root.''Any set of abstract instance entries that are all children (either directlyor indirectly) of some abstract instance root, together with the root itself,will be known as an ``abstract instance tree.''.PA debugging information entry that is a member of an abstract instancetree should not contain a.Cf DW_AT_high_pc , .Cf DW_AT_low_pc , .Cf DW_AT_location ,.Cf DW_AT_return_addr , .Cf DW_AT_start_scope ,or.Cf DW_AT_segment attribute..P.IIt would not make sense to put these attributesinto abstract instance entries sincesuch entries do not represent actual (concrete) instances and thusdo not actually exist at run-time..P.RThe rules for the relative location of entries belonging to abstract instance trees are exactlythe same as for other similar types of entries that are not abstract.Specifically, the rule that requires that an entry representing adeclaration be a direct child of the entry representing the scope ofthe declaration applies equally to both abstract andnon-abstract entries. Also, the ordering rules for formal parameter entries,member entries, and so on, all apply regardless of whether or not a given entryis abstract..H 4 "Concrete Inlined Instances".IX subroutines, inlinedEach inline expansion of an inlinable subroutine is representedby a debugging information entry with the tag.Cf DW_TAG_inlined_subroutine .Each such entry should be a direct child of the entry that represents thescope within which the inlining occurs..PEach inlined subroutine entry contains a .Cf DW_AT_low_pcattribute, representing the address of the firstinstruction associated with the given inlineexpansion. Each inlined subroutine entry also contains a.Cf DW_AT_high_pcattribute, representing theaddress of the first location past the last instruction associated withthe inline expansion..PFor the remainder of this discussion,any debugging information entry that is owned (either directly or indirectly)by a debugging information entry with the tag .Cf DW_TAG_inlined_subroutine will be referred to as a ``concrete inlined instance entry.''Any entry that has the tag .Cf DW_TAG_inlined_subroutinewill be known asa ``concrete inlined instance root.''Any set of concrete inlined instance entries that are all children (eitherdirectly or indirectly) of some concrete inlined instance root, togetherwith the root itself, will be known as a ``concrete inlined instancetree.''.PEach concrete inlined instance tree is uniquely associated with one (andonly one) abstract instance tree..P.INote, however, that the reverse is not true. Any given abstract instancetree may be associated with several different concrete inlined instancetrees, or may even be associated with zero concrete inlined instancetrees..P.RAlso, each separate entry within a given concrete inlined instance tree isuniquely associated with one particular entry in the associated abstractinstance tree. In other words, there is a one-to-one mapping from entriesin a given concrete inlined instance tree to the entries in the associatedabstract instance tree..P.INote, however, that the reverse is not true. A given abstract instancetree that is associated with a given concrete inlined instance treemay (and quite probably will) contain more entries than the associatedconcrete inlined instance tree (see below)..R.PConcrete inlined instance entries do not have most of the attributes (exceptfor .Cf DW_AT_low_pc , .Cf DW_AT_high_pc ,.Cf DW_AT_location ,.Cf DW_AT_return_addr ,.Cf DW_AT_start_scopeand.Cf DW_AT_segment )that such entrieswould otherwise normally have. In place of these omitted attributes,each concrete inlined instance entry has a.Cf DW_AT_abstract_origin attribute that may be used to obtain the missing information (indirectly) fromthe associated abstract instance entry. The value of the abstractorigin attribute is a reference to the associated abstract instance entry..PFor each pair of entries that are associated via a.Cf DW_AT_abstract_originattribute, both members of the pair will have the same tag. So, forexample, an entry with the tag .Cf DW_TAG_local_variable can only be associatedwith another entry that also has the tag .Cf DW_TAG_local_variable.The only exception to this rule is that the root of a concreteinstance tree (which must always have the tag .Cf DW_TAG_inlined_subroutine )can only be associated with the root of its associated abstractinstance tree (which must have the tag.Cf DW_TAG_subprogram )..PIn general, the structure and content of any given concreteinstance tree will be directly analogous to the structure and contentof its associated abstract instance tree.There are two exceptions to this general rule however..AL.LI.IX anonymous typesNo entries representing anonymous types are ever made a partof any concrete instance inlined tree..LI.IX membersNo entries representing members of structure, union or classtypes are ever made a part of any concrete inlined instance tree..LE.P.IEntries that represent members and anonymous types are omitted from concreteinlined instance trees because they would simply be redundant duplicates ofthe corresponding entries in the associated abstract instance trees. Ifany entry within a concrete inlined instance tree needs to refer to ananonymous type that was declared within the scope of therelevant inline function, the reference should simply refer to the abstractinstance entry for the given anonymous type..R.P.IX declarations, coordinatesIf an entry within a concrete inlined instance tree containsattributes describing the declaration coordinates ofthat entry,then those attributes should refer to the file, line and columnof the original declaration of the subroutine, not to thepoint at which it was inlined..H 4 "Out-of-Line Instances of Inline Subroutines".IX subroutines, out-of-lineUnder some conditions, compilers may need to generate concrete executableinstances of inline subroutines other than at points where those subroutinesare actually called. For the remainder of this discussion,such concrete instances of inline subroutines willbe referred to as ``concrete out-of-line instances.'' .P.IIn C++, for example, taking the address of a function declared to be inlinecan necessitate the generation of a concrete out-of-lineinstance of the given function..P.RThe DWARF representation of a concrete out-of-line instance of an inlinesubroutine is essentially the same as for a concrete inlined instance ofthat subroutine (as described in the preceding section). The representationof such a concrete out-of-line instance makes use of .Cf DW_AT_abstract_originattributes in exactly the same way as they are used for a concrete inlinedinstance (that is, as references to corresponding entries within the associatedabstract instance tree) and, as for concrete instance trees, theentries for anonymous types and for all members are omitted..PThe differences between the DWARF representation of a concrete out-of-lineinstance of a given subroutine and the representation of a concrete inlinedinstance of that same subroutine are as follows:.AL.LIThe root entry for a concrete out-of-line instance of a giveninline subroutine has the same tag as does its associated(abstract) inline subroutine entry (that is, it does not have thetag .Cf DW_TAG_inlined_subroutine )..LIThe root entry for a concrete out-of-line instance tree isalways directly owned by the same parent entry thatalso owns the root entry of the associated abstract instance..LE.H 2 "Lexical Block Entries".I.IX lexical blocksA lexical block is a bracketed sequence of source statements that maycontain any number of declarations. In some languages (C and C++)blocks can be nested within other blocks to any depth. .P.RA lexical block is represented by a debugging information entrywith the tag.Cf DW_TAG_lexical_block ..PThe lexical block entry has a .Cf DW_AT_low_pcattribute whose value is therelocated address of the first machine instruction generated for the lexicalblock.The lexical block entry also has a .Cf DW_AT_high_pcattribute whose value is therelocated address of the first locationpast the last machine instruction generated for the lexical block..PIf a name has been given to the lexical block in the source program,then the corresponding lexical block entry has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the name of thelexical block as it appears in the source program. .P.IThis is not thesame as a C or C++ label (see below)..R.PThe lexical block entry owns debugging information entries thatdescribe the declarations within that lexical block.There is one such debugging information entry for each local declarationof an identifier or inner lexical block..H 2 "Label Entries".I.IX labelsA label is a way of identifying a source statement. A labeled statementis usually the target of one or more ``go to'' statements..P.RA label is represented by a debugging information entrywith the tag .Cf DW_TAG_label .The entry for a label should be owned bythe debugging information entry representing the scope within which the nameof the label could be legally referenced within the source program..PThe label entry has a .Cf DW_AT_low_pcattribute whose value is therelocated address of the first machine instruction generated for thestatement identified by the label in the source program.The label entry also has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the name of thelabel as it appears in the source program..H 2 "With Statement Entries".I.IX with statements.IX Pascal.IX Modula2Both Pascal and Modula support the concept of a ``with'' statement. The with statement specifies a sequence of executable statementswithin which the fields of a record variable may be referenced, unqualifiedby the name of the record variable..P.RA with statement is represented by a debugging information entry withthe tag.Cf DW_TAG_with_stmt .A with statement entry has a .Cf DW_AT_low_pcattribute whose value is the relocatedaddress of the first machine instruction generated for the body ofthe with statement. A with statement entry also has a .Cf DW_AT_high_pcattribute whose value is the relocatedaddress of the first location after the last machine instruction generated for the body ofthe statement..PThe with statement entry has a .Cf DW_AT_typeattribute, denotingthe type of record whose fields may be referenced without full qualificationwithin the body of the statement. It also has a.Cf DW_AT_locationattribute, describing how to find the base addressof the record object referenced within the body of the with statement..H 2 "Try and Catch Block Entries".I.IX C++ %caa.IX exceptions.IX try blocks.IX catch blocksIn C++ a lexical block may be designated as a ``catch block.''A catch block is an exception handler that handles exceptionsthrown by an immediately preceding ``try block.'' A catch blockdesignates the type of the exception that it can handle..R.PA try block is represented by a debugging information entrywith the tag.Cf DW_TAG_try_block .A catch block is represented by a debugging information entrywith the tag.Cf DW_TAG_catch_block .Both try and catch block entries contain a.Cf DW_AT_low_pcattribute whose value is therelocated address of the first machine instruction generated for that block. These entries also contain a.Cf DW_AT_high_pcattribute whose value is therelocated address of the first locationpast the last machine instruction generated for that block..PCatch block entries have at least one child entry,an entry representing the type of exception acceptedby that catch block. This child entry will have one of the tags.Cf DW_TAG_formal_parameteror.Cf DW_TAG_unspecified_parameters ,.IX parameters, formal.IX parameters, unspecifiedand will have the same form as other parameter entries..PThe first sibling of each try block entry will be a catch blockentry..OP.H 1 "DATA OBJECT AND OBJECT LIST ENTRIES"This section presents the debugging information entries thatdescribe individual data objects: variables, parameters andconstants, and lists of those objects that may be groupedin a single declaration, such as a common block..H 2 "Data Object Entries".IX variables.IX parameters, formal.IX constantsProgram variables, formal parameters and constants are representedby debugging information entries with the tags.Cf DW_TAG_variable ,.Cf DW_TAG_formal_parameterand.Cf DW_TAG_constant ,respectively. .P.IThe tag.Cf DW_TAG_constantis used for languages that distinguish between variablesthat may have constant value and true named constants..R.PThe debugging information entry for a program variable, formalparameter or constant may have the following attributes:.AL.LIA .Cf DW_AT_name attribute whose value is a null-terminatedstring containing the data object name as it appears in the source program..P.IX anonymous unions.IX unions, anonymous.IX C++ %caaIf a variable entry describes a C++ anonymous union, the nameattribute is omitted or consists of a single zero byte..LIIf the name of a variable is visible outside of its enclosing compilation unit, the variable entry has a.Cf DW_AT_external.IX declarations, externalattribute, whose value is a flag..I.P.IX members, static dataThe definitions of C++ static data membersof structures or classes are represented by variable entries flaggedas external..IX C %c.IX C++ %caaBoth file static and local variables in C and C++ are represented by non-external variable entries..R.LIA.Cf DW_AT_locationattribute, whose value describes the location of a variable or parameterat run-time..P.IX declarations, non-definingA data object entry representing a non-defining declaration of the objectwill not have a location attribute, and will have the.Cf DW_AT_declarationattribute..PIn a variable entry representing the definition of the variable(that is, with no.Cf DW_AT_declarationattribute)if no location attribute is present, or ifthe location attribute is present but describesa null entry (as described in section 2.4), the variableis assumed to exist in the source code but not in the executableprogram (but see number 9, below)..IX optimized code.PThe location of a variable may be further specified with a.Cf DW_AT_segmentattribute, if appropriate..IX segmented address space.IX address space, segmented.LIA .Cf DW_AT_typeattribute describing the type of the variable, constant or formalparameter..LI.IX members, static data.IX declarations, definingIf the variable entry represents the defining declaration for a C++ staticdata member of a structure, class or union, the entry has a.Cf DW_AT_specificationattribute, whose value is a reference to the debugging informationentry representing the declaration of this data member. Thereferenced entry will be a child of some class, structure orunion type entry..IX classes.IX structures.IX unions.PVariable entries containing the .Cf DW_AT_specificationattribute do not need to duplicate information provided by thedeclaration entry referenced by the specification attribute.In particular, such variable entries do not need to containattributes for the name or type of the data member whosedefinition they represent..LI.ISome languages distinguish between parameters whose value in thecalling function can be modified by the callee (variable parameters), and parameters whose value in the calling function cannot be modifiedby the callee (constant parameters)..P.RIf a formal parameter entry represents a parameter whose valuein the calling function may be modified by the callee, that entrymay have a.Cf DW_AT_variable_parameterattribute, whose value is a flag. The absence of this attributeimplies that the parameter's value in the calling function cannotbe modified by the callee..IX parameters, variable.LI.IFortran90 has the concept of an optional parameter..IX Fortran90.P.R.IX parameters, optionalIf a parameter entry represents an optional parameter, it has a.Cf DW_AT_is_optionalattribute, whose value is a flag..LI.IX parameters, default valueA formal parameter entry describing a formal parameter that has a defaultvalue may have a.Cf DW_AT_default_valueattribute. The value of this attribute is a reference to thedebugging information entry for a variable or subroutine. Thedefault value of the parameter is the value of the variable (whichmay be constant) or the value returned by the subroutine. If thevalue of the.Cf DW_AT_default_valueattribute is 0, it means that no default value has been specified..LI.IX constantsAn entry describing a variable whose value is constantand not represented by an object in the address space of the program,or an entry describing a named constant,does not have a location attribute. Such entries have a.Cf DW_AT_const_valueattribute, whose value may be a string or any of the constantdata or data block forms, as appropriate for the representationof the variable's value. The value of this attribute is the actualconstant value of the variable, represented as it would beon the target architecture..LI.IX scope.IX declarations, scopeIf the scope of an object begins sometime after the low pc valuefor the scope most closely enclosing the object, theobject entry may have a.Cf DW_AT_start_scopeattribute. The value of this attribute is the offset in bytes of the beginningof the scope for the object from the low pc value of the debugginginformation entry that defines its scope..P.IThe scope of a variable may begin somewhere in the middle of a lexicalblock in a language that allows executable code in a block before a variable declaration, or where one declarationcontaining initialization code may change the scope of a subsequentdeclaration. For example, in the following C code:.DS\f(CWfloat x = 99.99;int myfunc(){ float f = x; float x = 88.99; return 0;}\fP.DE.PANSI-C scoping rules require that the value of the variable \f(CWx\fPassigned to the variable \f(CWf\fP in the initialization sequenceis the value of the global variable \f(CWx\fP, rather than the local \f(CWx\fP,because the scope of the local variable \f(CWx\fP only starts after the fulldeclarator for the local \f(CWx\fP..R.LE.P.H 2 "Common Block Entries".IX common blocks.IX FortranA Fortran common block may be described by a debugging informationentry with the tag.Cf DW_TAG_common_block .The common block entry has a.Cf DW_AT_name attribute whose value is a null-terminatedstring containing the common block name as it appears in the source program.It also has a.Cf DW_AT_locationattribute whose value describes the location of the beginning of thecommon block. The common block entry owns debugging informationentries describing the variables contained within the common block..H 2 "Imported Declaration Entries".I .IX declarations, imported.IX importsSome languages support the concept of importing into a givenmodule declarations made in a different module..R.PAn imported declaration is represented by a debugging informationentry with the tag.Cf DW_TAG_imported_declaration .The entry for the imported declaration has a .Cf DW_AT_name attribute whose valueis a null-terminated string containing the name of the entitywhose declaration is being imported as it appears in the sourceprogram. The imported declaration entry also has a.Cf DW_AT_importattribute, whose value is a reference to the debugging informationentry representing the declaration that is being imported..H 2 "Namelist Entries".I.IX namelists.IX Fortran90At least one language, Fortran90, has the concept of a namelist.A namelist is an ordered list of the names of some set of declared objects.The namelist object itself may be used as a replacement for the list of names in various contexts..R.PA namelist is represented by a debugging information entry withthe tag.Cf DW_TAG_namelist .If the namelist itself has a name, the namelist entry has a.Cf DW_AT_nameattribute, whose value is a null-terminated string containing the namelist'sname as it appears in the source program..PEach name that is part of the namelist is represented by a debugginginformation entry with the tag .Cf DW_TAG_namelist_item .Each such entry is a child of the namelist entry, and all ofthe namelist item entries for a given namelist are ordered as werethe list of names they correspond to in the source program..PEach namelist item entry contains a.Cf DW_AT_namelist_itemattribute whose value is a reference to the debugging informationentry representing the declaration of the item whose nameappears in the namelist..OP.H 1 "TYPE ENTRIES"This section presents the debugging information entriesthat describe program types: base types, modified typesand user-defined types..PIf the scope of the declaration of a named type begins sometime after .IX scope.IX declarations, scopethe low pc valuefor the scope most closely enclosing the declaration, thedeclaration may have a.Cf DW_AT_start_scopeattribute. The value of this attribute is the offset in bytes of the beginningof the scope for the declaration from the low pc value of the debugginginformation entry that defines its scope..H 2 "Base Type Entries".I.IX base types.IX types, baseA base type is a data type that is not defined in terms ofother data types. Each programming language has a set ofbase types that are considered to be built into that language..R.PA base type is represented by a debugging information entrywith the tag.Cf DW_TAG_base_type .A base type entry has a .Cf DW_AT_name attribute whose value is a null-terminatedstring describing the name of the base type as recognized bythe programming language of the compilation unit containingthe base type entry..PA base type entry also has a.Cf DW_AT_encodingattribute describing how the base type is encoded and isto be interpreted. The value of this attribute is a constant.The set of values and their meanings for the .Cf DW_AT_encoding.nr aX \n(Fg+1attribute is given in Figure \n(aX..DF.TSbox center;l llf(CW) l. Name Meaning_DW_ATE_address linear machine addressDW_ATE_boolean true or falseDW_ATE_complex_float complex floating-point numberDW_ATE_float floating-point numberDW_ATE_signed signed binary integerDW_ATE_signed_char signed characterDW_ATE_unsigned unsigned binary integerDW_ATE_unsigned_char unsigned character.TE.FG "Encoding attribute values".DE.PAll encodings assume the representation that is ``normal'' forthe target architecture..PA base type entry has a.Cf DW_AT_byte_sizeattribute, whose value is a constant,describing the size in bytes of the storageunit used to represent an object of the given type..PIf the value of an object of the given type does notfully occupy the storage unit described by the byte size attribute,the base type entry may have a.Cf DW_AT_bit_sizeattribute and a.Cf DW_AT_bit_offsetattribute, both of whose values are constants.The bit size attribute describes the actual size in bits usedto represent a value of the given type. The bit offsetattribute describes the offset in bits of the high orderbit of a value of the given type from the high order bitof the storage unit used to contain that value..I.PFor example, the C type .Cf inton a machine that uses 32-bit integers would berepresented by a base type entry with a nameattribute whose value was ``\f(CWint\fP,'' anencoding attribute whose value was .Cf DW_ATE_signedand a byte size attribute whose value was.Cf 4 ..R.H 2 "Type Modifier Entries".IX type modifiers.IX types, modifiersA base or user-defined type may be modified in differentways in different languages. A type modifier is representedin DWARF by a debugging information entry with one of the.nr aX \n(Fg+1tags given in Figure \n(aX..DF.TSbox center;l llf(CW) l. Tag Meaning_DW_TAG_const_type C or C++ const qualified typeDW_TAG_packed_type Pascal packed typeDW_TAG_pointer_type The address of the object whose type is being modifiedDW_TAG_reference_type A C++ reference to the object whose type is being modifiedDW_TAG_volatile_type C or C++ volatile qualified type.TE.FG "Type modifier tags".DE.P.IX types, constant.IX types, packed.IX types, volatile.IX types, pointer.IX types, referenceEach of the type modifier entries has a.Cf DW_AT_typeattribute, whose value is a reference to a debugging informationentry describing a base type, a user-defined type or another type modifier..PA modified type entry describing a pointer or reference typemay have a .IX addresses, class.Cf DW_AT_address_class attributeto describe how objects having the given pointer or reference typeought to be dereferenced..PWhen multiple type modifiers are chained together to modifya base or user-defined type, they are ordered as if part ofa right-associative expression involving the base or user-definedtype..I.PAs examples of how type modifiers are ordered, take the followingC declarations:.R.DS.ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i\f(CWconst char * volatile p;\fP \fIwhich represents a volatile pointer to a constant character.\fP \fIThis is encoded in DWARF as:\fP \f(CWDW_TAG_volatile_type \(-> DW_TAG_pointer_type \(-> DW_TAG_const_type \(-> DW_TAG_base_type\fP\f(CWvolatile char * const p;\fP \fIon the other hand, represents a constant pointer to a volatile character.\fP \fIThis is encoded as:\fP \f(CWDW_TAG_const_type \(-> DW_TAG_pointer_type \(-> DW_TAG_volatile_type \(-> DW_TAG_base_type\fP.DE.R.H 2 "Typedef Entries".IX typedefsAny arbitrary type named via a typedef is representedby a debugging information entry with the tag .Cf DW_TAG_typedef .The typedef entry has a .Cf DW_AT_name attribute whose value is a null-terminatedstring containing the name of the typedef as it appears in thesource program.The typedef entry also contains a .Cf DW_AT_typeattribute..PIf the debugging information entry for a typedef represents a declaration of the type that is not also a definition,it does not contain a type attribute..IX declarations, non-defining.H 2 "Array Type Entries".I.IX arraysMany languages share the concept of an ``array,'' which is atable of components of identical type..P.RAn array type is represented by a debugging information entry withthe tag .Cf DW_TAG_array_type ..PIf a name has been given to the array type in the source program, then thecorresponding array type entry has a .Cf DW_AT_name attribute whose value is anull-terminated string containing the array type name as it appears in thesource program..P.IX arrays, orderingThe array type entry describing a multidimensional array may have a.Cf DW_AT_orderingattribute whose constant value is interpreted to mean eitherrow-major or column-major ordering of array elements.The set of values and their meanings for the ordering attribute.nr aX \n(Fg+1are listed in Figure \n(aX.If no ordering attribute is present, the default ordering forthe source language (which is indicated by the.Cf DW_AT_languageattribute of the enclosing compilation unit entry)is assumed..DF.TSbox center;lf(CW). DW_ORD_col_majorDW_ORD_row_major.TE.FG "Array ordering".DE.PThe ordering attribute may optionally appear on one-dimensional arrays; itwill be ignored..PAn array type entry has a .Cf DW_AT_typeattribute describing the typeof each element of the array..P.IX arrays, strideIf the amount of storage allocated to hold each element of an object ofthe given array type is different from the amount of storage that is normallyallocated to hold an individual object of the indicated element type, thenthe array type entry has a.Cf DW_AT_stride_size attribute, whose constant valuerepresents the size in bits of each element of the array..PIf the size of the entire array can be determined statically at compiletime, the array type entry may have a.Cf DW_AT_byte_size attribute, whose constant value represents the total size in bytes of aninstance of the array type..P.INote that if the size of the array can be determined statically atcompile time, this value can usually be computed by multiplyingthe number of array elements by the size of each element..P.REach array dimension is described by a debugging informationentry with either the tag.IX subranges.IX enumerations.IX arrays, dimensions.Cf DW_TAG_subrange_typeor the tag.Cf DW_TAG_enumeration_type .These entries are children of the array type entry and areordered to reflect the appearance of the dimensions in the sourceprogram (i.e. leftmost dimension first, next to leftmost second,and so on)..P.I.IX C %cIn languages, such as ANSI-C, in which there is no concept of a``multidimensional array,'' an array of arrays may be represented by a debugging information entryfor a multidimensional array..R.H 2 "Structure, Union, and Class Type Entries".IThe languages C, C++, and Pascal, among others, allow the programmer to define types thatare collections of related components. In C and C++, these collections arecalled ``structures.'' In Pascal, they are called ``records.'' The componentsmay be of different types. The components are called ``members'' in C andC++, and ``fields'' in Pascal..P.IX structures.IX classes.IX unions.IX records.IX C %c.IX C++ %caa.IX PascalThe components of these collections each exist in their own space incomputer memory. The components of a C or C++ ``union'' all coexist inthe same memory..PPascal and other languages have a ``discriminated union,'' also called a.IX variants.IX discriminated unions``variant record.'' Here, selection of a number of alternative substructures(``variants'') is based on the value of a component that is not part of any ofthose substructures (the ``discriminant'')..PAmong the languages discussed in this document,the ``class'' concept is unique to C++. A class is similar to a structure.A C++ class or structure may have ``member functions'' which are subroutinesthat are within the scope of a class or structure..R.H 3 "General Structure Description"Structure, union, and class types are represented by debugging information entries with the tags.Cf DW_TAG_structure_type ,.Cf DW_TAG_union_type and .Cf DW_TAG_class_type ,respectively.If a name has been given to the structure, union, or class in the sourceprogram, then the corresponding structure type, union type, or class typeentry has a .Cf DW_AT_name attribute whose value is a null-terminated stringcontaining the type name as it appears in the source program..PIf the size of an instance of thestructure type, union type, or class type entry can be determinedstatically at compile time, the entry has a.Cf DW_AT_byte_size attribute whose constant value is the number of bytes required tohold an instance of the structure, union, or class, and any padding bytes..I.P.IX structures, incomplete.IX classes, incomplete.IX unions, incompleteFor C and C++, an incomplete structure, union or class type is representedby a structure, union or class entry that does not havea byte size attribute and that has a.Cf DW_AT_declarationattribute..R.PThe members of a structure, union, or class are represented bydebugging information entries that are owned by the correspondingstructure type, union type, or class type entry and appear in the sameorder as the corresponding declarations in the source program..P.I.IX declarations, defining.IX members, static data.IX members, data.IX members, functionsData member declarations occurring within the declaration of a structure,union or class type are considered to be ``definitions'' of those members,with the exception of C++ ``static'' data members, whose definitionsappear outside of the declaration of the enclosing structure, unionor class type. Function member declarations appearing within a structure,union or class type declaration are definitions only if the bodyof the function also appears within the type declaration..R.P.IX declarations, non-definingIf the definition for a given member of the structure, union or classdoes not appear within the body of the declaration, that memberalso has a debugging information entry describing its definition.That entry will have a.Cf DW_AT_specificationattribute referencing the debugging entry owned by thebody of the structure, union or class debugging entry and representinga non-defining declaration of the data or function member. The referenced entry willnot have information about the location of that member (low and highpc attributes for function members, location descriptions for datamembers) and will have a.Cf DW_AT_declarationattribute..H 3 "Derived Classes and Structures".IX classes, derived.IX structures, derived.IX inheritanceThe class type or structure type entry that describes a derived class or structure owns debugging information entries describing each ofthe classes or structures it is derived from, ordered as they werein the source program. Each such entry has the tag.Cf DW_TAG_inheritance ..PAn inheritance entry has a .Cf DW_AT_typeattribute whosevalue is a reference to the debugging information entry describingthe structure or class from which the parent structure or classof the inheritance entry is derived. It also has a.Cf DW_AT_data_member_locationattribute, whose value is a location description describingthe location of the beginning ofthe data members contributed to the entire class by thissubobject relative to the beginning address of the data members of theentire class..P.IX accessibility.IX virtuality.IX classes, virtual baseAn inheritance entry may have a.Cf DW_AT_accessibilityattribute.If no accessibility attribute is present,private access is assumed.If the structure or class referenced by the inheritance entry servesas a virtual base class, the inheritance entry has a.Cf DW_AT_virtualityattribute..P .IIn C++, a derived class may contain access declarations thatchange the accessibility of individual class members fromthe overall accessibility specified by the inheritance declaration.A single access declaration may refer to a set of overloadednames..R.PIf a derived class or structure contains access declarations,.IX access declarations.IX C++ %caaeach such declaration may be represented by a debugging informationentry with the tag.Cf DW_TAG_access_declaration .Each such entry is a child of the structure or class type entry..PAn access declaration entry has a .Cf DW_AT_name attribute, whose valueis a null-terminated string representing the name used in thedeclaration in the source program, including any class or structurequalifiers..PAn access declaration entry also has a .Cf DW_AT_accessibilityattributedescribing the declared accessibility of the named entities..H 3 "Friends".IX friends.IX classes, friendsEach ``friend'' declared bya structure, union or class type may be represented bya debugging information entry that is a child of the structure,union or class type entry; the friend entry has the tag.Cf DW_TAG_friend..PA friend entry has a.Cf DW_AT_friend attribute, whose value is a reference to the debugging informationentry describing the declaration of the friend..H 3 "Structure Data Member Entries".IX members, dataA data member (as opposed to a member function) is represented bya debugging information entry with the tag.Cf DW_TAG_member .The member entry for a named member has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the member nameas it appears in the source program. If the member entry describesa C++ anonymous union, the name attribute is omitted or consistsof a single zero byte..IX unions, anonymous.IX anonymous unions.PThe structure data member entry has a .Cf DW_AT_typeattributeto denote the type of that member..PIf the member entry is defined in the structure or class body, it has a.Cf DW_AT_data_member_locationattribute whose value is a locationdescription that describes the location of thatmember relative to the base address of the structure, union, or class thatmost closely encloses the corresponding member declaration..I.P.IX locations, expressions.IX locations, descriptionsThe addressing expression represented by the location description for a structure data member expects the base addressof the structure data member to be on the expression stackbefore being evaluated..P.IX unionsThe location description for a data member of a union may be omitted,since all data members of a union begin at the same address..R.P.IX bit fields.IX members, bit fieldsIf the member entry describes a bit field, then that entry has the followingattributes:.AL.LIA.Cf DW_AT_byte_sizeattribute whose constant value is the number of bytes thatcontain an instance of the bit field and any padding bits..P.IThe byte size attribute may be omitted if the size of the object containingthe bit field can be inferred from the type attribute of the datamember containing the bit field..R.LIA.Cf DW_AT_bit_offsetattribute whose constant value is the number of bitsto the left of the leftmost (most significant) bit of the bit field value..LIA.Cf DW_AT_bit_sizeattribute whose constant value is the number of bits occupiedby the bit field value..LE.PThe location description for a bit field calculates the address ofan anonymous object containing the bit field. The address isrelative to the structure, union, or class thatmost closely encloses the bit field declaration. The numberof bytes in this anonymous object is the value of the bytesize attribute of the bit field. The offset (in bits)from the most significant bit of theanonymous object to the most significant bit of the bit field is thevalue of the bit offset attribute..I.PFor example, take one possible representation of the followingstructure definition in both big and little endian byte orders:.DS\f(CWstruct S { int j:5; int k:6; int m:5; int n:8;};\fP.DE.PIn both cases, the location descriptions for the debugging informationentries for \f(CWj\fP, \f(CWk\fP, \f(CWm\fP and \f(CWn\fPdescribe the address ofthe same 32-bit word that contains all three members. (In the big-endian case,the location description addresses the most significant byte, inthe little-endian case, the least significant). The following diagram shows the structure layout and lists the bitoffsets for each case. The offsetsare from the most significant bit of the object addressed by the locationdescription. .PSbitht = .3boxht = bithtbitwid = .11nibwid = .75 * bitwidbytewid = 8 * bitwidboxwid = bytewiddefine nibble X # nibble(len, "label", hi-left, hi-right, lo-left, lo-right, any)N: box width $1*nibwid $2 $7 { if $3 >= 0 then % "\s-4\|$3\s0" at N.w + (0,bitht/3) ljust % } # curly on separate line for pic bug { if $4 >= 0 then % "\s-4\|$4\s0" at N.e + (0,bitht/3) rjust % } { if $5 >= 0 then % "\s-4\|$5\s0" at N.w - (0,bitht/3) ljust % } { if $6 >= 0 then % "\s-4$6\|\s0" at N.e - (0,bitht/3) rjust % }Xdefine tbox X # tbox(width,"label", any)T: box width $1*nibwid ht 1/6 $3 invis { $2 at T.w ljust }X.PE.DS.PS downH: tbox(20,"Bit Offsets:") tbox(20,"\f(CW j:0\fP") tbox(20,"\f(CW k:5\fP") tbox(20,"\f(CW m:11\fP") tbox(20,"\f(CW n:16\fP") rightH: tbox(32, "Big-Endian", with .w at H.e)H: nibble(5,"\f(CWj\fP",0,-1,31,-1,with .nw at H.sw)H: nibble(6,"\f(CWk\fP",-1,-1,26,-1)H: nibble(5,"\f(CWm\fP",-1,-1,20,-1)H: nibble(8,"\f(CWn\fP",-1,-1,15,-1)H: nibble(8,"\fIpad\fP",-1,-1,7,0).PE.DE.DS.PS downH: tbox(20,"Bit Offsets:") tbox(20,"\f(CW j:27\fP") tbox(20,"\f(CW k:21\fP") tbox(20,"\f(CW m:16\fP") tbox(20,"\f(CW n:8\fP") rightH: tbox(32, "Little-Endian", with .w at H.e)H: nibble(8,"\f2pad\fP",-1,-1,31,-1, with .nw at H.sw)H: nibble(8,"\f(CWn\fP",-1,-1,23,-1)H: nibble(5,"\f(CWm\fP",-1,-1,15,-1)H: nibble(6,"\f(CWk\fP",-1,-1,10,-1)H: nibble(5,"\f(CWj\fP",-1,0,4,0).PE.DE.R.H 3 "Structure Member Function Entries".IX subroutines, members.IX members, functions.IX members, locationsA member function is represented in the debugging information by adebugging information entry with the tag .Cf DW_TAG_subprogram .The member function entry may contain the same attributes and followsthe same rules as non-member global subroutine entries (see section 3.3)..P.IX virtuality.IX virtual functionsIf the member function entry describes a virtual function, then that entryhas a .Cf DW_AT_virtuality attribute..PAn entry for a virtual function also has a.Cf DW_AT_vtable_elem_locationattribute whose value contains a locationdescription yielding the address of the slot for the functionwithin the virtual function table for the enclosing class or structure..P.IX declarations, definingIf a subroutine entry represents the defining declarationof a member function and that definition appears outsideof the body of the enclosing class or structure declaration,the subroutine entry has a.Cf DW_AT_specificationattribute, whose value is a reference to the debugging informationentry representing the declaration of this function member. Thereferenced entry will be a child of some class or structuretype entry..PSubroutine entries containing the .Cf DW_AT_specificationattribute do not need to duplicate information provided by thedeclaration entry referenced by the specification attribute.In particular, such entries do not need to containattributes for the name or return type of the function member whosedefinition they represent..H 3 "Class Template Instantiations".I.IX C++ %caa.IX templatesIn C++ a class template is a genericdefinition of a class type thatis instantiated differently when an instance of the classis declared or defined. The generic description of the classmay include both parameterized types and parameterized constantvalues. DWARF does not represent the generictemplate definition, but does represent each instantiation..R.PA class template instantiation is represented by a debugging informationwith the tag.Cf DW_TAG_class_type .With four exceptions,such an entry will contain the same attributes and have the sametypes of child entries as would an entry for a class type defined explicitly using the instantiation types and values.The exceptions are:.AL.LI Each formal parameterized type declaration appearing in thetemplate definition is represented by a debugging information entrywith the tag .Cf DW_TAG_template_type_parameter .Each such entry has a .Cf DW_AT_name attribute, whose value is a null-terminatedstring containing the name of the formal type parameter as itappears in the source program. The template type parameterentry also has a .Cf DW_AT_typeattribute describing the actual type bywhich the formal is replaced for this instantiation..LIEach formal parameterized value declaration appearingin the templated definition is represented by a debugging informationentry with the tag.Cf DW_TAG_template_value_parameter .Each such entry has a .Cf DW_AT_name attribute, whose value is a null-terminatedstring containing the name of the formal value parameter as itappears in the source program. The template value parameterentry also has a .Cf DW_AT_typeattribute describing the type of the parameterizedvalue. Finally, the template value parameter entry has a.Cf DW_AT_const_valueattribute, whose value is the actual constant value of the valueparameter for this instantiation as represented on the targetarchitecture..LI.IX compilation unitsIf the compiler has generated a special compilation unitto hold the template instantiation and that compilation unithas a different namefrom the compilation unit containing the template definition,the name attribute for the debugging entry representingthat compilation unit should be empty or omitted..LI.IX declarations, coordinatesIf the class type entry representing the template instantiationor any of its child entriescontain declaration coordinate attributes, those attributesshould refer to the source for the template definition, notto any source generated artificially by the compiler..LE.H 3 "Variant Entries".IX variants.IX discriminated unionsA variant part of a structure is represented by a debugginginformation entry with the tag.Cf DW_TAG_variant_partand is owned by the corresponding structure typeentry. .P.IX discriminantsIf the variant part has a discriminant, the discriminant is representedby a separate debugging information entry which is a child of the variant part entry. This entry has the form of a structure data memberentry.The variant part entry will have a.Cf DW_AT_discrattribute whose value is areference to the member entry for the discriminant. .PIf the variant partdoes not have a discriminant (tag field), the variant part entry has a .Cf DW_AT_typeattribute to represent the tag type..PEach variant of a particular variant part is represented by a debugginginformation entry with the tag.Cf DW_TAG_variant and is a child of the variant part entry. The value that selects a given variant may be represented in one of three ways. Thevariant entry may have a.Cf DW_AT_discr_valueattribute whose value represents a single case label. The value of this attributeis encoded as an LEB128 number. The number is signed if the tagtype for the variant part containing this variant isa signed type. The number is unsigned if the tag type is an unsigned type..PAlternatively, the variant entry may contain a.Cf DW_AT_discr_listattribute, whose value represents a list of discriminant values.This list is represented by any of the block forms and may containa mixture of case labels and label ranges. Each item on the listis prefixed with a discriminant value descriptor that determines whetherthe list item represents a single label or a label range.A single case label is represented as an LEB128 number as defined abovefor the.Cf DW_AT_discr_valueattribute. A label range is represented by two LEB128 numbers,the low value of the range followed by the high value. Both valuesfollow the rules for signedness just described. The discriminant value descriptor is a constant that may have.nr aX \n(Fg+1one of the values given in Figure \n(aX..DF.TScenter box;lf(CW).DW_DSC_labelDW_DSC_range.TE.FG "Discriminant descriptor values".DE.PIf a variant entry has neither a.Cf DW_AT_discr_valueattribute nor a.Cf DW_AT_discr_listattribute, or if it has a.Cf DW_AT_discr_listattribute with 0 size, the variant is a default variant..PThe components selected by a particular variant are representedby debugging information entries owned by the corresponding variantentry and appear in the same order as the corresponding declarations inthe source program..H 2 "Enumeration Type Entries".I.IX enumerationsAn ``enumeration type'' is a scalar that can assume one of a fixed number ofsymbolic values..P.RAn enumeration type is represented by a debugging information entrywith the tag.Cf DW_TAG_enumeration_type ..PIf a name has been given to the enumeration type in the source program,then the corresponding enumeration type entry has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the enumeration typename as it appears in the source program.These entries also have a .Cf DW_AT_byte_size attribute whoseconstant value is the number of bytes required to hold aninstance of the enumeration..PEach enumeration literal is represented by a debugging informationentry with the tag.Cf DW_TAG_enumerator .Each such entry is a child of the enumeration type entry, andthe enumerator entries appear in the same order as the declarations ofthe enumeration literals in the source program..PEach enumerator entry has a .Cf DW_AT_name attribute, whose value isa null-terminated string containing the name of the enumerationliteral as it appears in the source program. Each enumeratorentry also has a.Cf DW_AT_const_valueattribute, whose value is the actual numeric value of the enumeratoras represented on the target system..H 2 "Subroutine Type Entries".I.IX subroutines, typesIt is possible in C to declare pointers to subroutines that return a valueof a specific type. In both ANSI C and C++, it is possible to declarepointers to subroutines that not only return a value of a specific type,but accept only arguments of specific types. The type of such pointerswould be described with a ``pointer to'' modifier applied to a user-definedtype. .R.PA subroutine type is represented by a debugging information entrywith the tag.Cf DW_TAG_subroutine_type .If a name has been given to the subroutine type in the source program,then the corresponding subroutine type entry has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the subroutine typename as it appears in the source program..P.IX subroutines, return typesIf the subroutine type describes a function that returns a value, thenthe subroutine type entry has a .Cf DW_AT_typeattributeto denote the type returned by the subroutine.If the types of the arguments are necessary to describe the subroutine type,then the corresponding subroutine type entry owns debugginginformation entries that describe the arguments.These debugging information entries appear in the orderthat the corresponding argument types appear in the source program..P.I.IX C %c.IX subroutines, prototypesIn ANSI-C there is a difference between the types of functionsdeclared using function prototype style declarations and thosedeclared using non-prototype declarations. .P.RA subroutine entrydeclared with a function prototype style declaration may have a.Cf DW_AT_prototypedattribute, whose value is a flag..PEach debugging information entryowned by a subroutine type entry has a tag whose value has one oftwo possible interpretations. .AL.LI.IX parameters, formalEach debugging information entry that is owned by a subroutine type entry andthat defines a single argument of a specific type has the tag.Cf DW_TAG_formal_parameter ..PThe formal parameter entry has a type attributeto denote the type of the corresponding formal parameter..LIThe unspecified parameters of a variable parameter list are represented by adebugging information entry owned by the subroutine type entry with the tag.Cf DW_TAG_unspecified_parameters ..IX parameters, unspecified.LE.H 2 "String Type Entries".I.IX string types.IX FortranA ``string'' is a sequence of characters that have specific semantics andoperations that separate them from arrays of characters. Fortran is one ofthe languages that has a string type..R.PA string type is represented by a debugging information entrywith the tag .Cf DW_TAG_string_type .If a name has been given to the string type in the source program,then the corresponding string type entry has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the string typename as it appears in the source program..PThe string type entry may have a.Cf DW_AT_string_lengthattribute whose value is a location descriptionyielding the location where the length of the stringis stored in the program. The string type entry may also have a.Cf DW_AT_byte_size attribute, whose constant value is the size in bytes of the datato be retrieved from the location referenced by the string lengthattribute. If no byte size attribute is present, the size of thedata to be retrieved is the same as the size of an address onthe target machine..PIf no string length attribute is present, the string type entry may havea .Cf DW_AT_byte_size attribute, whose constant value is the length in bytes ofthe string..H 2 "Set Entries".IPascal provides the concept of a ``set,'' which represents a group ofvalues of ordinal type..P.R.IX Pascal.IX set typesA set is represented by a debugging information entrywith the tag.Cf DW_TAG_set_type .If a name has been given to the set type,then the set type entry has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the set type nameas it appears in the source program..PThe set type entry has a .Cf DW_AT_typeattribute to denote the type of an element of the set. .PIf the amount of storage allocated to hold each element of an object ofthe given set type is different from the amount of storage that is normallyallocated to hold an individual object of the indicated element type, thenthe set type entry has a .Cf DW_AT_byte_size attribute, whose constant valuerepresents the size in bytes of an instance of the set type..H 2 "Subrange Type Entries".ISeveral languages support the concept of a ``subrange'' type object.These objects can represent a subset of the values that anobject of the basis type for the subrange can represent.Subrange type entries may also be used to represent the boundsof array dimensions..R.P.IX subrangesA subrange type is represented by a debugging information entrywith the tag.Cf DW_TAG_subrange_type .If a name has been given to the subrange type,then the subrange type entry has a .Cf DW_AT_name attributewhose value is a null-terminated string containing the subrange type nameas it appears in the source program..PThe subrange entry may have a .Cf DW_AT_typeattribute to describethe type of object of whose values this subrange is a subset..PIf the amount of storage allocated to hold each element of an object ofthe given subrange type is different from the amount of storage that is normallyallocated to hold an individual object of the indicated element type, thenthe subrange type entry has a.Cf DW_AT_byte_size attribute, whose constant valuerepresents the size in bytes of each element of the subrange type..PThe subrange entry may have the attributes.Cf DW_AT_lower_boundand.Cf DW_AT_upper_boundto describe, respectively, the lower and upper bound valuesof the subrange.The .Cf DW_AT_upper_boundattribute may be replaced by a.Cf DW_AT_countattribute, whose value describes the number of elements inthe subrange rather than the value of the last element.If a bound or count value is described by a constantnot represented in the program's address space and canbe represented by one of the constant attribute forms, then the valueof the lower or upper bound or count attribute may be one of the constanttypes. Otherwise, the value of the lower or upper bound or countattribute is a reference to a debugging information entry describingan object containing the bound value or itself describing a constantvalue. .PIf either the lower or upper bound or count values are missing, thebound value is assumed to be a language-dependent defaultconstant..P.I.IX C %c.IX C++ %caa.IX FortranThe default lower bound value for C or C++ is 0. For Fortran,it is 1. No other default values are currently defined by DWARF..R.PIf the subrange entry has no type attribute describing the basistype, the basis type is assumed to be the same as the objectdescribed by the lower bound attribute (if it references an object).If there is no lower bound attribute, or it does not referencean object, the basis type is the type of the upper bound or countattribute(if it references an object). If there is no upper bound or count attributeor it does not reference an object, the type is assumed to bethe same type, in the source languageof the compilation unit containing the subrange entry,as a signed integer with the same sizeas an address on the target machine..H 2 "Pointer to Member Type Entries".IIn C++, a pointer to a data or function member of a class orstructure is a unique type. .P.R.IX C++ %caa.IX members, pointers to.IX pointers to membersA debugging information entryrepresenting the type of an object that is a pointer to a structureor class member has the tag.Cf DW_TAG_ptr_to_member_type ..PIf the pointer to member type has a name, the pointer to member entryhas a .Cf DW_AT_name attribute, whose value is a null-terminated stringcontaining the type name as it appears in the source program..PThe pointer to member entry has a.Cf DW_AT_typeattribute to describethe type of the class or structure member to which objectsof this type may point..PThe pointer to member entry also has a.Cf DW_AT_containing_typeattribute, whose value is a reference to a debugging informationentry for the class or structure to whose members objects ofthis type may point..PFinally, the pointer to member entry has a.Cf DW_AT_use_locationattribute whose value is a location description that computesthe address of the member of the class or structure to which thepointer to member type entry can point..P.IThe method used to find the address of a given memberof a class or structure is common to any instance of thatclass or structure and to any instance of the pointer ormember type. The method is thus associatedwith the type entry, rather than with each instance of the type..PThe .Cf DW_AT_use_locationexpression, however, cannot be used on its own, but mustbe used in conjunction with the location expressions fora particular object of the given pointer to member typeand for a particular structure or class instance. The .Cf DW_AT_use_locationattribute expects two values to be pushed onto the location expressionstack before the.Cf DW_AT_use_locationexpression is evaluated. The first value pushed should bethe value of the pointer to member object itself.The second value pushed should be the base address of the entirestructure or union instance containing the member whoseaddress is being calculated..PSo, for an expression like.DS \f(CWobject.*mbr_ptr\fP.DEwhere \f(CWmbr_ptr\fP has some pointer to member type,a debugger should:.AL.LIPush the value of .Cf mbr_ptronto the location expression stack..LIPush the base address of.Cf object onto the location expression stack..LIEvaluate the .Cf DW_AT_use_locationexpression for the type of .Cf mbr_ptr ..LE.R.H 2 "File Type Entries".ISome languages, such as Pascal, provide a first class data typeto represent files..R.P.IX Pascal.IX file typesA file type is represented by a debugging information entrywith the tag.Cf DW_TAG_file_type.If the file type has a name, the file type entryhas a .Cf DW_AT_name attribute, whose value is a null-terminated stringcontaining the type name as it appears in the source program..PThe file type entry has a .Cf DW_AT_typeattribute describing the typeof the objects contained in the file..PThe file type entry also has a .Cf DW_AT_byte_size attribute, whose valueis a constant representing the size in bytes of an instanceof this file type. .OP.H 1 "OTHER DEBUGGING INFORMATION"This section describes debugging information thatis not represented in the form of debugging informationentries and is not contained within the .Cf .debug_infosection..H 2 "Accelerated Access".I.IX accelerated accessA debugger frequently needs to find the debugging information fora program object defined outside of the compilation unitwhere the debugged program is currently stopped. Sometimesit will know only the name of the object; sometimes only the address.To find the debugging informationassociated with a global object by name, using the DWARF debugging informationentries alone, a debugger would needto run through all entries at the highest scope within eachcompilation unit. For lookup by address, for a subroutine,a debugger can use the low and high pc attributesof the compilation unit entries to quickly narrow down the search,but these attributes only cover the range of addresses for the text associated with a compilationunit entry. To find the debugging information associated with adata object, an exhaustive search would be needed.Furthermore, any search through debugging information entries fordifferent compilation units within a large programwould potentially require the access of many memory pages,probably hurting debugger performance..R.PTo make lookups of program objects by name or by address faster,a producer of DWARF information may provide two different typesof tables containing information about the debugging informationentries owned by a particular compilation unit entry in a more condensedformat..H 3 "Lookup by Name".IX lookup, by nameFor lookup by name, a table is maintained in a separateobject file section called.Cf .debug_pubnames ..IX \f(CW.debug_pubnames\fP %debugapThe table consists of sets of variable length entries, eachset describing the names of global objects whose definitionsor declarations are represented by debugging information entriesowned by a single compilation unit. Each set beginswith a header containing four values: the total length of the entriesfor that set, not including the length field itself, a version number,the offset from the beginning of the.Cf .debug_info.IX \f(CW.debug_info\fP %debugaisection of the compilation unit entry referenced by the set andthe size in bytes of the contents of the.Cf .debug_infosection generated to represent that compilation unit. Thisheader is followed by a variable number of offset/name pairs.Each pair consists of the offset from the beginning of the compilationunit entry corresponding to the current set to the debugging information entry forthe given object, followed by a null-terminated characterstring representing the name of the object as given bythe.Cf DW_AT_nameattribute of the referenced debugging entry.Each set of names is terminated by zero..P.IX C++ %caa.IX members, static dataIn the case of the name of a static data member or function memberof a C++ structure, class or union, the name presentedin the .Cf .debug_pubnamessection is not the simple name given by the.Cf DW_AT_name attribute of the referenced debugging entry, but ratherthe fully class qualified name of the data or function member..IX identifiers, names.H 3 "Lookup by Address".IX lookup, by addressFor lookup by address, a table is maintained in a separateobject file section called.Cf .debug_aranges ..IX \f(CW.debug_aranges\fP %debugaarThe table consists of sets of variable length entries, eachset describing the portion of the program's address space thatis covered by a single compilation unit. Each set beginswith a header containing five values: .AL.LIThe total length of the entriesfor that set, not including the length field itself..LIA version number..LIThe offset from the beginning of the.Cf .debug_info.IX \f(CW.debug_info\fP %debugaisection of the compilation unit entry referenced by the set. .LIThe size in bytes of an address on the target architecture. Forsegmented addressing, this is the size of the offset portion of the.IX addresses, offset portion.IX addresses, size ofaddress..LI.IX address space, segmented.IX segmented address spaceThe size in bytes of a segment descriptor on the target architecture.If the target system uses a flat address space, this value is 0..LE.PThisheader is followed by a variable number of addressrange descriptors. Each descriptor is a pair consisting of the beginning addressof a range of text or data covered by some entry ownedby the corresponding compilation unit entry, followed by the lengthof that range. A particular set is terminated by an entry consistingof two zeroes. By scanning the table, a debugger can quicklydecide which compilation unit to look in to find the debugging informationfor an object that has a given address..H 2 "Line Number Information".I.IX line number informationA source-level debugger will need to know how to associate statements inthe source files with the corresponding machine instruction addresses inthe executable object or the shared objects used by that executableobject. Such an association would make it possible for the debugger userto specify machine instruction addresses in terms of source statements.This would be done by specifying the line number and the source filecontaining the statement. The debugger can also use this information todisplay locations in terms of the source files and to single step fromstatement to statement..R.PAs mentioned in section 3.1, above, the line number information generated for a compilation unitis represented in the \f(CW.debug_line\fP section of an object file and isreferenced by a corresponding compilation unit debugging information entryin the \f(CW.debug_info\fP section..IX \f(CW.debug_info\fP %debugai.IX \f(CW.debug_line\fP %debugali.I.PIf space were not a consideration, the informationprovided in the .Cf .debug_linesection could be represented as a large matrix,with one row for each instruction in the emittedobject code. The matrix would have columns for:.DL.LIthe source file name.LIthe source line number.LIthe source column number.LIwhether this instruction is the beginning of a source statement.LIwhether this instruction is the beginning of a basic block..LE.PSuch a matrix, however, would be impractically large. We shrink it withtwo techniques. First, we delete from the matrix each row whose file,line and source column information is identical with that of its predecessors.Second, we design a byte-coded language for a state machine and store a streamof bytes in the object file instead of the matrix. This language can bemuch more compact than the matrix. When a consumer of the statementinformation executes, it must ``run'' the state machine to generatethe matrix for each compilation unit it is interested in. The conceptof an encoded matrix also leaves room for expansion. In the future,columns can be added to the matrix to encode other things that arerelated to individual instruction addresses..R.H 3 "Definitions".IX line number information, definitionsThe following terms are used in the description of the line number informationformat:.VL 20.LI "state machine"The hypothetical machine used by a consumer of the line number information to expand the byte-coded instruction stream into a matrix of line number information..LI "statement program"A series of byte-coded line number information instructions representing onecompilation unit..LI "basic block"A sequence of instructions that is entered only at the first instructionand exited only at the last instruction. We define a procedure invocationto be an exit from a basic block..LI "sequence"A series of contiguous target machine instructions. One compilationunit may emit multiple sequences (that is, not all instructions withina compilation unit are assumed to be contiguous)..LI "sbyte"Small signed integer..LI "ubyte"Small unsigned integer..LI "uhalf"Medium unsigned integer..LI "sword"Large signed integer..LI "uword"Large unsigned integer..LI "LEB128".IX LEB128Variable length signed and unsigned data. See section 7.6..LE.H 3 "State Machine Registers".IX line number information, state machine registersThe statement information state machine has the following registers:.VL 20.LI "\f(CWaddress\fP"The program-counter value corresponding to a machine instruction generatedby the compiler..LI "\f(CWfile\fP"An unsigned integer indicating the identity of the source file correspondingto a machine instruction..IX source, files.LI "\f(CWline\fP".IX source, linesAn unsigned integer indicating a source line number. Lines are numberedbeginning at 1. The compiler may emit the value 0 in cases where aninstruction cannot be attributed to any source line..LI "\f(CWcolumn\fP".IX source, columnsAn unsigned integer indicating a column number within a source line.Columns are numbered beginning at 1. The value 0 is reserved to indicatethat a statement begins at the ``left edge'' of the line..LI "\f(CWis_stmt\fP"A boolean indicating that the current instruction is the beginning of astatement..LI "\f(CWbasic_block\fP"A boolean indicating that the current instruction is the beginning ofa basic block..LI "\f(CWend_sequence\fP"A boolean indicating that the current address is that of the firstbyte after the end of a sequence of target machine instructions..LE.PAt the beginning of each sequence within a statement program, thestate of the registers is:.DS.TS;lf(CW) l.address 0file 1line 1column 0is_stmt determined by \f(CWdefault_is_stmt\fP in the statement program prologuebasic_block ``false''end_sequence ``false''.TE.DE.H 3 "Statement Program Instructions"The state machine instructions in a statement program belong to oneof three categories:.VL 20.LI "special opcodes".IX line number information, special opcodesThese have a ubyte opcode field and no arguments. Most of the instructions in a statement program are special opcodes..LI "standard opcodes".IX line number information, standard opcodesThese have a ubyte opcode field which may be followed by zero or moreLEB128 arguments (except for .Cf DW_LNS_fixed_advance_pc ,see below).The opcode implies the number of arguments and their meanings, but the statement program prologue also specifies the number of arguments for each standard opcode..LI "extended opcodes".IX line number information, extended opcodesThese have a multiple byte format. The first byte is zero;the next bytes are an unsigned LEB128 integer giving the number of bytesin the instruction itself (does not include the first zero byte or the size).The remaining bytes are the instruction itself..LE.H 3 "The Statement Program Prologue".IX line number information, prologueThe optimal encoding of line number information depends to a certaindegree upon the architecture of the target machine. The statement programprologue provides information used by consumers in decoding the statementprogram instructions for a particular compilation unit and also providesinformation used throughout the rest of the statement program. The statementprogram for each compilation unit begins with a prologue containing thefollowing fields in order:.AL.LI.Cf total_length (uword).brThe size in bytes of the statement information for this compilation unit(not including the .Cf total_lengthfield itself)..LI.Cf version(uhalf).brVersion identifier for the statement information format..LI.Cf prologue_length (uword).brThe number of bytes following the .Cf prologue_lengthfield to the beginning of the first byte of the statement program itself..LI.Cf minimum_instruction_length(ubyte).brThe size in bytes of the smallest target machine instruction. Statementprogram opcodes that alter the .Cf address register first multiply their operands by this value..LI.Cf default_is_stmt(ubyte).brThe initial value of the .Cf is_stmtregister. .P.IA simple code generatorthat emits machine instructions in the order implied by the source programwould set this to ``true,'' and every entry in the matrix would representa statement boundary. A pipeline scheduling code generator would setthis to ``false'' and emit a specific statement program opcode for eachinstruction that represented a statement boundary..R.LI.Cf line_base (sbyte).brThis parameter affects the meaning of the special opcodes. See below..LI.Cf line_range (ubyte).brThis parameter affects the meaning of the special opcodes. See below..LI.Cf opcode_base(ubyte).brThe number assigned to the first special opcode..LI.Cf standard_opcode_lengths(array of ubyte).brThis array specifies the number of LEB128 operands for each ofthe standard opcodes. The first element of the array correspondsto the opcode whose value is 1, and the last element correspondsto the opcode whose value is .Cf "opcode_base - 1" . By increasing.Cf opcode_base , and adding elements to this array, new standard opcodescan be added, while allowing consumers who do not know about thesenew opcodes to be able to skip them..LI.Cf include_directories(sequence of path names).brThe sequence contains an entry for each path that was searchedfor included source files in this compilation. (The paths includethose directories specified explicitly by the user for the compilerto search and those the compiler searches without explicit direction).Each path entry is either a fullpath name or is relative to the current directory of the compilation.The current directory of the compilation is understood to be the first entryand is not explicitly represented. Each entry is a null-terminatedstring containing a full path name. The last entry is followed bya single null byte..LI.Cf file_names(sequence of file entries).br.IX source, filesThe sequence contains an entry for each source file that contributedto the statement information for this compilation unit or isused in other contexts, such as in a declaration coordinateor a macro file inclusion. Each entryhas a null-terminated string containing the file name, an unsigned LEB128 number representing the directory index of thedirectory in which the file was found, an unsigned LEB128 number representing the time of last modification forthe file and an unsigned LEB128 number representing the length inbytes of the file. A compiler may choose to emit LEB128(0) for thetime and length fields to indicate that this information is notavailable. The last entry is followed by a single null byte..PThe directory index represents an entry in the.Cf include_directoriessection. The index is LEB128(0) if the file was found inthe current directory of the compilation, LEB128(1) if it wasfound in the first directory in the.Cf include_directoriessection, and so on. The directory index is ignored for file namesthat represent full path names..PThe statement program assigns numbers to each of the file entriesin order, beginning with 1, and uses those numbers instead of filenames in the .Cf file register..PA compiler may generate a single null byte for the file names fieldand define file names using the extended opcode.Cf DEFINE_FILE ..LE.H 3 "The Statement Program"As stated before, the goal of a statement program is to build a matrix representingone compilation unit, which may have produced multiple sequences oftarget-machine instructions. Within a sequence, addresses may only increase.(Line numbers may decrease in cases of pipeline scheduling.).H 4 "Special Opcodes".IX line number information, special opcodesEach 1-byte special opcode has the following effect on the state machine:.AL.LIAdd a signed integer to the .Cf line register..LIMultiply an unsigned integer by the .Cf minimum_instruction_lengthfield of the statement program prologue and add the result to the .Cf address register..LIAppend a row to the matrix using the current values of the state machineregisters..LISet the .Cf basic_block register to ``false.''.LE.PAll of the special opcodes do those same four things; they differ from one anotheronly in what values they add to the .Cf line and .Cf address registers..P.IInstead of assigning a fixed meaning to each special opcode, the statementprogram uses severalparameters in the prologue to configure the instruction set. There are tworeasons for this.First, although the opcode space available for special opcodes nowranges from 10 through 255, the lower bound may increase if one adds newstandard opcodes. Thus, the .Cf opcode_basefield of the statement programprologue gives the value of the first special opcode.Second, the best choice of special-opcode meanings depends on the targetarchitecture. For example, for a RISC machine where the compiler-generated codeinterleaves instructions from different lines to schedule the pipeline,it is important to be able to add a negative value to the .Cf line registerto express the fact that a later instruction may have been emitted for anearlier source line. For a machine where pipeline scheduling never occurs,it is advantageous to trade away the ability to decrease the .Cf line register(a standard opcode provides an alternate way to decrease the line number) inreturn for the ability to add larger positive values to the .Cf addressregister. To permit this variety of strategies, the statement program prologue defines a .Cf line_basefield that specifies the minimum value which a special opcode can addto the .Cf lineregister and a .Cf line_rangefield that defines the range ofvalues it can add to the .Cf line register..R.PA special opcode value is chosen based on the amount that needs tobe added to the .Cf lineand .Cf addressregisters. The maximum line incrementfor a special opcode is the value of the .Cf line_basefield in theprologue, plus the value of the .Cf line_range field, minus 1 (\f(CWline base + line range - 1\fP). If the desired line incrementis greater than the maximum line increment, a standard opcodemust be used instead of a special opcode.The ``address advance'' is calculated by dividing the desired addressincrement by the .Cf minimum_instruction_lengthfield from theprologue. The special opcode is then calculated using the followingformula:.br \f(CWopcode = (desired line increment - line_base) +.br (line_range * address advance) + opcode_base\fP.brIf the resulting opcode is greater than 255, a standard opcodemust be used instead..PTo decode a special opcode, subtract the .Cf opcode_basefromthe opcode itself. The amount to increment the .Cf address register isthe adjusted opcode divided by the .Cf line_range .The amount toincrement the .Cf line register is the .Cf line_baseplus the resultof the adjusted opcode modulo the .Cf line_range .That is,.br \f(CWline increment = line_base + (adjusted opcode % line_range)\fP.br.P.IAs an example, suppose that the .Cf opcode_base is 16, .Cf line_baseis -1 and .Cf line_rangeis 4.This means that we can use a special opcode whenever two successiverows in the matrix have source line numbers differing by any value withinthe range [-1, 2] (and, because of the limited number of opcodes available,when the difference between addresses is within the range [0, 59])..PThe opcode mapping would be:.R.DS.TSbox center;l l lnf(CW) nf(CW) nf(CW).Opcode Line advance Address advance_16 -1 017 0 018 1 019 2 020 -1 121 0 122 1 123 2 1... ... ...253 0 59254 1 59255 2 59.TE.DE.PThere is no requirement that the expression \f(CW255 - line_base + 1\fP be anintegral multiple of .Cf line_range ..H 4 "Standard Opcodes".IX line number information, standard opcodesThere are currently 9 standard ubyte opcodes. In the future additional ubyte opcodes may be defined by setting the .Cf opcode_basefield in the statement programprologue to a value greater than 10..AL.LI.Cf DW_LNS_copy .brTakes no arguments. Append a row to the matrix using the current values ofthe state-machine registers. Then set the .Cf basic_blockregister to ``false.''.LI.Cf DW_LNS_advance_pc.brTakes a single unsigned LEB128 operand,multiplies it by the.Cf minimum_instruction_lengthfield of the prologue, and adds the result to the.Cf addressregister of the state machine..LI.Cf DW_LNS_advance_line.brTakes a single signed LEB128 operand and addsthat value to the .Cf lineregister of the state machine..LI.Cf DW_LNS_set_file .brTakes a single unsigned LEB128 operand and storesit in the .Cf fileregister of the state machine..LI.Cf DW_LNS_set_column.brTakes a single unsigned LEB128 operand and storesit in the .Cf column register of the state machine..LI.Cf DW_LNS_negate_stmt.brTakes no arguments.Set the .Cf is_stmtregister of the state machine to thelogical negation of its current value..LI.Cf DW_LNS_set_basic_block.brTakes no arguments. Set the .Cf basic_block register of the state machine to ``true.''.LI.Cf DW_LNS_const_add_pc.brTakes no arguments.Add to the .Cf address register of the state machine theaddress increment value corresponding to specialopcode 255..P.IThe motivation for .Cf DW_LNS_const_add_pc is this: when the statement program needsto advance the address by a small amount, it can use a single specialopcode, which occupies a single byte. When it needs to advance theaddress by up to twice the range of the last special opcode, it can use.Cf DW_LNS_const_add_pc followed by a special opcode, for a total of two bytes.Only if it needs to advance the address by more than twice that rangewill it need to use both.Cf DW_LNS_advance_pcand a special opcode, requiring three or more bytes..R.LI.Cf DW_LNS_fixed_advance_pc.brTakes a single uhalf operand. Add to the .Cf address register of the state machine the value of the (unencoded) operand.This is the only extended opcode that takes an argument that is nota variable length number..P.IThe motivation for .Cf DW_LNS_fixed_advance_pcis this: existing assemblers cannot emit .Cf DW_LNS_advance_pcor special opcodes because they cannot encode LEB128 numbersor judge when the computation of a special opcode overflows and requiresthe use of .Cf DW_LNS_advance_pc .Such assemblers, however, can use.Cf DW_LNS_fixed_advance_pcinstead, sacrificing compression. .R.LE.H 4 "Extended Opcodes".IX line number information, extended opcodesThere are three extended opcodes currently defined. The first bytefollowing the length field of the encoding for each contains a sub-opcode..AL.LI\f(CWDW_LNE_end_sequence\fP .brSet the .Cf end_sequence register of the state machineto ``true'' and append a row to the matrix using thecurrent values of the state-machine registers. Thenreset the registers to the initial values specifiedabove..PEvery statement program sequence must end with a.Cf DW_LNE_end_sequenceinstruction which creates arow whose address is that of the byte after the last target machine instructionof the sequence..LI\f(CWDW_LNE_set_address\fP.brTakes a single relocatable address as an operand. The size of theoperand is the size appropriate to hold an address on the target machine.Set the .Cf address register to the value given by therelocatable address. .P.IAll of the other statement program opcodes that affect the .Cf address register add a delta to it. This instruction stores a relocatable value into it instead..R.LI\f(CWDW_LNE_define_file\fP.br.IX source, filesTakes 4 arguments. The first is a null terminated string containing asource file name. The second is anunsigned LEB128 number representing the directory index of thedirectory in which the file was found.The third is an unsigned LEB128 number representingthe time of last modification of the file. The fourth is an unsignedLEB128 number representing the length in bytes of the file.The time and length fields may contain LEB128(0) if the information isnot available..PThe directory index represents an entry in the.Cf include_directoriessection of the statement program prologue. The index is LEB128(0) if the file was found inthe current directory of the compilation, LEB128(1) if it wasfound in the first directory in the.Cf include_directoriessection, and so on. The directory index is ignored for file namesthat represent full path names..PThe files are numbered, starting at 1,in the order in which they appear; the names in the prologuecome before names defined by the.Cf DW_LNE_define_fileinstruction.These numbers are used in the the .Cf file register of the state machine..LE.P.IAppendix 3 gives some sample statement programs..R.H 2 "Macro Information".I.IX macro information.IX pre-processor.IX C %c.IX C++ %caaSome languages, such as C and C++, provide a way to replace textin the source program with macros defined either in the sourcefile itself, or in another file included by the source file.Because these macros are not themselves defined in the targetlanguage, it is difficult to represent their definitionsusing the standard language constructs of DWARF. The debugginginformation therefore reflects the state of the source afterthe macro definition has been expanded, rather than as theprogrammer wrote it.The macro information table provides a way of preserving the originalsource in the debugging information..R.PAs described in section 3.1, the macro information for a givencompilation unit is represented in the.Cf .debug_macinfo.IX \f(CW.debug_macinfo\fP %debugamsection of an object file. The macro information for each compilationunit is represented as a series of ``macinfo'' entries. Eachmacinfo entry consists of a ``type code'' and up to two additionaloperands. The series of entries for a given compilation unitends with an entry containing a type code of 0..H 3 "Macinfo Types"The valid macinfo types are as follows:.VL 30.LI \f(CWDW_MACINFO_define\fPA macro definition..LI \f(CWDW_MACINFO_undef\fPA macro un-definition..LI \f(CWDW_MACINFO_start_file\fPThe start of a new source file inclusion..LI \f(CWDW_MACINFO_end_file\fPThe end of the current source file inclusion..LI \f(CWDW_MACINFO_vendor_ext\fPVendor specific macro information directives that do not fitinto one of the standard categories..LE.H 4 "Define and Undefine Entries".IX macro information, define and undefine entriesAll .Cf DW_MACINFO_defineand .Cf DW_MACINFO_undefentries have two operands.The first operand encodes the line number of the source line.IX source, lineson which the relevant defining or undefiningpre-processor directives appeared..P The second operand consists of a null-terminated character string.In the case of a .Cf DW_MACINFO_undef entry, the value of thisstring will be simply the name of the pre-processorsymbol which was undefined at the indicated source line..PIn the case of a .Cf DW_MACINFO_defineentry, the value of thisstring will be the name of the pre-processor symbolthat was defined at the indicated source line,followed immediately by the macro formal parameterlist including the surrounding parentheses (in thecase of a function-like macro) followed by thedefinition string for the macro. If there is noformal parameter list, then the name of the definedmacro is followed directly by its definition string..PIn the case of a function-like macro definition, nowhitespace characters should appear between thename of the defined macro and the following leftparenthesis. Also, no whitespace characters shouldappear between successive formal parameters in theformal parameter list. (Successive formal parametersshould, however, be separated by commas.) Also, exactlyone space charactershould separate the right parenthesis which terminatesthe formal parameter list and the following definitionstring..PIn the case of a ``normal'' (i.e. non-function-like)macro definition, exactly one space charactershould separate the name of the defined macro from the following definitiontext..H 4 "Start File Entries".IX macro information, start file entriesEach .Cf DW_MACINFO_start_fileentry also has two operands. The first operandencodes the line number of thesource line on which the inclusion pre-processordirective occurred..P.IX source, filesThe second operand encodes asource file name index. This index corresponds to a filenumber in the statement information table for the relevantcompilation unit. This indexindicates (indirectly) the name of the filewhich is being included by the inclusion directive onthe indicated source line..H 4 "End File Entries".IX macro information, end file entriesA .Cf DW_MACINFO_end_file entry has no operands. The presence of the entry marks the end ofthe current source file inclusion..H 4 "Vendor Extension Entries".IX macro information, vendor extensions.IX vendor extensionsA.Cf DW_MACINFO_vendor_extentry has two operands.The first is a constant. The second is a null-terminatedcharacter string.The meaning and/or significance of these operands isintentionally left undefined by this specification..PA consumer must be able to totally ignore all.Cf DW_MACINFO_vendor_extentries that it does not understand..H 3 "Base Source Entries".IX macro information, base source entriesIn addition to producing a matched pair of.Cf DW_MACINFO_start_file and .Cf DW_MACINFO_end_fileentries for each inclusion directive actually processed duringcompilation, a producer should generate such a matchedpair also for the ``base'' source file submitted to thecompiler for compilation. If the base source file.IX source, filesfor a compilation is submitted to the compiler viasome means other than via a named disk file (e.g. viathe standard input \fIstream\fP on a UNIX system) then thecompiler should still produce this matched pair of.Cf DW_MACINFO_start_fileand .Cf DW_MACINFO_end_file entries forthe base source file, however, the file name indicated(indirectly) by the .Cf DW_MACINFO_start_fileentry of thepair should reference a statement information file name entry consistingof a null string..H 3 "Macinfo Entries for Command Line Options".IX macro information, command line optionsIn addition to producing.Cf DW_MACINFO_define and.Cf DW_MACINFO_undefentries for each of the define andundefine directives processed during compilation, theDWARF producer should generate a .Cf DW_MACINFO_define or.Cf DW_MACINFO_undefentry for each pre-processor symbolwhich is defined or undefined by somemeans other than via a define or undefine directivewithin the compiled source text. In particular,pre-processor symbol definitions and un-definitionswhich occur as a result of command line options(when invoking the compiler) should be represented bytheir own .Cf DW_MACINFO_defineand .Cf DW_MACINFO_undefentries..PAll such .Cf DW_MACINFO_defineand .Cf DW_MACINFO_undefentries representing compilation options should appear before the first .Cf DW_MACINFO_start_fileentry for that compilation unit and should encode the value0 in their line number operands..H 3 " General Rules and Restrictions".IX line number information, general rulesAll macinfo entries within a .Cf .debug_macinfo section for a given compilation unit should appear in the same orderin which the directives were processed by the compiler..PAll macinfo entries representing command line optionsshould appear in the same order as the relevant commandline options were given to the compiler. In the casewhere the compiler itself implicitly supplies one ormore macro definitions or un-definitions in additionto those which may be specified on the command line,macinfo entries should also be produced for theseimplicit definitions and un-definitions, andthese entries should also appear in the proper orderrelative to each other and to any definitions orundefinitions given explicitly by the user on thecommand line..H 2 "Call Frame Information".IX call frame information.IX activations.IDebuggers often need to be able to view and modify the state of anysubroutine activation that is on the call stack. An activationconsists of:.BL.LIA code location that is within the subroutine. This location iseither the place where the program stopped when the debugger gotcontrol (e.g. a breakpoint), or is a place where a subroutinemade a call or was interrupted by an asynchronous event (e.g. asignal)..LIAn area of memory that is allocated on a stack called a ``callframe.'' The call frame is identified by an address on thestack. We refer to this address as the Canonical Frame Address or CFA..LIA set of registers that are in use by the subroutine at the codelocation..LE.PTypically, a set of registers are designated to be preserved across acall. If a callee wishes to use such a register, it saves the valuethat the register had at entry time in its call frame and restores iton exit. The code that allocates space on the call frame stack andperforms the save operation is called the subroutine's prologue, and thecode that performs the restore operation and deallocates the frame iscalled its epilogue. Typically, the prologue code is physically at thebeginning of a subroutine and the epilogue code is at the end..PTo be able to view or modify an activation that is not on the top ofthe call frame stack, the debugger must ``virtually unwind'' the stack ofactivations until it finds the activation of interest. A debugger unwinds astack in steps. Starting with the current activation it restores anyregisters that were preserved by the current activation and computes thepredecessor's CFA and code location. This has the logical effect ofreturning from the current subroutine to its predecessor. We say thatthe debugger virtually unwinds the stack because it preserves enoughinformation to be able to ``rewind'' the stack back to the state it wasin before it attempted to unwind it..PThe unwinding operation needs to know where registers are saved and howto compute the predecessor's CFA and code location. When consideringan architecture-independent way of encoding this information one has toconsider a number of special things..BL.LIPrologue and epilogue code is not always in distinct blocks at thebeginning and end of a subroutine. It is common to duplicate theepilogue code at the site of each return from the code. Sometimesa compiler breaks up the register save/unsave operations and movesthem into the body of the subroutine to just where they are needed..LICompilers use different ways to manage the call frame. Sometimesthey use a frame pointer register, sometimes not..LIThe algorithm to compute the CFA changes as you progress throughthe prologue and epilogue code. (By definition, the CFA valuedoes not change.).LISome subroutines have no call frame..LISometimes a register is saved in another register that byconvention does not need to be saved..LISome architectures have special instructions thatperform some or all of the register management in one instruction,leaving special information on the stack that indicates howregisters are saved..LISome architectures treat return address valuesspecially. For example, in one architecture, the call instruction guarantees that the low order twobits will be zero and the return instruction ignores those bits.This leaves two bits of storage that are available to other usesthat must be treated specially..LE.R.H 3 "Structure of Call Frame Information".IX call frame information, structureDWARF supports virtual unwinding by defining an architecture independentbasis for recording how procedures save and restore registers throughouttheir lifetimes. This basis must be augmented on some machines withspecific information that is defined by either an architecture specificABI authoring committee, a hardware vendor, or a compiler producer..IX ABI.IX vendor extensionsThe body defining a specific augmentation is referred tobelow as the ``augmenter.''.PAbstractly, this mechanism describes a very large table that has thefollowing structure:.TScenter;l l l l l ll s s s s s.LOC CFA R0 R1 ... RNL0L1\...LN.TE.PThe first column indicates an address for every location that containscode in a program. (In shared objects, this is an object-relativeoffset.) The remaining columns contain virtual unwinding rules that areassociated with the indicated location. The first column of the rulesdefines the CFA rule which is a register and a signed offset that areadded together to compute the CFA value..PThe remaining columns are labeled by register number. This includessome registers that have special designation on some architectures suchas the PC and the stack pointer register. (The actual mapping ofregisters for a particular architecture is performed by the augmenter.)The register columns contain rules that describewhether a given register has been saved and the rule to find the value for the register in the previous frame..PThe register rules are:.IX call frame information, register rules.VL 20.LI "undefined"A register that has this rule has no value in theprevious frame. (By convention, it is not preserved by a callee.).LI "same value"This register has not been modified from theprevious frame. (By convention, it is preserved by the callee,but the callee has not modified it.).LI "offset(N)"The previous value of this register is saved at the address CFA+N whereCFA is the current CFA value and N is a signed offset..LI "register(R)"The previous value of this register is stored inanother register numbered R..LI "architectural"The rule is defined externally to this specification by the augmenter..LE.P.IThis table would be extremely large if actually constructed asdescribed. Most of the entries at any point in the table are identicalto the ones above them. The whole table can be represented quitecompactly by recording just the differences starting at the beginningaddress of each subroutine in the program..R.PThe virtual unwind information is encoded in a self-contained sectioncalled .Cf .debug_frame . .IX \f(CW.debug_frame\fP %debugafEntries in a .Cf .debug_framesection are aligned on.IX call frame information, Common Information Entryan addressing unit boundary and come in two forms: A Common InformationEntry (CIE) and a Frame Description Entry (FDE).Sizes of data objects used in the encoding of the .Cf .debug_framesection are described in terms of the same data definitionsused for the line number information (see section 6.2.1)..PA Common Information Entry holds information that is shared among manyFrame Descriptors. There is at least one CIE in every non-empty.Cf .debug_frame section. A CIE contains the following fields, in order:.AL.LI \f(CWlength\fP.brA uword constant that gives the number of bytes of the CIEstructure, not including the length field, itself (length mod <addressing unit size> == 0)..LI \f(CWCIE_id\fP.brA uword constant that is used to distinguish CIEsfrom FDEs..LI\f(CWversion\fP.brA ubyte version number. This number is specific to the call frameinformation and is independent of the DWARF version number..LI \f(CWaugmentation\fP.brA null terminated string that identifies theaugmentation to this CIE or to the FDEs that useit. If a reader encounters an augmentation string that isunexpected, then only the following fields can be read:CIE: .Cf length , .Cf CIE_id , .Cf version , .Cf augmentation ;FDE:.Cf length , .Cf CIE_pointer , .Cf initial_location , .Cf address_range .If there is no augmentation, this value is a zero byte..LI \f(CWcode_alignment_factor\fP.brAn unsigned LEB128 constant that is factored outof all advance location instructions (see below)..LI \f(CWdata_alignment_factor\fP.brA signed LEB128 constant that is factored outof all offset instructions (see below.).LI \f(CWreturn_address_register\fP.brA ubyte constant that indicateswhich column in the rule table represents the return addressof the function. Note that this column might not correspondto an actual machine register..LI \f(CWinitial_instructions\fP.brA sequence of rules that are interpreted tocreate the initial setting of each column in the table..LI \f(CWpadding\fP.brEnough .Cf DW_CFA_nopinstructions to make the size of this entrymatch the .Cf lengthvalue above..LE.PAn FDE contains the following fields, in order:.IX call frame information, Frame Description Entry.AL.LI \f(CWlength\fP.brA uword constant that gives the number of bytes of the headerand instruction stream for this function (not including the lengthfield itself) (length mod <addressing unit size> == 0)..LI \f(CWCIE_pointer\fP.brA uword constant offset into the.Cf .debug_frame section that denotes the CIE that is associated with this FDE..LI \f(CWinitial_location\fPAn addressing-unit sized constant indicatingthe address of the first location associated with this table entry..LI \f(CWaddress_range\fP.brAn addressing unit sized constant indicating thenumber of bytes of program instructions described by this entry..LI \f(CWinstructions\fP.brA sequence of table defining instructions that aredescribed below..LE.H 3 "Call Frame Instructions".IX call frame information, instructionsEach call frame instruction is defined totake 0 or more operands. Some of the operands may beencoded as part of the opcode (see section 7.23).The instructions are as follows:.AL.LI .Cf DW_CFA_advance_loctakes a single argument that represents a constant delta.The required action is tocreate a new table row with a location value thatis computed by taking the current entry's location value andadding (delta * \f(CWcode_alignment_factor\fP). All other values in thenew row are initially identical to the current row..LI .Cf DW_CFA_offsettakes two arguments: an unsigned LEB128 constant representing a factored offsetand a register number. The required action isto change the rule for the register indicated by the registernumber to be an offset(N) rule with a value of(N = factored offset * \f(CWdata_alignment_factor\fP)..LI .Cf DW_CFA_restoretakes a single argument that represents a register number.The required action isto change the rule for the indicated register to the rule assigned it by the \f(CWinitial_instructions\fP in the CIE..LI .Cf DW_CFA_set_loctakes a single argument that represents an address.The required action is to create a new table rowusing the specified address as the location. All other values in thenew row are initially identical to the current row.The new location value should always be greater than the currentone..LI .Cf DW_CFA_advance_loc1takes a single ubyte argument that represents a constant delta.This instruction is identical to .Cf DW_CFA_advance_locexcept for the encoding and size of the delta argument..LI .Cf DW_CFA_advance_loc2takes a single uhalf argument that represents a constant delta.This instruction is identical to .Cf DW_CFA_advance_locexcept for the encoding and size of the delta argument..LI .Cf DW_CFA_advance_loc4takes a single uword argument that represents a constant delta.This instruction is identical to .Cf DW_CFA_advance_locexcept for the encoding and size of the delta argument..LI .Cf DW_CFA_offset_extendedtakes two unsigned LEB128 arguments representing a register numberand a factored offset.This instruction is identical to .Cf DW_CFA_offsetexcept for the encoding and size of the register argument..LI .Cf DW_CFA_restore_extendedtakes a single unsigned LEB128 argument that represents a register number.This instruction is identical to .Cf DW_CFA_restoreexcept for the encoding and size of the register argument..LI .Cf DW_CFA_undefinedtakes a single unsigned LEB128 argument that represents a register number.The required action is to set the rule for the specified registerto ``undefined.''.LI .Cf DW_CFA_same_valuetakes a single unsigned LEB128 argument that represents a register number.The required action is to set the rule for the specified registerto ``same value.''.LI .Cf DW_CFA_registertakes two unsigned LEB128 arguments representing register numbers.The required action is to set the rule for the first registerto be the second register..LI \f(CWDW_CFA_remember_state\fP.LI \f(CWDW_CFA_restore_state\fP.brThese instructions define a stack of information. Encountering the .Cf DW_CFA_remember_stateinstruction means to save the rules for every registeron the current row on the stack. Encountering the.Cf DW_CFA_restore_stateinstruction means to pop the set of rulesoff the stack and place them in the current row. .I(Thisoperation is useful for compilers that move epiloguecode into the body of a function.).R.LI.Cf DW_CFA_def_cfatakes two unsigned LEB128 arguments representing aregister number and an offset.The required action is to define the current CFA ruleto use the provided register and offset..LI .Cf DW_CFA_def_cfa_registertakes a single unsigned LEB128 argument representing a registernumber. The required action is to define the current CFArule to use the provided register (but to keep the old offset)..LI .Cf DW_CFA_def_cfa_offsettakes a single unsigned LEB128 argument representing an offset.The required action is to define the current CFArule to use the provided offset (but to keep the old register)..LI .Cf DW_CFA_nophas no arguments and no required actions. It is used as paddingto make the FDE an appropriate size..LE.H 3 "Call Frame Instruction Usage".IX call frame information, usage.ITo determine the virtual unwind rule set for a given location (L1), onesearches through the FDE headers looking at the .Cf initial_locationand.Cf address_rangevalues to see if L1 is contained in the FDE. If so, then:.AL.LIInitialize a register set by reading the .Cf initial_instructionsfield of the associated CIE..LIRead and process the FDE's instruction sequence until a.Cf DW_CFA_advance_loc ,.Cf DW_CFA_set_loc ,or the end of the instruction stream isencountered..LIIf a .Cf DW_CFA_advance_locor .Cf DW_CFA_set_locinstruction was encountered, thencompute a new location value (L2). If L1 >= L2 then process theinstruction and go back to step 2..LIThe end of the instruction stream can be thought of as a.br\f(CWDW_CFA_set_loc( initial_location + address_range )\fP .brinstruction. Unless the FDE is ill-formed, L1 should be less than L2 at this point..LE.PThe rules in the register set now apply to location L1..PFor an example, see Appendix 5..R.OP.H 1 "DATA REPRESENTATION"This section describes the binary representation of the debugginginformation entry itself, of theattribute types and of other fundamental elements described above..H 2 "Vendor Extensibility".IX vendor extensionsTo reserve a portion of the DWARF name space and ranges ofenumeration values for use for vendor specific extensions,.IX tags.IX types, base.IX base types.IX locations, expressions.IX calling conventions.IX call frame informationspecial labels are reserved for tag names, attribute names,base type encodings, location operations, language names,calling conventions and call frame instructions.The labels denoting the beginning and end of the reserved valuerange for vendor specific extensions consist of the appropriate prefix (.Cf DW_TAG ,.Cf DW_AT ,.Cf DW_ATE ,.Cf DW_OP ,.Cf DW_LANG ,.CF DW_CCor.Cf DW_CFArespectively) followed by .Cf _lo_useror .Cf _hi_user .For example, for entry tags, the special labels are.Cf DW_TAG_lo_userand.Cf DW_TAG_hi_user .Values in the range between \fIprefix\fP\f(CW_lo_user\fP and\fIprefix\fP\f(CW_hi_user\fPinclusive, are reserved for vendor specific extensions.Vendors may use values in this range withoutconflicting with current or future system-defined values.All other values are reserved for use by the system..PVendor defined tags, attributes, base type encodings, location atoms, language names, calling conventions and call frame instructions, conventionally use the form\fIprefix\f(CW_\fIvendor_id\f(CW_\fIname\fR, where \fIvendor_id\fP is some identifying character sequence chosen so as to avoid conflicts with othervendors..P.IX compatibilityTo ensure that extensions added by one vendor may be safely ignoredby consumers that do not understand those extensions, the following rules should be followed:.AL.LINew attributes should be added in such a way that a debugger may recognizethe format of a new attribute value without knowing the content of thatattribute value..LIThe semantics of any new attributes should not alter the semantics ofpreviously existing attributes..LIThe semantics of any new tagsshould not conflict with the semantics of previously existing tags..LE.H 2 "Reserved Error Values".IX error valuesAs a convenience for consumers of DWARF information,the value 0 is reserved in the encodings for attribute names, attributeforms, base type encodings, location operations, languages,statement program opcodes, macro information entries and tag namesto represent an error condition or unknown value. DWARF doesnot specify names for these reserved values, since they do notrepresent valid encodings for the given type and should not appearin DWARF debugging information..H 2 "Executable Objects and Shared Objects"The relocated addresses in the debugging information for an executableobject are virtual addresses and the relocated addresses in thedebugging information for a shared object are offsets relative tothe start of the lowest segment used by that shared object..P.IThis requirement makes the debugging information for shared objectsposition independent.Virtual addresses in a shared object may be calculated by adding theoffset to the base address at which the object was attached.This offset is available in the run-time linker's data structures..H 2 "File Constraints"All debugging information entries in a relocatable object file, executable object or sharedobject are required to be physically contiguous..H 2 "Format of Debugging Information".IX Version 2For each compilation unit compiled with a DWARF Version 2 producer,.IX compilation units.IX compilation units, headera contribution is made to the.Cf .debug_info.IX \f(CW.debug_info\fP %debugaisection of the object file. Each such contribution consists ofa compilation unit header followed by a series of debugging informationentries. Unlike the information encoding for DWARF Version 1, Version 2.IX Version 1debugging information entries do not themselves contain the debugginginformation entry tag or the attribute name and form encodings foreach attribute. Instead, each debugging information entry begins witha code that represents an entry in a separate abbreviations table.This code is followed directly by a series of attribute values.The appropriate entry in the abbreviations table guides the interpretationof the information contained directly in the .Cf .debug_infosection. Each compilation unit is associated with a particularabbreviation table, but multiple compilation units may sharethe same table. .IX abbreviations table.I.PThis encoding was based on the observation that typical DWARF producersproduce a very limited number of different types of debugging informationentries. By extracting the common information from those entriesinto a separate table, we are able to compress the generated information..R.H 3 "Compilation Unit Header".IX compilation units, headerThe header for the series of debugging information entries contributedby a single compilation unit consists of the following information:.AL.LIA 4-byte unsigned integer representing the length of the.Cf .debug_infocontribution for that compilation unit, not including the length field itself..LIA 2-byte unsigned integer representing the version of the DWARF informationfor that compilation unit. For DWARF Version 2, the value in this field is 2..IX Version 2.LIA 4-byte unsigned offset into the .Cf .debug_abbrev.IX \f(CW.debug_abbrev\fP %debugaabsection. This offset associates the compilation unit with a particularset of debugging information entry abbreviations..LI.IX segmented address space.IX address space, segmented.IX addresses, size ofA 1-byte unsigned integer representing the size in bytes of an addresson the target architecture. If the system uses segmented addressing,this value represents the size of the offset portion of an address..IX addresses, offset portion.LE.P.IThe compilation unit header does not replace the.Cf DW_TAG_compile_unitdebugging information entry. It is additional information thatis represented outside the standard DWARF tag/attributes format..R.H 3 "Debugging Information Entry"Each debugging information entry begins with an unsigned LEB128.IX debugging information entriesnumber containing the abbreviation code for the entry.This code represents an entry within the abbreviation table associatedwith the compilation unit containing this entry. The abbreviation.IX abbreviations tablecode is followed by a series of attribute values..IX attributes, values.POn some architectures, there are alignment constraints on section boundaries.To make it easier to pad debugging information sections to satisfysuch constraints, the abbreviation code 0 is reserved. Debugginginformation entries consisting of only the 0 abbreviation code are considerednull entries..IX debugging information entries, null entries.H 3 "Abbreviation Tables".IX abbreviations tableThe abbreviation tables for all compilation units are contained ina separate object file section called.Cf .debug_abbrev ..IX \f(CW.debug_abbrev\fP %debugaabAs mentioned before, multiple compilation units may share the sameabbreviation table. .PThe abbreviation table for a single compilationunit consists of a series of abbreviation declarations.Each declaration specifies the tag and attributes for a particular.IX tags.IX attributesform of debugging information entry. Each declaration begins withan unsigned LEB128 number representing the abbreviation code itself.It is this code that appears at the beginning of a debugging informationentry in the.Cf .debug_infosection. As described above, the abbreviation code 0 is reserved for nulldebugging information entries.The abbreviation code is followed by another unsigned LEB128number that encodes the entry's tag..IX tags.nr aX \n(Fg+1.nr bX \n(Fg+2The encodings for the tag names are given in Figures \n(aXand \n(bX..DF.TSbox center;l llf(CW) lf(CW). Tag name Value_DW_TAG_array_type 0x01DW_TAG_class_type 0x02DW_TAG_entry_point 0x03DW_TAG_enumeration_type 0x04DW_TAG_formal_parameter 0x05DW_TAG_imported_declaration 0x08DW_TAG_label 0x0aDW_TAG_lexical_block 0x0b DW_TAG_member 0x0dDW_TAG_pointer_type 0x0fDW_TAG_reference_type 0x10DW_TAG_compile_unit 0x11DW_TAG_string_type 0x12DW_TAG_structure_type 0x13DW_TAG_subroutine_type 0x15DW_TAG_typedef 0x16DW_TAG_union_type 0x17DW_TAG_unspecified_parameters 0x18DW_TAG_variant 0x19DW_TAG_common_block 0x1aDW_TAG_common_inclusion 0x1bDW_TAG_inheritance 0x1cDW_TAG_inlined_subroutine 0x1dDW_TAG_module 0x1eDW_TAG_ptr_to_member_type 0x1fDW_TAG_set_type 0x20DW_TAG_subrange_type 0x21DW_TAG_with_stmt 0x22DW_TAG_access_declaration 0x23DW_TAG_base_type 0x24DW_TAG_catch_block 0x25DW_TAG_const_type 0x26DW_TAG_constant 0x27DW_TAG_enumerator 0x28DW_TAG_file_type 0x29.TE.FG "Tag encodings (part 1)".DE.DF.TSbox center;l llf(CW) lf(CW). Tag name Value_DW_TAG_friend 0x2aDW_TAG_namelist 0x2bDW_TAG_namelist_item 0x2cDW_TAG_packed_type 0x2dDW_TAG_subprogram 0x2eDW_TAG_template_type_param 0x2fDW_TAG_template_value_param 0x30DW_TAG_thrown_type 0x31DW_TAG_try_block 0x32DW_TAG_variant_part 0x33DW_TAG_variable 0x34DW_TAG_volatile_type 0x35DW_TAG_lo_user 0x4080DW_TAG_hi_user 0xffff.TE.FG "Tag encodings (part 2)".DE.PFollowing the tag encoding is a 1-byte value that determineswhether a debugging information entry using this abbreviationhas child entries or not. If the value is.Cf DW_CHILDREN_yes ,the next physically succeeding entry of any debugging informationentry using this abbreviation is the first child of the prior entry.If the 1-byte value following the abbreviation's tag encodingis.Cf DW_CHILDREN_no ,the next physically succeeding entry of any debugging information entryusing this abbreviation is a sibling of the prior entry. (Eitherthe first child or sibling entries may be null entries)..IX debugging information entries, siblings.IX debugging information entries, child entries.IX debugging information entries, null entries.nr aX \n(Fg+1The encodings for the child determination byte are given in Figure \n(aX.(As mentioned in section 2.3, each chain of sibling entries isterminated by a null entry)..IX debugging information entries, null entries.DF.TSbox center;l llf(CW) lf(CW). Child determination name Value_DW_CHILDREN_no 0DW_CHILDREN_yes 1.TE.FG "Child determination encodings".DE.PFinally, the child encoding is followed by a series of attribute specifications..IX attributesEach attribute specification consists of two parts. The first partis an unsigned LEB128 number representing the attribute's name..IX attributes, namesThe second part is an unsigned LEB128 number representing theattribute's form. The series of attribute specifications ends.IX attributes, formswith an entry containing 0 for the name and 0 for the form..PThe attribute form .Cf DW_FORM_indirectis a special case. For attributes with this form, the attribute valueitself in the.Cf .debug_infosection begins with an unsigned LEB128 number that represents its form.This allows producers to choose forms for particular attributes dynamically,without having to add a new entry to the abbreviation table..PThe abbreviations for a given compilation unit end with an entryconsisting of a 0 byte for the abbreviation code..I.PSee Appendix 2 for a depiction of the organizationof the debugging information..R.H 3 "Attribute Encodings".nr aX \n(Fg+1.nr bX \n(Fg+2The encodings for the attribute names are given in Figures \n(aXand \n(bX..DF.TSbox center;l l llf(CW) lf(CW) l. Attribute name Value Classes_DW_AT_sibling 0x01 referenceDW_AT_location 0x02 block, constantDW_AT_name 0x03 stringDW_AT_ordering 0x09 constantDW_AT_byte_size 0x0b constantDW_AT_bit_offset 0x0c constantDW_AT_bit_size 0x0d constantDW_AT_stmt_list 0x10 constantDW_AT_low_pc 0x11 addressDW_AT_high_pc 0x12 addressDW_AT_language 0x13 constantDW_AT_discr 0x15 referenceDW_AT_discr_value 0x16 constantDW_AT_visibility 0x17 constantDW_AT_import 0x18 referenceDW_AT_string_length 0x19 block, constantDW_AT_common_reference 0x1a referenceDW_AT_comp_dir 0x1b stringDW_AT_const_value 0x1c string, constant, blockDW_AT_containing_type 0x1d referenceDW_AT_default_value 0x1e referenceDW_AT_inline 0x20 constantDW_AT_is_optional 0x21 flagDW_AT_lower_bound 0x22 constant, referenceDW_AT_producer 0x25 stringDW_AT_prototyped 0x27 flagDW_AT_return_addr 0x2a block, constantDW_AT_start_scope 0x2c constantDW_AT_stride_size 0x2e constantDW_AT_upper_bound 0x2f constant, reference.TE.FG "Attribute encodings, part 1".DE.DF.TSbox center;l l llf(CW) lf(CW) l. Attribute name Value Classes_DW_AT_abstract_origin 0x31 referenceDW_AT_accessibility 0x32 constantDW_AT_address_class 0x33 constantDW_AT_artificial 0x34 flagDW_AT_base_types 0x35 referenceDW_AT_calling_convention 0x36 constantDW_AT_count 0x37 constant, referenceDW_AT_data_member_location 0x38 block, referenceDW_AT_decl_column 0x39 constantDW_AT_decl_file 0x3a constantDW_AT_decl_line 0x3b constantDW_AT_declaration 0x3c flagDW_AT_discr_list 0x3d blockDW_AT_encoding 0x3e constantDW_AT_external 0x3f flagDW_AT_frame_base 0x40 block, constantDW_AT_friend 0x41 referenceDW_AT_identifier_case 0x42 constantDW_AT_macro_info 0x43 constantDW_AT_namelist_item 0x44 blockDW_AT_priority 0x45 referenceDW_AT_segment 0x46 block, constantDW_AT_specification 0x47 referenceDW_AT_static_link 0x48 block, constantDW_AT_type 0x49 referenceDW_AT_use_location 0x4a block, constantDW_AT_variable_parameter 0x4b flagDW_AT_virtuality 0x4c constantDW_AT_vtable_elem_location 0x4d block, referenceDW_AT_lo_user 0x2000 \(emDW_AT_hi_user 0x3fff \(em.TE.FG "Attribute encodings, part 2".DE.P.IX attributes, formsThe attribute form governs how the value of the attribute is encoded.The possible forms may belong to one of the followingform classes:.VL 18.LI address.IX attributes, addressesRepresented as an object of appropriate size to hold an address on the target machine (\f(CWDW_FORM_addr\fP).This address is relocatable ina relocatable object file and is relocated in an executable file or shared object..LI "block".IX attributes, blocksBlocks come in four forms. The first consists of a 1-byte lengthfollowed by 0 to 255 contiguous information bytes (\f(CWDW_FORM_block1\fP). The second consists of a 2-byte lengthfollowed by 0 to 65,535 contiguous information bytes (\f(CWDW_FORM_block2\fP). The third consists of a 4-byte lengthfollowed by 0 to 4,294,967,295 contiguous information bytes (\f(CWDW_FORM_block4\fP). The fourth consists of an unsigned LEB128 length followed by the numberof bytes specified by the length (\f(CWDW_FORM_block\fP).In all forms, the length is the number of information bytes that follow.The information bytes may contain any mixture of relocated (orrelocatable) addresses, references to other debugging information entries ordata bytes..LI "constant".IX attributes, constantsThere are six forms of constants:one, two, four and eight byte values (respectively,.Cf DW_FORM_data1 ,.Cf DW_FORM_data2 ,.Cf DW_FORM_data4 ,and.Cf DW_FORM_data8 )..IX variable length data.IX LEB128There are also variable length constant data forms encodedusing LEB128 numbers (see below). Both signed (\f(CWDW_FORM_sdata\fP)and unsigned (\f(CWDW_FORM_udata\fP) variable length constants are available..LI flag.IX attributes, flagsA flag is represented as a single byte of data (\f(CWDW_FORM_flag\fP). If the flag has value zero, it indicates the absence of the attribute.If the flag has a non-zero value, it indicates the presence ofthe attribute..LI reference.IX attributes, referencesThere are two types of reference. The first is anoffset relative to the first byte of the compilation unit headerfor the compilation unit containing the reference.The offset must refer to an entry withinthat same compilation unit. There are five forms for thistype of reference:one, two, four and eight byte offsets (respectively,.Cf DW_FORM_ref1 ,.Cf DW_FORM_ref2 ,.Cf DW_FORM_ref4 ,and.Cf DW_FORM_ref8 ).There are is also an unsigned variable length offset encodedusing LEB128 numbers (\f(CWDW_FORM_ref_udata\fP)..PThe second type of referenceis the address of any debugging information entry withinthe same executable or shared object; it may refer to an entryin a different compilation unit from the unit containing thereference. This type of reference (\f(CWDW_FORM_ref_addr\fP) is thesize of an address on the target architecture; it is relocatablein a relocatable object file and relocated in an executable fileor shared object..P.IThe use of compilation unit relative references will reducethe number of link-time relocations and so speed up linking..PThe use of address-type references allows for the commonizationof information, such as types, across compilation units..R.LI string.IX attributes, stringsA string is a sequence of contiguous non-null bytes followed by one nullbyte. A string may be represented immediately in the debugging informationentry itself (\f(CWDW_FORM_string\fP), or may be represented as a 4-byte offsetinto a string table contained in the .Cf .debug_str.IX \f(CW.debug_str\fP %debugas.IX string tablesection of the object file (\f(CWDW_FORM_strp\fP)..LE.P.nr aX \n(Fg+1The form encodings are listed in Figure \n(aX..DF.TSbox center;l l llf(CW) lf(CW) l. Form name Value Class_DW_FORM_addr 0x01 addressDW_FORM_block2 0x03 blockDW_FORM_block4 0x04 blockDW_FORM_data2 0x05 constantDW_FORM_data4 0x06 constantDW_FORM_data8 0x07 constantDW_FORM_string 0x08 stringDW_FORM_block 0x09 blockDW_FORM_block1 0x0a blockDW_FORM_data1 0x0b constantDW_FORM_flag 0x0c flagDW_FORM_sdata 0x0d constantDW_FORM_strp 0x0e stringDW_FORM_udata 0x0f constantDW_FORM_ref_addr 0x10 referenceDW_FORM_ref1 0x11 referenceDW_FORM_ref2 0x12 referenceDW_FORM_ref4 0x13 referenceDW_FORM_ref8 0x14 referenceDW_FORM_ref_udata 0x15 referenceDW_FORM_indirect 0x16 (see section 7.5.3).TE.FG "Attribute form encodings".DE.H 2 "Variable Length Data".IX variable length data.IX LEB128The special constant data forms.Cf DW_FORM_sdataand.Cf DW_FORM_udataare encoded using ``Little Endian Base 128'' (LEB128)numbers. LEB128 is a scheme for encoding integers densely thatexploits the assumption that most integers are small in magnitude.(This encoding is equally suitable whether the target machinearchitecture represents data in big-endian or little-endian order.It is ``little endian'' only in the sense that it avoids using spaceto represent the ``big'' end of an unsigned integer, when the bigend is all zeroes or sign extension bits)..P.Cf DW_FORM_udata(unsigned LEB128) numbers are encoded as follows:start at thelow order end of an unsigned integer and chop it into 7-bit chunks.Place each chunk into the low order 7 bits of a byte. Typically,several of the high order bytes will be zero; discard them. Emit theremaining bytes in a stream, starting with the low order byte;set the high order bit on each byte except the last emitted byte.The high bit of zero on the last byte indicates to the decoderthat it has encountered the last byte..PThe integer zero is a special case, consisting of a single zero byte..P.I.nr aX \n(Fg+1Figure \n(aX gives some examples of.Cf DW_FORM_udata numbers. The .Cf 0x80in each case is the high order bit of the byte, indicating thatan additional byte follows:.R.DF.TSbox center;l l lnf(CW) lf(CW) lf(CW).Number First byte Second byte_2 2 \(em127 127 \(em128 0+0x80 1 129 1+0x80 1130 2+0x80 112857 57+0x80 100.TE.FG "Examples of unsigned LEB128 encodings".DE.PThe encoding for .Cf DW_FORM_sdata(signed, 2s complement LEB128) numbers is similar, except that thecriterion for discarding high order bytes is not whether they arezero, but whether they consist entirely of sign extension bits.Consider the 32-bit integer .Cf -2 .The three high level bytes of the number are sign extension, thus LEB128would represent it as a single byte containing the low order 7 bits,with the high order bit cleared to indicate the end of the bytestream. Note that there is nothing within the LEB128 representationthat indicates whether an encoded number is signed or unsigned.The decoder must know what type of number to expect..P.I.nr aX \n(Fg+1Figure \n(aX gives some examples of .Cf DW_FORM_sdata numbers..R.P.IAppendix 4 gives algorithms for encoding and decoding these forms..R.DF.TSbox center;l l lnf(CW) lf(CW) lf(CW).Number First byte Second byte_2 2 \(em-2 0x7e \(em127 127+0x80 0-127 1+0x80 0x7f128 0+0x80 1-128 0+0x80 0x7f129 1+0x80 1-129 0x7f+0x80 0x7e.TE.FG "Examples of signed LEB128 encodings".DE.H 2 "Location Descriptions".H 3 "Location Expressions".IX locations, descriptions.IX locations, expressionsA location expression is stored in a block of contiguous bytes.The bytes form a set of operations.Each location operation has a 1-byte codethat identifies that operation. Operations can be followedby one or more bytes of additional data. All operations in alocation expression are concatenated from left to right.The encodings for the operations in a location expression.IX locations, expressions.nr aX \n(Fg+1.nr bX \n(Fg+2are described in Figures \n(aX and \n(bX..DS.TScenter box;l l l llf(CW) lf(CW) l l.Operation Code No. of Operands Notes_DW_OP_addr 0x03 1 constant address (size target specific)DW_OP_deref 0x06 0DW_OP_const1u 0x08 1 1-byte constantDW_OP_const1s 0x09 1 1-byte constantDW_OP_const2u 0x0a 1 2-byte constantDW_OP_const2s 0x0b 1 2-byte constantDW_OP_const4u 0x0c 1 4-byte constantDW_OP_const4s 0x0d 1 4-byte constantDW_OP_const8u 0x0e 1 8-byte constantDW_OP_const8s 0x0f 1 8-byte constantDW_OP_constu 0x10 1 ULEB128 constantDW_OP_consts 0x11 1 SLEB128 constantDW_OP_dup 0x12 0 DW_OP_drop 0x13 0 DW_OP_over 0x14 0 DW_OP_pick 0x15 1 1-byte stack index DW_OP_swap 0x16 0 DW_OP_rot 0x17 0 DW_OP_xderef 0x18 0DW_OP_abs 0x19 0DW_OP_and 0x1a 0DW_OP_div 0x1b 0DW_OP_minus 0x1c 0DW_OP_mod 0x1d 0DW_OP_mul 0x1e 0DW_OP_neg 0x1f 0DW_OP_not 0x20 0DW_OP_or 0x21 0DW_OP_plus 0x22 0DW_OP_plus_uconst 0x23 1 ULEB128 addendDW_OP_shl 0x24 0DW_OP_shr 0x25 0DW_OP_shra 0x26 0.TE.FG "Location operation encodings, part 1".DE.DS.TScenter box;l l l llf(CW) lf(CW) l l.Operation Code No. of Operands Notes_DW_OP_xor 0x27 0DW_OP_skip 0x2f 1 signed 2-byte constantDW_OP_bra 0x28 1 signed 2-byte constantDW_OP_eq 0x29 0 DW_OP_ge 0x2a 0 DW_OP_gt 0x2b 0 DW_OP_le 0x2c 0 DW_OP_lt 0x2d 0 DW_OP_ne 0x2e 0 DW_OP_lit0 0x30 0 literals 0..31 = (DW_OP_LIT0|literal)DW_OP_lit1 0x31 0 \.\.\. DW_OP_lit31 0x4f 0 DW_OP_reg0 0x50 0 reg 0..31 = (DW_OP_REG0|regnum)DW_OP_reg1 0x51 0\.\.\. DW_OP_reg31 0x6f 0DW_OP_breg0 0x70 1 SLEB128 offsetDW_OP_breg1 0x71 1 base reg 0..31 = (DW_OP_BREG0|regnum)\.\.\. DW_OP_breg31 0x8f 1DW_OP_regx 0x90 1 ULEB128 registerDW_OP_fbreg 0x91 1 SLEB128 offsetDW_OP_bregx 0x92 2 ULEB128 register followed by SLEB128 offsetDW_OP_piece 0x93 1 ULEB128 size of piece addressedDW_OP_deref_size 0x94 1 1-byte size of data retrievedDW_OP_xderef_size 0x95 1 1-byte size of data retrievedDW_OP_nop 0x96 0DW_OP_lo_user 0xe0 DW_OP_hi_user 0xff .TE.FG "Location operation encodings, part 2".DE.H 3 "Location Lists".IX locations, listsEach entry in a location list consists of two relative addressesfollowed by a 2-byte length, followed by a block of contiguousbytes. The length specifies the number of bytes in the blockthat follows. The two addresses are the same size as used by.Cf DW_FORM_addron the target machine..H 2 "Base Type Encodings".nr aX \n(Fg+1.IX base types.IX types, baseThe values of the constants used in the.Cf DW_AT_encodingattribute are given in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Base type encoding name Value_DW_ATE_address 0x1DW_ATE_boolean 0x2DW_ATE_complex_float 0x3DW_ATE_float 0x4DW_ATE_signed 0x5DW_ATE_signed_char 0x6DW_ATE_unsigned 0x7DW_ATE_unsigned_char 0x8DW_ATE_lo_user 0x80DW_ATE_hi_user 0xff.TE.FG "Base type encoding values".DE.H 2 "Accessibility Codes".nr aX \n(Fg+1.IX accessibility.IX declarations, accessibilityThe encodings of the constants used in the .Cf DW_AT_accessibilityattribute are given in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Accessibility code name Value_DW_ACCESS_public 1DW_ACCESS_protected 2DW_ACCESS_private 3.TE.FG "Accessibility encodings".DE.H 2 "Visibility Codes".nr aX \n(Fg+1The encodings of the constants used in the .Cf DW_AT_visibility.IX visibility.IX declarations, visibilityattribute are given in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Visibility code name Value_DW_VIS_local 1DW_VIS_exported 2DW_VIS_qualified 3.TE.FG "Visibility encodings".DE.H 2 "Virtuality Codes".nr aX \n(Fg+1.IX virtualityThe encodings of the constants used in the .Cf DW_AT_virtualityattribute are given in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Virtuality code name Value_DW_VIRTUALITY_none 0DW_VIRTUALITY_virtual 1DW_VIRTUALITY_pure_virtual 2.TE.FG "Virtuality encodings".DE.H 2 "Source Languages".nr aX \n(Fg+1.IX languagesThe encodings for source languages are given in Figure \n(aX.Names marked with \(dg and their associatedvalues are reserved, but the languagesthey represent are not supported in DWARF Version 2..DF.TSbox center;l llf(CW) lf(CW). Language name Value_DW_LANG_C89 0x0001DW_LANG_C 0x0002DW_LANG_Ada83\(dg 0x0003DW_LANG_C_plus_plus 0x0004DW_LANG_Cobol74\(dg 0x0005DW_LANG_Cobol85\(dg 0x0006DW_LANG_Fortran77 0x0007DW_LANG_Fortran90 0x0008DW_LANG_Pascal83 0x0009DW_LANG_Modula2 0x000aDW_LANG_lo_user 0x8000DW_LANG_hi_user 0xffff.TE.FG "Language encodings".DE.H 2 "Address Class Encodings".IX addresses, classThe value of the common address class encoding .Cf DW_ADDR_noneis 0..H 2 "Identifier Case".IX identifiers, caseThe encodings of the constants used in the .Cf DW_AT_identifier_case.nr aX \n(Fg+1attribute are given in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Identifier Case Name Value_DW_ID_case_sensitive 0DW_ID_up_case 1DW_ID_down_case 2DW_ID_case_insensitive 3.TE.FG "Identifier case encodings".DE.H 2 "Calling Convention Encodings".IX calling conventionsThe encodings for the values of the .Cf DW_AT_calling_convention .nr aX \n(Fg+1attribute are given in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Calling Convention Name Value_DW_CC_normal 0x1DW_CC_program 0x2DW_CC_nocall 0x3DW_CC_lo_user 0x40DW_CC_hi_user 0xff.TE.FG "Calling convention encodings".DE.H 2 "Inline Codes".IX subroutines, inlineThe encodings of the constants used in the .Cf DW_AT_inline.nr aX \n(Fg+1attribute are given in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Inline Code Name Value_DW_INL_not_inlined 0DW_INL_inlined 1DW_INL_declared_not_inlined 2DW_INL_declared_inlined 3.TE.FG "Inline encodings".DE.H 2 "Array Ordering".IX arrays, orderingThe encodings for the values of the order attributes of arrays.nr aX \n(Fg+1is given in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Ordering name Value_DW_ORD_row_major 0DW_ORD_col_major 1.TE.FG "Ordering encodings".DE.H 2 "Discriminant Lists".IX variants.IX discriminated unions.IX discriminantsThe descriptors used in the.Cf DW_AT_dicsr_listattribute are encoded as 1-byte constants..nr aX \n(Fg+1The defined values are presented in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW). Descriptor Name Value_DW_DSC_label 0DW_DSC_range 1.TE.FG "Discriminant descriptor encodings".DE.H 2 "Name Lookup Table".IX lookup, by nameEach set of entries in the table of global names contained in the.Cf .debug_pubnames.IX \f(CW.debug_pubnames\fP %debugapsection begins with a header consisting of: a 4-byte length containingthe length of the set of entries for this compilation unit, not includingthe length field itself; a 2-byte version identifier containingthe value 2 for DWARF Version 2; a 4-byte offset into the .Cf .debug_info section; and a 4-byte length containing the size in bytesof the contents of the .Cf .debug_infosection generated to represent this compilation unit.This header is followed by a series of tuples. Each tuple consists of a 4-byte offsetfollowed by a string of non-null bytes terminated by one null byte.Each set is terminated by a 4-byte word containing the value 0..H 2 "Address Range Table".IX lookup, by addressEach set of entries in the table of address ranges contained in the.Cf .debug_aranges.IX \f(CW.debug_aranges\fP %debugaarsection begins with a header consisting of: a 4-byte length containingthe length of the set of entries for this compilation unit, not includingthe length field itself; a 2-byte version identifier containingthe value 2 for DWARF Version 2; a 4-byte offset into the .Cf .debug_infosection; a 1-byte unsigned integer containing the size in bytes of an address (or the offset portion of an address for segmented addressing).IX addresses, offset portion.IX addresses, size ofon the target system; and a 1-byte unsigned integer containing the size in bytes of a segment descriptor on the target system.This header is followed by a series of tuples. Each tuple consists of an address and a length, eachin the size appropriate for an address on the target architecture.The first tuple following the header in each set begins atan offset that is a multiple of the size of a single tuple(that is, twice the size of an address). The header ispadded, if necessary, to the appropriate boundary.Each set of tuples is terminated by a 0 for the address and 0 for the length..H 2 "Line Number Information".IX line number information.IX line number information, definitionsThe sizes of the integers used in the line number andcall frame information sections are as follows:.VL 15.LI "sbyte"Signed 1-byte value..LI "ubyte"Unsigned 1-byte value..LI "uhalf"Unsigned 2-byte value..LI "sword"Signed 4-byte value..LI "uword"Unsigned 4-byte value..LI.LE.P.IX Version 2The version number in the statement program prologue is 2 forDWARF Version 2.The boolean values ``true'' and ``false'' used by the statementinformation program are encoded as a single byte containing thevalue 0 for ``false,'' and a non-zero value for ``true.''The encodings for the pre-defined standard opcodes are given.IX line number information, standard opcodes.nr aX \n(Fg+1in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW).Opcode Name Value_DW_LNS_copy 1DW_LNS_advance_pc 2DW_LNS_advance_line 3DW_LNS_set_file 4DW_LNS_set_column 5DW_LNS_negate_stmt 6DW_LNS_set_basic_block 7DW_LNS_const_add_pc 8DW_LNS_fixed_advance_pc 9.TE.FG "Standard Opcode Encodings".DEThe encodings for the pre-defined extended opcodes are given.IX line number information, extended opcodes.nr aX \n(Fg+1in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW).Opcode Name Value_DW_LNE_end_sequence 1DW_LNE_set_address 2DW_LNE_define_file 3.TE.FG "Extended Opcode Encodings".DE.H 2 "Macro Information".IX macro information.IX source, filesThe source line numbers and source file indices encoded in themacro information section are represented as unsigned LEB128 numbersas are the constants in an.Cf DW_MACINFO_vendor_extentry.The macinfo type is encoded as a single byte. The encodings are given.nr aX \n(Fg+1in Figure \n(aX..DF.TSbox center;l llf(CW) lf(CW).Macinfo Type Name Value_DW_MACINFO_define 1DW_MACINFO_undef 2DW_MACINFO_start_file 3DW_MACINFO_end_file 4DW_MACINFO_vendor_ext 255.TE.FG "Macinfo Type Encodings".DE.H 2 "Call Frame Information".IX call frame informationThe value of the CIE id in the CIE header is.Cf 0xffffffff .The initial value of the CIE version number is 1..PCall frame instructions are encoded in one or more bytes..IX call frame information, instructionsThe primary opcode is encoded in the high order two bits of the first byte (that is, opcode = byte >> 6).An operand or extended opcode may be encoded in the low order6 bits. Additional operands are encoded in subsequent bytes.The instructions and their encodings are presented.nr aX \n(Fg+1in Figure \n(aX..DS.TScenter box;l l l l llf(CW) lf(CW) l llf(CW) lf(CW) l llf(CW) lf(CW) l llf(CW) lf(CW) lf(CW) l.Instruction High 2 Bits Low 6 Bits Operand 1 Operand 2_DW_CFA_advance_loc 0x1 delta DW_CFA_offset 0x2 register ULEB128 offsetDW_CFA_restore 0x3 registerDW_CFA_set_loc 0 0x01 addressDW_CFA_advance_loc1 0 0x02 1-byte deltaDW_CFA_advance_loc2 0 0x03 2-byte deltaDW_CFA_advance_loc4 0 0x04 4-byte deltaDW_CFA_offset_extended 0 0x05 ULEB128 register ULEB128 offsetDW_CFA_restore_extended 0 0x06 ULEB128 registerDW_CFA_undefined 0 0x07 ULEB128 registerDW_CFA_same_value 0 0x08 ULEB128 registerDW_CFA_register 0 0x09 ULEB128 register ULEB128 registerDW_CFA_remember_state 0 0x0aDW_CFA_restore_state 0 0x0bDW_CFA_def_cfa 0 0x0c ULEB128 register ULEB128 offsetDW_CFA_def_cfa_register 0 0x0d ULEB128 registerDW_CFA_def_cfa_offset 0 0x0e ULEB128 offsetDW_CFA_nop 0 0DW_CFA_lo_user 0 0x1cDW_CFA_hi_user 0 0x3f.TE.FG "Call frame instruction encodings".DE.H 2 "Dependencies"The debugging information in this format is intended to exist in the.Cf .debug_abbrev ,.Cf .debug_aranges ,.Cf .debug_frame ,.Cf .debug_info ,.Cf .debug_line ,.Cf .debug_loc ,.Cf .debug_macinfo ,.Cf .debug_pubnames and.Cf .debug_str.IX \f(CW.debug_abbrev\fP %debugaab.IX \f(CW.debug_aranges\fP %debugaar.IX \f(CW.debug_frame\fP %debugaf.IX \f(CW.debug_info\fP %debugai.IX \f(CW.debug_line\fP %debugali.IX \f(CW.debug_loc\fP %debugalo.IX \f(CW.debug_macinfo\fP %debugam.IX \f(CW.debug_pubnames\fP %debugap.IX \f(CW.debug_str\fP %debugassections of an object file.The information is not word-aligned, so the assembler must provide away for the compiler to produce 2-byte and 4-byte quantities withoutalignment restrictions, and the linker must be able torelocate a 4-byte reference at an arbitrary alignment.In target architectures with 64-bit addresses, the assembler and linkermust similarly handle 8-byte references at arbitrary alignments..OP.H 1 "FUTURE DIRECTIONS"The \*(iX \*(tE is working on a specification for a set of interfacesfor reading DWARF information, that will hide changes in therepresentation of that information from its consumers. It ishoped that using these interfaces will make the transition fromDWARF Version 1 to Version 2 much simpler and will make iteasier for a single consumer to support objects using eitherVersion 1 or Version 2 DWARF..PA draft of this specification is available for review from\*(iX. The \*(tE wishes to stress, however, that the specificationis still in flux..OP.HU "Appendix 1 -- Current Attributes by Tag Value".PThe list below enumerates the attributes that are most applicable to each typeof debugging information entry.DWARF does not in general require that a given debugging informationentry contain a particular attribute or set of attributes. Instead, aDWARF producer is free to generate any, all, or none of the attributesdescribed in the text as being applicable to a given entry. Otherattributes (both those defined within this document but not explicitlyassociated with the entry in question, and new, vendor-defined ones)may also appear in a given debugging entry.Therefore, the list may betaken as instructive, but cannot be considered definitive..sp.sp.DS.TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_access_declaration:DECL\(dg:DW_AT_accessibility:DW_AT_name:DW_AT_sibling_DW_TAG_array_type:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_byte_size:DW_AT_declaration:DW_AT_name:DW_AT_ordering:DW_AT_sibling:DW_AT_start_scope:DW_AT_stride_size:DW_AT_type:DW_AT_visibility_DW_TAG_base_type:DW_AT_bit_offset:DW_AT_bit_size:DW_AT_byte_size:DW_AT_encoding:DW_AT_name:DW_AT_sibling_DW_TAG_catch_block:DW_AT_abstract_origin:DW_AT_high_pc:DW_AT_low_pc:DW_AT_segment:DW_AT_sibling.TE.DE.br\(dg.Cf DW_AT_decl_column ,.Cf DW_AT_decl_file ,.Cf DW_AT_decl_line ..SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_class_type:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_byte_size:DW_AT_declaration:DW_AT_name:DW_AT_sibling:DW_AT_start_scope:DW_AT_visibility_DW_TAG_common_block:DECL:DW_AT_declaration:DW_AT_location:DW_AT_name:DW_AT_sibling:DW_AT_visibility_DW_TAG_common_inclusion:DECL:DW_AT_common_reference:DW_AT_declaration:DW_AT_sibling:DW_AT_visibility_DW_TAG_compile_unit:DW_AT_base_types:DW_AT_comp_dir:DW_AT_identifier_case:DW_AT_high_pc:DW_AT_language:DW_AT_low_pc:DW_AT_macro_info:DW_AT_name:DW_AT_producer:DW_AT_sibling:DW_AT_stmt_list_DW_TAG_const_type:DW_AT_sibling:DW_AT_type.TE.DE.br.SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_constant:DECL:DW_AT_accessibility:DW_AT_constant_value:DW_AT_declaration:DW_AT_external:DW_AT_name:DW_AT_sibling:DW_AT_start_scope:DW_AT_type:DW_AT_visibility_DW_TAG_entry_point:DW_AT_address_class:DW_AT_low_pc:DW_AT_name:DW_AT_return_addr:DW_AT_segment:DW_AT_sibling:DW_AT_static_link:DW_AT_type_DW_TAG_enumeration_type:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_byte_size:DW_AT_declaration:DW_AT_name:DW_AT_sibling:DW_AT_start_scope:DW_AT_visibility_DW_TAG_enumerator:DECL:DW_AT_const_value:DW_AT_name:DW_AT_sibling_DW_TAG_file_type:DECL:DW_AT_abstract_origin:DW_AT_byte_size:DW_AT_name:DW_AT_sibling:DW_AT_start_scope:DW_AT_type:DW_AT_visibility.TE.DE.br.SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_formal_parameter:DECL:DW_AT_abstract_origin:DW_AT_artificial:DW_AT_default_value:DW_AT_is_optional:DW_AT_location:DW_AT_name:DW_AT_segment:DW_AT_sibling:DW_AT_type:DW_AT_variable_parameter_DW_TAG_friend:DECL:DW_AT_abstract_origin:DW_AT_friend:DW_AT_sibling_DW_TAG_imported_declaration:DECL:DW_AT_accessibility:DW_AT_import:DW_AT_name:DW_AT_sibling:DW_AT_start_scope_DW_TAG_inheritance:DECL:DW_AT_accessibility:DW_AT_data_member_location:DW_AT_sibling:DW_AT_type:DW_AT_virtuality_DW_TAG_inlined_subroutine:DECL:DW_AT_abstract_origin:DW_AT_high_pc:DW_AT_low_pc:DW_AT_segment:DW_AT_sibling:DW_AT_return_addr:DW_AT_start_scope_DW_TAG_label:DW_AT_abstract_origin:DW_AT_low_pc:DW_AT_name:DW_AT_segment:DW_AT_start_scope:DW_AT_sibling.TE.DE.br.SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_lexical_block:DW_AT_abstract_origin:DW_AT_high_pc:DW_AT_low_pc:DW_AT_name:DW_AT_segment:DW_AT_sibling_DW_TAG_member:DECL:DW_AT_accessibility:DW_AT_byte_size:DW_AT_bit_offset:DW_AT_bit_size:DW_AT_data_member_location:DW_AT_declaration:DW_AT_name:DW_AT_sibling:DW_AT_type:DW_AT_visibility_DW_TAG_module:DECL:DW_AT_accessibility:DW_AT_declaration:DW_AT_high_pc:DW_AT_low_pc:DW_AT_name:DW_AT_priority:DW_AT_segment:DW_AT_sibling:DW_AT_visibility_DW_TAG_namelist:DECL:DW_AT_accessibility:DW_AT_abstract_origin:DW_AT_declaration:DW_AT_sibling:DW_AT_visibility_DW_TAG_namelist_item:DECL:DW_AT_namelist_item:DW_AT_sibling_DW_TAG_packed_type:DW_AT_sibling:DW_AT_type.TE.DE.br.SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_pointer_type:DW_AT_address_class:DW_AT_sibling:DW_AT_type_DW_TAG_ptr_to_member_type:DECL:DW_AT_abstract_origin:DW_AT_address_class:DW_AT_containing_type:DW_AT_declaration:DW_AT_name:DW_AT_sibling:DW_AT_type:DW_AT_use_location:DW_AT_visibility_DW_TAG_reference_type:DW_AT_address_class:DW_AT_sibling:DW_AT_type_DW_TAG_set_type:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_byte_size:DW_AT_declaration:DW_AT_name:DW_AT_start_scope:DW_AT_sibling:DW_AT_type:DW_AT_visibility_DW_TAG_string_type:DECL:DW_AT_accessibility:DW_AT_abstract_origin:DW_AT_byte_size:DW_AT_declaration:DW_AT_name:DW_AT_segment:DW_AT_sibling:DW_AT_start_scope:DW_AT_string_length:DW_AT_visibility.TE.DE.SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_structure_type:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_byte_size:DW_AT_declaration:DW_AT_name:DW_AT_sibling:DW_AT_start_scope:DW_AT_visibility_DW_TAG_subprogram:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_address_class:DW_AT_artificial:DW_AT_calling_convention:DW_AT_declaration:DW_AT_external:DW_AT_frame_base:DW_AT_high_pc:DW_AT_inline:DW_AT_low_pc:DW_AT_name:DW_AT_prototyped:DW_AT_return_addr:DW_AT_segment:DW_AT_sibling:DW_AT_specification:DW_AT_start_scope:DW_AT_static_link:DW_AT_type:DW_AT_visibility:DW_AT_virtuality:DW_AT_vtable_elem_location.TE.DE.SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_subrange_type:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_byte_size:DW_AT_count:DW_AT_declaration:DW_AT_lower_bound:DW_AT_name:DW_AT_sibling:DW_AT_type:DW_AT_upper_bound:DW_AT_visibility_DW_TAG_subroutine_type:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_address_class:DW_AT_declaration:DW_AT_name:DW_AT_prototyped:DW_AT_sibling:DW_AT_start_scope:DW_AT_type:DW_AT_visibility_DW_TAG_template_type_param:DECL:DW_AT_name:DW_AT_sibling:DW_AT_type_DW_TAG_template_value_param:DECL:DW_AT_name:DW_AT_const_value:DW_AT_sibling:DW_AT_type_DW_TAG_thrown_type:DECL:DW_AT_sibling:DW_AT_type_DW_TAG_try_block:DW_AT_abstract_origin:DW_AT_high_pc:DW_AT_low_pc:DW_AT_segment:DW_AT_sibling.TE.DE.br.SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_typedef:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_declaration:DW_AT_name:DW_AT_sibling:DW_AT_start_scope:DW_AT_type:DW_AT_visibility_DW_TAG_union_type:DECL:DW_AT_abstract_origin:DW_AT_accessibility:DW_AT_byte_size:DW_AT_declaration:DW_AT_friends:DW_AT_name:DW_AT_sibling:DW_AT_start_scope:DW_AT_visibility_DW_TAG_unspecified_parameters:DECL:DW_AT_abstract_origin:DW_AT_artificial:DW_AT_sibling_DW_TAG_variable:DECL:DW_AT_accessibility:DW_AT_constant_value:DW_AT_declaration:DW_AT_external:DW_AT_location:DW_AT_name:DW_AT_segment:DW_AT_sibling:DW_AT_specification:DW_AT_start_scope:DW_AT_type:DW_AT_visibility.TE.DE.br.SK.DS.B "Appendix 1 (cont'd) -- Current Attributes by Tag Value".TSbox, tab(:) ;lfB lfBlf(CW) lf(CW) .TAG NAME:APPLICABLE ATTRIBUTES_DW_TAG_variant:DECL:DW_AT_accessibility:DW_AT_abstract_origin:DW_AT_declaration:DW_AT_discr_list:DW_AT_discr_value:DW_AT_sibling_DW_TAG_variant_part:DECL:DW_AT_accessibility:DW_AT_abstract_origin:DW_AT_declaration:DW_AT_discr:DW_AT_sibling:DW_AT_type_DW_TAG_volatile_type:DW_AT_sibling:DW_AT_type_DW_TAG_with_statement:DW_AT_accessibility:DW_AT_address_class:DW_AT_declaration:DW_AT_high_pc:DW_AT_location:DW_AT_low_pc:DW_AT_segment:DW_AT_sibling:DW_AT_type:DW_AT_visibility.TE.DE.SK.OP.HU "Appendix 2 -- Organization of Debugging Information"The following diagram depicts the relationship of the abbreviationtables contained in the .Cf .debug_abbrevsection to the information contained in the .Cf .debug_infosection. Values are given in symbolic form, where possible..DF.nf.PSscale=100define t201 |[ box invis ht 154 wid 295 with .sw at 0,0"\f(CW\s9\&1\f1\s0" at 0,147 ljust"\f(CW\s9\&DW_TAG_compile_unit\f1\s0" at 0,133 ljust"\f(CW\s9\&DW_CHILDREN_yes\f1\s0" at 0,119 ljust"\f(CW\s9\&DW_AT_name DW_FORM_string\f1\s0" at 0,105 ljust"\f(CW\s9\&DW_AT_producer DW_FORM_string\f1\s0" at 0,91 ljust"\f(CW\s9\&DW_AT_compdir DW_FORM_string\f1\s0" at 0,77 ljust"\f(CW\s9\&DW_AT_language DW_FORM_data1\f1\s0" at 0,63 ljust"\f(CW\s9\&DW_AT_low_poc DW_FORM_addr\f1\s0" at 0,49 ljust"\f(CW\s9\&DW_AT_high_pc DW_FORM_addr\f1\s0" at 0,35 ljust"\f(CW\s9\&DW_AT_stmt_list DW_FORM_indirect\f1\s0" at 0,21 ljust"\f(CW\s9\&0 0\f1\s0" at 0,7 ljust] |define t103 |[ box invis ht 42 wid 74 with .sw at 0,0"\f(CW\s9\&4\f1\s0" at 0,35 ljust"\f(CW\s9\&\"POINTER\"\f1\s0" at 0,21 ljust"\f(CW\s9\&\f1\s0" at 0,7 ljust] |define t177 |[ box invis ht 28 wid 13 with .sw at 0,0"\f(CW\s9\&3\f1\s0" at 0,21 ljust"\f(CW\s9\&\f1\s0" at 0,7 ljust] |define t224 |[ box invis ht 84 wid 280 with .sw at 0,0"\f(CW\s9\&4\f1\s0" at 0,77 ljust"\f(CW\s9\&DW_TAG_typedef\f1\s0" at 0,63 ljust"\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,49 ljust"\f(CW\s9\&DW_AT_name DW_FORM_string\f1\s0" at 0,35 ljust"\f(CW\s9\&DW_AT_type DW_FORM_ref4 \f1\s0" at 0,21 ljust"\f(CW\s9\&0 0 \f1\s0" at 0,7 ljust] |define t149 |[ box invis ht 28 wid 51 with .sw at 0,0"\f(CW\s9\&4\f1\s0" at 0,21 ljust"\f(CW\s9\&\"strp\"\f1\s0" at 0,7 ljust] |define t205 |[ box invis ht 98 wid 280 with .sw at 0,0"\f(CW\s9\&2\f1\s0" at 0,91 ljust"\f(CW\s9\&DW_TAG_base_type\f1\s0" at 0,77 ljust"\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,63 ljust"\f(CW\s9\&DW_AT_name DW_FORM_string\f1\s0" at 0,49 ljust"\f(CW\s9\&DW_AT_encoding DW_FORM_data1\f1\s0" at 0,35 ljust"\f(CW\s9\&DW_AT_byte_size DW_FORM_data1\f1\s0" at 0,21 ljust"\f(CW\s9\&0 0\f1\s0" at 0,7 ljust] |define t126 |[ box invis ht 126 wid 257 with .sw at 0,0"\f(CW\s9\&\"myfile.c\"\f1\s0" at 0,119 ljust"\f(CW\s9\&\"Best Compiler Corp: Version 1.3\"\f1\s0" at 0,105 ljust"\f(CW\s9\&\"mymachine:/home/mydir/src:\"\f1\s0" at 0,91 ljust"\f(CW\s9\&DW_LANG_C89\f1\s0" at 0,77 ljust"\f(CW\s9\&0x0\f1\s0" at 0,63 ljust"\f(CW\s9\&0x55\f1\s0" at 0,49 ljust"\f(CW\s9\&DW_FORM_data4\f1\s0" at 0,35 ljust"\f(CW\s9\&0x0\f1\s0" at 0,21 ljust"\f(CW\s9\&\f1\s0" at 0,7 ljust] |define t219 |[ box invis ht 70 wid 260 with .sw at 0,0"\f(CW\s9\&3\f1\s0" at 0,63 ljust"\f(CW\s9\&DW_TAG_pointer_type\f1\s0" at 0,49 ljust"\f(CW\s9\&DW_CHILDREN_no\f1\s0" at 0,35 ljust"\f(CW\s9\&DW_AT_type DW_FORM_ref4\f1\s0" at 0,21 ljust"\f(CW\s9\&0 0\f1\s0" at 0,7 ljust] |define t109 |[ box invis ht 42 wid 165 with .sw at 0,0"\f(CW\s9\&\"char\"\f1\s0" at 0,35 ljust"\f(CW\s9\&DW_ATE_unsigned_char\f1\s0" at 0,21 ljust"\f(CW\s9\&1\f1\s0" at 0,7 ljust] |box invis ht 704 wid 680 with .sw at 0,0t201 with .nw at 376,657box ht 520 wid 320 with .nw at 360,672 box ht 208 wid 280 with .nw at 24,208 t103 with .nw at 40,353t177 with .nw at 40,398line from 360,176 to 680,176 line from 360,280 to 680,280 line from 360,368 to 680,368 line from 360,488 to 680,488 t224 with .nw at 376,270"\f(CW\s9\&0\f1\s0" at 376,164 ljust"\f(CW\s9\&0\f1\s0" at 40,289 ljust"\fI\s9\&e2\f1\s0" at 40,317 ljust"\fI\s9\&e2:\f1\s0" at 0,389 ljust"\f(CW\s9\&2\f1\s0" at 44,176 ljustline from 24,128 to 304,128 "\f(CW\s9\&...\f1\s0" at 44,113 ljustt149 with .nw at 44,88"\fI\s9\&e2\f1\s0" at 44,49 ljust"\f(CW\s9\&...\f1\s0" at 44,17 ljustbox ht 416 wid 280 with .nw at 24,688 "\fI\s9\&length\f1\s0" at 44,192 ljust"\f(CW\s9\&4\f1\s0" at 48,140"\fI\s9\&a1 (abbreviation table offset)\f1\s0" at 44,160 ljust"\f(CW\s9\&4\f1\s0" at 44,624"\fI\s9\&a1 (abbreviation table offset)\f1\s0" at 40,640 ljustt205 with .nw at 376,477"\fI\s9\&a1:\f1\s0" at 348,657 rjust"\fI\s9\&length\f1\s0" at 40,672 ljust"\fR\s10\&Abbreviation Table - .debug_abbrev\f1\s0" at 384,678 ljust"\fR\s10\&Compilation Unit 1 - .debug_info\f1\s0" at 68,694 ljust"\fR\s10\&Compilation Unit 2 - .debug_info\f1\s0" at 64,218 ljust"\f(CW\s9\&2\f1\s0" at 44,656"\f(CW\s9\&1\f1\s0" at 44,605t126 with .nw at 36,599line from 24,616 to 304,616 "\f(CW\s9\&2\f1\s0" at 40,461 ljustt219 with .nw at 376,359line from 24,96 to 304,96 line from 24,32 to 304,32 t109 with .nw at 40,449"\fI\s9\&e1\f1\s0" at 40,373 ljust"\fI\s9\&e1:\f1\s0" at 0,461 ljustline from 24,480 to 304,480 line from 24,400 to 304,400 line from 24,360 to 304,360 line from 24,304 to 304,304 .PE.fi.DE.SK.OP.HU "Appendix 3 -- Statement Program Examples".PConsider this simple source file and the resulting machine code forthe Intel 8086 processor:.DS.S -2.TS;lf(CW) lf(CW) slf(CW) lf(CW) slf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) slf(CW) lf(CW) slf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) slf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) slf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) slf(CW) lf(CW) lf(CW).1: int2: main() 0x239: push pb 0x23a: mov bp,sp3: {4: printf("Omit needless words\en"); 0x23c: mov ax,0xaa 0x23f: push ax 0x240: call _printf 0x243: pop cx5: exit(0); 0x244: xor ax,ax 0x246: push ax 0x247: call _exit 0x24a: pop cx6: } 0x24b: pop bp 0x24c: ret7: 0x24d:.TE.S +2.DE.PIf the statement program prologue specifies the following:.DS.S -2.TS;lf(CW) lf(CW).minimum_instruction_length 1opcode_base 10line_base 1line_range 15.TE.S +2.DE.PThen one encoding of the statement program would occupy 12 bytes(the opcode \f(CWSPECIAL(\fIm\fP, \fIn\fP)\fR indicates the specialopcode generated for a line increment of \fIm\fP and an address incrementof \fIn\fP):.DS.S -2.TS;l l llf(CW) lf(CW) lf(CW).Opcode Operand Byte Stream_DW_LNS_advance_pc LEB128(0x239) 0x2, 0xb9, 0x04SPECIAL(2, 0) 0xbSPECIAL(2, 3) 0x38SPECIAL(1, 8) 0x82SPECIAL(1, 7) 0x73DW_LNS_advance_pc LEB128(2) 0x2, 0x2DW_LNE_end_sequence 0x0, 0x1, 0x1.TE.S +2.DE.PAn alternate encoding of the same program using standard opcodes toadvance the program counter would occupy 22 bytes:.DS.S -2.TS;l l llf(CW) lf(CW) lf(CW).Opcode Operand Byte Stream_DW_LNS_fixed_advance_pc 0x239 0x9, 0x39, 0x2SPECIAL(2, 0) 0xbDW_LNS_fixed_advance_pc 0x3 0x9, 0x3, 0x0SPECIAL(2, 0) 0xbDW_LNS_fixed_advance_pc 0x8 0x9, 0x8, 0x0SPECIAL(1, 0) 0xaDW_LNS_fixed_advance_pc 0x7 0x9, 0x7, 0x0SPECIAL(1, 0) 0xaDW_LNS_fixed_advance_pc 0x2 0x9, 0x2, 0x0DW_LNE_end_sequence 0x0, 0x1, 0x1.TE.S +2.DE.SK.OP.HU "Appendix 4 -- Encoding and decoding variable length data".ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i.PHere are algorithms expressed in a C-like pseudo-code to encode and decodesigned and unsigned numbers in LEB128:.P\fBEncode an unsigned integer:\fP.br.DS.S -2\f(CWdo{ byte = low order 7 bits of value; value >>= 7; if (value != 0) /* more bytes to come */ set high order bit of byte; emit byte;} while (value != 0);\fP.S +2.DE.P\fBEncode a signed integer:\fP.br.DS.S -2\f(CWmore = 1;negative = (value < 0);size = no. of bits in signed integer;while(more){ byte = low order 7 bits of value; value >>= 7; /* the following is unnecessary if the implementation of >>= * uses an arithmetic rather than logical shift for a signed * left operand */ if (negative) /* sign extend */ value |= - (1 << (size - 7)); /* sign bit of byte is 2nd high order bit (0x40) */ if ((value == 0 && sign bit of byte is clear) || (value == -1 && sign bit of byte is set)) more = 0; else set high order bit of byte; emit byte;}\fP.S +2.DE.SK.ta .5i +.5i +.5i +.5i +.5i +.5i +.5i +.5i.P\fBDecode unsigned LEB128 number:\fP.br.DS.S -2\f(CWresult = 0;shift = 0;while(true){ byte = next byte in input; result |= (low order 7 bits of byte << shift); if (high order bit of byte == 0) break; shift += 7;}\fP.S +2.DE.P\fBDecode signed LEB128 number:\fP.br.DS.S -2\f(CWresult = 0;shift = 0;size = no. of bits in signed integer;while(true){ byte = next byte in input; result |= (low order 7 bits of byte << shift); shift += 7; /* sign bit of byte is 2nd high order bit (0x40) */ if (high order bit of byte == 0) break;}if ((shift < size) && (sign bit of byte is set)) /* sign extend */ result |= - (1 << shift);\fP.S +2.DE.SK.OP.HU "Appendix 5 -- Call Frame Information Examples"The following example uses a hypothetical RISC machine in the style ofthe Motorola 88000..BL.LIMemory is byte addressed..LIInstructions are all 4-bytes each and word aligned..LIInstruction operands are typically of the form:.br.DS <destination reg> <source reg> <constant>.DE.LIThe address for the load and store instructions is computed byadding the contents of the source register with the constant..LIThere are 8 4-byte registers:.br.DS R0 always 0 R1 holds return address on call R2-R3 temp registers (not preserved on call) R4-R6 preserved on call R7 stack pointer..DE.LIThe stack grows in the negative direction..LE.PThe following are two code fragments from a subroutine called \f(CWfoo\fP thatuses a frame pointer (in addition to the stack pointer.) The firstcolumn values are byte addresses..DS.S -2.TS;lf(CW) lf(CW) s slf(CW) lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) lf(CW) lf(CW)lf(CW) lf(CW) s slf(CW) lf(CW) s slf(CW) lf(CW) s slf(CW) lf(CW) lf(CW) lf(CW). ;; start prologuefoo sub R7, R7, <fsize> ; Allocate framefoo+4 store R1, R7, (<fsize>-4) ; Save the return addressfoo+8 store R6, R7, (<fsize>-8) ; Save R6foo+12 add R6, R7, 0 ; R6 is now the Frame ptrfoo+16 store R4, R6, (<fsize>-12) ; Save a preserve reg. ;; This subroutine does not change R5 ... ;; Start epilogue (R7 has been returned to entry value)foo+64 load R4, R6, (<fsize>-12) ; Restore R4foo+68 load R6, R7, (<fsize>-8) ; Restore R6foo+72 load R1, R7, (<fsize>-4) ; Restore return addressfoo+76 add R7, R7, <fsize> ; Deallocate framefoo+80 jump R ; Returnfoo+84.TE.S +2.DE.SKThe table for the \f(CWfoo\fP subroutine is as follows. It is followed by thecorresponding fragments from the .Cf .debug_frame section..DS.S -2.TStab(|);lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW) lf(CW).Loc|CFA|R0|R1|R2|R3|R4|R5|R6|R7|R8foo|[R7]+0|s|u|u|u|s|s|s|s|r1foo+4|[R7]+fsize|s|u|u|u|s|s|s|s|r1foo+8|[R7]+fsize|s|u|u|u|s|s|s|s|c4foo+12|[R7]+fsize|s|u|u|u|s|s|c8|s|c4foo+16|[R6]+fsize|s|u|u|u|s|s|c8|s|c4foo+20|[R6]+fsize|s|u|u|u|c12|s|c8|s|c4...foo+64|[R6]+fsize|s|u|u|u|c12|s|c8|s|c4foo+68|[R6]+fsize|s|u|u|u|s|s|c8|s|c4foo+72|[R7]+fsize|s|u|u|u|s|s|s|s|c4foo+76|[R7]+fsize|s|u|u|u|s|s|s|s|r1foo+80|[R7]+0|s|u|u|u|s|s|s|s|r1.TE.TS;l sl l.notes:1. R8 is the return address2. s = same_value rule3. u = undefined rule4. rN = register(N) rule5. cN = offset(N) rule.sp.sp.TE.S +2.DE.PCommon Information Entry (CIE):.DS.S -2.TS;lf(CW) lf(CW) lf(CW).cie 32 ; lengthcie+4 0xffffffff ; CIE_idcie+8 1 ; versioncie+9 0 ; augmentationcie+10 4 ; code_alignment_factorcie+11 4 ; data_alignment_factorcie+12 8 ; R8 is the return addr.cie+13 DW_CFA_def_cfa (7, 0) ; CFA = [R7]+0cie+16 DW_CFA_same_value (0) ; R0 not modified (=0)cie+18 DW_CFA_undefined (1) ; R1 scratchcie+20 DW_CFA_undefined (2) ; R2 scratchcie+22 DW_CFA_undefined (3) ; R3 scratchcie+24 DW_CFA_same_value (4) ; R4 preservecie+26 DW_CFA_same_value (5) ; R5 preservecie+28 DW_CFA_same_value (6) ; R6 preservecie+30 DW_CFA_same_value (7) ; R7 preservecie+32 DW_CFA_register (8, 1) ; R8 is in R1cie+35 DW_CFA_nop ; paddingcie+36.TE.S +2.DE.SK.PFrame Description Entry (FDE):.DS.S -2.TS;lf(CW) lf(CW) lf(CW).fde 40 ; lengthfde+4 cie ; CIE_ptrfde+8 foo ; initial_locationfde+12 84 ; address_rangefde+16 DW_CFA_advance_loc(1) ; instructionsfde+17 DW_CFA_def_cfa_offset(<fsize>/4) ; assuming <fsize> < 512fde+19 DW_CFA_advance_loc(1)fde+20 DW_CFA_offset(8,1)fde+22 DW_CFA_advance_loc(1)fde+23 DW_CFA_offset(6,2)fde+25 DW_CFA_advance_loc(1)fde+26 DW_CFA_def_cfa_register(6)fde+28 DW_CFA_advance_loc(1)fde+29 DW_CFA_offset(4,3)fde+31 DW_CFA_advance_loc(11)fde+32 DW_CFA_restore(4)fde+33 DW_CFA_advance_loc(1)fde+34 DW_CFA_restore(6)fde+35 DW_CFA_def_cfa_register(7)fde+37 DW_CFA_advance_loc(1)fde+38 DW_CFA_restore(8)fde+39 DW_CFA_advance_loc(1)fde+40 DW_CFA_def_cfa_offset(0)fde+42 DW_CFA_nop ; paddingfde+43 DW_CFA_nop ; paddingfde+44.TE.S +2.DE.S +1'\"'\" Table of Contents stuff'\".de TP.sp 4...VM.de TY.ce 1Table of Contents.sp...nr Lf 1.ds Lf List of Figures.SK.TC 1 1 7 0