aboutsummaryrefslogtreecommitdiff
path: root/gdb/varobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r--gdb/varobj.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 7f7fda2..b27013c 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1751,6 +1751,16 @@ value_of_root (struct varobj **var_handle, int *type_changed)
new_type = varobj_get_type (tmp_var);
if (strcmp (old_type, new_type) == 0)
{
+ /* The expression presently stored inside var->root->exp
+ remembers the locations of local variables relatively to
+ the frame where the expression was created (in DWARF location
+ button, for example). Naturally, those locations are not
+ correct in other frames, so update the expression. */
+
+ struct expression *tmp_exp = var->root->exp;
+ var->root->exp = tmp_var->root->exp;
+ tmp_var->root->exp = tmp_exp;
+
varobj_delete (tmp_var, NULL, 0);
*type_changed = 0;
}