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: -var-update @


On Saturday 29 March 2008 08:15:39 Nick Roberts wrote:
> *** varobj.c.~1.108.~???2008-03-27 08:02:16.000000000 +1200
> --- varobj.c????2008-03-29 17:06:35.000000000 +1200
> *************** varobj_update (struct varobj **varp, str
> *** 1160,1177 ****
> ? ?????? has changed. ?*/
> ? ? ? ? new = value_of_root (varp, &type_changed);
> ? ? ? ? 
> ! ? ? ? /* If this is a floating varobj, and its type has changed,
> ! ?????? them note that it's changed. ?*/
> ! ? ? ? if (type_changed)
> ? ??????VEC_safe_push (varobj_p, result, *varp);
> ? ? ? ? 
> ! ? ? ? ? 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_p, result, *varp);
> ! ?????? ?}
> ? 
> ? ? ? ? if (new == NULL)
> ? ??????{
> --- 1160,1176 ----
> ? ?????? has changed. ?*/
> ? ? ? ? new = value_of_root (varp, &type_changed);
> ? ? ? ? 
> ! ? ? ? /* If this is a floating varobj, then note that it's changed. ?*/
> ! ? ? ? if ((*varp)->root->floating)
> ? ??????VEC_safe_push (varobj_p, result, *varp);

What is the logic here? Surely, a floating varobj might as well not change.
 ? ? ? ? 
> ! ? ? ? 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_p, result, *varp);
> ! ??????}
> ? 
> ? ? ? ? if (new == NULL)
> ? ??????{
> *************** value_of_root (struct varobj **var_handl
> *** 1738,1758 ****
> ? ? ? ? old_type = varobj_get_type (var);
> ? ? ? ? new_type = varobj_get_type (tmp_var);
> ? ? ? ? if (strcmp (old_type, new_type) == 0)
> - ??????{
> - ?????? ?varobj_delete (tmp_var, NULL, 0);
> ? ?????? ?*type_changed = 0;
> - ??????}
> ? ? ? ? else
> - ??????{
> - ?????? ?tmp_var->obj_name =
> - ?????? ? ?savestring (var->obj_name, strlen (var->obj_name));
> - ?????? ?varobj_delete (var, NULL, 0);
> - 
> - ?????? ?install_variable (tmp_var);
> - ?????? ?*var_handle = tmp_var;
> - ?????? ?var = *var_handle;
> ? ?????? ?*type_changed = 1;
> ! ??????}
> ? ? ? ? xfree (old_type);
> ? ? ? ? xfree (new_type);
> ? ? ? }
> --- 1737,1753 ----
> ? ? ? ? old_type = varobj_get_type (var);
> ? ? ? ? new_type = varobj_get_type (tmp_var);
> ? ? ? ? if (strcmp (old_type, new_type) == 0)
> ? ?????? ?*type_changed = 0;
> ? ? ? ? else
> ? ?????? ?*type_changed = 1;
> ! 
> ! ? ? ? tmp_var->obj_name =
> ! ??????savestring (var->obj_name, strlen (var->obj_name));
> ! ? ? ? varobj_delete (var, NULL, 0);
> ! ? ? ? install_variable (tmp_var);
> ! ? ? ? *var_handle = tmp_var;
> ! ? ? ? var = *var_handle;
> ! 
> ? ? ? ? xfree (old_type);
> ? ? ? ? xfree (new_type);
> ? ? ? }

Hmm, I see. This actually causes a new varobj to be created each time.

> I think the patch below fixes the behaviour for var2.  There may be a
> less expensive way to do this, e.g, just update the "struct value",
> but I don't know how to do that.

So, we still don't know why the current code does not work? I think
we still get to figure out, to make sure that whatever bug there is
does not affect other cases.

- Volodya







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