SAITO@sdr.slb.com ("Naoki Saito Ext. 5471", GEO-002) (06/01/89)
Hello! I'm using gdb-3.1.2 on the Sun3 OS 4.0.1. In debugging g++
programs, I have the following problem.
Suppose I have two classes in the separate directories as follows:
====================================
// file X/X.h
class X
{
//...
public:
virtual void f();
//
};
====================================
// file X/f.cc
void X::f()
{
//...
}
====================================
// file Y/Y.h
class Y : public X
{
//...
public:
void f();
};
====================================
// file Y/f.cc
void Y::f()
{
//...
}
====================================
And suppose I made a library from the above classes. I have a main program
// file main.cc
main()
{
X* x;
x = new Y();
x->f();
}
This is a typical virtual function call. In the above case, g++ correctly
recognizes f() as the Y::f(). There's no problem on actual execution of the
program. However, gdb finds the first function named "f" in the files in the
path DIR. So, if I set
dir X
dir Y
in the gdb, then gdb displays the file of X::f() as a source, not Y::f().
How can I get around this problem?
Regards,
Naoki Saito (saito@sdr.slb.com)
Schlumberger-Doll Research