diff options
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/ada-lang.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2loc.c | 9 | ||||
-rw-r--r-- | gdb/dwarf2loc.h | 3 | ||||
-rw-r--r-- | gdb/findvar.c | 4 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 13 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 4 | ||||
-rw-r--r-- | gdb/value.c | 2 |
8 files changed, 45 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5c3ca8f..5233c6d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,22 @@ 2015-05-05 Joel Brobecker <brobecker@adacore.com> + * dwarf2loc.h (struct property_addr_info): Add "valaddr" field. + * dwarf2loc.c (dwarf2_evaluate_property): Add handling of + pinfo->valaddr. + * gdbtypes.h (resolve_dynamic_type): Add "valaddr" parameter. + * gdbtypes.c (resolve_dynamic_struct): Set pinfo.valaddr. + (resolve_dynamic_type_internal): Set pinfo.valaddr. + Add handling of addr_stack->valaddr. + (resolve_dynamic_type): Add "valaddr" parameter. + Set pinfo.valaddr field. + * ada-lang.c (ada_discrete_type_high_bound): Update call to + resolve_dynamic_type. + (ada_discrete_type_low_bound): Likewise. + * findvar.c (default_read_var_value): Likewise. + * value.c (value_from_contents_and_address): Likewise. + +2015-05-05 Joel Brobecker <brobecker@adacore.com> + * gdbtypes.c (resolve_dynamic_array): Use create_array_type_with_stride instead of create_array_type. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d034049..26f2c52 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -794,7 +794,7 @@ min_of_type (struct type *t) LONGEST ada_discrete_type_high_bound (struct type *type) { - type = resolve_dynamic_type (type, 0); + type = resolve_dynamic_type (type, NULL, 0); switch (TYPE_CODE (type)) { case TYPE_CODE_RANGE: @@ -815,7 +815,7 @@ ada_discrete_type_high_bound (struct type *type) LONGEST ada_discrete_type_low_bound (struct type *type) { - type = resolve_dynamic_type (type, 0); + type = resolve_dynamic_type (type, NULL, 0); switch (TYPE_CODE (type)) { case TYPE_CODE_RANGE: diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index e674933..d811106 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -2526,8 +2526,13 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, break; if (pinfo == NULL) error (_("cannot find reference address for offset property")); - val = value_at (baton->offset_info.type, - pinfo->addr + baton->offset_info.offset); + if (pinfo->valaddr != NULL) + val = value_from_contents + (baton->offset_info.type, + pinfo->valaddr + baton->offset_info.offset); + else + val = value_at (baton->offset_info.type, + pinfo->addr + baton->offset_info.offset); *value = value_as_address (val); return 1; } diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h index 0932456..f3630ac 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h @@ -111,6 +111,9 @@ struct property_addr_info being resolved. */ struct type *type; + /* If not NULL, a buffer containing the object's value. */ + const gdb_byte *valaddr; + /* The address of that object. */ CORE_ADDR addr; diff --git a/gdb/findvar.c b/gdb/findvar.c index 128bf5e..2079b4b 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -438,7 +438,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) if (is_dynamic_type (type)) { /* Value is a constant byte-sequence and needs no memory access. */ - type = resolve_dynamic_type (type, /* Unused address. */ 0); + type = resolve_dynamic_type (type, NULL, /* Unused address. */ 0); } /* Put the constant back in target format. */ v = allocate_value (type); @@ -470,7 +470,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) if (is_dynamic_type (type)) { /* Value is a constant byte-sequence and needs no memory access. */ - type = resolve_dynamic_type (type, /* Unused address. */ 0); + type = resolve_dynamic_type (type, NULL, /* Unused address. */ 0); } v = allocate_value (type); memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d91b5d5..4bbfc75 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1984,6 +1984,7 @@ resolve_dynamic_struct (struct type *type, " (invalid location kind)")); pinfo.type = check_typedef (TYPE_FIELD_TYPE (type, i)); + pinfo.valaddr = addr_stack->valaddr; pinfo.addr = addr_stack->addr; pinfo.next = addr_stack; @@ -2054,7 +2055,11 @@ resolve_dynamic_type_internal (struct type *type, struct property_addr_info pinfo; pinfo.type = check_typedef (TYPE_TARGET_TYPE (type)); - pinfo.addr = read_memory_typed_address (addr_stack->addr, type); + pinfo.valaddr = NULL; + if (addr_stack->valaddr != NULL) + pinfo.addr = extract_typed_address (addr_stack->valaddr, type); + else + pinfo.addr = read_memory_typed_address (addr_stack->addr, type); pinfo.next = addr_stack; resolved_type = copy_type (type); @@ -2096,9 +2101,11 @@ resolve_dynamic_type_internal (struct type *type, /* See gdbtypes.h */ struct type * -resolve_dynamic_type (struct type *type, CORE_ADDR addr) +resolve_dynamic_type (struct type *type, const gdb_byte *valaddr, + CORE_ADDR addr) { - struct property_addr_info pinfo = {check_typedef (type), addr, NULL}; + struct property_addr_info pinfo + = {check_typedef (type), valaddr, addr, NULL}; return resolve_dynamic_type_internal (type, &pinfo, 1); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index a912c8c..4275ee0 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1791,7 +1791,9 @@ extern void get_signed_type_minmax (struct type *, LONGEST *, LONGEST *); ADDR specifies the location of the variable the type is bound to. If TYPE has no dynamic properties return TYPE; otherwise a new type with static properties is returned. */ -extern struct type *resolve_dynamic_type (struct type *type, CORE_ADDR addr); +extern struct type *resolve_dynamic_type (struct type *type, + const gdb_byte *valaddr, + CORE_ADDR addr); /* * Predicate if the type has dynamic values, which are not resolved yet. */ extern int is_dynamic_type (struct type *type); diff --git a/gdb/value.c b/gdb/value.c index c36f748..2b32881 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3509,7 +3509,7 @@ value_from_contents_and_address (struct type *type, const gdb_byte *valaddr, CORE_ADDR address) { - struct type *resolved_type = resolve_dynamic_type (type, address); + struct type *resolved_type = resolve_dynamic_type (type, valaddr, address); struct type *resolved_type_no_typedef = check_typedef (resolved_type); struct value *v; |