This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: PATCH: printing elements of typedef'ed arrays
- To: Elena Zannoni <ezannoni at cygnus dot com>
- Subject: Re: PATCH: printing elements of typedef'ed arrays
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Tue, 14 Mar 2000 18:41:02 +1100
- CC: gdb-patches at sourceware dot cygnus dot com
- Organization: Cygnus Solutions
- References: <14535.62150.908914.943283@kwikemart.cygnus.com>
Elena Zannoni wrote:
>
> [Sorry, wrong list...]
>
> When an array is typedeffed, like in this example:
>
> typedef long ArrayLong [10];
> ArrayLong a1;
>
> typedef struct s
> {
> int a;
> int b;
> } structure;
>
> long a2 [10];
> structure s1;
>
> int main (void)
> {
> return 0;
> }
>
> Gdb cannot print individual elements of the array a1:
>
> (gdb) p a1
> $1 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
> (gdb) p a1[0]
> $2 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} <<<< is incorrect
> (gdb) p a2
> $3 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
> (gdb) p a2[0]
> $4 = 0
> (gdb)
>
> The following patch takes care of this.
> I tested it on solaris and showed no regressions.
> OK to check in?
>
> Elena
Just two cross checks:
o the existing testsuite
checks that the printing of
character strings doesn't change
and the patch didn't change the
behavour
(I've a foggy memory about a great
debate where the printing of strings
was made special in some way)
o you've sneekered in a testsuite
change (to printcmd.exp?) :-)
Andrew
PS: I guess I'm the defacto maintainer.