summaryrefslogtreecommitdiff
path: root/gdb/values.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/values.c')
-rw-r--r--gdb/values.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gdb/values.c b/gdb/values.c
index 1c833af52c8..1eaef33254b 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -259,6 +259,18 @@ record_latest_value (val)
if (i) return -1; /* Indicate value not saved in history */
}
+ /* We don't want this value to have anything to do with the inferior anymore.
+ In particular, "set $1 = 50" should not affect the variable from which
+ the value was taken, and fast watchpoints should be able to assume that
+ a value on the value history never changes. */
+ if (VALUE_LAZY (val))
+ value_fetch_lazy (val);
+ /* We preserve VALUE_LVAL so that the user can find out where it was fetched
+ from. This is a bit dubious, because then *&$1 does not just return $1
+ but the current contents of that location. c'est la vie... */
+ val->modifiable = 0;
+ release_value (val);
+
/* Here we treat value_history_count as origin-zero
and applying to the value being stored now. */
@@ -275,18 +287,6 @@ record_latest_value (val)
value_history_chain->values[i] = val;
- /* We don't want this value to have anything to do with the inferior anymore.
- In particular, "set $1 = 50" should not affect the variable from which
- the value was taken, and fast watchpoints should be able to assume that
- a value on the value history never changes. */
- if (VALUE_LAZY (val))
- value_fetch_lazy (val);
- /* We preserve VALUE_LVAL so that the user can find out where it was fetched
- from. This is a bit dubious, because then *&$1 does not just return $1
- but the current contents of that location. c'est la vie... */
- val->modifiable = 0;
- release_value (val);
-
/* Now we regard value_history_count as origin-one
and applying to the value just stored. */