This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problem with gcc and gdb
- From: "Randolph C. Wilhoit" <rwilhoit at neo dot tamu dot edu>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 18 May 2002 14:41:36 -0500
- Subject: Problem with gcc and gdb
Bug Report for GNU gcc
1. Version of gcc
the command gcc -v reports
version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
2. Version of gdb
the command gdb -v reports
GNU gdb 5.0rh-5 Red Hat Linux 7.1
3. Description of the problem
When runing gdb on an exectuable file compiled by gcc. gdb cannot
access any of the variables defined in the source file. The make file
for compiling prdsy1.x is
CFLAGS = -g
CC = g++
fcLIB = /usr/fcm-6.11/lib.fpg/libctreestd.a
fcINC = /usr/fcm-6.11/ctree/include
fcTOM = /usr/fcm-6.11/ctree/custom
fcII = -I$(fcINC) -I$(fcTOM)
aplb = /usr/local/srcdb/util/appl.a
refdsp.x: refdsp.cpp refdsp.h smprfcl.o
$(CC) $(CFLAGS) -o $@ $(fcII) refdsp.cpp smprfcl.o $(aplb) $(fcLIB)
prdsy1.x: prdsy1.cpp prdsp1.h purec.o smprfcl.o
$(CC) $(CFLAGS) -o $@ $(fcII) prdsy1.cpp purec.o smprfcl.o $(aplb)
$(fcLIB)
Then runing gdb with the command
gdb prdsy1.x
An attempt to read any program symbol, such as
print x
gives the response,
No symbol 'x' in current context
However prdsy1.x executes normally as expected.
The line in prdsy1.cpp that causes this behaviour is,
litref rfdsp;
When this line, and all lines that reference rfdsp are removed from
prdsy1.cpp and it is recompiled with the makefile above, gdb behaves
normally.
litref is a class defined in prdsp1.h. Its definition is,
class litref {
long pleng;
short int gaunm(AUKEY &aunmx);
public:
short int erm;
litref() {
if ((erm = OpenIFile(&sprrf)))
cerr << "Error opening reference superfile " << erm << "\n";
if (!erm)
if ((erm = OpenIFile(&vaut)))
cerr << "Error opening author database " << erm << "\n";
if (!erm)
if ((erm = OpenIFile(&vref)))
cerr << "Error opening reference database " << erm << "\n";
}
~litref() {erm = CloseIFile(&sprrf);}
void dsref(REFX, RFZ &);
};
I have two similar programs that use class litref. They give the
same problem.
However program refdsp.x (see make file above) which also includes
the line,
litref rfdsp;
gives the expected response when displaying variables in gdb.
The command,
file prdsy1.x
gives the result,
prdsy1.x: ELF 32-bit LSB executable, Intel 80386, version 1,
dynamically
linked (uses shared libs), not stripped
All files execute normally
Randolph Wilhoit
rwilhoit@neo.tamu.edu