This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [c++] Pointer to member overhaul
Thanks for looking over it.
On Fri, Dec 29, 2006 at 11:06:21AM -0800, Jim Blandy wrote:
> The comments in cp-abi.h refer to 'cplus_method_ptr_to_target', which
> isn't defined anywhere.
Fixed, thanks.
> The sentence "CONTENTS is the bytes forming the pointer to method"
> isn't grammatical.
Actually I disagree. CONTENTS is a singular noun here, the pointer
whose name is "contents".
> What is the use of TYPE_CODE_METHOD now? Is it equivalent to
> TYPE_CODE_FUNC, except that it expects a 'this' pointer?
It's basically the same as TYPE_CODE_FUNC. I eliminated a number of
cases which treated them differently. dwarf2read uses the distinction
to figure out what's a member pointer, but it could check for
TYPE_CODE_FUNC too. There's some bits in infcall mostly dealing with
argument promotion. It looks like it would be possible to remove
TYPE_CODE_METHOD now - it wouldn't be hard, just require careful
attention to detail.
> Is the representation of a pointer to a data member always simply an
> offset from the start of the member pointer's class? It would be nice
> if the comment for TYPE_CODE_MEMBERPTR said this; similarly, it would
> be nice if the comment for TYPE_CODE_METHODPTR explained that the
> representation varies from one ABI to the next, and one should use the
> cp-abi.h methods to work with them. Say the word, and I'll write
> these for you.
The only supported representation for TYPE_CODE_MEMBERPTR is the GNU v3
one, which is an offset and -1 for NULL. It varies by compiler, but I
did not add support for any other representation, since the only thing
already present was aCC and that support is on its way out. I added
some words.
> Why are vtable_function_descriptors and vbit_in_delta gdbarch methods
> instead of cp-abi.h methods?
Because they don't depend on the ABI, they depend on the architecture.
Itanium sets vtable_function_descriptors but PowerPC64 doesn't. ARM
and MIPS set vbit_in_delta since they need the low bit (for Thumb /
MIPS16).
--
Daniel Jacobowitz
CodeSourcery