Call value_fetch_lazy when needed in pretty-printers
authorTom Tromey <tom@tromey.com>
Sun, 8 Jul 2018 18:17:36 +0000 (12:17 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 22 Jul 2018 19:20:04 +0000 (13:20 -0600)
This removes some unused variables, and replaces the calls to
value_contents_for_printing with a call to value_fetch_lazy, when
needed.

gdb/ChangeLog
2018-07-22  Tom Tromey  <tom@tromey.com>

* python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Remove
unused variable.  Call value_fetch_lazy when needed.
* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer):
Remove unused variable.  Call value_fetch_lazy when needed.

gdb/ChangeLog
gdb/guile/scm-pretty-print.c
gdb/python/py-prettyprint.c

index a05f459151de8b158eada7563c42f5538c084388..591cb935aa265fff5ac43bdf3c2ccd523b505bc0 100644 (file)
@@ -1,3 +1,10 @@
+2018-07-22  Tom Tromey  <tom@tromey.com>
+
+       * python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Remove
+       unused variable.  Call value_fetch_lazy when needed.
+       * guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer):
+       Remove unused variable.  Call value_fetch_lazy when needed.
+
 2018-07-22  Tom Tromey  <tom@tromey.com>
 
        * m32c-tdep.c (mark_dma): Return void.
index 3fe36820a6a3ee42e86a95737c0cb0efdeb29761..f292960dbbdad543176ccd55111cbfad9b5561d8 100644 (file)
@@ -949,7 +949,9 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
   enum display_hint hint;
   enum ext_lang_rc result = EXT_LANG_RC_NOP;
   enum string_repr_result print_result;
-  const gdb_byte *valaddr = value_contents_for_printing (val);
+
+  if (value_lazy (val))
+    value_fetch_lazy (val);
 
   /* No pretty-printer support for unavailable values.  */
   if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type)))
index 21b1ce948797822c7359c2c4ef573b78ed6136e7..a8a8489930993f0a12467defb53436754501c589 100644 (file)
@@ -662,7 +662,9 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
   struct gdbarch *gdbarch = get_type_arch (type);
   struct value *value;
   enum string_repr_result print_result;
-  const gdb_byte *valaddr = value_contents_for_printing (val);
+
+  if (value_lazy (val))
+    value_fetch_lazy (val);
 
   /* No pretty-printer support for unavailable values.  */
   if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type)))