include/elf/ChangeLog:
[deliverable/binutils-gdb.git] / gdb / p-valprint.c
index 46e40e059683fef01ff55c66a7c232cecedd9eef..72be1f508c411f252778bc97dba0255c7ecc9d24 100644 (file)
@@ -1,6 +1,6 @@
 /* Support for printing Pascal values for GDB, the GNU debugger.
 
-   Copyright 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -16,7 +16,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 /* This file is derived from c-valprint.c */
 
@@ -57,7 +58,7 @@
 
 
 int
-pascal_val_print (struct type *type, const bfd_byte *valaddr,
+pascal_val_print (struct type *type, const gdb_byte *valaddr,
                  int embedded_offset, CORE_ADDR address,
                  struct ui_file *stream, int format, int deref_ref,
                  int recurse, enum val_prettyprint pretty)
@@ -240,9 +241,8 @@ pascal_val_print (struct type *type, const bfd_byte *valaddr,
                      wtype = TYPE_TARGET_TYPE (type);
                    }
                  vt_val = value_at (wtype, vt_address);
-                 val_print (value_type (vt_val), value_contents (vt_val), 0,
-                            VALUE_ADDRESS (vt_val), stream, format,
-                            deref_ref, recurse + 1, pretty);
+                 common_val_print (vt_val, stream, format, deref_ref,
+                                   recurse + 1, pretty);
                  if (pretty)
                    {
                      fprintf_filtered (stream, "\n");
@@ -292,10 +292,8 @@ pascal_val_print (struct type *type, const bfd_byte *valaddr,
              (TYPE_TARGET_TYPE (type),
               unpack_pointer (lookup_pointer_type (builtin_type_void),
                               valaddr + embedded_offset));
-             val_print (value_type (deref_val),
-                        value_contents (deref_val), 0,
-                        VALUE_ADDRESS (deref_val), stream, format,
-                        deref_ref, recurse + 1, pretty);
+             common_val_print (deref_val, stream, format, deref_ref,
+                               recurse + 1, pretty);
            }
          else
            fputs_filtered ("???", stream);
@@ -566,9 +564,7 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format,
          fprintf_filtered (stream, ") ");
        }
     }
-  return val_print (type, value_contents (val), value_embedded_offset (val),
-                   VALUE_ADDRESS (val) + value_offset (val),
-                   stream, format, 1, 0, pretty);
+  return common_val_print (val, stream, format, 1, 0, pretty);
 }
 
 
@@ -591,17 +587,17 @@ show_pascal_static_field_print (struct ui_file *file, int from_tty,
 static struct obstack dont_print_vb_obstack;
 static struct obstack dont_print_statmem_obstack;
 
-static void pascal_object_print_static_field (struct type *, struct value *,
+static void pascal_object_print_static_field (struct value *,
                                              struct ui_file *, int, int,
                                              enum val_prettyprint);
 
-static void pascal_object_print_value (struct type *, const bfd_byte *,
+static void pascal_object_print_value (struct type *, const gdb_byte *,
                                       CORE_ADDR, struct ui_file *,
                                       int, int, enum val_prettyprint,
                                       struct type **);
 
 void
-pascal_object_print_class_method (const bfd_byte *valaddr, struct type *type,
+pascal_object_print_class_method (const gdb_byte *valaddr, struct type *type,
                                  struct ui_file *stream)
 {
   struct type *domain;
@@ -741,7 +737,7 @@ pascal_object_is_vtbl_member (struct type *type)
    should not print, or zero if called from top level.  */
 
 void
-pascal_object_print_value_fields (struct type *type, const bfd_byte *valaddr,
+pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
                                  CORE_ADDR address, struct ui_file *stream,
                                  int format, int recurse,
                                  enum val_prettyprint pretty,
@@ -854,8 +850,7 @@ pascal_object_print_value_fields (struct type *type, const bfd_byte *valaddr,
                  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
                                   unpack_field_as_long (type, valaddr, i));
 
-                 val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
-                            stream, format, 0, recurse + 1, pretty);
+                 common_val_print (v, stream, format, 0, recurse + 1, pretty);
                }
            }
          else
@@ -874,9 +869,8 @@ pascal_object_print_value_fields (struct type *type, const bfd_byte *valaddr,
                  if (v == NULL)
                    fputs_filtered ("<optimized out>", stream);
                  else
-                   pascal_object_print_static_field (TYPE_FIELD_TYPE (type, i), v,
-                                               stream, format, recurse + 1,
-                                                     pretty);
+                   pascal_object_print_static_field (v, stream, format,
+                                                     recurse + 1, pretty);
                }
              else
                {
@@ -914,7 +908,7 @@ pascal_object_print_value_fields (struct type *type, const bfd_byte *valaddr,
    baseclasses.  */
 
 void
-pascal_object_print_value (struct type *type, const bfd_byte *valaddr,
+pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
                           CORE_ADDR address, struct ui_file *stream,
                           int format, int recurse,
                           enum val_prettyprint pretty,
@@ -940,7 +934,7 @@ pascal_object_print_value (struct type *type, const bfd_byte *valaddr,
       int boffset;
       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
       char *basename = TYPE_NAME (baseclass);
-      const bfd_byte *base_valaddr;
+      const gdb_byte *base_valaddr;
 
       if (BASETYPE_VIA_VIRTUAL (type, i))
        {
@@ -978,7 +972,7 @@ pascal_object_print_value (struct type *type, const bfd_byte *valaddr,
       if (boffset != -1 && (boffset < 0 || boffset >= TYPE_LENGTH (type)))
        {
          /* FIXME (alloc): not safe is baseclass is really really big. */
-         bfd_byte *buf = alloca (TYPE_LENGTH (baseclass));
+         gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
          base_valaddr = buf;
          if (target_read_memory (address + boffset, buf,
                                  TYPE_LENGTH (baseclass)) != 0)
@@ -1017,14 +1011,16 @@ pascal_object_print_value (struct type *type, const bfd_byte *valaddr,
    static member classes in an obstack and refuse to print them more
    than once.
 
-   VAL contains the value to print, TYPE, STREAM, RECURSE, and PRETTY
+   VAL contains the value to print, STREAM, RECURSE, and PRETTY
    have the same meanings as in c_val_print.  */
 
 static void
-pascal_object_print_static_field (struct type *type, struct value *val,
+pascal_object_print_static_field (struct value *val,
                                  struct ui_file *stream, int format,
                                  int recurse, enum val_prettyprint pretty)
 {
+  struct type *type = value_type (val);
+
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
       CORE_ADDR *first_dont_print;
@@ -1053,12 +1049,11 @@ pascal_object_print_static_field (struct type *type, struct value *val,
                                  stream, format, recurse, pretty, NULL, 1);
       return;
     }
-  val_print (type, value_contents (val), 0, VALUE_ADDRESS (val),
-            stream, format, 0, recurse, pretty);
+  common_val_print (val, stream, format, 0, recurse, pretty);
 }
 
 void
-pascal_object_print_class_member (const bfd_byte *valaddr, struct type *domain,
+pascal_object_print_class_member (const gdb_byte *valaddr, struct type *domain,
                                  struct ui_file *stream, char *prefix)
 {
 
This page took 0.025641 seconds and 4 git commands to generate.