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: Problem with virtual function pointers


On Thu, Mar 27, 2003 at 03:24:12PM +0100, Corinna Vinschen wrote:
> Hi,
> 
> I'm just investigating a problem which XStormy16 gets in
> gdb.c++/printmethod.exp:
> 
>   print theA->virt^M
>   $1 = invalid pointer to member function^M
>   FAIL: gdb.c++/printmethod.exp: print virtual method.
> 
> It turned out that the error happens in xstormy16_pointer_to_address().
> This function converts an address to a jump table entry into a pointer
> to the actual function.  To do this, it calls a conversion routine,
> which is only called if the following condition applies:
> 
> 
>   enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
> 
>   if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
>     convert();
> 
> Surprisingly (at least for me) this fails for the above case.  Looking
> into type, I found that type is TYPE_CODE_PTR which is correct, but
> target_type is TYPE_CODE_VOID!  Sure, the above virtual method is of
> type void but is that really ok?  Shouldn't that be 
> 
>   type: TYPE_CODE_PTR
>   type->target_type: TYPE_CODE_METHOD
>   type->target_type->target_type: TYPE_CODE_VOID
> 
> ?

Could you give me a backtrace?

> Does somebody know why that happens?  Is that just a bug in gdb?  Or
> could that be related to incorrect debug info from gcc?

I believe this has to do with the type info emitted for virtual
function tables, but I need to see the backtrace to confirm.  If so I'm
not sure whether it's really a bug in GCC or GDB...

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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