🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #788

multiple file names in g++ debugging

#788
From: "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
Technical Details
Message-ID: <8905312342.AA07111@AENEAS.MIT.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!sdr.slb.com!SAITO

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!sdr.slb.com!SAITO
From: SAITO@sdr.slb.com ("Naoki Saito  Ext. 5471", GEO-002)
Newsgroups: gnu.gdb.bug
Subject: multiple file names in g++ debugging
Message-ID: <8905312342.AA07111@AENEAS.MIT.EDU>
Date: 31 May 89 22:11:00 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 68