* [RFA] dwarf2read.c: Avoid complaint for char array of unspecified size
@ 2010-05-21 20:35 Pierre Muller
0 siblings, 0 replies; 4+ messages in thread
From: Pierre Muller @ 2010-05-21 20:35 UTC (permalink / raw)
To: gdb-patches
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);
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <38685.0063725889$1274473713@news.gmane.org>]
* Re: [RFA] dwarf2read.c: Avoid complaint for char array of unspecified size
[not found] <38685.0063725889$1274473713@news.gmane.org>
@ 2010-05-21 22:13 ` Tom Tromey
2010-05-21 23:55 ` Pierre Muller
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2010-05-21 22:13 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> This code:
Pierre> external char gdbint [];
Pierre> generated a DW_TAG_subrange_type with zero attributes
Pierre> to describe the `[]' part.
Pierre> (compiled with gcc (Debian 4.3.2-1.1) 4.3.2.).
I think this kind of DIE is explicitly ok, according to DWARF.
See the paragraph toward the end of section 5.11 that describes what to
do when a DW_TAG_subrange_type has no basis type.
So, I think this complaint is incorrect. It would be better to simply
remove it.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [RFA] dwarf2read.c: Avoid complaint for char array of unspecified size
2010-05-21 22:13 ` Tom Tromey
@ 2010-05-21 23:55 ` Pierre Muller
2010-05-24 15:35 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Pierre Muller @ 2010-05-21 23:55 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : Friday, May 21, 2010 11:43 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA] dwarf2read.c: Avoid complaint for char array of
> unspecified size
>
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
>
> Pierre> This code:
> Pierre> external char gdbint [];
> Pierre> generated a DW_TAG_subrange_type with zero attributes
> Pierre> to describe the `[]' part.
> Pierre> (compiled with gcc (Debian 4.3.2-1.1) 4.3.2.).
>
> I think this kind of DIE is explicitly ok, according to DWARF.
> See the paragraph toward the end of section 5.11 that describes what to
> do when a DW_TAG_subrange_type has no basis type.
For dwarf2, in it on 5.10, page number 47 (49 of pdf file).
If I understand this correctly, without anything it should be
a subrange of type "singed integer" having the same size as an address
for that target machine. This is not exactly what is done in the Irix
code I modified...
But I still don't get the bounds that we should use:
lower bound is 0, or 1 for fortran (default value),
but should upper bound be equal to lower bound or lower bound -1?
> So, I think this complaint is incorrect. It would be better to simply
> remove it.
This would mean that we should fix the code inside read_subrange_type, no?
Do you think that this would be the correct approach?
Pierre
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] dwarf2read.c: Avoid complaint for char array of unspecified size
2010-05-21 23:55 ` Pierre Muller
@ 2010-05-24 15:35 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2010-05-24 15:35 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> But I still don't get the bounds that we should use:
Pierre> lower bound is 0, or 1 for fortran (default value),
Pierre> but should upper bound be equal to lower bound or lower bound -1?
Whatever means "unknown bounds" inside gdb.
I don't remember offhand what this is.
Pierre> This would mean that we should fix the code inside
Pierre> read_subrange_type, no?
Pierre> Do you think that this would be the correct approach?
Yeah, I do.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-24 15:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-21 20:35 [RFA] dwarf2read.c: Avoid complaint for char array of unspecified size Pierre Muller
[not found] <38685.0063725889$1274473713@news.gmane.org>
2010-05-21 22:13 ` Tom Tromey
2010-05-21 23:55 ` Pierre Muller
2010-05-24 15:35 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox