Bug 606660 - print only shows the first member of a class if that member has any virt. method
Summary: print only shows the first member of a class if that member has any virt. method
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jan Kratochvil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 609218
TreeView+ depends on / blocked
 
Reported: 2010-06-22 07:49 UTC by David Tardon
Modified: 2010-06-30 15:09 UTC (History)
3 users (show)

Fixed In Version: gdb-7.1-27.fc13
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 609218 (view as bug list)
Environment:
Last Closed: 2010-06-30 15:09:31 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
reproducer (235 bytes, text/plain)
2010-06-22 07:50 UTC, David Tardon
no flags Details
gdb script to run the reproducer (41 bytes, text/plain)
2010-06-22 07:50 UTC, David Tardon
no flags Details
correct reproducer (235 bytes, text/plain)
2010-06-25 11:50 UTC, David Tardon
no flags Details

Description David Tardon 2010-06-22 07:49:52 UTC
Description of problem:
If there is a C++ class whose first member is of a class type and the class of the member has at least one virt. function, and if "print objects is on, then any print of an object of that class prints only its first member. (Huh, well, not so much of a description... but the sample reproducer should be more comprehensive .-)

Version-Release number of selected component (if applicable):
gdb-7.1-26.fc13.x86_64

How reproducible:
always

Steps to Reproduce:
1. g++ -g3 -o print-class print-class.cc
2. gdb -nx -x print-class.gdb ./print-class
3. observe the result
  
Actual results:
$1 = (base) {_vptr.base = 0x400810}

Expected results:
$1 = {m_base = {_vptr.base = 0x400810}, m_i = 0}

Comment 1 David Tardon 2010-06-22 07:50:28 UTC
Created attachment 425847 [details]
reproducer

Comment 2 David Tardon 2010-06-22 07:50:53 UTC
Created attachment 425849 [details]
gdb script to run the reproducer

Comment 3 Jan Kratochvil 2010-06-25 11:21:35 UTC
I do not have the problem reproducible, it always prints:
$1 = {m_i = 0, m_base = {_vptr.base = 0x400830}}

It works the same even with `set print object on' removed as `obj' has both the declared type `wrapper' and the instance has also the rtti type `wrapper'.

Tested all the combinations of:
gdb-7.1-26.fc13.x86_64
GNU gdb (GDB) 7.1.50.20100625-cvs
gcc-c++-4.4.4-2.fc13.x86_64
gcc-c++-4.4.4-8.fc13.x86_64
g++ (GCC) 4.4.5 20100625 (prerelease)

These have a problem but this is outside of the Fedora BZ scope:
g++ (GCC) 4.5.1 20100625 (prerelease)
g++ (GCC) 4.6.0 20100625 (experimental)

Comment 4 David Tardon 2010-06-25 11:42:06 UTC
It fails here with

gdb-7.1-26.fc13.x86_64
gcc-4.4.4-8.fc14.x86_64

. As a matter of fact, I saw the same problem before ~4 months, but did nothing about it then.

Comment 6 Jan Kratochvil 2010-06-25 11:50:28 UTC
(In reply to comment #4)
> It fails here with
> 
> gdb-7.1-26.fc13.x86_64
> gcc-4.4.4-8.fc14.x86_64

Works even with these versions (forgot this is filed against Rawhide).

Please provide best the .s output and also the binary:
g++ -g3 -S -o print-class.s print-class.cc

BTW suggesting in this case s/-g3/-Wall -g/.

Comment 7 David Tardon 2010-06-25 11:50:54 UTC
Created attachment 426861 [details]
correct reproducer

I'm sorry for the confusion...

Comment 8 Jan Kratochvil 2010-06-27 13:18:27 UTC
Post for FSF GDB:
http://sourceware.org/ml/gdb-patches/2010-06/msg00615.html

Comment 9 Fedora Update System 2010-06-29 23:52:59 UTC
gdb-7.1-27.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/gdb-7.1-27.fc13

Comment 10 Fedora Update System 2010-06-30 15:09:12 UTC
gdb-7.1-27.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.