public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15401] New: "set print object on" + printing variables of type: a reference to derived class.
@ 2013-04-25 19:14 marcin.konarski at gmail dot com
  2013-05-07 17:51 ` [Bug c++/15401] " jan.kratochvil at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: marcin.konarski at gmail dot com @ 2013-04-25 19:14 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 15401
           Summary: "set print object on" + printing variables of type: a
                    reference to derived class.
           Product: gdb
           Version: 7.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: marcin.konarski@gmail.com
    Classification: Unclassified


gdb prints values of variables that are of reference type
like they were a pointers if value in question is instance of some
derived type that has a vtable.

Notice difference in how f2 variable is printed in session script
that is included below after I turn "set print object on".

How to reproduce:

[amok@vegeta](2/3)~/$ lsb_release -a
LSB Version:   
core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: Ubuntu
Description:    Ubuntu Raring Ringtail (development branch)
Release:        13.04
Codename:       raring
[amok@vegeta](2/3)~/$ g++ --version
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[amok@vegeta](2/3)~/$ cat set-print-object-on.cxx
struct Base {
        virtual ~Base() {}
};

struct Foo : public Base { };

int main( int, char** ) {
        Foo f;
        Foo& f2( f );
        return ( sizeof ( f2 ) );
}

[amok@vegeta](2/3)~/$ g++ -g set-print-object-on.cxx
[amok@vegeta](2/3)~/$ gdb ./a.out
GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/amok/a.out...done.
(gdb) b main
Breakpoint 1 at 0x4006ec: file set-print-object-on.cxx, line 8.
(gdb) r
Starting program: /home/amok/a.out

Breakpoint 1, main () at set-print-object-on.cxx:8
8               Foo f;
(gdb) n
9               Foo& f2( f );
(gdb)
10              return ( sizeof ( f2 ) );
(gdb) p f2
$1 = (Foo &) @0x7fffffffd550: {<Base> = {_vptr.Base = 0x4008f0 <vtable for
Foo+16>}, <No data fields>}
(gdb) set print object on
(gdb) p f2
$2 = (Foo *) 0x7fffffffd550
(gdb) quit
A debugging session is active.

        Inferior 1 [process 2512] will be killed.

Quit anyway? (y or n) y
[amok@vegeta](2/3)~/$

-- 
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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/15401] "set print object on" + printing variables of type: a reference to derived class.
  2013-04-25 19:14 [Bug c++/15401] New: "set print object on" + printing variables of type: a reference to derived class marcin.konarski at gmail dot com
@ 2013-05-07 17:51 ` jan.kratochvil at redhat dot com
  2013-05-08 18:13 ` tromey at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-05-07 17:51 UTC (permalink / raw)
  To: gdb-prs

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

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat
                   |                            |dot com

-- 
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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/15401] "set print object on" + printing variables of type: a reference to derived class.
  2013-04-25 19:14 [Bug c++/15401] New: "set print object on" + printing variables of type: a reference to derived class marcin.konarski at gmail dot com
  2013-05-07 17:51 ` [Bug c++/15401] " jan.kratochvil at redhat dot com
@ 2013-05-08 18:13 ` tromey at redhat dot com
  2013-05-22 20:51 ` cvs-commit at gcc dot gnu.org
  2013-05-22 20:52 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2013-05-08 18:13 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com
         AssignedTo|unassigned at sourceware    |tromey at redhat dot com
                   |dot org                     |

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2013-05-08 18:13:09 UTC ---
Testing a patch.

-- 
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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/15401] "set print object on" + printing variables of type: a reference to derived class.
  2013-04-25 19:14 [Bug c++/15401] New: "set print object on" + printing variables of type: a reference to derived class marcin.konarski at gmail dot com
  2013-05-07 17:51 ` [Bug c++/15401] " jan.kratochvil at redhat dot com
  2013-05-08 18:13 ` tromey at redhat dot com
@ 2013-05-22 20:51 ` cvs-commit at gcc dot gnu.org
  2013-05-22 20:52 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2013-05-22 20:51 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2013-05-22 20:51:51 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    tromey@sourceware.org    2013-05-22 20:51:49

Modified files:
    gdb            : ChangeLog c-valprint.c 
    gdb/testsuite  : ChangeLog 
    gdb/testsuite/gdb.cp: class2.cc class2.exp 

Log message:
    PR c++/15401:
    * c-valprint.c (c_value_print): Use value_addr for
    references.  Convert back to reference type with value_ref.
    gdb/testsuite
    * gdb.cp/class2.cc (main): New local 'aref'.
    * gdb.cp/class2.exp: Check printing of 'aref'.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15616&r2=1.15617
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/c-valprint.c.diff?cvsroot=src&r1=1.102&r2=1.103
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3674&r2=1.3675
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/class2.cc.diff?cvsroot=src&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/class2.exp.diff?cvsroot=src&r1=1.18&r2=1.19

-- 
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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/15401] "set print object on" + printing variables of type: a reference to derived class.
  2013-04-25 19:14 [Bug c++/15401] New: "set print object on" + printing variables of type: a reference to derived class marcin.konarski at gmail dot com
                   ` (2 preceding siblings ...)
  2013-05-22 20:51 ` cvs-commit at gcc dot gnu.org
@ 2013-05-22 20:52 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2013-05-22 20:52 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |7.7

--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2013-05-22 20:52:39 UTC ---
Fixed.

-- 
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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-22 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-25 19:14 [Bug c++/15401] New: "set print object on" + printing variables of type: a reference to derived class marcin.konarski at gmail dot com
2013-05-07 17:51 ` [Bug c++/15401] " jan.kratochvil at redhat dot com
2013-05-08 18:13 ` tromey at redhat dot com
2013-05-22 20:51 ` cvs-commit at gcc dot gnu.org
2013-05-22 20:52 ` 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).