I have a struct Hash which can contain Hashes as values. This way one can produce a cyclic reference adding two hashes to each other. Such a cyclic produces an infinite recursion during pretty-printing of children.
Created attachment 6528 [details] minimalistic c++ example sourcce
Created attachment 6529 [details] pretty printer implementation
I have had a glance at the python api source and want to add some proposals: py-prettyprint.c: print_children (PyObject *printer, const char *hint, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language, int is_py_none) I. Let the pretty-printer know about the current recursion level this would give the pretty-printer more control about how deep it provides children. II. Handle Visited information A value has a location (struct) that contains the address which could be collected in a set of visited addresses. The set would be initialized on recurse==0. A visited flag could be set in the gdb.Value, leaving handling this to the pretty-printer, or recursion stopped based on this information, and maybe based on gdb pretty-print options: ... common_val_print (value, stream, recurse + 1, options, language); ...
Created attachment 6564 [details] this patch implements proposal I
Comment on attachment 6564 [details] this patch implements proposal I Thanks for the bug report, and the patch. If you want to submit this as a solution, it would be great if you could post it to gdb-patched@sourceware.org for review. It will receive the attention if deserves there. There is a brief guide to contributions formats and processes here http://sourceware.org/gdb/contribute/
Sorry, typo, that should be: gdb-patches@sourceware.org
Giving printers better access to some gdb printing context has been requested in a few contexts now.