This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Improved pretty printing for smart pointers
- From: Tom Tromey <tromey at redhat dot com>
- To: Michael Marte <informarte at freenet dot de>
- Cc: gdb at sourceware dot org
- Date: Tue, 23 Apr 2013 12:01:36 -0600
- Subject: Re: Improved pretty printing for smart pointers
- References: <516D297C dot 7030104 at freenet dot de>
>>>>> "Michael" == Michael Marte <informarte@freenet.de> writes:
Michael> I found the pretty printers for std::shared_ptr, std::weak_ptr and
Michael> std::unique_ptr (as provided by
Michael> svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python) not sufficient
Michael> for daily use as they only generate a description (including the
Michael> address of the pointee) but do not pretty print the pointee
Michael> itself. This behaviour implies that one has to copy the address of the
Michael> pointee, cast it to the pointee's type, and dereference the result. To
Michael> improve on the current state of affairs, I improved the pretty
Michael> printers to generate children. For std::shared_ptr and std::weak_ptr,
Michael> three children are generated, namely "Use count", "Weak count", and
Michael> "Managed value". For std::unique_ptr, one child is generated, namely
Michael> "Managed value". Using this solution with an IDE like kdevelop or
Michael> Eclipse CTD, it only needs two clicks to see the value managed by a
Michael> smart pointer.
Michael> I attached my patch in the hope that you will find it interesting and
Michael> that it will be integrated into your suite of GCC STL pretty printers.
This patch should go to the libstdc++ list.
The printers are maintained there.
Tom