* alpha-tdep.c (alpha_push_dummy_call): Transmography from
[deliverable/binutils-gdb.git] / gdb / c-valprint.c
index 315d03479de0acec7133e0e0600937a86c3c2c9c..848f7ac8adea03c22c18ce078754ca5ba3052171 100644 (file)
@@ -1,7 +1,7 @@
 /* Support for printing C values for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000
-   Free Software Foundation, Inc.
+
+   Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,6 +21,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "gdb_string.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "expression.h"
@@ -204,12 +205,12 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
                  (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
                {
                  fputs_filtered (" <", stream);
-                 fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
+                 fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
                  fputs_filtered (">", stream);
                }
              if (vt_address && vtblprint)
                {
-                 value_ptr vt_val;
+                 struct value *vt_val;
                  struct symbol *wsym = (struct symbol *) NULL;
                  struct type *wtype;
                  struct symtab *s;
@@ -217,8 +218,8 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
                  int is_this_fld;
 
                  if (msymbol != NULL)
-                   wsym = lookup_symbol (SYMBOL_NAME (msymbol), block,
-                                         VAR_NAMESPACE, &is_this_fld, &s);
+                   wsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol), block,
+                                         VAR_DOMAIN, &is_this_fld, &s);
 
                  if (wsym)
                    {
@@ -274,7 +275,7 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
        {
          if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
            {
-             value_ptr deref_val =
+             struct value *deref_val =
              value_at
              (TYPE_TARGET_TYPE (type),
               unpack_pointer (lookup_pointer_type (builtin_type_void),
@@ -441,8 +442,12 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_METHOD:
-      cp_print_class_method (valaddr + embedded_offset, lookup_pointer_type (type), stream);
-      break;
+      {
+       struct value *v = value_at (type, address, NULL);
+       cp_print_class_method (VALUE_CONTENTS (value_addr (v)),
+                              lookup_pointer_type (type), stream);
+       break;
+      }
 
     case TYPE_CODE_VOID:
       fprintf_filtered (stream, "void");
@@ -459,6 +464,28 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
       fprintf_filtered (stream, "<incomplete type>");
       break;
 
+    case TYPE_CODE_COMPLEX:
+      if (format)
+       print_scalar_formatted (valaddr + embedded_offset,
+                               TYPE_TARGET_TYPE (type),
+                               format, 0, stream);
+      else
+       print_floating (valaddr + embedded_offset, TYPE_TARGET_TYPE (type),
+                       stream);
+      fprintf_filtered (stream, " + ");
+      if (format)
+       print_scalar_formatted (valaddr + embedded_offset
+                               + TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
+                               TYPE_TARGET_TYPE (type),
+                               format, 0, stream);
+      else
+       print_floating (valaddr + embedded_offset
+                       + TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
+                       TYPE_TARGET_TYPE (type),
+                       stream);
+      fprintf_filtered (stream, " * I");
+      break;
+
     default:
       error ("Invalid C/C++ type code %d in symbol table.", TYPE_CODE (type));
     }
@@ -467,7 +494,7 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
 }
 \f
 int
-c_value_print (value_ptr val, struct ui_file *stream, int format,
+c_value_print (struct value *val, struct ui_file *stream, int format,
               enum val_prettyprint pretty)
 {
   struct type *type = VALUE_TYPE (val);
@@ -488,7 +515,7 @@ c_value_print (value_ptr val, struct ui_file *stream, int format,
       if (TYPE_CODE (type) == TYPE_CODE_PTR &&
          TYPE_NAME (type) == NULL &&
          TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL &&
-         STREQ (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char"))
+         strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
        {
          /* Print nothing */
        }
@@ -500,7 +527,7 @@ c_value_print (value_ptr val, struct ui_file *stream, int format,
              /* Copy value, change to pointer, so we don't get an
               * error about a non-pointer type in value_rtti_target_type
               */
-             value_ptr temparg;
+             struct value *temparg;
              temparg=value_copy(val);
              VALUE_TYPE (temparg) = lookup_pointer_type(TYPE_TARGET_TYPE(type));
              val=temparg;
This page took 0.025534 seconds and 4 git commands to generate.