Modified Files:
[deliverable/binutils-gdb.git] / gdb / c-valprint.c
index f50432d40be1722a3dc67b7ca92f0e9cf514241e..b370db9f67b04e677963a5e326c66065d32c01b1 100644 (file)
@@ -32,13 +32,13 @@ extern int vtblprint;               /* Controls printing of vtbl's */
 extern int demangle;           /* whether to print C++ syms raw or src-form */
 
 extern void
-cp_print_class_member PARAMS ((char *, struct type *, FILE *, char *));
+cp_print_class_member PARAMS ((char *, struct type *, GDB_FILE *, char *));
 
 extern void
-cp_print_class_method PARAMS ((char *, struct type *, FILE *));
+cp_print_class_method PARAMS ((char *, struct type *, GDB_FILE *));
 
 extern void
-cp_print_value_fields PARAMS ((struct type *, char *, FILE *, int, int,
+cp_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int,
                               enum val_prettyprint, struct type **));
 
 extern int
@@ -53,11 +53,11 @@ cp_is_vtbl_member PARAMS ((struct type *));
 /* BEGIN-FIXME:  Hooks into c-typeprint.c */
 
 extern void
-c_type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
+c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int));
 
 extern void
 cp_type_print_method_args PARAMS ((struct type **, char *, char *, int,
-                                  FILE *));
+                                  GDB_FILE *));
 /* END-FIXME */
 
 
@@ -83,7 +83,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
      struct type *type;
      char *valaddr;
      CORE_ADDR address;
-     FILE *stream;
+     GDB_FILE *stream;
      int format;
      int deref_ref;
      int recurse;
@@ -94,7 +94,6 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
   struct type *elttype;
   unsigned eltlen;
   LONGEST val;
-  unsigned char c;
   CORE_ADDR addr;
 
   switch (TYPE_CODE (type))
@@ -172,7 +171,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
 
          if (addressprint && format != 's')
            {
-             fprintf_filtered (stream, "0x%x", addr);
+             fprintf_filtered (stream, "0x%lx", (unsigned long)addr);
            }
 
          /* For a pointer to char or unsigned char, also print the string
@@ -198,11 +197,28 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
                  fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
                  fputs_filtered (">", stream);
                }
-             if (vtblprint)
+             if (vt_address && vtblprint)
                {
                  value vt_val;
-
-                 vt_val = value_at (TYPE_TARGET_TYPE (type), vt_address);
+                 struct symbol *wsym = (struct symbol *)NULL;
+                 struct type *wtype;
+                 struct symtab *s;
+                 struct block *block = (struct block *)NULL;
+                 int is_this_fld;
+
+                 if (msymbol != NULL)
+                   wsym = lookup_symbol (SYMBOL_NAME(msymbol), block, 
+                               VAR_NAMESPACE, &is_this_fld, &s);
+                 if (wsym)
+                   {
+                     wtype = SYMBOL_TYPE(wsym);
+                   }
+                 else
+                   {
+                     wtype = TYPE_TARGET_TYPE(type);
+                   }
+                 vt_val = value_at (wtype, vt_address);
                  val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val),
                             VALUE_ADDRESS (vt_val), stream, format,
                             deref_ref, recurse + 1, pretty);
@@ -395,6 +411,6 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
     default:
       error ("Invalid C/C++ type code %d in symbol table.", TYPE_CODE (type));
     }
-  fflush (stream);
+  gdb_flush (stream);
   return (0);
 }
This page took 0.024892 seconds and 4 git commands to generate.