Bug 8217 - can't set breakpoint on destructor
Summary: can't set breakpoint on destructor
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 7.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-03 22:18 UTC by David Carlton
Modified: 2010-01-22 21:14 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Carlton 2003-03-03 22:18:00 UTC
[Converted from Gnats 1112]

GDB won't let me set a breakpoint on a destructor, unless
I add parentheses.

Release:
GNU gdb 2003-03-03-cvs

Environment:
i686-pc-linux-gnu (Red Hat 7.3), GCC 3.1, DWARF 2

How-To-Repeat:
Compile this:

class C {
public:
  ~C() {}
};

int main()
{
  C c;
}

Then:

jackfruit$ /extra/gdb/mirror/src/gdb/gdb a.out
GNU gdb 2003-03-03-cvs
Copyright 2003 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) b C::~C
the class `C' does not have destructor defined
Hint: try 'C::~C<TAB> or 'C::~C<ESC-?>
(Note leading single quote.)
(gdb) b C::~C()
Breakpoint 1 at 0x8048515: file foo.cc, line 3.
Comment 1 David Carlton 2003-03-04 17:02:21 UTC
From: carlton@sources.redhat.com
To: gdb-gnats@sourceware.org
Cc:  
Subject: c++/1112
Date: 4 Mar 2003 17:02:21 -0000

 CVSROOT:	/cvs/src
 Module name:	src
 Changes by:	carlton@sourceware.org	2003-03-04 17:02:20
 
 Modified files:
 	gdb/testsuite  : ChangeLog 
 	gdb/testsuite/gdb.c++: templates.exp 
 
 Log message:
 	2003-03-04  David Carlton  <carlton@math.stanford.edu>
 	
 	* gdb.c++/templates.exp (do_tests): Accept valid const in "print
 	Garply<Garply<char> >:: garply".
 	(test_ptype_of_templates): KFAIL "ptype T5<int>" and "ptype t5i"
 	with respect to PR c++/1111; note also PR c++/1113.
 	(test_template_breakpoints): KFAIL "constructor breakpoint" with
 	respect to PR c++/1062.
 	KFAIL "destructor breakpoint" with respect to PR c++/1112.
 
 Patches:
 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.503&r2=1.504
 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.c++/templates.exp.diff?cvsroot=src&r1=1.17&r2=1.18
Comment 2 Tom Tromey 2010-01-22 21:14:59 UTC
This works in CVS head gdb:

(gdb) b C::~C
Breakpoint 1 at 0x8048463: file pr.cc, line 3.