🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Naoki Saito Ext. 5471", GEO-002 Wed, 31 May 1989 22:11
multiple file names in g++ debugging
#788
Author: "Naoki Saito Ext. 5471", GEO-002
Date: Wed, 31 May 1989 22:11
68 lines
1634 bytes
	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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads