[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gdb 5.0: no symbol 'foo' in current context
From: |
Michael Elizabeth Chastain |
Subject: |
Re: gdb 5.0: no symbol 'foo' in current context |
Date: |
Tue, 13 Feb 2001 20:38:03 -0800 |
I tested this on my trusty installed-from-a-retail-boxed-set Red Hat 7
machine, and Dan Berlin is right.
I tried four combinations:
g++ 2.96, gdb 5.0 -> the bug happens
g++ CVS snapshot, gdb 5.0 -> all locals found
g++ 2.96, gdb CVS snapshot -> the bug happens
g++ CVS snapshot, gdb CVS snapshot -> all locals found
This does not feel like the other scope problem I know about (nested
scopes expanding to the whole function, screwing up variables that are
redeclared in inner scopes). I guess gcc people have just been doing
a lot of scope fixing.
Michael Elizabeth Chastain
<address@hidden>
"love without fear"
===
Script started on Tue Feb 13 23:33:09 2001
bash-2.04$ date
Tue Feb 13 23:33:11 EST 2001
bash-2.04$ hostname
gehman.chastain.redhat.com
bash-2.04$ uname -a
Linux gehman.chastain.redhat.com 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686
unknown
bash-2.04$ cat x-nest.cpp
int main(int argc, char **argv)
{
int a = 10;
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < 10; j++)
{
int b = 20;
int c = 30;
}
}
}
bash-2.04$ /usr/bin/gcc --version
2.96
bash-2.04$ /vittone/fsf/2001-02-12/gehman/install-gcc-native/bin/gcc --version
2.97
bash-2.04$ /usr/bin/gdb --version
GNU gdb 5.0
Copyright 2000 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 "i386-redhat-linux".
bash-2.04$ /vittone/fsf/2001-02-12/gehman/install-src-native/bin/gdb --version
GNU gdb 5.0
Copyright 2001 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 "i686-pc-linux-gnu".
bash-2.04$ /usr/bin/gcc -g -o x-nest-296 x-nest.cpp
bash-2.04$ /vittone/fsf/2001-02-12/gehman/install-gcc-native/bin/gcc -g -o
x-nes t-2001-02-12 x-nest.cpp
bash-2.04$ /usr/bin/gdb x-nest-296
GNU gdb 5.0
Copyright 2000 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 "i386-redhat-linux"...
(gdb) list main
1 int main(int argc, char **argv)
2 {
3 int a = 10;
4 for(int i = 0; i < 10; i++)
5 {
6 for(int j = 0; j < 10; j++)
7 {
8 int b = 20;
9 int c = 30;
10 }
(gdb) break 8
Breakpoint 1 at 0x8048450: file x-nest.cpp, line 8.
(gdb) run
Starting program: /gehman/home/chastain/tmp/x-nest-296
Breakpoint 1, main (argc=1, argv=0xbffff864) at x-nest.cpp:8
8 int b = 20;
(gdb) info locals
a = 10
i = 0
(gdb) quit
The program is running. Exit anyway? (y or n) y
bash-2.04$ /usr/bin/gdb x-nest-2
x-nest-2001-02-12 x-nest-296
bash-2.04$ /usr/bin/gdb x-nest-2001-02-12
GNU gdb 5.0
Copyright 2000 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 "i386-redhat-linux"...
(gdb) list main
1 int main(int argc, char **argv)
2 {
3 int a = 10;
4 for(int i = 0; i < 10; i++)
5 {
6 for(int j = 0; j < 10; j++)
7 {
8 int b = 20;
9 int c = 30;
10 }
(gdb) break 8
Breakpoint 1 at 0x8048470: file x-nest.cpp, line 8.
(gdb) run
Starting program: /gehman/home/chastain/tmp/x-nest-2001-02-12
Breakpoint 1, main (argc=1, argv=0xbffff854) at x-nest.cpp:8
8 int b = 20;
(gdb) info locals
b = -1073743880
c = 1073832772
j = 0
i = 0
a = 10
(gdb) quit
The program is running. Exit anyway? (y or n) y
bash-2.04$ /vittone/fsf/2001-02-12/gehman/install-src-native/bin/gdb x-nest
x-nest x-nest-296 x-nest.s
x-nest-2001-02-12 x-nest.cpp
bash-2.04$ /vittone/fsf/2001-02-12/gehman/install-src-native/bin/gdb x-nest-296
GNU gdb 5.0
Copyright 2001 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 "i686-pc-linux-gnu"...
(gdb) break 8
Breakpoint 1 at 0x8048450: file x-nest.cpp, line 8.
(gdb) run
Starting program: /gehman/home/chastain/tmp/x-nest-296
Breakpoint 1, main (argc=1, argv=0xbffff864) at x-nest.cpp:8
8 int b = 20;
Current language: auto; currently c++
(gdb) info locals
a = 10
i = 0
(gdb) quit
The program is running. Exit anyway? (y or n) y
Abash-2.04$ /vittone/fsf/2001-02-12/gehman/install-src-native/bin/gdb
x-nest-2001-02-12
GNU gdb 5.0
Copyright 2001 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 "i686-pc-linux-gnu"...
(gdb) break 8
Breakpoint 1 at 0x8048470: file x-nest.cpp, line 8.
(gdb) run
Starting program: /gehman/home/chastain/tmp/x-nest-2001-02-12
Breakpoint 1, main (argc=1, argv=0xbffff854) at x-nest.cpp:8
8 int b = 20;
Current language: auto; currently c++
(gdb) info locals
b = -1073743880
c = 1073832772
j = 0
i = 0
a = 10
(gdb) quit
The program is running. Exit anyway? (y or n) y
bash-2.04$ exit
exit
Script done on Tue Feb 13 23:37:11 2001