From 42331a1ea2a13ce15ec202c5f0fbef3e5171253c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 13 Mar 2020 17:39:52 -0600 Subject: Change extension language pretty-printers to use value API This changes the extension language pretty-printers to use the value API. Note that new functions were needed, for both Guile and Python. Currently both languages always wrap values by removing the values from the value chain. This makes sense to avoid strange behavior with watchpoints, and to avoid excessive memory use. However, when printing, it's important to leave the passed-in value untouched, in case pretty-printing does nothing -- that way the caller can still access it. gdb/ChangeLog 2020-03-13 Tom Tromey * valprint.c (do_val_print): Update. * python/python-internal.h (gdbpy_apply_val_pretty_printer): Take a struct value. (value_to_value_object_no_release): Declare. * python/py-value.c (value_to_value_object_no_release): New function. * python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Take a struct value. * guile/scm-value.c (vlscm_scm_from_value_no_release): New function. * guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Take a struct value. * guile/guile-internal.h (vlscm_scm_from_value_no_release): Declare. (gdbscm_apply_val_pretty_printer): Take a struct value. * extension.h (apply_ext_lang_val_pretty_printer): Take a struct value. * extension.c (apply_ext_lang_val_pretty_printer): Take a struct value. * extension-priv.h (struct extension_language_ops) : Take a struct value. * cp-valprint.c (cp_print_value): Create a struct value. (cp_print_value): Update. --- gdb/extension.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gdb/extension.h') diff --git a/gdb/extension.h b/gdb/extension.h index ca3fc14..c840dbc 100644 --- a/gdb/extension.h +++ b/gdb/extension.h @@ -283,10 +283,8 @@ extern char *apply_ext_lang_type_printers (struct ext_lang_type_printers *, struct type *); extern int apply_ext_lang_val_pretty_printer - (struct type *type, - LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *val, const struct value_print_options *options, + (struct value *value, struct ui_file *stream, int recurse, + const struct value_print_options *options, const struct language_defn *language); extern enum ext_lang_bt_status apply_ext_lang_frame_filter -- cgit v1.1