From: Bernhard Heckel <bernhard.heckel@intel.com>
To: qiyaoltc@gmail.com, brobecker@adacore.com
Cc: gdb-patches@sourceware.org, Bernhard Heckel <bernhard.heckel@intel.com>
Subject: [PATCH V4 2/6] Fortran: Resolve dynamic properties of pointer types.
Date: Wed, 07 Sep 2016 06:38:00 -0000 [thread overview]
Message-ID: <1473230295-809-3-git-send-email-bernhard.heckel@intel.com> (raw)
In-Reply-To: <1473230295-809-1-git-send-email-bernhard.heckel@intel.com>
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.
---
gdb/gdbtypes.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
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;
--
2.7.1.339.g0233b80
next prev parent reply other threads:[~2016-09-07 6:38 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 6:38 [PATCH V4 0/6] Fortran: Resolve target types of pointers Bernhard Heckel
2016-09-07 6:38 ` [PATCH V4 1/6] Fortran: Testsuite, fix differences in type naming Bernhard Heckel
2016-09-21 15:57 ` Yao Qi
2016-09-07 6:38 ` [PATCH V4 3/6] Typeprint: Resolve any dynamic target type of a pointer Bernhard Heckel
[not found] ` <861szvayzg.fsf@gmail.com>
2016-10-05 11:03 ` Bernhard Heckel
2016-10-13 13:41 ` Yao Qi
2016-09-07 6:38 ` [PATCH V4 6/6] Fortran: Testsuite, add cyclic pointers Bernhard Heckel
2016-10-13 14:08 ` Yao Qi
2016-09-07 6:38 ` Bernhard Heckel [this message]
2016-10-05 8:44 ` [PATCH V4 2/6] Fortran: Resolve dynamic properties of pointer types Yao Qi
2016-10-05 9:36 ` Yao Qi
2016-10-05 10:07 ` Bernhard Heckel
2016-09-07 6:38 ` [PATCH V4 5/6] Resolve dynamic target types of pointers Bernhard Heckel
2016-09-07 14:24 ` Eli Zaretskii
2016-10-13 14:07 ` Yao Qi
2016-10-13 14:57 ` Bernhard Heckel
2016-10-17 10:32 ` Yao Qi
2016-10-17 11:25 ` Bernhard Heckel
2016-10-17 12:18 ` Bernhard Heckel
2016-10-20 11:52 ` Bernhard Heckel
2016-10-20 15:33 ` Yao Qi
2016-11-08 7:07 ` Bernhard Heckel
2016-11-08 11:26 ` Yao Qi
2016-11-08 12:27 ` Bernhard Heckel
2016-11-16 12:16 ` Bernhard Heckel
2016-11-21 15:03 ` Bernhard Heckel
2016-09-07 6:38 ` [PATCH V4 4/6] Fortran: Typeprint, fix dangling types Bernhard Heckel
2016-10-13 13:53 ` Yao Qi
2016-09-14 12:55 ` [PING][PATCH V4 0/6] Fortran: Resolve target types of pointers Bernhard Heckel
2016-09-28 12:45 ` Bernhard Heckel
2016-10-05 6:03 ` [ping 2][PATCH " Bernhard Heckel
2016-09-21 9:49 ` [ping 2] [PATCH " Bernhard Heckel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473230295-809-3-git-send-email-bernhard.heckel@intel.com \
--to=bernhard.heckel@intel.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox