diff options
author | Tom Tromey <tom@tromey.com> | 2016-09-25 16:28:03 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2016-10-21 14:17:37 -0600 |
commit | 718b962660007c529f4ff4c5e940119da21e05a7 (patch) | |
tree | aec64a64fc7753e25948ddc5555b989a359853bd /gdb/dwarf2-frame.c | |
parent | 5841433461e2ce9da41292a49af4cc3c6b1e1f2d (diff) | |
download | gdb-718b962660007c529f4ff4c5e940119da21e05a7.zip gdb-718b962660007c529f4ff4c5e940119da21e05a7.tar.gz gdb-718b962660007c529f4ff4c5e940119da21e05a7.tar.bz2 |
Initial conversion of dwarf_expr_ctx
This is the first step in the conversion of dwarf_expr_ctx to a C++
class. This conversion is done in steps to make the patches, and the
reviews, a bit simpler. This patch changes dwarf_expr_ctx to be
stack-allocated and removes the associated cleanup.
2016-10-21 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Stack-allocate
dwarf_expr_context. Remove cleanups.
(dwarf2_locexpr_baton_eval)
(dwarf2_loc_desc_get_symbol_read_needs): Likewise.
* dwarf2expr.h (dwarf_expr_context, ~dwarf_expr_context): Add
constructors and destructors.
(new_dwarf_expr_context, free_dwarf_expr_context)
(make_cleanup_free_dwarf_expr_context): Don't declare.
* dwarf2-frame.c (execute_stack_op): Stack-allocate
dwarf_expr_context. Remove cleanups.
(dwarf_expr_context): Rename from new_dwarf_expr_context. Turn
into constructor.
(free_dwarf_expr_context, free_dwarf_expr_context_cleanup):
Remove.
(~dwarf_expr_context): Rename from
make_cleanup_free_dwarf_expr_context. Turn into destructor.
Diffstat (limited to 'gdb/dwarf2-frame.c')
-rw-r--r-- | gdb/dwarf2-frame.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 11258ea..48963de 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -369,29 +369,27 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size, CORE_ADDR offset, struct frame_info *this_frame, CORE_ADDR initial, int initial_in_stack_memory) { - struct dwarf_expr_context *ctx; CORE_ADDR result; struct cleanup *old_chain; - ctx = new_dwarf_expr_context (); - old_chain = make_cleanup_free_dwarf_expr_context (ctx); - make_cleanup_value_free_to_mark (value_mark ()); + dwarf_expr_context ctx; + old_chain = make_cleanup_value_free_to_mark (value_mark ()); - ctx->gdbarch = get_frame_arch (this_frame); - ctx->addr_size = addr_size; - ctx->ref_addr_size = -1; - ctx->offset = offset; - ctx->baton = this_frame; - ctx->funcs = &dwarf2_frame_ctx_funcs; + ctx.gdbarch = get_frame_arch (this_frame); + ctx.addr_size = addr_size; + ctx.ref_addr_size = -1; + ctx.offset = offset; + ctx.baton = this_frame; + ctx.funcs = &dwarf2_frame_ctx_funcs; - dwarf_expr_push_address (ctx, initial, initial_in_stack_memory); - dwarf_expr_eval (ctx, exp, len); + dwarf_expr_push_address (&ctx, initial, initial_in_stack_memory); + dwarf_expr_eval (&ctx, exp, len); - if (ctx->location == DWARF_VALUE_MEMORY) - result = dwarf_expr_fetch_address (ctx, 0); - else if (ctx->location == DWARF_VALUE_REGISTER) + if (ctx.location == DWARF_VALUE_MEMORY) + result = dwarf_expr_fetch_address (&ctx, 0); + else if (ctx.location == DWARF_VALUE_REGISTER) result = read_addr_from_reg (this_frame, - value_as_long (dwarf_expr_fetch (ctx, 0))); + value_as_long (dwarf_expr_fetch (&ctx, 0))); else { /* This is actually invalid DWARF, but if we ever do run across |