diff options
author | Doug Evans <xdje42@gmail.com> | 2014-03-13 09:24:19 -0700 |
---|---|---|
committer | Doug Evans <xdje42@gmail.com> | 2014-03-13 09:24:19 -0700 |
commit | 350e1a768cca6deab7aeca8adcff9561faeb1f35 (patch) | |
tree | 0516a81e3241b782e18e12a726da4054c1b7d2f2 /gdb/value.c | |
parent | c307e84195f4cc97bf73fcefcb947f73a17b1141 (diff) | |
download | gdb-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.c | 6 |
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. */ |