https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59161
Jan Kratochvil <jan.kratochvil at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |palves at redhat dot com --- Comment #5 from Jan Kratochvil <jan.kratochvil at redhat dot com> --- Returning gdb.Value means for GDB the pretty printer is printing its elements which are printed in a simplified way - suppressing their addresses - since: Message-Id: <20091110021158.c3c2576...@ppluzhnikov.mtv.corp.google.com> https://sourceware.org/ml/gdb/2009-11/msg00105.html Message-Id: <20091110214517.49a3e76...@ppluzhnikov.mtv.corp.google.com> https://sourceware.org/ml/gdb-patches/2009-11/msg00234.html commit 269f82e5eb0aa5d5b4c1accc858f95b62bc16df4 Printing an iterator means GDB should print the referenced element in its normal form - the referenced element are not data items of the iterator itself. The str() cast has a side-effect GDB will print format the data without the simplification from patch above. It may be weird that GDB value_print_options::deref_ref is off, therefore GDB then prints neither the reference address nor the referenced value. But that is unrelated IMO. No matter how weird the GDB printing is in the end I find str() does the right thing for GDB in this case.