public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Roland McGrath <roland@redhat.com>
Cc: Tom Tromey <tromey@redhat.com>,
	Project Archer <archer@sourceware.org>,
	Cary Coutant <ccoutant@google.com>
Subject: Re: DW_TAG_imported_unit support
Date: Tue, 09 Jun 2009 04:02:00 -0000	[thread overview]
Message-ID: <e394668d0906082102s590065b8m64b29b8d48cd25dc@mail.gmail.com> (raw)
In-Reply-To: <20090604005844.2313DFC3C3@magilla.sf.frob.com>

On Wed, Jun 3, 2009 at 8:58 PM, Roland McGrath<roland@redhat.com> wrote:
> When my DWARF size reduction plan comes along on the producer side,
> there will be some new format elements and/or extensions that GDB
> will want to grok so it can use the packaged debuginfo directly in
> its most compact form.  This remains nebulous since we're still a
> few months away from having any tool to produce any new-style data.
> But I want to let you plan to be ready for what I think we'll have.
>
> I have various ideas for low-level variations/extensions of the format that
> would be used for the most thoroughly compact way to package debuginfo.
> Actuals details of those remain quite vague and yet to be fleshed out.
> Fortunately they are sufficiently coherent in my own mind that I can be
> pretty sure all that will be the less onerous bits to address in GDB/BFD's
> DWARF reader code.
>
> The key piece of the plan that is not an extension, but a proper part of
> DWARF 3--just one that we have never used or supported before.  That is
> DW_TAG_imported_unit (section 3.1.2 of DWARF 3).
>
> This is a magical "middle-level" DWARF feature that is supposed to tell the
> reader to graft a physically separate DWARF tree in as a subtree at another
> given point in the reader's "logical" view of the overall DIE tree rooted
> in a CU.  In this way, common subtrees can be moved off and then shared by
> many different containing DIEs (often in multiple different CUs).  I call
> it "middle-level" because the tag itself is encoded in the normal format--a
> DW_TAG_imported_unit node with a single DW_AT_import attribute--but what is
> specifies is not a "consumer"-level semantic node that the exists in the
> conceptual DIE tree emitted by the compiler, rather it's a "transparent"
> DWARF format detail that the consumer should pretend doesn't exist for
> purposes of its semantic DIE-traversal algorithms.
>
> So it needs to be understood by every place that does a DIE tree walk (or
> just flat enumeration of a given DIE's children).  (Ideally this would be
> consolidated in one "logical tree walker" place, but I imagine the existing
> code might not all be quite so nicely-structured.)  Handling it in a walk
> is pretty straightforward: you follow the DW_AT_import (which should always
> be DW_FORM_ref_addr) to another DIE, which is either DW_TAG_compile_unit or
> DW_TAG_partial_unit.  All the children of that DIE appear in the logical
> tree in place of the DW_TAG_imported_unit child.
>
> The other main wrinkle of DW_TAG_imported_unit is the "which CU" issue.
> The referent DIE is a CU, but logically all the DIEs (its children) you
> look at belong to the referring CU.  For the low-level format pointers,
> the referent CU is what matters: which line table DW_AT_decl_file refers
> to, etc.  For the stuff about using "the CU" as context for how you
> understand DIEs at a semantic level, it's the logically-containing
> (referring) CU that matters: finding the relevant "top of tree" to
> search what's in scope, etc.
>
> So, I didn't really mean to try to cover the whole technical subject.
> I'm sure there are many more corners we will stumble across, and as I
> said this work anticipates producer/transformer tools that aren't there
> yet to drive the need.  But now I've put this task on your radar.

As a data point, reading this made me think of the comdat types
support in DWARF 4.

http://wiki.dwarfstd.org/index.php?title=COMDAT_Type_Sections

I'm not suggesting the two are identical, comdat types is just for,
well, types. :-)
But both tell the reader to (at least conceptually) graft a physically
separate DWARF tree in as a subtree.

      parent reply	other threads:[~2009-06-09  4:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04  0:58 Roland McGrath
2009-06-04 16:58 ` Tom Tromey
2009-06-09  4:02 ` Doug Evans [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e394668d0906082102s590065b8m64b29b8d48cd25dc@mail.gmail.com \
    --to=dje@google.com \
    --cc=archer@sourceware.org \
    --cc=ccoutant@google.com \
    --cc=roland@redhat.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).