+
+ * 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.
+
* varobj.c (struct varobj_root): Clarify
$(gdb_assert_h) $(regcache_h) $(block_h) $(dfp_h)
varobj.o: varobj.c $(defs_h) $(exceptions_h) $(value_h) $(expression_h) \
$(frame_h) $(language_h) $(wrapper_h) $(gdbcmd_h) $(block_h) \
- $(gdb_assert_h) $(gdb_string_h) $(varobj_h) $(vec_h)
+ $(gdb_assert_h) $(gdb_string_h) $(varobj_h) $(vec_h) $(gdbthread_h) \
+ $(inferior_h)
vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \
$(vax_tdep_h) $(inf_ptrace_h) $(bsd_kvm_h)
vax-nat.o: vax-nat.c $(defs_h) $(inferior_h) $(gdb_assert_h) $(vax_tdep_h) \
static void thread_apply_command (char *, int);
static void restore_current_thread (ptid_t);
static void prune_threads (void);
-static struct cleanup *make_cleanup_restore_current_thread (ptid_t,
- struct frame_id);
void
delete_step_resume_breakpoint (void *arg)
xfree (old);
}
-static struct cleanup *
+struct cleanup *
make_cleanup_restore_current_thread (ptid_t inferior_ptid,
struct frame_id a_frame_id)
{
#include "varobj.h"
#include "vec.h"
+#include "gdbthread.h"
+#include "inferior.h"
/* Non-zero if we want to see trace of varobj level stuff. */
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? */
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
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. */
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)
return new_val;
}
+ do_cleanups (back_to);
+
return NULL;
}