Mail Archives: cygwin/2003/05/07/14:48:36
I've verified that this problem occurs on multiple cygwin installations.
One of them was a brand new installation.
A summary of the problem:
Cygwin-gdb doesn't handle classes with virtual destructors properly.
It prints out a warning "can't find linker symbol for virtual table"
whenever a member variable is printed.
I've verified that this problem does NOT occur on linux.
This problem causes havoc when using insight.
How to recreate the problem in 3 easy steps:
############# step 1: create josh.cpp ###############
class Object
{
public:
int x;
virtual ~Object() { }
};
int main()
{
Object * obj = new Object;
}
############# step 2: build josh.cpp ###############
g++ -g -o josh josh.cpp
############# step 3: run gdb ######################
gdb josh
b main
r
n
p obj->x
#####################################################
gdb will generate this warning: (which it shouldn't)
warning: can't find linker symbol for virtual table for `Object' value
Thanks for any help,
Josh
> -----Original Message-----
> From: Julin, Joshua
> Sent: Monday, May 05, 2003 1:29 PM
> To: cygwin AT cygwin DOT com
> Subject: Cygwin-gdb can't find linker symbol for virtual table
>
>
> Hey everybody,
>
> I'm getting an (incorrect?) warning in gdb whenever I try to
> debug classes with virtual functions.
> When I try to print out a member variable, gdb states
> "warning: can't find linker symbol for virtual table for
> `Object4' value". It then prints out the member variable correctly.
>
> This behavior is isolated to my cygwin configuration; I don't
> get this warning on my Linux box.
>
> I've searched the internet for this message and can't find
> any answers...Geoff Alexander did post this question a while
> back to multiple user groups, but to no avail. I've searched
> the gcc man page for 'virtual' but didn't find anything which
> would make the warning go away.
>
> This warning message is particularly annoying to me when I
> use insight, the gdb graphical debugger. insight causes
> about 1 to 20 useless dialog boxes to popup whenever I try to
> 'watch' a member variable. They all say the same thing:
> "can't find linker symbol for virtual table".
>
> Below I show some very simple code that causes this warning
> on my system.
> I also show what gdb commands I used to cause the warning
> message to appear.
>
> Thanks for any help,
> Josh Julin
>
>
>
> //----------------------------------------------------------------
> //code (THIS CODE IS FINE, BUT CAUSES WARNING IN GDB)
> //----------------------------------------------------------------
> class Object3
> {
> public:
> int x;
> ~Object3() { } // no virtual foo
> };
>
> class Object4
> {
> public:
> int x;
> virtual ~Object4() { } // virtual foo
> };
>
> int main()
> {
> Object3 * ptr3 = new Object3;
> Object4 * ptr4 = new Object4; // when I "watch" ptr4->x
> I get the warning
> }
>
> //----------------------------------------------------------------
> // gcc version (ON CYGWIN)
> //----------------------------------------------------------------
> gcc --version
> gcc (GCC) 3.2 20020927 (prerelease)
>
> //----------------------------------------------------------------
> // gdb session on cygwin (NOTICE THE WARNING)
> //----------------------------------------------------------------
> GNU gdb 2003-03-03-cvs (cygwin-special)
> Copyright 2003 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-cygwin"...
> (gdb) b main
> Breakpoint 1 at 0x4010ae: file josh.cpp, line 17.
> (gdb) r
> Starting program: /home/josh/rearch/tryAgain/josh.exe
>
> Breakpoint 1, main () at josh.cpp:17
> 17 Object3 * ptr3 = new Object3;
> (gdb) n
> 18 Object4 * ptr4 = new Object4;
> (gdb) n
> 19 }
> (gdb) p ptr4->x
> warning: can't find linker symbol for virtual table for
> `Object4' value
> $1 = 0
> (gdb)
>
>
> //----------------------------------------------------------------
> // gdb session on linux (EVERYTHING WORKS!)
> //----------------------------------------------------------------
> GNU gdb 5.3
> Copyright 2002 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) b main
> Breakpoint 1 at 0x8048656: file josh.cpp, line 17.
> (gdb) r
> Starting program: /home/josh/tmp/jjj/josh
>
> Breakpoint 1, main () at josh.cpp:17
> 17 Object * ptr1 = new Object();
> (gdb) n
> 18 Object2 * ptr2 = new Object2();
> (gdb) n
> 19 }
> (gdb) p ptr2->x
> $1 = 0
> (gdb)
>
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -