diff options
author | Bernhard Heckel <bernhard.heckel@intel.com> | 2016-07-12 08:19:34 +0200 |
---|---|---|
committer | Bernhard Heckel <bernhard.heckel@intel.com> | 2016-07-12 08:19:34 +0200 |
commit | a879b2501e61ee3d3efadbdb6b33212b57d3a2e1 (patch) | |
tree | 6574e080c6c7446faeba2ec54a91fc93a1f181b6 | |
parent | 26e156d62211ca8458faa326f21940e9fa18c8fe (diff) | |
download | binutils-a879b2501e61ee3d3efadbdb6b33212b57d3a2e1.zip binutils-a879b2501e61ee3d3efadbdb6b33212b57d3a2e1.tar.gz binutils-a879b2501e61ee3d3efadbdb6b33212b57d3a2e1.tar.bz2 |
Fortran: Resolve dynamic properties of pointer types.
In Fortran a pointer may have a dynamic associated property.
2016-07-08 Bernhard Heckel <bernhard.heckel@intel.com>
gdb/Changelog:
* gdbtypes.c (resolve_dynamic_types_internal): Resolve pointer types.
(resolve_dynamic_pointer): New.
Change-Id: Ie4b9d6397cfa089ee2e0db02beb18415a751c1c0
-rw-r--r-- | gdb/gdbtypes.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index ec5c17a..b53e649 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1806,7 +1806,8 @@ is_dynamic_type_internal (struct type *type, int top_level) type = check_typedef (type); /* We only want to recognize references at the outermost level. */ - if (top_level && TYPE_CODE (type) == TYPE_CODE_REF) + if (top_level && + (TYPE_CODE (type) == TYPE_CODE_REF || TYPE_CODE (type) == TYPE_CODE_PTR)) type = check_typedef (TYPE_TARGET_TYPE (type)); /* Types that have a dynamic TYPE_DATA_LOCATION are considered @@ -2105,6 +2106,28 @@ resolve_dynamic_struct (struct type *type, return resolved_type; } +/* Worker for pointer types. */ + +static struct type * +resolve_dynamic_pointer (struct type *type, + struct property_addr_info *addr_stack) +{ + struct dynamic_prop *prop; + CORE_ADDR value; + + type = copy_type (type); + + /* Resolve associated property. */ + prop = TYPE_ASSOCIATED_PROP (type); + if (prop != NULL && dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) + { + TYPE_DYN_PROP_ADDR (prop) = value; + TYPE_DYN_PROP_KIND (prop) = PROP_CONST; + } + + return type; +} + /* Worker for resolved_dynamic_type. */ static struct type * @@ -2153,6 +2176,10 @@ resolve_dynamic_type_internal (struct type *type, break; } + case TYPE_CODE_PTR: + resolved_type = resolve_dynamic_pointer (type, addr_stack); + break; + case TYPE_CODE_ARRAY: resolved_type = resolve_dynamic_array (type, addr_stack); break; |