Fix frozen variable objects laziness

Vladimir Prus vladimir@codesourcery.com
Thu Sep 27 18:06:00 GMT 2007


I've just noticed that gdb mainline has grown some
subtle bugs in the handling of frozen variable objects.

1. The install_new_value always calls value_get_print_value,
which fetches the value. It means that it's not possible
to have read-sensitive variable object that are read only
on user request.

2. In the case where a value for variable object is not
yet fetched, and we -var-update it, we enter install_new_value
and go via this path:

  if (initial && changeable)
	...
  else if (changeable)
    {
      if (var->updated)
	{
	  .....
	}
      else 
	{
	  if (var->not_fetched && value_lazy (var->value))
	    {
	      /* This is a frozen varobj and the value was never read.
		 Presumably, UI shows some "never read" indicator.
		 Now that we've fetched the real value, we need to report
		 this varobj as changed so that UI can show the real
		 value.  */
	      changed = 1;
	    }

And the var->print_value is never updated.

The attached patch, fixes that by:

1. Updating var->print_value in a single place at the end of
install_new_value.

2. Not getting print_value at all for lazy value.

The attached patch fixes that.  Approved by Daniel Jacobowitz and
checked in.

- Volodya


-------------- next part --------------
A non-text attachment was scrubbed...
Name: print_value.diff
Type: text/x-diff
Size: 3524 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20070927/dd032e0b/attachment.bin>


More information about the Gdb-patches mailing list