🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #8821

no breakpoints

#8821
From: Karl Berry
Date: Sat, 24 Oct 1992 07:32
86 lines
2680 bytes
If I compile the following program with g++ 2.2.2 on a sun 4 running
SunOS 4.1.1, both gdb 4.6 and 4.7 

1) complain about a badly mangled name for the constructor (but it sets
   a breakpoint there);
2) cannot set breakpoints at push or pop (but ptype knows they're there);
3) set a breakpoint at the destructor, but it's never called.  (I guess
   that's a g++ bug, if it's a bug at all, but I thought I'd throw it
   in.  Sorry.)

The transcript follows the program.

karl@cs.umb.edu

#include <stdio.h>

class stack
{
 private:
    int *top;
    int *bottom;
 public:
    stack::stack();

    void push(int c);

    int stack::pop()
    { printf ("pop"); }

    ~stack() {delete bottom;}
};

stack::stack ()
    {top = bottom = new int[100];}

void
stack::push (int c)
    {printf("%d\n", c);}
    

main()
{
    stack s;
    int i;
    s.push(3);
}

GDB 4.7, Copyright 1992 Free Software Foundation, Inc...
(gdb) b stack::stack
Internal: Cannot demangle mangled name `__5stack__5stack'.
(gdb) b stack::push
(Cannot find method stack::push(stack, int) - possibly inlined.)
warning: the class stack does not have any method named push
Hint: try 'stack::push<TAB> or 'stack::push<ESC-?>
(Note leading single quote.)
(gdb) b stack::pop
(Cannot find method stack::pop(stack) - possibly inlined.)
warning: the class stack does not have any method named pop
Hint: try 'stack::pop<TAB> or 'stack::pop<ESC-?>
(Note leading single quote.)
(gdb) b stack::~stack
Breakpoint 1 at 0x2364: file stack.cc, line 20.
(gdb) ptype stack
type = class stack {
  private:
    int *top;
    int *bottom;

  public:
    ~stack ();
    <badly mangled name __5stack__5stack>;
    void push (struct stack, int);
    int pop (struct stack);
}
(gdb) c
The program is not being run.
(gdb) r
Starting program: /u/zapf/karl/misc/src/a.out 

Breakpoint 1, stack::stack (this=0xf7fff4b0) at stack.cc:20
20	    {top = bottom = new int[100];}
(gdb) c
Continuing.
3

Program exited normally.
Technical Details
Message-ID: <199210241532.AA11648@claude.cs.umb.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!claude.cs.umb.edu!karl

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,3f34ffe7e147a9e3,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1992-10-24 17:07:28 PST
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!claude.cs.umb.edu!karl
From: karl@claude.cs.umb.edu (Karl Berry)
Subject: no breakpoints
Message-ID: <199210241532.AA11648@claude.cs.umb.edu>
Sender: gnulists@ai.mit.edu
Reply-To: karl@cs.umb.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 24 Oct 1992 07:32:46 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 87