+2016-11-11  Yao Qi  <yao.qi@linaro.org>
+
+       * cp-valprint.c (cp_print_value): Remove local base_valaddr.
+       * extension-priv.h (struct extension_language_ops)
+       <apply_val_pretty_printer>: Remove the second parameter.
+       Remove const from "struct value *".  Callers updated.
+       * extension.c (apply_ext_lang_val_pretty_printer): Update
+       comments.  Remove parameter valaddr.  Remove const from
+       "struct value *".
+       * extension.h (apply_ext_lang_val_pretty_printer): Update
+       declaration.
+       * guile/guile-internal.h (gdbscm_apply_val_pretty_printer):
+       Update declaration.
+       * guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer):
+       Remove parameter valaddr.  Remove const from "struct value *".
+       * python/py-prettyprint.c (gdbpy_apply_val_pretty_printer):
+       Likewise.
+       * python/python-internal.h (gdbpy_apply_val_pretty_printer):
+       Update declaration.
+
 2016-11-11  Yao Qi  <yao.qi@linaro.org>
 
        * c-lang.h (cp_print_value_fields): Update declaration.
 
       int skip = 0;
       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
       const char *basename = TYPE_NAME (baseclass);
-      const gdb_byte *base_valaddr = NULL;
       struct value *base_val = NULL;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
                  thisoffset = 0;
                  boffset = 0;
                  thistype = baseclass;
-                 base_valaddr = value_contents_for_printing_const (base_val);
                  do_cleanups (back_to);
                }
              else
                {
-                 base_valaddr = valaddr;
                  base_val = val;
                }
            }
          else
            {
-             base_valaddr = valaddr;
              base_val = val;
            }
        }
             baseclass if possible.  */
          if (!options->raw)
            result
