public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/9688] New: gdb core dump c++ virtual inheritance
@ 2008-12-27 15:14 sirlore at gmail dot com
2009-07-24 18:27 ` [Bug c++/9688] " tromey at redhat dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: sirlore at gmail dot com @ 2008-12-27 15:14 UTC (permalink / raw)
To: gdb-prs
Gdb core dumps on virtual inheritance, ONLY when base class implementation and
specification is separated. Note that base class specification is in file
`base.h` a implementation is in `base.cpp`.
Release:
GNU gdb 6.8-debian
Environment:
Linux 2.6.26-1-686 #1 SMP Thu Oct 9 15:18:09 UTC 2008 i686 GNU/Linux
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1)
How-To-Repeat:
///FILE base.h
#ifndef __BASE_H__
#define __BASE_H__
class Base {
public:
Base();
virtual ~Base();
virtual void run();
};
#endif
///FILE base.cpp
#include "base.h"
#include <iostream>
Base::Base()
{ std::cout << "base\n"; }
Base::~Base()
{ }
void Base::run()
{ }
///FILE gdb_bug.cpp
#include "base.h"
class Derived1 : virtual public Base{
protected:
int i;
public:
Derived1(){};
};
class Derived2 : public Derived1 {
public:
Derived2(){};
~Derived2(){};
};
class Derived3 : virtual public Base {
public:
Derived3(){};
~Derived3(){};
};
class Bug : public Derived2, public Derived3{
public:
Bug(){};
~Bug(){};
virtual void run(){};
};
int main(int argc, char *argv[])
{
Bug b;
int a =2; // breakpoint here. Command `print b` makes gdb SEG FAULT
return 0;
}
//-------------------------------
g++ -O0 -g3 base.cpp gdb_bug.cpp -o bug
gdb ./bug
break main
run
n
print b
************* SEGMENTAION FAULT ************
--
Summary: gdb core dump c++ virtual inheritance
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at sourceware dot org
ReportedBy: sirlore at gmail dot com
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=9688
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/9688] gdb core dump c++ virtual inheritance
2008-12-27 15:14 [Bug c++/9688] New: gdb core dump c++ virtual inheritance sirlore at gmail dot com
@ 2009-07-24 18:27 ` tromey at redhat dot com
2009-07-24 18:30 ` tromey at redhat dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2009-07-24 18:27 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From tromey at redhat dot com 2009-07-24 18:27 -------
gdb now prints:
$1 = (Bug [incomplete object]) {
<Derived2> = {
<Derived1> = {
<Base> = {
_vptr.Base = 0x8049094
},
members of Derived1:
i = 134513747
}, <No data fields>},
<Derived3> = {<No data fields>}, <No data fields>}
According to cvs annotate, the "[incomplete object]" text has
been there since at least 2005.
I'm closing this as fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at redhat dot com
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://sourceware.org/bugzilla/show_bug.cgi?id=9688
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/9688] gdb core dump c++ virtual inheritance
2008-12-27 15:14 [Bug c++/9688] New: gdb core dump c++ virtual inheritance sirlore at gmail dot com
2009-07-24 18:27 ` [Bug c++/9688] " tromey at redhat dot com
@ 2009-07-24 18:30 ` tromey at redhat dot com
2009-07-25 7:14 ` sirlore at gmail dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2009-07-24 18:30 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From tromey at redhat dot com 2009-07-24 18:30 -------
I was too hasty in closing this -- you reported this pretty recently :)
My first guess is that this is dependent on the compiler version.
I'm using the F11 system compiler, which is based on gcc 4.4.
Is there any way you could try a newer gcc?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |
http://sourceware.org/bugzilla/show_bug.cgi?id=9688
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/9688] gdb core dump c++ virtual inheritance
2008-12-27 15:14 [Bug c++/9688] New: gdb core dump c++ virtual inheritance sirlore at gmail dot com
2009-07-24 18:27 ` [Bug c++/9688] " tromey at redhat dot com
2009-07-24 18:30 ` tromey at redhat dot com
@ 2009-07-25 7:14 ` sirlore at gmail dot com
2010-01-28 19:28 ` tromey at redhat dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: sirlore at gmail dot com @ 2009-07-25 7:14 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From sirlore at gmail dot com 2009-07-25 07:14 -------
(In reply to comment #2)
> I was too hasty in closing this -- you reported this pretty recently :)
> My first guess is that this is dependent on the compiler version.
> I'm using the F11 system compiler, which is based on gcc 4.4.
> Is there any way you could try a newer gcc?
>
>
Hi. This bug still exists when using gcc4.4.
Environment:
GNU gdb 6.8-debian
Linux sirlorelaptop 2.6.29-2-686 #1 SMP Sun May 17 17:56:29 UTC 2009 i686
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.0-5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-objc-gc
--enable-targets=all --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.4.0 (Debian 4.4.0-5)
--
http://sourceware.org/bugzilla/show_bug.cgi?id=9688
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/9688] gdb core dump c++ virtual inheritance
2008-12-27 15:14 [Bug c++/9688] New: gdb core dump c++ virtual inheritance sirlore at gmail dot com
` (2 preceding siblings ...)
2009-07-25 7:14 ` sirlore at gmail dot com
@ 2010-01-28 19:28 ` tromey at redhat dot com
2010-02-02 16:45 ` cvs-commit at gcc dot gnu dot org
2010-02-02 16:49 ` tromey at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2010-01-28 19:28 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From tromey at redhat dot com 2010-01-28 19:28 -------
I think the reason I didn't see this earlier is that I have
"set print object on".
I am testing a fix.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at sourceware dot|tromey at redhat dot com
|org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2010-01-28 19:28:05
date| |
http://sourceware.org/bugzilla/show_bug.cgi?id=9688
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/9688] gdb core dump c++ virtual inheritance
2008-12-27 15:14 [Bug c++/9688] New: gdb core dump c++ virtual inheritance sirlore at gmail dot com
` (3 preceding siblings ...)
2010-01-28 19:28 ` tromey at redhat dot com
@ 2010-02-02 16:45 ` cvs-commit at gcc dot gnu dot org
2010-02-02 16:49 ` tromey at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2010-02-02 16:45 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2010-02-02 16:45 -------
Subject: Bug 9688
CVSROOT: /cvs/src
Module name: src
Changes by: tromey@sourceware.org 2010-02-02 16:45:18
Modified files:
gdb : ChangeLog c-lang.h c-valprint.c cp-valprint.c
language.h valops.c
gdb/python : py-prettyprint.c
gdb/testsuite : ChangeLog
gdb/testsuite/gdb.cp: userdef.exp
Added files:
gdb/testsuite/gdb.cp: virtbase.cc virtbase.exp
Log message:
gdb
PR c++/11226, PR c++/9629, PR c++/9688, PR c++/8890:
* valops.c (search_struct_field): Compute nbases after calling
CHECK_TYPEDEF.
(check_field): Call CHECK_TYPEDEF.
* cp-valprint.c (cp_print_value): Pass correct address to
baseclass_offset. Fix check for virtual base past the end of the
object. Don't offset address passed to cp_print_value_fields or
apply_val_pretty_printer.
(cp_print_value_fields): Fix call to val_print.
(cp_print_value_fields_rtti): New function.
* c-valprint.c (c_val_print): Use cp_print_value_fields_rtti.
* p-valprint.c (pascal_object_print_value_fields): Fix call to
val_print.
* python/py-prettyprint.c (apply_val_pretty_printer): Add embedded
offset to address.
* language.h (struct language_defn) <la_val_print>: Document.
* c-lang.h (cp_print_value_fields_rtti): Declare.
gdb/testsuite
PR c++/11226, PR c++/9629, PR c++/9688, PR c++/8890:
* gdb.cp/virtbase.cc: New file.
* gdb.cp/virtbase.exp: New file.
* gdb.cp/userdef.exp: Allow 'struct' or 'class'.
Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11313&r2=1.11314
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-lang.h.diff?cvsroot=src&r1=1.26&r2=1.27
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-valprint.c.diff?cvsroot=src&r1=1.66&r2=1.67
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/cp-valprint.c.diff?cvsroot=src&r1=1.62&r2=1.63
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/language.h.diff?cvsroot=src&r1=1.62&r2=1.63
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/valops.c.diff?cvsroot=src&r1=1.233&r2=1.234
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/python/py-prettyprint.c.diff?cvsroot=src&r1=1.4&r2=1.5
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2117&r2=1.2118
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/virtbase.cc.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/virtbase.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/userdef.exp.diff?cvsroot=src&r1=1.12&r2=1.13
--
http://sourceware.org/bugzilla/show_bug.cgi?id=9688
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/9688] gdb core dump c++ virtual inheritance
2008-12-27 15:14 [Bug c++/9688] New: gdb core dump c++ virtual inheritance sirlore at gmail dot com
` (4 preceding siblings ...)
2010-02-02 16:45 ` cvs-commit at gcc dot gnu dot org
@ 2010-02-02 16:49 ` tromey at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2010-02-02 16:49 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From tromey at redhat dot com 2010-02-02 16:49 -------
Fix checked in.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|6.8 |7.1
http://sourceware.org/bugzilla/show_bug.cgi?id=9688
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-02-02 16:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-27 15:14 [Bug c++/9688] New: gdb core dump c++ virtual inheritance sirlore at gmail dot com
2009-07-24 18:27 ` [Bug c++/9688] " tromey at redhat dot com
2009-07-24 18:30 ` tromey at redhat dot com
2009-07-25 7:14 ` sirlore at gmail dot com
2010-01-28 19:28 ` tromey at redhat dot com
2010-02-02 16:45 ` cvs-commit at gcc dot gnu dot org
2010-02-02 16:49 ` tromey at redhat dot com
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).