000410.3 B A D. Weatherford Editorial Add aliases "loclist", "lineptr", and "macptr"


(REVISED) PROPOSAL

Remove the two paragraphs added to 7.5.4 by my previous proposal (000410.1),
which explain the usage of class constant for pointers into .debug_loc
etc., and add, instead, three new FORM classes.

Replace the second paragraph of Section 7.5.4 with:

    The attribute form governs how the value of the
    attribute is encoded. There are 9 classes of
    form, listed below. Some encodings are members
    of more than one class; in that case, the list
    of classes allowed by the attribute in question
    determines the class of the form. DW_FORM_data4
    and DW_FORM_data8 are members of class "constant",
    "lineptr", "loclist", and "macptr". They are
    members of the constant class if used for the
    value of an attribute that allows class constant
    but not class lineptr, loclist or macptr. They
    are members of class lineptr, loclist, or macptr
    if used for the value of an attribute that
    allows one of those classes.

    Each possible form belongs to one or more of the
    following classes:

Replace the description of class constant in Section 7.5.4 with:

  constant

    There are six forms of constants. There are
    fixed length constant data forms for one, two,
    four and eight byte values (respectively,
    DW_FORM_data1, DW_FORM_data2, DW_FORM_data4, and
    DW_FORM_data8). There are also variable length
    constant data forms encoded using LEB128 numbers
    (see below). Both signed (DW_FORM_sdata) and
    unsigned (DW_FORM_udata) variable length
    constants are available. Note that
    DW_FORM_data4 and DW_FORM_data8 are members of
    class constant only if the attribute in question
    does not allow one of "lineptr", "loclist", or
    "macptr" (see below).

    In the 32-bit DWARF format, a constant that
    represents an offset into another section uses
    form DW_FORM_data4; in the 64-bit DWARF format,
    such offsets use form DW_FORM_data8 (see section
    7.4).

Add to the list in Section 7.5.4 (between "flag" and "reference",
keeping it alphabetical):

  lineptr

    This is an offset into the .debug_line section. It
    consists of a 4- or 8-byte value which is the offset from
    the beginning of the .debug_line section to the first
    byte of the data making up the statement list for the
    compilation unit. It is relocatable in a relocatable
    object file, and relocated in an executable or shared
    object. It includes DW_FORM_data4 and DW_FORM_data8.

  loclist

    This is an offset into the .debug_loc section. It
    consists of a 4- or 8-byte value which is the offset from
    the beginning of the .debug_loc section to the first
    byte of the data making up the location list for the
    object in question. It is relocatable in a relocatable
    object file, and relocated in an executable or shared
    object. It includes DW_FORM_data4 and DW_FORM_data8.

  macptr

    This is an offset into the .debug_macinfo section. It
    consists of a 4- or 8-byte value which is the offset from
    the beginning of the .debug_macinfo section to the first
    byte of the data making up the macro information for the
    compilation unit. It is relocatable in a relocatable
    object file, and relocated in an executable or shared
    object. It includes DW_FORM_data4 and DW_FORM_data8.


Add (in italics) the following paragraph after the above:

    <i>Because classes lineptr, loclist, and macptr
    share a common representation, it is not
    possible for an attribute to allow more than one
    of these classes. If an attribute allows both
    class constant and one of lineptr, loclist or
    macptr, then DW_FORM_data4 and DW_FORM_data8 are
    interpreted as members of the latter as
    appropriate to the attribute (and not class
    constant).</i>

Modify Figure 17 (Attribute Encodings) as follows:

    DW_AT_location block, loclist
    DW_AT_stmt_list lineptr
    DW_AT_string_length block, loclist
    DW_AT_return_addr block, loclist
    DW_AT_frame_base block, loclist
    DW_AT_macro_info macptr
    DW_AT_static_link block, loclist
    DW_AT_use_location block, loclist
    DW_AT_vtable_elem_location block, loclist

NOTE: I intentionally omitted DW_AT_segment from the list above; there
I believe "constant" was intended to be an actual constant value.


This proposal adds aliases to the description of the constant values described in section 7.5.4. These serve to clarify the use of the constant value, without changing the semantics of the constant values.