> Daniel Jacobowitz wrote: >> I think this is the key bit - my_value_equal called value_fetch_lazy, >> the new code calls gdb_value_fetch_lazy. >> >> Vlad, I noticed that the old code used coerce_array and the new one >> doesn't. Is that a problem? > > This should not be a problem on -var-update path, because we never try > to compare values of array types, since for them type_changeable returns > false. > > However, it looks to be a problem on -var-assign path. Given: > > int b[] = {1,2,3}; > int *a = b; > > if we create varobj for 'a' and assign it the value of 'b', we should not > mark this variable as changed. > > I'll double-check this (and other coercions that coerce_array silently > does) and add new test cases as needed. This version of patch fixes the problem and adds new tests. - Volodya Fetch values from memory in a single place, and only fetch the values that are really needed. * varobj.c (struct varobj): Clarify comment. (my_value_equal): Remove. (install_new_value): New function. (type_of_child): Remove. (varobj_create): Use install_new_value. (varobj_set_value): Use value_contents_equal, not my_value_equal. (varobj_update): Use install_new_value. (create_child): Likewise. Inline type_of_child here. (value_of_child): Don't fetch the value. (c_value_of_root): Likewise. (c_value_of_variable): Likewise. (type_changeable): Improve comments. gdb/testsuite/ * gdb.mi/mi-var-cmd.exp: Check -var-update after assignement of arrays and function pointers. * gdb.mi/var-cmd.c: Add declaration necessary for above tests.