This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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]

[Bug c++/13342] insufficient memory is fetched from the inferior forpartially destroyed C++ objects


http://sourceware.org/bugzilla/show_bug.cgi?id=13342

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #2 from Tom Tromey <tromey at redhat dot com> 2011-11-02 14:52:11 UTC ---
I couldn't reproduce this.
Could you post exactly what commands you used?

I tried putting a breakpoint in ~Apple and printing *this.
I also stepped into ~Fruit, then went "up" and printed *this.
It all looked sane to me:

Starting program: /home/tromey/gnu/PRS/gdb13342/pr 

Breakpoint 1, Apple::~Apple (this=0x7fffffffe450, 
    __in_chrg=<value optimized out>) at pr.cc:34
34        ~Apple(void) { }
(gdb) p *this
$5 = (Apple) {
  <Fruit> = {
    _vptr.Fruit = 0x4008f0, 
    fruit1 = 1, 
    fruit2 = 2, 
    fruit3 = 3, 
    fruit4 = 4
  }, 
  members of Apple: 
  apple1 = 1, 
  apple2 = 2, 
  apple3 = 3, 
  apple4 = 4
}
(gdb) s
Fruit::~Fruit (this=0x7fffffffe450, __in_chrg=<value optimized out>)
    at pr.cc:17
17        virtual ~Fruit(void) {
(gdb) s
18            abort();
(gdb) p *this
$6 = (Fruit) {
  _vptr.Fruit = 0x400910, 
  fruit1 = 1, 
  fruit2 = 2, 
  fruit3 = 3, 
  fruit4 = 4
}
(gdb) up
#1  0x000000000040078d in Apple::~Apple (this=0x7fffffffe450, 
    __in_chrg=<value optimized out>) at pr.cc:34
34        ~Apple(void) { }
(gdb) p *this
$7 = (Fruit) {
  _vptr.Fruit = 0x400910, 
  fruit1 = 1, 
  fruit2 = 2, 
  fruit3 = 3, 
  fruit4 = 4
}

At the end here I think the dynamic type has changed to Fruit, so this
is still correct.

Your patch seems reasonable, I just would like to be able to reproduce the bug.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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