Add support for DW_OP_push_object_address.

gdb/ChangeLog:

        * dwarf2expr.h (struct dwarf_expr_context_funcs): Uncomment
        field "get_object_address".
        * dwarf2expr.c (execute_stack_op): Add handling for
        DW_OP_push_object_address.
        * dwarf2loc.h (dwarf2_evaluate_property): Add "address" field.
        * dwarf2loc.c (struct dwarf_expr_baton): Add field "obj_address".
        (dwarf_expr_push_dwarf_reg_entry_value): Set baton_local.obj_address.
        (dwarf_expr_get_obj_addr): New function.
        (dwarf_expr_ctx_funcs): Add get_object_address field.
        (dwarf2_evaluate_loc_desc_full): Set baton.obj_address.
        (dwarf2_locexpr_baton_eval): Add parameter "addr".  Use it.
        (dwarf2_evaluate_property): Add parameter "address".  Use it.
        (needs_get_obj_addr): New function.
        (needs_frame_ctx_funcs): Add get_object_address field.
        (dwarf2_compile_expr_to_ax): Add DW_OP_push_object_address handling.
        * gdbtypes.c (resolve_dynamic_range): Add "addr" field.  Use it.
        (resolve_dynamic_array): Likewise.
This commit is contained in:
Joel Brobecker
2014-08-11 16:36:04 -07:00
parent 84754697d2
commit 08412b0722
6 changed files with 79 additions and 18 deletions

View File

@@ -1664,11 +1664,11 @@ static struct type *resolve_dynamic_type_internal (struct type *type,
CORE_ADDR addr,
int top_level);
/* Given a dynamic range type (dyn_range_type), return a static version
of that type. */
/* Given a dynamic range type (dyn_range_type) and address,
return a static version of that type. */
static struct type *
resolve_dynamic_range (struct type *dyn_range_type)
resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR addr)
{
CORE_ADDR value;
struct type *static_range_type;
@@ -1679,7 +1679,7 @@ resolve_dynamic_range (struct type *dyn_range_type)
gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE);
prop = &TYPE_RANGE_DATA (dyn_range_type)->low;
if (dwarf2_evaluate_property (prop, &value))
if (dwarf2_evaluate_property (prop, addr, &value))
{
low_bound.kind = PROP_CONST;
low_bound.data.const_val = value;
@@ -1691,7 +1691,7 @@ resolve_dynamic_range (struct type *dyn_range_type)
}
prop = &TYPE_RANGE_DATA (dyn_range_type)->high;
if (dwarf2_evaluate_property (prop, &value))
if (dwarf2_evaluate_property (prop, addr, &value))
{
high_bound.kind = PROP_CONST;
high_bound.data.const_val = value;
@@ -1718,7 +1718,7 @@ resolve_dynamic_range (struct type *dyn_range_type)
of the associated array. */
static struct type *
resolve_dynamic_array (struct type *type)
resolve_dynamic_array (struct type *type, CORE_ADDR addr)
{
CORE_ADDR value;
struct type *elt_type;
@@ -1729,12 +1729,12 @@ resolve_dynamic_array (struct type *type)
elt_type = type;
range_type = check_typedef (TYPE_INDEX_TYPE (elt_type));
range_type = resolve_dynamic_range (range_type);
range_type = resolve_dynamic_range (range_type, addr);
ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY)
elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type));
elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type), addr);
else
elt_type = TYPE_TARGET_TYPE (type);
@@ -1877,11 +1877,11 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr,
}
case TYPE_CODE_ARRAY:
resolved_type = resolve_dynamic_array (type);
resolved_type = resolve_dynamic_array (type, addr);
break;
case TYPE_CODE_RANGE:
resolved_type = resolve_dynamic_range (type);
resolved_type = resolve_dynamic_range (type, addr);
break;
case TYPE_CODE_UNION: