diff options
author | Tom Tromey <tom@tromey.com> | 2016-11-21 21:04:59 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-01-10 19:14:13 -0700 |
commit | 0cf082277804ba3747be70a4013019f68b92bb84 (patch) | |
tree | 4277ab15a1d85e67962e4c39229a94c705886c14 /gdb/value.h | |
parent | eb115069323087e15210c09e3b581be0f6fb5852 (diff) | |
download | gdb-0cf082277804ba3747be70a4013019f68b92bb84.zip gdb-0cf082277804ba3747be70a4013019f68b92bb84.tar.gz gdb-0cf082277804ba3747be70a4013019f68b92bb84.tar.bz2 |
Use scoped_value_mark in dwarf2_evaluate_loc_desc_full
This changes dwarf2_evaluate_loc_desc_full to use scoped_value_mark.
Note that this function previously called do_cleanup using the same
cleanup multiple times. I had thought this was buggy, but re-reading
make_my_cleanup2 indicates that it is not. Nevertheless it is
surprising, and at least one of the calls (the one that is completely
removed in this patch) seems to have been done under the assumption
that it would still have some effect.
2017-01-10 Tom Tromey <tom@tromey.com>
* value.h (scoped_value_mark::~scoped_value_mark): Call
free_to_mark.
(scoped_value_mark::free_to_mark): New method.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use
scoped_value_mark.
Diffstat (limited to 'gdb/value.h')
-rw-r--r-- | gdb/value.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gdb/value.h b/gdb/value.h index 0c5ab28..c57ea79 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -728,7 +728,17 @@ class scoped_value_mark ~scoped_value_mark () { - value_free_to_mark (m_value); + free_to_mark (); + } + + /* Free the values currently on the value stack. */ + void free_to_mark () + { + if (m_value != NULL) + { + value_free_to_mark (m_value); + m_value = NULL; + } } private: |