[Dwarf-Discuss] More on DW_AT_str_offset_base debug_str_offsets.dwo confusion

David Blaikie dblaikie@gmail.com
Tue Sep 1 17:05:34 GMT 2020

On Tue, Sep 1, 2020 at 6:59 AM David Anderson <davea42 at linuxmail.org> wrote:

> On 8/31/20 8:39 PM, David Blaikie wrote:
> > Hmm... yeah. I guess LLVM implements rnglistx /rnglist_base the same
> > as strx/str_offsets_base. Where it assumes that any *x encoding refers
> > to entities in the .dwo, even in the absence of a
> > rnglists_base/str_offsets_base in the split full unit. I had thought
> > we'd implemented it to emit a rnglists_base in the split full unit,
> > which would've been in contrast to the str_offsets_base - so my
> > mistake/apologies for the previous description.
> So the base addresses are in the skeleton and the actual section
> (rnglists/loclists/str_offsets/str)
> can go with Split Full (i.e, in a .dwo) if it has no addresses but must
> go with the skeleton if has addresses.

Sorry, I missed a step/not sure I understand this ^ comment - could you
rephrase/expound/clarify a bit?

I'm suggesting there are two possible ways we could spec this:

1) all loclistx, rnglistx, strx in .dwo are required/guaranteed/defined to
always refer to debug_loclists.dwo, debug_rnglists.dwo,
  In this model, there's no way to

  -> this is how parts of the spec seem to be already defined, and how
strx/loclistx work in the DWARFv4 GNU extension Split DWARF implementation
(there's no loclists_base or str_offsets_base - the strx/loclistx in
debug_info.dwo is assumed to refer to the str_offsets.dwo/loc.dwo sections)

2) allow/require a *x encoding in a split full unit to refer (when combined
with a *_base attribute on the skeleton CU) a split full unit's
*_rnglist/loclist/str_offsets (non-dwo) contributions if the split full
unit has no *_base attributes. The split full unit's *_base attribute could
then be optionally specified to say "resolve *x encodings relative to/in
the split unit, instead of searching back up into the skeleton unit".

(1) is what LLVM's implemented at the moment, and changing that to (2)
wouldn't be too hard (we'd just always emit a *_base attribute in the split
full unit any time we were using the corresponding *x forms in the split
full unit)

> Ok.
> This way the standard is not in error as written.

I think there's still some contradictions - the two bits I quoted

"The DW_AT_addr_base and DW_AT_str_offsets_base attributes provide context
that may be necessary to interpret the contents of the corresponding split
DWARF object file."
"The following attributes are not part of a split full compilation unit
entry but instead are inherited (if present) from the corresponding
skeleton compilation unit: DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges,
DW_AT_stmt_list, DW_AT_comp_dir, DW_AT_str_offsets_base, DW_AT_addr_base
and DW_AT_rnglists_base."

If we're going with model (1), then the first of those two quotations
should remove "and DW_AT_str_offsets_base" and the second should carveout a
special case for str_offsets_base and rnglists_base to say they cannot be
specified on a skeleton unit, but also are /not/ inherited by the split
full compilation unit. (essentially the split full compilation unit has
implicit *_base attributes (if you think of them more like the (2) model
above) equal to the size of the contribution headers for those 3 sections)

> This understanding
> restricts what information can be derived from
> the Split Full CU by itself (ie, without the skeleton) a bit since the
> base addresses are not in the Split Full CU DIE.

That confuses me a bit. If you have rnglists.dwo, for example - you can't
use the actual rnglists_base from the skeleton CU to find the rnglists.dwo
contribution (because the rnglists_base will be relocated in the final
executable, to a value that has nothing to do with the rnglists.dwo
contribution location in the dwo or the index-relative location in the
dwp). So having the skeleton CU shouldn't make you any more or less able to
parse/dump/etc *x forms in a split full unit if we're using (1). If we're
using (2), then the wording needs to change to say that you must specify
*_base on the split full unit if you want to resolve *x forms in the split
full unit into rnglists.dwo/loclists.dwo/str_offsets.dwo references, and in
the absence of *_base on the split full unit, such *x forms would use the
*_base in the skeleton unit and the rnglists/loclists/str_offsets (non-dwo)
in the linked executable.

> Mike Eager: please delete the new issue 200831.1 as it is simply wrong.
> DavidA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20200901/d19a8abe/attachment-0001.html>

More information about the Dwarf-discuss mailing list