aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-05-13 15:44:49 +0000
committerTom Tromey <tromey@redhat.com>2011-05-13 15:44:49 +0000
commit72fc29ff1236177b2be5f702ed40c7d327897e7e (patch)
treebce50db16c82b81493f308495b856e7364cefcee /gdb/utils.c
parent3ac5406bdb24ecbb504bda4c539a517fc51122e8 (diff)
downloadgdb-72fc29ff1236177b2be5f702ed40c7d327897e7e.zip
gdb-72fc29ff1236177b2be5f702ed40c7d327897e7e.tar.gz
gdb-72fc29ff1236177b2be5f702ed40c7d327897e7e.tar.bz2
* 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) <mark>: 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.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c16
1 files changed, 16 insertions, 0 deletions
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 *))