On 1/26/06, Daniel Jacobowitz wrote: > On Thu, Jan 26, 2006 at 06:30:56PM -0500, Igor Khavkine wrote: > > On 1/26/06, Daniel Jacobowitz wrote: > > > The first thing to do is to write a small testcase, and post the > > > testcase along with the debugging output that your GCC generates > > > for it. > > > > There is a test case already in the GDB bug database (PR 1796, as I > > mentioned in my first message). What kind of debugging output should I > > post? Is there an option to make gcc dump the debugging info in human > > readable form? > > Not really - but you can run readelf -wi on the resulting object file. > I recommend you do this after linking to make sure relocations are > resolved. OK. I'm attaching a small test case, vla-bug.c. I compiled the object with `gcc -g -c vla-bug.c' and the executable with `gcc -g -o vla-bug vla-bug.c'. I then ran `readelf -wi' on the .o and the executable. I'm attaching all the relevant files. Note that I call the function test() with argument 3. This means that the local variable length array will have size 3. However, when run under GDB, GDB will think the array is only of size 2 (that's the size it always seems to assume for VLA's). Unfortunately, I can glimpse next to nothing from the readelf output. Can you tell whether GCC puts enough debugging info into the compiled code for GDB to get the size right at runtime? Thanks in advance. Igor