This is the mail archive of the
mailing list for the GCC project.
Re: dwarf2out patch: Emit const_value for non-definitions
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Subject: Re: dwarf2out patch: Emit const_value for non-definitions
- From: Daniel Berlin <dberlin at redhat dot com>
- Date: Mon, 25 Sep 2000 10:17:05 -0700 (PDT)
- cc: Jason Merrill <jason at redhat dot com>, gcc-patches at gcc dot gnu dot org, bkoz at cygnus dot com
On Mon, 25 Sep 2000, Benjamin Kosnik wrote:
> This is nice, thanks. Did you get a chance to think about the changes
> Daniel is making to gdb (involving --with-mmap, and throwing away
> duplicate bits of data? I'd sent you mail about it last week but don't
> have it handy now.)
The changes I've made to throw away duplicates could be done in the
linker, but it would be a lot of work.
This throws away duplicates that we can't catch, even with the
elimination we can do in the compiler.
The same optimization could be applied to stabs.
It also fixes bugs, because it's actually the right thing to do anyway.
What we do is thus:
(Ignoring partial symbols, which work similarly, but slightly different).
In the dwarf2 reader, when something goes to get a new symbol it can do
things with (like attach members), it calls new_symbol with a bunch of
paramters, like the name, etc.
What used to happen is that we'd always happily create a new symbol, and
What I did, was add a hash table of symbols, hash the mangled name of the
symbol we want to create, and see if we have a symbol for it already in
the hash table. If we do, we return that symbol. otherwise, we create a
new symbo, add it to
the hash table, and return it.. collisions just cause replacement right now,
because it's a cache, and collissions are very rare.
This removes all symbol duplicates, and doesn't affect statics because
the cache gets reset everytime we read a new file's dwarf2 info.
Eventually i'll get around to fixing that, and handle statics differently
when i do.
We do the same thing for types.
This is actually the right thing to do in both cases, because it causes
the case where we needed the info from earlier symbols of the same name
to work properly, because we end up with one complete,correct, symbol,
rather than 2 incomplete, half-correct ones.
We also end up with a gdb that runs a lot faster, tsince it's dealing
with 26k symbols, and 18k types, rather than 500k symbols, and 1 million
THe mmap changes just fix the stupid "let's allocate one big blob of
memory, and read the entire dwarf2 section into it" problem we had. It
seems like a good idea, until you have a dwarf2 section of 100 meg.
> > -benjamin >
> On Thu, 21 Sep 2000, Jason Merrill wrote:
> > This patch adds an AT_const_value to a declaration DIE for a C++
> > member constant, so that the debugger will know its value even if
> > no definition is ever provided. gdb doesn't seem to take advantage of
> > this yet, however.