Wednesday, July 18, 2007

gdb - c++ on the virtual class

Sometimes I feel I waste a lot of time stuck in one single point. If I have a class IFoo, it is just an abstract interface, so it defines foo function but never implements it. The implementation of foo was in the concreate classes, such as CFooConcreateA and CFooConcreateB. The problem of gdb is, if I use a pointer to IFoo, as "IFoo* pFoo", gdb only reports the type of pFoo is IFoo, I have no way to get the real concreate object by pFoo, so if i do "print *pFoo", gdb will response with "incomplete type". I search the internet, read gdb manual again and again, even read gdbinit macro about QString, still no help (QString contains a 'd' to store the string data which is different than IFoo). Am I something wrong, learning gdb not enough, or there is really no way to figure it out.

The only way right now is leave it:-(