[Dwarf-Discuss] 170427.3 Extending loclists with common sublists

Mark Wielaard mark@klomp.org
Wed Jun 30 12:36:57 GMT 2021


Hi,

We discussed 170427.3 Extending loclists with common sublists in the
last meeting. http://dwarfstd.org/ShowIssue.php?issue=170427.3

This issue was original part of a group of proposals to introduce
Location Views. Location views allow the user to observe multiple
program states at the same program counter. It would allow a user to
see that one instruction does various state changes expressed in the
source program that the compiler optimized into one instruction (for
example increment a variable in two steps in the code, which the
compiler would optimize into one step). Having multiple views makes
having similar location lists more common and/or makes it necessary to
mark those location lists as part of a particular view. But having a
generic mechanism for having common sublists seems useful in general.

This particular issue was split in two because it originally described
two mechanisms, one to extend loclists with user defined operations,
which became http://dwarfstd.org/ShowIssue.php?issue=170427.2

This proposal deals just with introducing two new operands
DW_LLE_extend_loclistx and DW_LLE_extend_loclist. One extends the
location list with to content of the loclist from the given index, the
other uses an offset into the loclists section.

There were various comments on this proposal:

- The original proposal imagined unknown loclist operations would
  end the current location list. Having such an implicit action on
  any unknown operation seems unwanted. So it was proposed to delete
  the part of the proposal.

- We like to keep the operands of loclists and rangelists the same.
  And if it is useful to construct loclists from common sublists, it
  seems it would be useful to construct ranges from common subranges.
  Add the same operands to rangelists.

- It seems more natural to call this include instead of extend.
  So rename DW_LLE_extend_loclistx and DW_LLE_extend_loclist to
  DW_LLE_include_loclistx and DW_LLE_include_loclist.

- Maybe add a note that creating loops with sublists including each
  other is not allowed? Seems obvious, similar to some other constructs
  in DWARF that could create a loop. Not sure if it needs to be
  explicitly spelled out here.

- It isn't really clear if this is needed or is actually an
  optimization without dealing with location view numbering first.
  So it was decided to revisit this issue (with the above changes)
  after we reviewed that proposal:
  http://dwarfstd.org/ShowIssue.php?issue=170427.1

Attached is the updated proposal with the above comments incorporated.

Cheers,

Mark
-------------- next part --------------
Section 2.6.2 Location Lists and Section 2.17.3 Non-Contiguous Address Ranges

This proposal introduces an extension mechanism to loclists and
rnglists, that can be used to share location list or range list
fragments among multiple location or range lists.

In Section 2.6.2:

  * List inclusion.  This kind of entry extends a location list with
    entries from another loclist.  It can be used to share list
    entries among multiple lists.

In Section 2.17.13:

  * Range inclusion.  This kind of entry extends a range list with
    entries from another rnglist.  It can be used to share range
    entries among multiple ranges.

In Section 2.6.2, page 44, add following 1. DW_LLE_end_of_list:

  2. DW_LLE_include_loclistx

  This is a form of list extension, that has one unsigned LEB128
  operand.  The value is an index into the .debug_loclists section,
  like the operand of a DW_FORM_loclistx loclist.  The contents of the
  location identified by the index are added to the base to determine
  the address of the first entry of a loclist whose entries are to be
  regarded as part of the loclist containing the list extension entry.

In Section 2.6.2, page 53, add after 8. DW_LLE_start_length:

  9. DW_RLE_include_rnglist

  This is a form of range extension, that has one offset operand.  The
  value is an offset into the .debug_rnglists section, like the
  operand of a DW_FORM_sec_offset loclist.  The offset identifies the
  first entry of a loclist whose entries are to be regarded as part of
  the loclist containing the list extension entry.

In Section 2.7.13, page 53, add following 1. DW_RLE_end_of_list:

  2. DW_LLE_include_loclistx

  This is a form of range extension, that has one unsigned LEB128
  operand.  The value is an index into the .debug_rnglists section,
  like the operand of a DW_FORM_rnglistx loclist.  The contents of the
  range identified by the index are added to the base to determine
  the address of the first entry of a rnglist whose entries are to be
  regarded as part of the rnglist containing the range extension entry.

In Section 2.7.13, page 54, add after 8. DW_RLE_start_length:

  10. DW_RLE_include_rnglist

  This is a form of range extension, that has one offset operand.  The
  value is an offset into the .debug_rnglists section, like the
  operand of a DW_FORM_sec_offset rnglist.  The offset identifies the
  first entry of a rnglist whose entries are to be regarded as part of
  the rnglist containing the range extension entry.


In Section 7.7.3, add to Table 7.10:

  DW_LLE_include_loclist  | 0x09
  DW_LLE_include_loclistx | 0x0A

In Section 7.25, add to Table 7.30:

  DW_LLE_include_rnglist  | 0x09
  DW_LLE_include_rnglistx | 0x0A



More information about the Dwarf-discuss mailing list