Issue 220706.1: Default Locations for Pieces of a Composite Location Description

Author: Cary Coutant
Champion: Cary Coutant
Date submitted: 2022-07-06
Date revised: 2023-04-03
Date closed:
Type: Enhancement
Status: Open
DWARF Version: 6

Section 2.6.1.1, pg 39

Background

With the addition of default location descriptions in location lists in DWARF 5, it is possible to provide a default location for a variable that describes where it exists in memory for most of its lifetime, excluding those ranges of code where it may have been promoted to a register (for example).

For composite location descriptions, however, consider a scenario where one piece of a variable (say, a field of a structure) is promoted to a register in a range of code, while the remainder of that variable remains in its default location. We have no way of describing this scenario without repeating the default location description of each piece that has not been promoted.

This proposal adds a simple way of indicating that a particular piece of a composite location description should defer to the default location description for that piece.

Proposed Changes to the DWARF Specification

In Section 2.6.1.1 (Simple Location Descriptions), pages 39-41, add the following:

2.6.1.1.5 Default Location Descriptions

A default location description represents a piece of an object whose location is given by the default location description in a location list (see Section 2.6.2). It may be used in a composite location description that is part of a location list entry, to describe a piece or pieces of an object that remain in the default location even when another piece or pieces have a different location for a particular address range. It consists of the single opcode DW_OP_default_location.

In Section 7.7.1 (DWARF Expressions), Table 7.9, beginning on Page 223, add a row:

Operation              Code       No. of Operands    Notes
---------              ----       ---------------    -----
DW_OP_default_location TBA        0

2023-04-03: Deferred until Tony T's overlay proposal.