From 24c5c679cb74ed4035f8c1dd4249654602fd1f10 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 17 Jun 2012 19:50:53 +0000 Subject: gdb/ Code cleanup: Generalize call_site.parameter key. * dwarf2expr.c (execute_stack_op) : Remove variable dwarf_reg. New variable kind_u. Update parameters to push_dwarf_reg_entry_value. (ctx_no_push_dwarf_reg_entry_value): Update parameters. * dwarf2expr.h (enum call_site_parameter_kind) (union call_site_parameter_u): Forward declarations. (struct dwarf_expr_context_funcs): Update parameters and their description for push_dwarf_reg_entry_value. (ctx_no_push_dwarf_reg_entry_value): Update parameters. * dwarf2loc.c (call_site_parameter_matches): New function. (dwarf_expr_reg_to_entry_parameter): Update parameters and their description. Use call_site_parameter_matches. (dwarf_expr_push_dwarf_reg_entry_value, value_of_dwarf_reg_entry): Update parameters and their description. (value_of_dwarf_block_entry): Remove variables dwarf_reg and fb_offset. New variable kind_u. Adjust the caller for updated parameters. (needs_dwarf_reg_entry_value): Update parameters. * dwarf2read.c (read_call_site_scope): New variable loc. Use it instead of attr. Update for the changed fields of struct call_site_parameter. * gdbtypes.h: Include dwarf2expr.h. (enum call_site_parameter_kind): New. (struct call_site.parameter): New field kind. Wrap dwarf_reg and fb_offset into new union u. --- gdb/dwarf2expr.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'gdb/dwarf2expr.c') diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index e0aafc7..117d5ba 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -1355,33 +1355,35 @@ execute_stack_op (struct dwarf_expr_context *ctx, case DW_OP_GNU_entry_value: { uint64_t len; - int dwarf_reg; CORE_ADDR deref_size; + union call_site_parameter_u kind_u; op_ptr = safe_read_uleb128 (op_ptr, op_end, &len); if (op_ptr + len > op_end) error (_("DW_OP_GNU_entry_value: too few bytes available.")); - dwarf_reg = dwarf_block_to_dwarf_reg (op_ptr, op_ptr + len); - if (dwarf_reg != -1) + kind_u.dwarf_reg = dwarf_block_to_dwarf_reg (op_ptr, op_ptr + len); + if (kind_u.dwarf_reg != -1) { op_ptr += len; - ctx->funcs->push_dwarf_reg_entry_value (ctx, dwarf_reg, - 0 /* unused */, + ctx->funcs->push_dwarf_reg_entry_value (ctx, + CALL_SITE_PARAMETER_DWARF_REG, + kind_u, -1 /* deref_size */); goto no_push; } - dwarf_reg = dwarf_block_to_dwarf_reg_deref (op_ptr, op_ptr + len, - &deref_size); - if (dwarf_reg != -1) + kind_u.dwarf_reg = dwarf_block_to_dwarf_reg_deref (op_ptr, + op_ptr + len, + &deref_size); + if (kind_u.dwarf_reg != -1) { if (deref_size == -1) deref_size = ctx->addr_size; op_ptr += len; - ctx->funcs->push_dwarf_reg_entry_value (ctx, dwarf_reg, - 0 /* unused */, - deref_size); + ctx->funcs->push_dwarf_reg_entry_value (ctx, + CALL_SITE_PARAMETER_DWARF_REG, + kind_u, deref_size); goto no_push; } @@ -1533,7 +1535,8 @@ ctx_no_get_base_type (struct dwarf_expr_context *ctx, cu_offset die) void ctx_no_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, - int dwarf_reg, CORE_ADDR fb_offset, + enum call_site_parameter_kind kind, + union call_site_parameter_u kind_u, int deref_size) { internal_error (__FILE__, __LINE__, -- cgit v1.1