This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Scope of typedefs
- To: gdb at sources dot redhat dot com
- Subject: Scope of typedefs
- From: "Paul N. Hilfinger" <hilfingr at otisco dot mckusick dot com>
- Date: Mon, 1 Oct 2001 23:07:46 -0700
- Reply-to: Hilfinger at syracuse dot mckusick dot com
The code in dwarf2read and the other readers assigns all typedef symbols
to the static symbol list (file scope). This is not, strictly speaking,
correct, is it? For example, in the (admittedly unusual) program
static int Foo;
int f (int y) {
typedef int Foo;
Foo x;
x = 3;
return x;
}
main () {
f (Foo); /* <<< */
}
an attempt to print Foo in GDB when stopped at the commented line gives us
an
Attempt to use a type name as an expression
message. I understand that GCC would have to be modified to put typedefs
in proper scope, but is there any particular objection to having GDB be ready
if it happens? For that matter, does anyone know why things are as they are?
P. Hilfinger