Add scoped_value_mark
authorTom Tromey <tom@tromey.com>
Tue, 22 Nov 2016 01:02:11 +0000 (18:02 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 11 Jan 2017 02:14:12 +0000 (19:14 -0700)
commiteb115069323087e15210c09e3b581be0f6fb5852
treea75b8fad89deba750322443fbd0275b3faed3cf9
parent906768f970826102252e8cfd30ee72da71de29f7
Add scoped_value_mark

This adds a scoped_value_mark class, that records the value mark in
the constructor and then calls value_free_to_mark in the destructor.
It then updates various spots in gdb to use this class, rather than a
cleanup.

It would be better overall to replace "struct value *" with a
shared_ptr, maybe eliminating the need for this class (watchpoints
would perhaps need some new mechanism as well).  However, that's
difficult to do.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-value.c (valpy_dereference, valpy_referenced_value)
(valpy_reference_value, valpy_const_value, valpy_get_address)
(valpy_get_dynamic_type, valpy_lazy_string, valpy_do_cast)
(valpy_getitem, valpy_call, valpy_binop_throw, valpy_negative)
(valpy_absolute, valpy_richcompare_throw): Use scoped_value_mark.
* dwarf2loc.c (dwarf2_loc_desc_get_symbol_read_needs): Use
scoped_value_mark.
* dwarf2-frame.c (execute_stack_op): Use scoped_value_mark.
* value.h (scoped_value_mark): New class.
gdb/ChangeLog
gdb/dwarf2-frame.c
gdb/dwarf2loc.c
gdb/python/py-value.c
gdb/value.h