Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Daniel Berlin <dan@cgsoftware.com>
Cc: gdb@sources.redhat.com
Subject: Re: C++ and multiple compilation units
Date: Wed, 18 Jul 2001 15:51:00 -0000	[thread overview]
Message-ID: <npofqhvoia.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <87n1631apn.fsf@cgsoftware.com>

Daniel Berlin <dan@cgsoftware.com> writes:
> In fact, dwarf2.1 adds an imported_unit/partial_unit tag so that you
> can comdat just about everything, and not screw up the scope
> (partial_unit means ignore it when scanning toplevel cu's, we read
> it in when we see the imported_unit tag))

This is new in Draft 6, right?

> >  Does GCC generate these inter-CU
> > references now? 
> 
> No, but only because GDB can't handle them
> Let me rephrase that. It *can* generate them, it just defaults to not doing so.
> -feliminate-dwarf2-dups is the flag to turn it on.

Okay.

> >   Do you have a test case?
> I can easily generate them, if you like. It's pretty trivial.

That would be really helpful.

> The inter-die cu references is what started the need the rewrite.
> We assume everywhere we are only processing the current CU, and
> never have to move between them.

That's right.

> So i rewrote the whole damn thing to pass around a structure that
> contains the compilation unit context to do whatever in.  When we need
> to switch between compilation units, we just change the context we are
> passing around, reading in the abbrevs/whatever for that cu if
> necessary.

But once we've called read_comp_unit, we're not going any more I/O ---
we've turned the whole CU into a linked list (which should be a tree)
of `struct die_info' nodes.  So if we find a reference to another
compilation unit, it seems to me we could just call read_comp_unit
again, and extend our die list (and reference table).

We'd need a map of where each compilation unit starts and ends, so we
could tell which CU to read when we find a reference that falls
outside of our own.  But that's easily produced when we build the
partial symbols.

Suppose further that we restructured `struct die_info' to be a real
tree, not a linked list whose tree structure is only apparent from the
presence of null dies.  Each die could have a parent pointer, which
would allow us to produce scoped names.

This *sounds* a bit simpler than your changes.  But I haven't actually
done the work, so I can't be sure.


  reply	other threads:[~2001-07-18 15:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-17 13:03 Jim Blandy
2001-07-17 14:56 ` Daniel Berlin
2001-07-18 15:51   ` Jim Blandy [this message]
2001-07-18 21:58     ` Daniel Berlin

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=npofqhvoia.fsf@zwingli.cygnus.com \
    --to=jimb@zwingli.cygnus.com \
    --cc=dan@cgsoftware.com \
    --cc=gdb@sources.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