This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] dwarf2read.c: Avoid complaint for char array of unspecified size
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 21 May 2010 22:28:23 +0200
- Subject: [RFA] dwarf2read.c: Avoid complaint for char array of unspecified size
When I tried to compile GDB on an Arm Linux,
I came across several complaint when debugging GDB with itself,
he is another patch.
This code:
external char gdbint [];
generated a DW_TAG_subrange_type with zero attributes
to describe the `[]' part.
(compiled with gcc (Debian 4.3.2-1.1) 4.3.2.).
As there was already some code that handled missing
children (for Irix), I simply extended it
to the case of a child with zero attributes.
I implicitly supposed that there could be no child
to the subrange type die, which seems reasonable to me,
but others might have another opinion.
I don't think it is possible to define a multiple
dimension array (matrix) in any language with one unspecified
length, am I right?
Pierre Muller
Pascal language support maintainer for GDB
2010-05-21 Pierre Muller <muller@ics.u-strasbg.fr>
* dwarf2read.c (read_array_type): Do not try to
read subrange type with zero attributes.
Index: src/gdb/dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.386
diff -u -p -r1.386 dwarf2read.c
--- src/gdb/dwarf2read.c 17 May 2010 15:55:01 -0000 1.386
+++ src/gdb/dwarf2read.c 21 May 2010 14:47:42 -0000
@@ -5431,8 +5431,12 @@ read_array_type (struct die_info *die, s
element_type = die_type (die, cu);
/* Irix 6.2 native cc creates array types without children for
- arrays with unspecified length. */
- if (die->child == NULL)
+ arrays with unspecified length.
+ Likewise, for the following code:
+ extern char gdbinit [];
+ GCC generates a DW_TAG_subrange_type with zero attributes. */
+ if (die->child == NULL || (die->child->tag == DW_TAG_subrange_type
+ && die->child->num_attrs == 0))
{
index_type = objfile_type (objfile)->builtin_int;
range_type = create_range_type (NULL, index_type, 0, -1);