aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-08-11 20:36:49 +0000
committerTom Tromey <tromey@redhat.com>2009-08-11 20:36:49 +0000
commit4a22739830aea21ec5de7756676a9ce7c3821001 (patch)
treed940da935e83fa6c33d7d8b5a1a7a66db52667b1 /gdb/dwarf2loc.c
parent0d8f9b2ced3015b9857a2456dcde76e04f18121f (diff)
downloadgdb-4a22739830aea21ec5de7756676a9ce7c3821001.zip
gdb-4a22739830aea21ec5de7756676a9ce7c3821001.tar.gz
gdb-4a22739830aea21ec5de7756676a9ce7c3821001.tar.bz2
* dwarf2loc.c (dwarf2_evaluate_loc_desc): Make a cleanup.
(dwarf2_loc_desc_needs_frame): Likewise. * dwarf2expr.h (make_cleanup_free_dwarf_expr_context): Declare. * dwarf2expr.c (free_dwarf_expr_context_cleanup): New function. (make_cleanup_free_dwarf_expr_context): Likewise. * dwarf2-frame.c (execute_stack_op): Make a cleanup.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 071b5ac..1df6a9f 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -215,6 +215,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
struct value *retval;
struct dwarf_expr_baton baton;
struct dwarf_expr_context *ctx;
+ struct cleanup *old_chain;
if (size == 0)
{
@@ -228,6 +229,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
baton.objfile = dwarf2_per_cu_objfile (per_cu);
ctx = new_dwarf_expr_context ();
+ old_chain = make_cleanup_free_dwarf_expr_context (ctx);
+
ctx->gdbarch = get_objfile_arch (baton.objfile);
ctx->addr_size = dwarf2_per_cu_addr_size (per_cu);
ctx->baton = &baton;
@@ -282,7 +285,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
set_value_initialized (retval, ctx->initialized);
- free_dwarf_expr_context (ctx);
+ do_cleanups (old_chain);
return retval;
}
@@ -346,10 +349,13 @@ dwarf2_loc_desc_needs_frame (gdb_byte *data, unsigned short size,
struct needs_frame_baton baton;
struct dwarf_expr_context *ctx;
int in_reg;
+ struct cleanup *old_chain;
baton.needs_frame = 0;
ctx = new_dwarf_expr_context ();
+ old_chain = make_cleanup_free_dwarf_expr_context (ctx);
+
ctx->gdbarch = get_objfile_arch (dwarf2_per_cu_objfile (per_cu));
ctx->addr_size = dwarf2_per_cu_addr_size (per_cu);
ctx->baton = &baton;
@@ -373,7 +379,7 @@ dwarf2_loc_desc_needs_frame (gdb_byte *data, unsigned short size,
in_reg = 1;
}
- free_dwarf_expr_context (ctx);
+ do_cleanups (old_chain);
return baton.needs_frame || in_reg;
}