Code cleanup: Generalize call_site.parameter key.
	* dwarf2expr.c (execute_stack_op) <DW_OP_GNU_entry_value>: 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.
This commit is contained in:
Jan Kratochvil
2012-06-17 19:50:53 +00:00
parent e8c21678a4
commit 24c5c679cb
6 changed files with 144 additions and 73 deletions

View File

@@ -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__,