Bug 16436 - pointed-to objects are not pretty printed
Summary: pointed-to objects are not pretty printed
Status: RESOLVED NOTABUG
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: 7.6
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-11 13:36 UTC by Peter Remmers
Modified: 2022-06-07 15:38 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Remmers 2014-01-11 13:36:00 UTC
Using eclipse CDT (Kepler) for debugging.

If there exists a pretty printer for a class, instances of this class are pretty-printed ok. I.e. you can expand the variable in the "Variables" view and see the pretty-printed children.

However, if the variable is a pointer to a class, then the pointed-to object is not pretty printed. If you expand the pointer variable, you see the raw members of the pointed-to object, not the children reported by the printer.

std::string str("Hello");  // pretty printed
std::string* pstr = &str;  // not pretty printed


Versions:
$ gdb -v
GNU gdb (GDB) 7.6
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 "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.8/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~12.04) 
$ uname -a
Linux xubuntuvm 3.2.0-57-generic #87-Ubuntu SMP Tue Nov 12 21:38:12 UTC 2013 i686 i686 i386 GNU/Linux


/Peter
Comment 1 Hannes Domani 2021-01-09 18:32:35 UTC
Isn't that a problem on eclipse side?
Comment 2 Tom Tromey 2022-06-06 19:30:31 UTC
This definitely works for me:

(gdb) p x
$1 = "hello there"
(gdb) p y
$2 = (std::string *) 0x7fffffffe2c0
(gdb) p *y
$3 = "hello there"

I'm inclined to close this bug unless there are more details
available?
Comment 3 Peter Remmers 2022-06-07 12:10:22 UTC
I tried this again, and yes, it works on the gdb prompt, but not in the variables window of eclipse.
I don't know what eclipse does there, but it does not seem to be a gdb bug.
Comment 4 Tom Tromey 2022-06-07 15:38:27 UTC
Thanks for the response.  I'm going to close this.

If you have access to logs of the Eclipse MI traffic with gdb,
that might tell us what's going on.