2000-12-22 Fernando Nasser <fnasser@redhat.com>
[deliverable/binutils-gdb.git] / gdb / cp-valprint.c
index ff2bec865a83b9c11501f17552d8ba360dbe220b..7f48a12634966e54dbc1ebaed041f8a370fc497d 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing C++ values for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1994, 1995, 1996
+   Copyright 1986, 1988, 1989, 1991, 1994-1996, 2000
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -45,26 +45,25 @@ int static_field_print;             /* Controls printing of static fields. */
 static struct obstack dont_print_vb_obstack;
 static struct obstack dont_print_statmem_obstack;
 
-extern void _initialize_cp_valprint PARAMS ((void));
+extern void _initialize_cp_valprint (void);
 
-static void
-cp_print_static_field PARAMS ((struct type *, value_ptr, GDB_FILE *, int, int,
-                              enum val_prettyprint));
+static void cp_print_static_field (struct type *, value_ptr,
+                                  struct ui_file *, int, int,
+                                  enum val_prettyprint);
 
-static void
-cp_print_value PARAMS ((struct type *, struct type *, char *, int, CORE_ADDR, GDB_FILE *,
-                       int, int, enum val_prettyprint, struct type **));
+static void cp_print_value (struct type *, struct type *, char *, int,
+                           CORE_ADDR, struct ui_file *, int, int,
+                           enum val_prettyprint, struct type **);
 
-static void
-cp_print_hpacc_virtual_table_entries PARAMS ((struct type *, int *, value_ptr, GDB_FILE *,
-                                          int, int, enum val_prettyprint));
+static void cp_print_hpacc_virtual_table_entries (struct type *, int *,
+                                                 value_ptr,
+                                                 struct ui_file *, int,
+                                                 int,
+                                                 enum val_prettyprint);
 
 
 void
-cp_print_class_method (valaddr, type, stream)
-     char *valaddr;
-     struct type *type;
-     GDB_FILE *stream;
+cp_print_class_method (char *valaddr, struct type *type, struct ui_file *stream)
 {
   struct type *domain;
   struct fn_field *f = NULL;
@@ -153,7 +152,7 @@ common:
       else
        {
          fputs_filtered (demangled_name, stream);
-         free (demangled_name);
+         xfree (demangled_name);
        }
     }
   else
@@ -182,8 +181,7 @@ const char hpacc_vtbl_ptr_type_name[] =
    "pointer to virtual function".  */
 
 int
