public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "marcin.konarski at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug c++/15401] New: "set print object on" + printing variables of type: a reference to derived class. Date: Thu, 25 Apr 2013 19:14:00 -0000 [thread overview] Message-ID: <bug-15401-4717@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2013-04-25 19:14 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-04-25 19:14 marcin.konarski at gmail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-15401-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).