This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/8256: g++ does not emmit debug info for subclasses


>Number:         8256
>Category:       c++
>Synopsis:       g++ -ggdb does not emmit debug info for subclasses
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 17 09:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Richter
>Release:        3.2
>Organization:
TU Berlin
>Environment:
System: Linux cleopatra 2.4.10-4GB #1 Tue Sep 25 12:33:54 GMT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/net/wavelet/gcc/gcc-3.2 --program-suffix=-3.2 --enable-threads=posix
>Description:
	g++ does not seem to generate appropriate code to set a breakpoint
	in a sub-class of a class. Hence, if B and C are private
	subclasses declared in a class A, gdb is not able to set a break-
	point in a method A::B::foo.
>How-To-Repeat:
	Add the following header file making use of private sub-classes,
	then save it as "foo.hpp":

	/* snip */
class A {
  class B {
  protected:
    int x;
  public:
    B(int y)
      : x(y)
    { }
  };
  class C : public B {
    int y;
  public:
    C(void);
    void Hello(void);
  } b;
public:
  void Hello(void);
};
	/* snip */
	
	Save the following code as "foo.cpp"

	/* snip */
#include <stdio.h>
#include "foo.hpp"

A::C::C(void)
  : B(1), y(2)
{ }

void A::C::Hello(void)
{
  printf("Hello World!\n");
}

void A::Hello(void)
{
  b.Hello();
}

int main(int argc,char **argv)
{
  A a;

  a.Hello();

  return 0;
}
	/* snip */

	Compile and link with "g++-3.2 -ggdb foo.cpp", then debug with
	"gdb a.out". Within gdb, the following happens when trying to
	set a breakpoint at "A::C::foo"

GNU gdb 5.2.1
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) break A::C::Hello
the class A does not have any method named C
Hint: try 'A::C::Hello<TAB> or 'A::C::Hello<ESC-?>
(Note leading single quote.)
(gdb) 

>Fix:
	Set the breakpoint as "C::Hello" or give a line within the file
	where to set it.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]