-cp_is_vtbl_ptr_type (type)
-     struct type *type;
+cp_is_vtbl_ptr_type (struct type *type)
 {
   char *typename = type_name_no_tag (type);
 
@@ -196,8 +194,7 @@ cp_is_vtbl_ptr_type (type)
    "pointer to virtual function table".  */
 
 int
-cp_is_vtbl_member (type)
-     struct type *type;
+cp_is_vtbl_member (struct type *type)
 {
   if (TYPE_CODE (type) == TYPE_CODE_PTR)
     {
@@ -230,19 +227,10 @@ cp_is_vtbl_member (type)
    should not print, or zero if called from top level.  */
 
 void
-cp_print_value_fields (type, real_type, valaddr, offset, address, stream, format, recurse, pretty,
-                      dont_print_vb, dont_print_statmem)
-     struct type *type;
-     struct type *real_type;
-     char *valaddr;
-     int offset;
-     CORE_ADDR address;
-     GDB_FILE *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
-     struct type **dont_print_vb;
-     int dont_print_statmem;
+cp_print_value_fields (struct type *type, struct type *real_type, char *valaddr,
+                      int offset, CORE_ADDR address, struct ui_file *stream,
+                      int format, int recurse, enum val_prettyprint pretty,
+                      struct type **dont_print_vb, int dont_print_statmem)
 {
   int i, len, n_baseclasses;
   struct obstack tmp_obstack;
@@ -427,7 +415,7 @@ cp_print_value_fields (type, real_type, valaddr, offset, address, stream, format
       /* pai: FIXME 32x64 problem? */
       /* Not sure what the best notation is in the case where there is no
          baseclass name.  */
-      v = value_from_longest (lookup_pointer_type (builtin_type_unsigned_long),
+      v = value_from_pointer (lookup_pointer_type (builtin_type_unsigned_long),
                              *(unsigned long *) (valaddr + offset));
 
       val_print (VALUE_TYPE (v), VALUE_CONTENTS (v), 0, 0,
@@ -470,7 +458,7 @@ cp_print_value_fields (type, real_type, valaddr, offset, address, stream, format
            }                   /* non-RRBC case */
          else
            {
-             /* FIXME -- seem comments above */
+             /* FIXME -- see comments above */
              /* RRBC support present; function pointers are found
               * by indirection through the class segment entries. */
 
@@ -493,18 +481,10 @@ cp_print_value_fields (type, real_type, valaddr, offset, address, stream, format
    baseclasses.  */
 
 static void
-cp_print_value (type, real_type, valaddr, offset, address, stream, format, recurse, pretty,
-               dont_print_vb)
-     struct type *type;
-     struct type *real_type;
-     char *valaddr;
-     int offset;
-     CORE_ADDR address;
-     GDB_FILE *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
-     struct type **dont_print_vb;
+cp_print_value (struct type *type, struct type *real_type, char *valaddr,
+               int offset, CORE_ADDR address, struct ui_file *stream,
+               int format, int recurse, enum val_prettyprint pretty,
+               struct type **dont_print_vb)
 {
   struct obstack tmp_obstack;
   struct type **last_dont_print
@@ -625,13 +605,8 @@ cp_print_value (type, real_type, valaddr, offset, address, stream, format, recur
    have the same meanings as in c_val_print.  */
 
 static void
-cp_print_static_field (type, val, stream, format, recurse, pretty)
-     struct type *type;
-     value_ptr val;
-     GDB_FILE *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
+cp_print_static_field (struct type *type, value_ptr val, struct ui_file *stream,
+                      int format, int recurse, enum val_prettyprint pretty)
 {
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
@@ -666,11 +641,8 @@ cp_print_static_field (type, val, stream, format, recurse, pretty)
 }
 
 void
-cp_print_class_member (valaddr, domain, stream, prefix)
-     char *valaddr;
-     struct type *domain;
-     GDB_FILE *stream;
-     char *prefix;
+cp_print_class_member (char *valaddr, struct type *domain,
+                      struct ui_file *stream, char *prefix)
 {
 
   /* VAL is a byte offset into the structure type DOMAIN.
@@ -726,7 +698,7 @@ cp_print_class_member (valaddr, domain, stream, prefix)
        fprintf_filtered (stream, " (offset in bits)");
     }
   else
-    fprintf_filtered (stream, "%d", val >> 3);
+    fprintf_filtered (stream, "%ld", (long) (val >> 3));
 }
 
 
@@ -744,14 +716,10 @@ cp_print_class_member (valaddr, domain, stream, prefix)
 
 
 static void
-cp_print_hpacc_virtual_table_entries (type, vfuncs, v, stream, format, recurse, pretty)
-     struct type *type;
-     int *vfuncs;
-     value_ptr v;
-     GDB_FILE *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
+cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs,
+                                     value_ptr v, struct ui_file *stream,
+                                     int format, int recurse,
+                                     enum val_prettyprint pretty)
 {
   int fn, oi;
 
@@ -796,7 +764,7 @@ cp_print_hpacc_virtual_table_entries (type, vfuncs, v, stream, format, recurse,
 
 
 void
-_initialize_cp_valprint ()
+_initialize_cp_valprint (void)
 {
   add_show_from_set
     (add_set_cmd ("static-members", class_support, var_boolean,
@@ -825,5 +793,5 @@ _initialize_cp_valprint ()
   obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
   obstack_specify_allocation (&dont_print_statmem_obstack,
                              32 * sizeof (CORE_ADDR), sizeof (CORE_ADDR),
-                             xmalloc, free);
+                             xmalloc, xfree);
 }
This page took 0.025628 seconds and 4 git commands to generate.