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]

representing C++ constructors in GDB's symbol tables


There are currently several problems I see in the way we represent C++
constructors in GDB's symbol table.

First, for a class named "X", we put three (or possibly four) entries
in VAR_DOMAIN all named "X": the typedef, and two (or possibly three)
constructors.  This makes it (cough) difficult to look up the one you
need.

It occured to me that perhaps constructors should not be in the
VAR_DOMAIN.  You can't use them by name in expressions: you have to
say "new X(...)", never "X(...)".  You can't call them directly.  You
can't take their addresses: "&X::X(int)" is not valid C++.  The only
reason they really have names at all is to let you define them outside
the class.

Creating a new CONSTRUCTORS_DOMAIN would give you something reasonable
to pass when handling a "new" expression.  And there's nothing wrong
with adding a C++-specific domain; domains were created to distinguish
the different roles identifiers might play in a particular language:
witness STRUCT_DOMAIN vs VAR_DOMAIN for C.

Then there's the question of duplicate copies of the constructors
themselves.  The code at the moment wants to distinguish them by their
physical (linker) names, but I gather one of the main thrusts of David
and Daniel's work was to move away from the internal use of mangled
names for this kind of thing.  Domains are the wrong tool there; the
presence of multiple constructor copies is an ABI-specific thing.
I don't have an answer to that that sounds good yet. 


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