GDB 4.16.86 bug report
Eric Blinn
eric.blinn@sdrc.com
Thu Mar 19 16:48:00 GMT 1998
Hello,
I believe we have found a bug in the GDB 4.16.86 snapshot. We are
running IBM AIX 4.2.1.0 and compiling with the IBM Cset++ 3.1.4.5
C compiler. The problem we are seeing is that GDB seems to think that
variables declared with the "const" or "volatile" qualifiers are
incomplete structs. The following example demonstrates the problem:
[rios68:/u/qablinn/scratch/tmp] ls
testing.c
[rios68:/u/qablinn/scratch/tmp] nl -ba testing.c
1 #include <stdio.h>
2
3 int main( void )
4 {
5 int imain = 1;
6 const int jmain = 2;
7
8 printf( "%d %d\n",imain, jmain );
9 }
[rios68:/u/qablinn/scratch/tmp] xlc -g -o testing testing.c
[rios68:/u/qablinn/scratch/tmp] ls
testing testing.c
[rios68:/u/qablinn/scratch/tmp] gdb testing
GNU gdb 4.16.86
Copyright 1997 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "powerpc-ibm-aix4.2.1.0"...
(gdb) list
1 #include <stdio.h>
2
3 int main( void )
4 {
5 int imain = 1;
6 const int jmain = 2;
7
8 printf( "%d %d\n",imain, jmain );
9 }
(gdb) break main
Breakpoint 1 at 0x10000214: file testing.c, line 5.
(gdb) run
Starting program: /scratch/qablinn/tmp/testing
Breakpoint 1, main () at testing.c:5
5 int imain = 1;
(gdb) next
6 const int jmain = 2;
(gdb) next
8 printf( "%d %d\n",imain, jmain );
(gdb) whatis imain
type = int
(gdb) print imain
$1 = 1
(gdb) whatis jmain
type = struct <unknown>
(gdb) print jmain
$2 = <incomplete type>
(gdb) print (const int) jmain
$3 = 2
(gdb) next
1 2
9 }
(gdb) next
0x100001a0 in __start ()
(gdb) next
Single stepping until exit from function __start,
which has no line number information.
Program exited with code 04.
(gdb) quit
[rios68:/u/qablinn/scratch/tmp]
As you can see, a workaround is to cast the variable to the necessary
type when printing it. We have begun to investigate this problem but
wanted to also get it in front of developers more knowledgeable of GDB
internals. Please send any correspondence to both Monty Stein
(monty.stein@sdrc.com) and myself (eric.blinn@sdrc.com).
Thanks,
Eric Blinn
Software QA Engineer II
Structural Dynamics Research Corporation
More information about the Gdb-patches
mailing list