aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile/scm-pretty-print.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/guile/scm-pretty-print.c')
-rw-r--r--gdb/guile/scm-pretty-print.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 656c4bb..630a062 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -897,7 +897,18 @@ ppscm_print_children (SCM printer, enum display_hint hint,
ppscm_print_exception_unless_memory_error (except_scm, stream);
break;
}
- common_val_print (value, stream, recurse + 1, options, language);
+ else
+ {
+ /* When printing the key of a map we allow one additional
+ level of depth. This means the key will print before the
+ value does. */
+ struct value_print_options opt = *options;
+ if (is_map && i % 2 == 0
+ && opt.max_depth != -1
+ && opt.max_depth < INT_MAX)
+ ++opt.max_depth;
+ common_val_print (value, stream, recurse + 1, &opt, language);
+ }
}
if (is_map && i % 2 == 0)
@@ -984,6 +995,12 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
}
gdb_assert (ppscm_is_pretty_printer_worker (printer));
+ if (val_print_check_max_depth (stream, recurse, options, language))
+ {
+ result = EXT_LANG_RC_OK;
+ goto done;
+ }
+
/* If we are printing a map, we want some special formatting. */
hint = ppscm_get_display_hint_enum (printer);
if (hint == HINT_ERROR)