Bug 606660 - print only shows the first member of a class if that member has any virt. method
print only shows the first member of a class if that member has any virt. method
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: gdb (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Jan Kratochvil
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 609218
  Show dependency treegraph
 
Reported: 2010-06-22 03:49 EDT by David Tardon
Modified: 2010-06-30 11:09 EDT (History)
3 users (show)

See Also:
Fixed In Version: gdb-7.1-27.fc13
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 609218 (view as bug list)
Environment:
Last Closed: 2010-06-30 11:09:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description David Tardon 2010-06-22 03:49:52 EDT
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 03:50:28 EDT
Created attachment 425847 [details]
reproducer
Comment 2 David Tardon 2010-06-22 03:50:53 EDT
Created attachment 425849 [details]
gdb script to run the reproducer
Comment 3 Jan Kratochvil 2010-06-25 07:21:35 EDT
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 07:42:06 EDT
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 07:50:28 EDT
(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 07:50:54 EDT
Created attachment 426861 [details]
correct reproducer

I'm sorry for the confusion...
Comment 8 Jan Kratochvil 2010-06-27 09:18:27 EDT
Post for FSF GDB:
http://sourceware.org/ml/gdb-patches/2010-06/msg00615.html
Comment 9 Fedora Update System 2010-06-29 19:52:59 EDT
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 11:09:12 EDT
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.