This is the mail archive of the gdb-patches@sourceware.org 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: [Patch] [MI] Out-of-scope varObjects no longer trigger a var-update change


Marc Khouzam writes:
 > Below is the session.  The testcase is part of my Eclipse
 > regression testsuite and basically looks for the content
 > of a variable name the same thing as a previous variable,
 > which is part of a method named the same thing as where the
 > previous variable was.  You'll understand better from the code
 > below :-)

OK, I see this now.  The failure occurs because `public' is considered
an unchangeable field by GDB.

 > Note that the below passes after I applied my proposed patch.

As a general principle, if a regression occurs I try to remove some of the
added logic, rather than add to it, as I find the latter tends to make
the logic more convoluted.

The procedure, varobj_update, used to return a scalar that corresponded to the
status field of the structure. varobj_update_result.  I don't know what the
advantage of returning a vector of structures is but, in any case, the changed
field of varobj_update_result appears not to be used outside varobj_update.  I
would suggest a change something like below.  A full patch would remove the
changed field altogether.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


*** varobj.c	25 Apr 2009 13:04:27 +1200	1.127
--- varobj.c	03 May 2009 03:27:17 +1200	
*************** VEC(varobj_update_result) *varobj_update
*** 1182,1198 ****
        r.varobj = *varp;
  
        r.type_changed = type_changed;
-       if (install_new_value ((*varp), new, type_changed))
- 	r.changed = 1;
-       
-       if (new == NULL)
- 	r.status = VAROBJ_NOT_IN_SCOPE;
  
!       if (r.type_changed || r.changed)
  	VEC_safe_push (varobj_update_result, result, &r);
  
!       if (r.status == VAROBJ_NOT_IN_SCOPE)
! 	return result;
      }
  
    VEC_safe_push (varobj_p, stack, *varp);
--- 1182,1204 ----
        r.varobj = *varp;
  
        r.type_changed = type_changed;
  
!       if (r.type_changed)
  	VEC_safe_push (varobj_update_result, result, &r);
  
!       if (install_new_value ((*varp), new, type_changed))
! 	{
! 	  /* If type_changed is 1, install_new_value will never return
! 	     non-zero, so we'll never report the same variable twice.  */
! 	  gdb_assert (!type_changed);
! 	  VEC_safe_push (varobj_update_result, result, &r);
! 	}
!       
!       if (new == NULL)
! 	{
! 	  r.status = VAROBJ_NOT_IN_SCOPE;
! 	  return result;
! 	}
      }
  
    VEC_safe_push (varobj_p, stack, *varp);


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