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] -var-update [was Re: Variable objects: references formatting]


Nick Roberts <nickrob@snap.net.nz> writes:
>  > > However, do you see the problem with references that I mentioned earlier
>  > > (that they don't seem to disappear from the changelist with -var-update)?
>  > > This seems to be the case for any variable object made from a reference.
>  > 
>  > Yes, I see that for variable object created from reference, -var-update * 
>  > always mentions that. Looking at this under debugger, it seems that the call 
>  > to my_value_equal in varobj_update compares the value of *reference* to the 
>  > value of new *referenced-to* object. This happens in my_value_equal 
>  > (varobj.c):
>  >
>  >  static int
>  >  my_value_equal (struct value *val1, struct value *volatile val2, int
>  >   *error2)
>  > ...
>
>  >   ...Alas, quick attempt to do that results in segfault, and I'm out of 
>  > time for today. Feel free to beat me to it ;-)
>
> I think this patch works.  My reasoning is one of symmetry: whatever is done to
> val2 should also be done to val1, and that you probably don't want to change
> the contents of val1 (hence val3).  I don't know exactly what coerce_array
> does, apart from convert the type from TYPE_CODE_REF to TYPE_CODE_INT or
> TYPE_CODE_FLOAT or whatever, so the comment might not be quite
> right.

Is there any reason you declared a new variable instead of just saying:

   val1 = coerce_array (val1)

?  That would make the symmetry more apparent.

(I don't know enough about the context to review the patch more
substantially.)


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