This is the mail archive of the gdb-patches@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]

Re: [RFC] eval.c (evaluate_subexp_standard) Deal with c++ referenceargs


On Tue, 23 Oct 2001, Daniel Berlin wrote:

> >
> Neither args[0], nor argvec[1], will always be the this pointer.
> Try a static class method.

Oops. I forgot about that. I'll see if I can unwind some of this mess...

Keith

>
> > +      /* Before calling a c++ function, check that reference types are
> > +	 passed as reference types and not something else. */
> > +      if (argvec[0] != NULL && exp->language_defn->la_language ==
> > language_cplus)
> > +	{
> > +	  struct type **args;
> > +	  args = TYPE_ARG_TYPES (VALUE_TYPE (argvec[0]));
> > +	  if (args != NULL)
> > +	    {
> > +	      /* args[0]   = "this" pointer
> > +		 args[1]   = first arg type
> > +		 argvec[0] = method
> > +		 argvec[1] = "this" pointer
> > +		 argvec[2] = first argument */
> > +	      for (ix = 1; args[ix] != NULL
> > +		     && TYPE_CODE (args[ix]) != TYPE_CODE_VOID; ix++)
> > +		{
> > +		  if (TYPE_CODE (args[ix]) == TYPE_CODE_REF
> > +		      && TYPE_CODE (VALUE_TYPE (argvec[2+ix-1])) != TYPE_CODE_REF)
> > +		    {
> > +		      struct value *v = value_addr (argvec[2+ix-1]);
> > +		      argvec[2+ix-1] =
> > +			value_cast (lookup_reference_type (VALUE_TYPE (v)), v);
> > +		    }
> > +		}
> > +	    }
> > +	}
> > +
> >      do_call_it:
> >
> >        if (noside == EVAL_SKIP)
> >
> >
>
>


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