This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: printing elements of typedef'ed arrays


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]