This is the mail archive of the gdb@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: printing array element broken?


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

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