[PATCH] m32c-tdep.c: Don't choke on virtual functions in push_dummy_call

Daniel Jacobowitz drow@false.org
Thu Jun 29 13:22:00 GMT 2006


On Thu, Jun 29, 2006 at 01:01:36PM +0200, Corinna Vinschen wrote:
> This I don't understand.  Calling virtual methods works quite nicely,
> at least in my m32c case here.  After dereferencing the method type,
> the m32c_push_dummy_call function passes all args correctly and the
> return value of the call is correct, too.
> 
> As for the problem of having to dereference the virtual function type,
> Maybe it makes sense to do this in call_function_by_hand already.
> Or are you suggesting that the representation of virtual methods is
> incorrect in GDB?

This is what a pointer to a virtual function looks like in the Itanium
(GNU v3) C++ ABI:

struct {
  int (*__pfn) (A *this);
  int __delta;
};

If it's a virtual function, __pfn is actually an offset to the virtual
table.  This is what a pointer to method is supposed to look like.  GDB
botches this.  The house of cards it has now more or less works, but
that's it.

I think you should be getting a TYPE_CODE_METHOD, not a pointer to
method, in target specific code.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list