This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: RFC: fix std::unique_ptr pretty-printer
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: libstdc <libstdc++ at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Sat, 11 Aug 2012 00:58:21 +0100
- Subject: Re: RFC: fix std::unique_ptr pretty-printer
- References: <874noaa5o9.fsf@fleche.redhat.com>
On 10 August 2012 20:49, Tom Tromey wrote:
> A user reported on irc that the std::unique_ptr pretty-printer yields
> bad results. For example:
>
> (gdb) p uptr
> $1 = std::tuple containing = {
> [1] = ,
> [2] = {
> <std::default_delete<datum>> = {<No data fields>}, <No data fields>}
> }
>
> This omits the actual pointer and prints some useless stuff instead.
>
> This patch fixes the printer and adds a test.
> The new output looks like this:
>
> $11 = std::unique_ptr containing (datum *) 0x6067d0
>
> Let me know what you think.
It's inconsistent with the other printers in that it prints the stored
type, unlike e.g. std::vector<int> which just says "std::vector of
length ..." but I think that's an improvement.
Personally I'd prefer the element_type as part of the type, e.g.
"std::unique_ptr<datum> = 0x6067d0" but that would be even more
inconsistent!
OK for trunk, thanks.