public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8256: g++ does not emmit debug info for subclasses
@ 2002-10-17  9:16 thor
  0 siblings, 0 replies; only message in thread
From: thor @ 2002-10-17  9:16 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-17 16:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-17  9:16 c++/8256: g++ does not emmit debug info for subclasses thor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).