[Dwarf-discuss] Overlapping PC ranges

Ron Brender ron.brender@gmail.com
Sat Sep 23 19:19:55 GMT 2023


Tim writes:

DWARF5 Section 2.17.3 explicitly states that *Bounded* ranges cannot
overlap, but there is no comment about contiguous ranges
(DW_AT_{low,high}_pc) or *Base address* range list entries. Is this a case
of "the exception that proves the rule"?


A "bounded range" is a contiguous range by definition. A base address range
entry is not a range at all--it merely modifies how the limit values in
following bounded range entries of the same list are interpreted. So what
is the problem or question? I see no exception that needs proving...

More completely, DWARF5 states (page 53, lines 15-16):

Bounded range entries in a range list may not overlap.


That is, the bounded range entries *within a single range list* may not
overlap. There is no restriction against entries in two different lists
overlapping. For example, the addresses for a function are necessarily
included in the addresses of the containing compilation unit. Their ranges
thus overlap--but they have distinct range lists.

The question about an outlined subprogram is unclear to me. If there are
two DW_AT_subprogram entries then each will have a distinct range list.
Even if the two units "share" some common code, each list can be complete
and include the common code without creating an overlap within its list.

Perhaps I am missing something--if so, please clarify.

Ron

=========================================
On Fri, Sep 22, 2023 at 11:43 PM Tim Haines via Dwarf-discuss <
dwarf-discuss@lists.dwarfstd.org> wrote:

> DWARF5 Section 2.17.3 explicitly states that *Bounded* ranges cannot
> overlap, but there is no comment about contiguous ranges
> (DW_AT_{low,high}_pc) or *Base address* range list entries. Is this a
> case of "the exception that proves the rule"?
>
> For DW_TAG_compile_unit and DW_TAG_type_unit entries, I don't think it
> would ever make sense for a compiler to emit overlapping PC ranges. Am I
> lacking imagination here? Was there a corner case in DWARF4 that needed
> this?
>
> For a DW_AT_subprogram entry, it might make sense to have overlapping
> ranges as it's possible the compiler has outlined the function and created
> two debug entries: one for the complete function and one for the extracted
> part.
>
> Thanks.
> - Tim
>
> --
> Dwarf-discuss mailing list
> Dwarf-discuss@lists.dwarfstd.org
> https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dwarfstd.org/pipermail/dwarf-discuss/attachments/20230923/d3cb5ee2/attachment.htm>


More information about the Dwarf-discuss mailing list