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]
Other format: [Raw text]

[PATCH] eval.c: Fix HP merge botch with set overload off


Thanks, committed.

2002-03-16  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>

	* eval.c (evaluate_subexp_standard): Fix setup of ``this'' pointer
	for method resolution.  Restore adjustment of ``this'' pointer after
	calling value_struct_elt, which was accidentally removed during the
	HP merge.

--- ./eval.c.orig	Fri Jan  4 18:51:38 2002
+++ ./eval.c	Sat Mar  2 11:32:33 2002
@@ -821,15 +821,10 @@ evaluate_subexp_standard (struct type *e
       if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
 	{
 	  int static_memfuncp;
-	  struct value *temp = arg2;
 	  char tstr[256];
 
 	  /* Method invocation : stuff "this" as first parameter */
-	  /* pai: this used to have lookup_pointer_type for some reason,
-	   * but temp is already a pointer to the object */
-	  argvec[1]
-	    = value_from_pointer (VALUE_TYPE (temp),
-				  VALUE_ADDRESS (temp) + VALUE_OFFSET (temp));
+	  argvec[1] = arg2;
 	  /* Name of method from expression */
 	  strcpy (tstr, &exp->elts[pc2 + 2].string);
 
@@ -855,11 +850,17 @@ evaluate_subexp_standard (struct type *e
 	  else
 	    /* Non-C++ case -- or no overload resolution */
 	    {
-	      temp = arg2;
+	      struct value *temp = arg2;
 	      argvec[0] = value_struct_elt (&temp, argvec + 1, tstr,
 					    &static_memfuncp,
 					    op == STRUCTOP_STRUCT
 				       ? "structure" : "structure pointer");
+	      /* value_struct_elt updates temp with the correct value
+	 	 of the ``this'' pointer if necessary, so modify argvec[1] to
+		 reflect any ``this'' changes.  */
+	      arg2 = value_from_longest (lookup_pointer_type(VALUE_TYPE (temp)),
+			     VALUE_ADDRESS (temp) + VALUE_OFFSET (temp)
+			     + VALUE_EMBEDDED_OFFSET (temp));
 	      argvec[1] = arg2;	/* the ``this'' pointer */
 	    }
 

> On Fri, Mar 15, 2002 at 11:42:20AM +0100, Peter.Schauer wrote:
> > For some unknown reason, the adjustment of the ``this'' pointer after
> > method resolution via value_struct_elt was zapped during the HP merge.
> > Putting it back yields identical results from virtfunc.exp, with or without
> > overload resolution. In addition, the initial setup of the ``this'' pointer
> > for method resolution was broken during the merge. It had no effect though,
> > as the method resolution functions are only interested in the type of
> > the ``this'' pointer, and don't care about the real value.
> > 
> > 2002-03-15  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
> > 
> > 	* eval.c (evaluate_subexp_standard): Fix setup of ``this'' pointer
> > 	for method resolution.  Restore adjustment of ``this'' pointer after
> > 	calling value_struct_elt, which was accidentally removed during the
> > 	HP merge.
> 
> Approved, please commit this.  Thanks!
> 
> -- 
> Daniel Jacobowitz                           Carnegie Mellon University
> MontaVista Software                         Debian GNU/Linux Developer

-- 
Peter Schauer			pes@regent.e-technik.tu-muenchen.de


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