diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-07-15 20:54:32 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-07-15 20:54:32 +0000 |
commit | 9e8b7a03dd9c4754ff3f18ca13a1dad851f4ec58 (patch) | |
tree | 7df265b8f00f013025d31216b505e3e2fe7a21b8 /gdb/dwarf2expr.c | |
parent | e9ea266294fcba2548c9b30d8229b1b430d45eee (diff) | |
download | gdb-9e8b7a03dd9c4754ff3f18ca13a1dad851f4ec58.zip gdb-9e8b7a03dd9c4754ff3f18ca13a1dad851f4ec58.tar.gz gdb-9e8b7a03dd9c4754ff3f18ca13a1dad851f4ec58.tar.bz2 |
gdb/
Code cleanup.
* dwarf2-frame.c (dwarf2_frame_ctx_funcs): New.
(execute_stack_op): Use dwarf2_frame_ctx_funcs
* dwarf2expr.c (dwarf_get_base_type): Access get_base_type via funcs.
(execute_stack_op): Access read_reg, get_frame_base, read_mem,
get_frame_cfa, get_tls_address and dwarf_call via funcs.
* dwarf2expr.h (struct dwarf_expr_context): New forward declaration.
(struct dwarf_expr_context_funcs): New, move here methods from ...
(struct dwarf_expr_context): ... here. New fields funcs.
* dwarf2loc.c (dwarf_expr_dwarf_call): Access get_frame_pc via funcs.
(dwarf_expr_ctx_funcs): New.
(dwarf2_evaluate_loc_desc_full): Use dwarf_expr_ctx_funcs.
(needs_frame_dwarf_call): Access get_frame_pc via funcs.
(needs_frame_ctx_funcs): New.
(dwarf2_loc_desc_needs_frame): Use needs_frame_ctx_funcs.
Diffstat (limited to 'gdb/dwarf2expr.c')
-rw-r--r-- | gdb/dwarf2expr.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 21a8363..efa497e 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -466,9 +466,9 @@ dwarf_get_base_type (struct dwarf_expr_context *ctx, ULONGEST die, int size) { struct type *result; - if (ctx->get_base_type) + if (ctx->funcs->get_base_type) { - result = ctx->get_base_type (ctx, die); + result = ctx->funcs->get_base_type (ctx, die); if (result == NULL) error (_("Could not find type for DW_OP_GNU_const_type")); if (size != 0 && TYPE_LENGTH (result) != size) @@ -759,7 +759,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_breg31: { op_ptr = read_sleb128 (op_ptr, op_end, &offset); - result = (ctx->read_reg) (ctx->baton, op - DW_OP_breg0); + result = (ctx->funcs->read_reg) (ctx->baton, op - DW_OP_breg0); result += offset; result_val = value_from_ulongest (address_type, result); } @@ -768,7 +768,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, { op_ptr = read_uleb128 (op_ptr, op_end, ®); op_ptr = read_sleb128 (op_ptr, op_end, &offset); - result = (ctx->read_reg) (ctx->baton, reg); + result = (ctx->funcs->read_reg) (ctx->baton, reg); result += offset; result_val = value_from_ulongest (address_type, result); } @@ -788,14 +788,13 @@ execute_stack_op (struct dwarf_expr_context *ctx, /* FIXME: cagney/2003-03-26: This code should be using get_frame_base_address(), and then implement a dwarf2 specific this_base method. */ - (ctx->get_frame_base) (ctx->baton, &datastart, &datalen); + (ctx->funcs->get_frame_base) (ctx->baton, &datastart, &datalen); dwarf_expr_eval (ctx, datastart, datalen); if (ctx->location == DWARF_VALUE_MEMORY) result = dwarf_expr_fetch_address (ctx, 0); else if (ctx->location == DWARF_VALUE_REGISTER) - result - = (ctx->read_reg) (ctx->baton, - value_as_long (dwarf_expr_fetch (ctx, 0))); + result = (ctx->funcs->read_reg) (ctx->baton, + value_as_long (dwarf_expr_fetch (ctx, 0))); else error (_("Not implemented: computing frame " "base using explicit value operator")); @@ -880,7 +879,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, else type = address_type; - (ctx->read_mem) (ctx->baton, buf, addr, addr_size); + (ctx->funcs->read_mem) (ctx->baton, buf, addr, addr_size); /* If the size of the object read from memory is different from the type length, we need to zero-extend it. */ @@ -1089,7 +1088,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, break; case DW_OP_call_frame_cfa: - result = (ctx->get_frame_cfa) (ctx->baton); + result = (ctx->funcs->get_frame_cfa) (ctx->baton); result_val = value_from_ulongest (address_type, result); in_stack_memory = 1; break; @@ -1105,7 +1104,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, returned. */ result = value_as_long (dwarf_expr_fetch (ctx, 0)); dwarf_expr_pop (ctx); - result = (ctx->get_tls_address) (ctx->baton, result); + result = (ctx->funcs->get_tls_address) (ctx->baton, result); result_val = value_from_ulongest (address_type, result); break; @@ -1178,13 +1177,13 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_call2: result = extract_unsigned_integer (op_ptr, 2, byte_order); op_ptr += 2; - ctx->dwarf_call (ctx, result); + ctx->funcs->dwarf_call (ctx, result); goto no_push; case DW_OP_call4: result = extract_unsigned_integer (op_ptr, 4, byte_order); op_ptr += 4; - ctx->dwarf_call (ctx, result); + ctx->funcs->dwarf_call (ctx, result); goto no_push; case DW_OP_GNU_entry_value: @@ -1220,7 +1219,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, op_ptr = read_uleb128 (op_ptr, op_end, &type_die); type = dwarf_get_base_type (ctx, type_die, 0); - result = (ctx->read_reg) (ctx->baton, reg); + result = (ctx->funcs->read_reg) (ctx->baton, reg); result_val = value_from_ulongest (address_type, result); result_val = value_from_contents (type, value_contents_all (result_val)); |