aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-11-21 18:02:11 -0700
committerTom Tromey <tom@tromey.com>2017-01-10 19:14:12 -0700
commiteb115069323087e15210c09e3b581be0f6fb5852 (patch)
treea75b8fad89deba750322443fbd0275b3faed3cf9 /gdb/dwarf2loc.c
parent906768f970826102252e8cfd30ee72da71de29f7 (diff)
downloadgdb-eb115069323087e15210c09e3b581be0f6fb5852.zip
gdb-eb115069323087e15210c09e3b581be0f6fb5852.tar.gz
gdb-eb115069323087e15210c09e3b581be0f6fb5852.tar.bz2
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.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index e9b41a1..633a459 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2790,16 +2790,14 @@ dwarf2_loc_desc_get_symbol_read_needs (const gdb_byte *data, size_t size,
struct dwarf2_per_cu_data *per_cu)
{
int in_reg;
- struct cleanup *old_chain;
struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
+ scoped_value_mark free_values;
+
symbol_needs_eval_context ctx;
ctx.needs = SYMBOL_NEEDS_NONE;
ctx.per_cu = per_cu;
-
- old_chain = make_cleanup_value_free_to_mark (value_mark ());
-
ctx.gdbarch = get_objfile_arch (objfile);
ctx.addr_size = dwarf2_per_cu_addr_size (per_cu);
ctx.ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu);
@@ -2820,8 +2818,6 @@ dwarf2_loc_desc_get_symbol_read_needs (const gdb_byte *data, size_t size,
in_reg = 1;
}
- do_cleanups (old_chain);
-
if (in_reg)
ctx.needs = SYMBOL_NEEDS_FRAME;
return ctx.needs;