aboutsummaryrefslogtreecommitdiff
path: root/gdb/extension.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-03-13 17:39:52 -0600
committerTom Tromey <tom@tromey.com>2020-03-13 18:03:42 -0600
commit42331a1ea2a13ce15ec202c5f0fbef3e5171253c (patch)
tree69cd05a4b2d8de096c8ee3f0b5a87c219f855ee1 /gdb/extension.c
parent3a916a975745f386cabbaba64531ed9b5f8be509 (diff)
downloadgdb-42331a1ea2a13ce15ec202c5f0fbef3e5171253c.zip
gdb-42331a1ea2a13ce15ec202c5f0fbef3e5171253c.tar.gz
gdb-42331a1ea2a13ce15ec202c5f0fbef3e5171253c.tar.bz2
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 <tom@tromey.com> * 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) <apply_val_pretty_printer>: Take a struct value. * cp-valprint.c (cp_print_value): Create a struct value. (cp_print_value): Update.
Diffstat (limited to 'gdb/extension.c')
-rw-r--r--gdb/extension.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/gdb/extension.c b/gdb/extension.c
index e2efe0b..09aa7d9 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -470,12 +470,9 @@ ext_lang_type_printers::~ext_lang_type_printers ()
}
}
-/* Try to pretty-print a value of type TYPE located at VAL's contents
- buffer + EMBEDDED_OFFSET, which came from the inferior at address
- ADDRESS + EMBEDDED_OFFSET, onto stdio stream STREAM according to
- OPTIONS.
- VAL is the whole object that came from ADDRESS.
- Returns non-zero if the value was successfully pretty-printed.
+/* Try to pretty-print a value onto stdio stream STREAM according to
+ OPTIONS. VAL is the object to print. Returns non-zero if the
+ value was successfully pretty-printed.
Extension languages are tried in the order specified by
extension_languages. The first one to provide a pretty-printed
@@ -488,10 +485,8 @@ ext_lang_type_printers::~ext_lang_type_printers ()
errors that trigger an exception in the extension language. */
int
-apply_ext_lang_val_pretty_printer (struct type *type,
- LONGEST embedded_offset, CORE_ADDR address,
+apply_ext_lang_val_pretty_printer (struct value *val,
struct ui_file *stream, int recurse,
- struct value *val,
const struct value_print_options *options,
const struct language_defn *language)
{
@@ -504,10 +499,8 @@ apply_ext_lang_val_pretty_printer (struct type *type,
if (extlang->ops->apply_val_pretty_printer == NULL)
continue;
- rc = extlang->ops->apply_val_pretty_printer (extlang, type,
- embedded_offset, address,
- stream, recurse, val,
- options, language);
+ rc = extlang->ops->apply_val_pretty_printer (extlang, val, stream,
+ recurse, options, language);
switch (rc)
{
case EXT_LANG_RC_OK: