Remove apply_val_pretty_printer parameter valaddr
authorYao Qi <yao.qi@linaro.org>
Fri, 11 Nov 2016 08:38:31 +0000 (08:38 +0000)
committerYao Qi <yao.qi@linaro.org>
Fri, 11 Nov 2016 08:38:31 +0000 (08:38 +0000)
This patch removes the parameter valaddr of
extension_language_ops::apply_val_pretty_printer and remove const from
"struct value *val".  valaddr can be got in each extension language's
implementation of apply_val_pretty_printer.

gdb:

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.

gdb/ChangeLog
gdb/cp-valprint.c
gdb/extension-priv.h
gdb/extension.c
gdb/extension.h
gdb/guile/guile-internal.h
gdb/guile/scm-pretty-print.c
gdb/python/py-prettyprint.c
gdb/python/python-internal.h
gdb/valprint.c

index 96e4f5fe5887e9e4601924df0613875f1179600b..7fc2b4a9fe10e56d2c6df9b3061f368551eecbf5 100644 (file)
@@ -1,3 +1,23 @@
+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.
index 57d5d02a37c3fc92be42e3d7fe5c8e1f51b3d1ac..9432c8369b046f02f5b05577467661f507d14c98 100644 (file)
@@ -490,7 +490,6 @@ cp_print_value (struct type *type, struct type *real_type,
       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))
@@ -551,18 +550,15 @@ cp_print_value (struct type *type, struct type *real_type,
                  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;
            }
        }
@@ -591,7 +587,7 @@ cp_print_value (struct type *type, struct type *real_type,
             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,
index 26bd21ff36c8a23d1c3ba94fa1fb605a99ca2f32..161d99bba7944d3d61678056ff50043c96d34108 100644 (file)
@@ -171,19 +171,19 @@ struct extension_language_ops
   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.
index c9f5664806ba0b7bfbb20dff2662795b8e0b875d..40c63a69b57f549a28947c2bbcb6c90f8c3355e1 100644 (file)
@@ -478,11 +478,11 @@ free_ext_lang_type_printers (struct ext_lang_type_printers *printers)
   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
@@ -496,10 +496,10 @@ free_ext_lang_type_printers (struct ext_lang_type_printers *printers)
    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)
 {
@@ -512,7 +512,7 @@ apply_ext_lang_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
 
       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);
index fa11f25f49d2fda7333398497dc07c9e7d5c7d5e..66bcb03f8c7b0078f1993a53d657342d27358c83 100644 (file)
@@ -225,10 +225,10 @@ extern char *apply_ext_lang_type_printers (struct ext_lang_type_printers *,
 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
index 5f819b88716890fcd72629a6df50938cf7aad06c..3865f7709f12a321bb5105a47a057a1a71408361 100644 (file)
@@ -597,10 +597,10 @@ extern void gdbscm_preserve_values
 
 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);
 
index afdd0c71e0a48af36e24812b45ef4fcb858bcb92..5253defc1eea0049ab1f02e9fcafecc1c02b07f5 100644 (file)
@@ -957,10 +957,10 @@ ppscm_print_children (SCM printer, enum display_hint hint,
 
 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)
 {
@@ -973,6 +973,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
   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)))
@@ -984,9 +985,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
   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);
index 3c6a5afe4026cd47beb043b0281e7d96b63536dd..cbc168de4ee85a56fce3f398c309af2dc7c1eb2b 100644 (file)
@@ -699,10 +699,10 @@ print_children (PyObject *printer, const char *hint,
 
 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)
 {
@@ -714,6 +714,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
   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)))
@@ -725,9 +726,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
   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);
index f3213bb82eb88c23c13a9093322ced55b1b216d4..5f0abf8263c3ad9ac19db32de43bc569366b583b 100644 (file)
@@ -315,10 +315,10 @@ extern int gdbpy_auto_load_enabled (const struct extension_language_defn *);
 
 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
index b18ece371c5ea62446aa83782ffd78c316049823..c0cdb34634c9a0699e42f77e2ebce20e43b96c2f 100644 (file)
@@ -1098,9 +1098,7 @@ val_print (struct type *type, LONGEST embedded_offset,
 
   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)
@@ -1223,7 +1221,6 @@ value_print (struct value *val, struct ui_file *stream,
     {
       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,
This page took 0.041064 seconds and 4 git commands to generate.