From 72fc29ff1236177b2be5f702ed40c7d327897e7e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 13 May 2011 15:44:49 +0000 Subject: * utils.c (do_value_free): New function. (make_cleanup_value_free): Likewise. * dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Handle value freeing correctly. (dwarf2_loc_desc_needs_frame): Call make_cleanup_value_free_to_mark. * dwarf2expr.h (struct dwarf_expr_context) : Remove field. * dwarf2expr.c (free_dwarf_expr_context): Don't call value_free_to_mark. (new_dwarf_expr_context): Don't call value_mark. * dwarf2-frame.c (execute_stack_op): Call make_cleanup_value_free_to_mark. * defs.h (make_cleanup_value_free): Declare. --- gdb/utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gdb/utils.c') diff --git a/gdb/utils.c b/gdb/utils.c index 3e4a54d..6fd220a 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -448,6 +448,22 @@ make_cleanup_value_free_to_mark (struct value *mark) return make_my_cleanup (&cleanup_chain, do_value_free_to_mark, mark); } +/* Helper for make_cleanup_value_free. */ + +static void +do_value_free (void *value) +{ + value_free (value); +} + +/* Free VALUE. */ + +struct cleanup * +make_cleanup_value_free (struct value *value) +{ + return make_my_cleanup (&cleanup_chain, do_value_free, value); +} + struct cleanup * make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function, void *arg, void (*free_arg) (void *)) -- cgit v1.1