aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2014-04-19 09:55:14 -0700
committerJoel Brobecker <brobecker@adacore.com>2014-04-28 15:44:48 -0400
commit8739bc53cd91cc38287432b1fb880be327c9435c (patch)
treeec72e1d860b74bcf0c2f5fcc5efe9da0993d8fea /gdb
parent6f8a3220a931ac052fedd75539058bd8aa97b3a8 (diff)
downloadgdb-8739bc53cd91cc38287432b1fb880be327c9435c.zip
gdb-8739bc53cd91cc38287432b1fb880be327c9435c.tar.gz
gdb-8739bc53cd91cc38287432b1fb880be327c9435c.tar.bz2
Improve Ada dynamic range type handling.
Consider the following declaration in Ada... type Array_Type is array (L .. U) of Natural; ... where L and U are parameters of the function where the declaration above was made. At the moment, GDB relies on descriptive types in order to properly decode the array bounds. For instance, if L was 5, and U was 10, we would see the following: (gdb) ptype array_type type = array (5 .. 10) of natural (gdb) maintenance set ada ignore-descriptive-types (gdb) ptype array_type type = array (1 .. 28544912) of natural This patch enhances ada_discrete_type_{high,low}_bound to resolve any dynamicity. This is sufficient to fix the case of the upper bound. For the lower bound, the dwarf2read module does not handle dynamic lower bounds yet, but once it does, the lower bound should be correctly handled as well [1]. gdb/ChangeLog: * ada-lang.c (ada_discrete_type_high_bound): Resolve the type's dynamic bounds before computing its upper bound. (ada_discrete_type_low_bound): Same as above with the lower bound. [1]: The reason why we do not enhance dwarf2read to handle dynamic lower bounds ahead of this patch is because it unveils some latent issues such as this one.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/ada-lang.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e1dda4c..6c811ea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2014-04-28 Joel Brobecker <brobecker@adacore.com>
+ * ada-lang.c (ada_discrete_type_high_bound): Resolve the type's
+ dynamic bounds before computing its upper bound.
+ (ada_discrete_type_low_bound): Same as above with the lower bound.
+
+2014-04-28 Joel Brobecker <brobecker@adacore.com>
+
* dwarf2read.c (is_dynamic_type): Return true for dynamic
range types. Adjust the array handling implementation to
take advantage of this change.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 0acc1b5..38972c6 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -793,6 +793,7 @@ min_of_type (struct type *t)
LONGEST
ada_discrete_type_high_bound (struct type *type)
{
+ type = resolve_dynamic_type (type, 0);
switch (TYPE_CODE (type))
{
case TYPE_CODE_RANGE:
@@ -813,6 +814,7 @@ ada_discrete_type_high_bound (struct type *type)
LONGEST
ada_discrete_type_low_bound (struct type *type)
{
+ type = resolve_dynamic_type (type, 0);
switch (TYPE_CODE (type))
{
case TYPE_CODE_RANGE: