aboutsummaryrefslogtreecommitdiff
path: root/gdb/varobj.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-03-23 09:53:52 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-03-23 09:53:52 +0000
commit6208b47d6c2552d1dd81d85b8b8ce350ea9fd09e (patch)
tree7d20e530ffd90c59b0a745d749a1afcb50f3da0d /gdb/varobj.c
parent44a67aa79a7f75ab484b560b0327b21acdd97d5c (diff)
downloadgdb-6208b47d6c2552d1dd81d85b8b8ce350ea9fd09e.zip
gdb-6208b47d6c2552d1dd81d85b8b8ce350ea9fd09e.tar.gz
gdb-6208b47d6c2552d1dd81d85b8b8ce350ea9fd09e.tar.bz2
* thread.c (make_cleanup_restore_current_thread): Make it
globally visible. * gdbthread.h (make_cleanup_restore_current_thread): Declare. * varobj.c (varobj_update): Don't save/restore frame. (c_value_of_root): Save/restore thread and frame here, using make_cleanup_restore_current_thread. * Makefile.in: Update dependecies.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r--gdb/varobj.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c
index c5df325..3f08dfc 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -31,6 +31,8 @@
#include "varobj.h"
#include "vec.h"
+#include "gdbthread.h"
+#include "inferior.h"
/* Non-zero if we want to see trace of varobj level stuff. */
@@ -1111,7 +1113,6 @@ varobj_update (struct varobj **varp, struct varobj ***changelist,
struct value *new;
VEC (varobj_p) *stack = NULL;
VEC (varobj_p) *result = NULL;
- struct frame_id old_fid;
struct frame_info *fi;
/* sanity check: have we been passed a pointer? */
@@ -1130,10 +1131,6 @@ varobj_update (struct varobj **varp, struct varobj ***changelist,
if ((*varp)->root->rootvar == *varp)
{
- /* Save the selected stack frame, since we will need to change it
- in order to evaluate expressions. */
- old_fid = get_frame_id (deprecated_safe_get_selected_frame ());
-
/* Update the root variable. value_of_root can return NULL
if the variable is no longer around, i.e. we stepped out of
the frame in which a local existed. We are letting the
@@ -1141,11 +1138,6 @@ varobj_update (struct varobj **varp, struct varobj ***changelist,
has changed. */
type_changed = 1;
new = value_of_root (varp, &type_changed);
-
- /* Restore selected frame. */
- fi = frame_find_by_id (old_fid);
- if (fi)
- select_frame (fi);
/* If this is a "use_selected_frame" varobj, and its type has changed,
them note that it's changed. */
@@ -2153,12 +2145,15 @@ c_value_of_root (struct varobj **var_handle)
struct varobj *var = *var_handle;
struct frame_info *fi;
int within_scope;
-
+ struct cleanup *back_to;
+
/* Only root variables can be updated... */
if (!is_root_p (var))
/* Not a root var */
return NULL;
+ back_to = make_cleanup_restore_current_thread (
+ inferior_ptid, get_frame_id (deprecated_safe_get_selected_frame ()));
/* Determine whether the variable is still around. */
if (var->root->valid_block == NULL || var->root->use_selected_frame)
@@ -2187,6 +2182,8 @@ c_value_of_root (struct varobj **var_handle)
return new_val;
}
+ do_cleanups (back_to);
+
return NULL;
}