This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: suggestion for dictionary representation


On Tue, 24 Sep 2002 01:35:30 -0500, Jim Blandy <jimb@redhat.com> said:

>> Also, for what it's worth, I'm still not ready to completely give up
>> on representing members of classes via a dictionary; that would
>> provide another place where a linear dictionary environment could be
>> useful.

> I agree, but it's worth noting that `struct symbol' is 52 bytes long
> on a Pentium, whereas `struct field' and `struct fn_field' are 16
> bytes long.  

> Not that that necessarily matters.  We know GDB does have memory
> consumption problems, but I have never seen those problems really
> analyzed.

Right.  It wouldn't be something to do lightly, but on the other hand
it's not something to rule out of hand without appropriate profiling.

One possible alternative would be to add a dictionary to each compound
data structure (or, as you suggest, only to certain compound data
structures) that knows how to test whether or not a name is in that
structure, but that always returns the same symbol for a match.  That
would let us get rid of the is_a_field_of_this argument to
lookup_symbol; C++ code could then handle that symbol as a possible
return value and would have enough information to do the right thing,
whereas non-C++ code could ignore the possibility (or gdb_assert that
it was never returned), and it would work automatically with a correct
C++ name lookup algorithm.

It would, of course, still increase GDB's memory usage, but it
wouldn't increase it for every single field.

David Carlton
carlton@math.stanford.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]