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]

Fix 'selected frame' varobjs


At the moment, the 'selected frame' varobjs (created with -var-create NAME @) are
somewhat broken.

I've reported that in:

	http://article.gmane.org/gmane.comp.gdb.devel/16381

to which Dan posted a preliminary patch to which I replied with another bug:

	http://article.gmane.org/gmane.comp.gdb.devel/16398

and the story ended there. This patch fixed both problems and causes no
regressions. OK?

- Volodya

2006-12-31  Daniel Jacobowitz  <dan@codesourcery.com>
	    Vladimir Prus  <vladimir@codesourcery.com>

	Fix 'selected frame' varobjs.
	* varobj.c (varobj_update): If we get error getting new
	value of root, reset the value.
	(c_value_of_root): Always reevaluate the value
	of selected frame varobjs in the selected frame.
	Dont call reinit_frame_cache.
--- gdb/varobj.c	(/mirrors/gdb_mainline)	(revision 3011)
+++ gdb/varobj.c	(/patches/gdb/at_varobjs/gdb_mainline)	(revision 3011)
@@ -1061,6 +1061,14 @@ varobj_update (struct varobj **varp, str
   if (new == NULL)
     {
       (*varp)->error = 1;
+      /* Also set the value to NULL, so that
+	 when the value becomes valid in future,
+	 -var-update notice the change.  */
+      if ((*varp)->value != NULL)
+	{
+	  value_free ((*varp)->value);
+	  (*varp)->value = NULL;
+	}
       return -1;
     }
 
@@ -1950,11 +1958,10 @@ c_value_of_root (struct varobj **var_han
 
 
   /* Determine whether the variable is still around. */
-  if (var->root->valid_block == NULL)
+  if (var->root->valid_block == NULL || var->root->use_selected_frame)
     within_scope = 1;
   else
     {
-      reinit_frame_cache ();
       fi = frame_find_by_id (var->root->frame);
       within_scope = fi != NULL;
       /* FIXME: select_frame could fail */

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