aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2014-03-13 09:24:19 -0700
committerDoug Evans <xdje42@gmail.com>2014-03-13 09:24:19 -0700
commit350e1a768cca6deab7aeca8adcff9561faeb1f35 (patch)
tree0516a81e3241b782e18e12a726da4054c1b7d2f2 /gdb/value.c
parentc307e84195f4cc97bf73fcefcb947f73a17b1141 (diff)
downloadgdb-350e1a768cca6deab7aeca8adcff9561faeb1f35.zip
gdb-350e1a768cca6deab7aeca8adcff9561faeb1f35.tar.gz
gdb-350e1a768cca6deab7aeca8adcff9561faeb1f35.tar.bz2
Fix segv when referencing a value added to history after a Guile garbage collect.
* value.c (record_latest_value): Call release_value_or_incref instead of release_value. testsuite/ * gdb.guile/scm-value.exp (test_value_in_inferior): Verify value added to history survives a gc.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 4e8d1fe..27043ee 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1659,7 +1659,11 @@ record_latest_value (struct value *val)
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);
+
+ /* The value may have already been released, in which case we're adding a
+ new reference for its entry in the history. That is why we call
+ release_value_or_incref here instead of release_value. */
+ release_value_or_incref (val);
/* Here we treat value_history_count as origin-zero
and applying to the value being stored now. */