This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Re: printing array element broken?
- To: Grant Edwards <grante at visi dot com>
- Subject: Re: printing array element broken?
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Wed, 16 Feb 2000 18:32:38 +1100
- CC: gdb at sourceware dot cygnus dot com
- Organization: Cygnus Solutions
- References: <20000202102302.A29253@visi.com>
Grant Edwards wrote:
>
> I've an array of 4 structures named txFrameDescrArray. When I
> print the entire array, everything is fine:
>
> (gdb) print/x txFrameDescrArray
> $2 = {{FrameDataPtr = 0x100e10, Reserved = 0x14, StatusAndFrameLength = 0x40800094, NextFD = 0x105610},
> {FrameDataPtr = 0x101400, Reserved = 0x14, StatusAndFrameLength = 0x40800094, NextFD = 0x105620},
> {FrameDataPtr = 0x1019f0, Reserved = 0x14, StatusAndFrameLength = 0x40800094, NextFD = 0x105630},
> {FrameDataPtr = 0x101fe0, Reserved = 0x0, StatusAndFrameLength = 0x0, NextFD = 0x105600}}
>
> However, asking gdb to print an individual element results in garbage:
>
> (gdb) print/x txFrameDescrArray[0]
> $3 = {FrameDataPtr = 0xfcfaa0ba, Reserved = 0xb8ff0003, StatusAndFrameLength = 0xbaeeffa2, NextFD = 0xb8ee70}
>
> (gdb) print/x txFrameDescrArray[1]
> $5 = {FrameDataPtr = 0xfcfaa0ba, Reserved = 0xb8ff0003, StatusAndFrameLength = 0xbaeeffa2, NextFD = 0xb8ee70}
>
> What am I doing wrong?
I guess you've compared:
(gdb) print txFrameDescrArray
with (gdb) print txFrameDescrArray[0]
and checked that that works ok.
Looking at your output, I suspect that yes, you've found a bug.
Interested in extending the testsuite to test for this? Or trying for a
patch?
Andrew