bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in trace D'tor of parent class


From: jackandking
Subject: bug in trace D'tor of parent class
Date: Tue, 6 Jan 2009 18:55:48 -0800 (PST)

[code]
#include <iostream>
class A
{
public:
    A(){}
    ~A(){std::cout << "~A()" <<std::endl;}
};
class B :public A
{
public:
    B(){}
    ~B(){std::cout << "~B()" <<std::endl;}
};
main()
{
    A a;
    B b;
}
[/code]

run output:

#> ./a.out
~B()
~A()
~A()


gdb output:

#>gdb a.out
(gdb) b A::~A()
Breakpoint 1 at 0x8048780: file testdtor.cpp, line 23.
(gdb) b B::~B()
Breakpoint 2 at 0x80487c4: file testdtor.cpp, line 29.
(gdb) r
Starting program: /home/jfg748/test/a.out

Breakpoint 2, ~B (this=0xbfffa370) at testdtor.cpp:29
29          ~B(){std::cout << "~B()" <<std::endl;}
(gdb) c
Continuing.
~B()
~A()

Breakpoint 1, ~A (this=0xbfffa380) at testdtor.cpp:23
23          ~A(){std::cout << "~A()" <<std::endl;}
(gdb)
Continuing.
~A()

Program exited normally.
(gdb)


question:
why Breakpoint 1 only be triggered once?
-- 
View this message in context: 
http://www.nabble.com/bug-in-trace-D%27tor-of-parent-class-tp21323937p21323937.html
Sent from the Gnu - gdb - Bugs mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]