-             = apply_ext_lang_val_pretty_printer (baseclass, base_valaddr,
+             = apply_ext_lang_val_pretty_printer (baseclass,
                                                   thisoffset + boffset,
                                                   value_address (base_val),
                                                   stream, recurse,
 
   void (*free_type_printers) (const struct extension_language_defn *,
                              struct ext_lang_type_printers *);
 
-  /* Try to pretty-print a value of type TYPE located at VALADDR
-     + 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.  VALADDR must point to
-     the head of VAL's contents buffer.
+  /* 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 EXT_LANG_RC_OK upon success, EXT_LANG_RC_NOP if the value
      is not recognized, and EXT_LANG_RC_ERROR if an error was encountered.  */
   enum ext_lang_rc (*apply_val_pretty_printer)
     (const struct extension_language_defn *,
-     struct type *type, const gdb_byte *valaddr,
+     struct type *type,
      LONGEST embedded_offset, CORE_ADDR address,
      struct ui_file *stream, int recurse,
-     const struct value *val, const struct value_print_options *options,
+     struct value *val, const struct value_print_options *options,
      const struct language_defn *language);
 
   /* GDB access to the "frame filter" feature.
 
   xfree (printers);
 }
 \f
-/* Try to pretty-print a value of type TYPE located at VALADDR
-   + 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.  VALADDR must point to
-   the head of VAL's contents buffer.
+/* 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.
 
    Extension languages are tried in the order specified by
    errors that trigger an exception in the extension language.  */
 
 int
-apply_ext_lang_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
+apply_ext_lang_val_pretty_printer (struct type *type,
                                   LONGEST embedded_offset, CORE_ADDR address,
                                   struct ui_file *stream, int recurse,
-                                  const struct value *val,
+                                  struct value *val,
                                   const struct value_print_options *options,
                                   const struct language_defn *language)
 {
 
       if (extlang->ops->apply_val_pretty_printer == NULL)
        continue;
-      rc = extlang->ops->apply_val_pretty_printer (extlang, type, valaddr,
+      rc = extlang->ops->apply_val_pretty_printer (extlang, type,
                                                   embedded_offset, address,
                                                   stream, recurse, val,
                                                   options, language);
 
 extern void free_ext_lang_type_printers (struct ext_lang_type_printers *);
 
 extern int apply_ext_lang_val_pretty_printer
-  (struct type *type, const gdb_byte *valaddr,
+  (struct type *type,
    LONGEST embedded_offset, CORE_ADDR address,
    struct ui_file *stream, int recurse,
-   const struct value *val, const struct value_print_options *options,
+   struct value *val, const struct value_print_options *options,
    const struct language_defn *language);
 
 extern enum ext_lang_bt_status apply_ext_lang_frame_filter
 
 
 extern enum ext_lang_rc gdbscm_apply_val_pretty_printer
   (const struct extension_language_defn *,
-   struct type *type, const gdb_byte *valaddr,
+   struct type *type,
    LONGEST embedded_offset, CORE_ADDR address,
    struct ui_file *stream, int recurse,
-   const struct value *val,
+   struct value *val,
    const struct value_print_options *options,
    const struct language_defn *language);
 
 
 
 enum ext_lang_rc
 gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
-                                struct type *type, const gdb_byte *valaddr,
+                                struct type *type,
                                 LONGEST embedded_offset, CORE_ADDR address,
                                 struct ui_file *stream, int recurse,
-                                const struct value *val,
+                                struct value *val,
                                 const struct value_print_options *options,
                                 const struct language_defn *language)
 {
   struct cleanup *cleanups;
   enum ext_lang_rc result = EXT_LANG_RC_NOP;
   enum string_repr_result print_result;
+  const gdb_byte *valaddr = value_contents_for_printing (val);
 
   /* No pretty-printer support for unavailable values.  */
   if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type)))
   cleanups = make_cleanup (null_cleanup, NULL);
 
   /* Instantiate the printer.  */
-  if (valaddr)
-    valaddr += embedded_offset;
-  value = value_from_contents_and_address (type, valaddr,
+  value = value_from_contents_and_address (type, valaddr + embedded_offset,
                                           address + embedded_offset);
 
   set_value_component_location (value, val);
 
 
 enum ext_lang_rc
 gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
-                               struct type *type, const gdb_byte *valaddr,
+                               struct type *type,
                                LONGEST embedded_offset, CORE_ADDR address,
                                struct ui_file *stream, int recurse,
-                               const struct value *val,
+                               struct value *val,
                                const struct value_print_options *options,
                                const struct language_defn *language)
 {
   struct cleanup *cleanups;
   enum ext_lang_rc result = EXT_LANG_RC_NOP;
   enum string_repr_result print_result;
+  const gdb_byte *valaddr = value_contents_for_printing (val);
 
   /* No pretty-printer support for unavailable values.  */
   if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type)))
   cleanups = ensure_python_env (gdbarch, language);
 
   /* Instantiate the printer.  */
-  if (valaddr)
-    valaddr += embedded_offset;
-  value = value_from_contents_and_address (type, valaddr,
+  value = value_from_contents_and_address (type, valaddr + embedded_offset,
                                           address + embedded_offset);
 
   set_value_component_location (value, val);
 
 
 extern enum ext_lang_rc gdbpy_apply_val_pretty_printer
   (const struct extension_language_defn *,
-   struct type *type, const gdb_byte *valaddr,
+   struct type *type,
    LONGEST embedded_offset, CORE_ADDR address,
    struct ui_file *stream, int recurse,
-   const struct value *val,
+   struct value *val,
    const struct value_print_options *options,
    const struct language_defn *language);
 extern enum ext_lang_bt_status gdbpy_apply_frame_filter
 
 
   if (!options->raw)
     {
-      const gdb_byte *valaddr = value_contents_for_printing (val);
-
-      ret = apply_ext_lang_val_pretty_printer (type, valaddr, embedded_offset,
+      ret = apply_ext_lang_val_pretty_printer (type, embedded_offset,
                                               address, stream, recurse,
                                               val, options, language);
       if (ret)
     {
       int r
        = apply_ext_lang_val_pretty_printer (value_type (val),
-                                            value_contents_for_printing (val),
                                             value_embedded_offset (val),
                                             value_address (val),
                                             stream, 0,