This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Support DW_AT_count inside DW_TAG_subrange_type
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 31 May 2005 17:49:48 +0400
- Subject: Support DW_AT_count inside DW_TAG_subrange_type
Hi,
the DWARF standard says that the DW_TAG_subrage_type tag can contain either
DW_AT_upper_bound or use DW_AT_count to specify upper bound relatively to
lower bound. The version 6.3 of gdb, and the current CVS, support only
DW_TAG_upper_bound.
The attached patch adds support for DW_AT_count.
The changelog entry could be:
2005-05-31 Vladimur Prus <ghost@cs.msu.su>
dwarf2read.c (read_subrange_type): If no DW_AT_upper_bound attribute
is present, try using DW_AT_count
Comments?
- Volodya
--- dwarf2read.c.orig 2004-10-16 04:41:00.000000000 +0400
+++ dwarf2read.c 2005-05-31 17:38:57.000000000 +0400
@@ -4794,6 +4794,17 @@
else
high = dwarf2_get_attr_constant_value (attr, 1);
}
+ else
+ {
+ /* Alternatively, the high boundary can be specified with the
+ DW_AT_count attribute, which must be added to the low value.
+ */
+ attr = dwarf2_attr (die, DW_AT_count, cu);
+ if (attr)
+ {
+ high = dwarf2_get_attr_constant_value(attr, 0) + low - 1;
+ }
+ }
range_type = create_range_type (NULL, base_type, low, high);