C++, can't see debug info for some classes

Michael Snyder msnyder@vmware.com
Wed Jan 26 18:57:00 GMT 2011


Vyacheslav V. Yurkov wrote:
> Hi,
> We use several static libraries in our project as our run-time.
> To add debug info for a class X I just do:
> g++ X.cpp -I../include -c -g -Wall -o X.o
> ar rsu ../lib1.a X.o
> That worked OK with any class from our library but at the moment
> I have some issues with class X. I can't see its members in a debugger gdb.
> gdb says that class X is <incomplete type>.
> I tried to do 'ptype X' in gdb and got the following:
> No symbol "X" in current context.
> I looked into it more, did objdump for X.o file and saw that
> there is no address near the symbol which looks like my class X.
> 
> I tried 3 different versions of g++ (4.3.x, 4.4.x, 4.5.x), tried 
> following parameters for gcc: -g3, -g2 -O0, -ggdb, -gstubs+. But nothing 
> helped.
> My class X also doesn't use anonymous unions.
> 
> Does anyone have an idea what is wrong with g++ or with my class X?
> Thanks in advance.

Was your class ever instantiated by the program?  Sometimes if a class 
or struct type has no instances, its symbolic info is discarded.



More information about the Gdb mailing list