* amd64-sol2-tdep.c (amd64_sol2_gregset_reg_offset): Correct
[deliverable/binutils-gdb.git] / gdb / p-valprint.c
index ee765421eeb625a4b2c4377ffda7e9ef7da720d9..39eff10cca1c2bb679a68e729d64b7dcf24486a1 100644 (file)
@@ -1,7 +1,7 @@
 /* Support for printing Pascal values for GDB, the GNU debugger.
 
-   Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003, 2005-2012 Free Software Foundation,
+   Inc.
 
    This file is part of GDB.
 
@@ -68,7 +68,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_ARRAY:
-      if (get_array_bounds (type, &low_bound, &high_bound)) 
+      if (get_array_bounds (type, &low_bound, &high_bound))
        {
          len = high_bound - low_bound + 1;
          elttype = check_typedef (TYPE_TARGET_TYPE (type));
@@ -149,7 +149,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          print_address_demangle (gdbarch, addr, stream, demangle);
          break;
        }
-      elttype = check_typedef (TYPE_TARGET_TYPE (type));
+      check_typedef (TYPE_TARGET_TYPE (type));
 
       addr = unpack_pointer (type, valaddr + embedded_offset);
     print_unpacked_pointer:
@@ -272,10 +272,19 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
        {
          if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
            {
-             struct value *deref_val =
-               value_at
-               (TYPE_TARGET_TYPE (type),
-                unpack_pointer (type, valaddr + embedded_offset));
+             struct value *deref_val;
+
+             deref_val = coerce_ref_if_computed (original_value);
+             if (deref_val != NULL)
+               {
+                 /* More complicated computed references are not supported.  */
+                 gdb_assert (embedded_offset == 0);
+               }
+             else
+               deref_val = value_at (TYPE_TARGET_TYPE (type),
+                                     unpack_pointer (type,
+                                                     (valaddr
+                                                      + embedded_offset)));
 
              common_val_print (deref_val, stream, recurse + 1, options,
                                current_language);
@@ -317,7 +326,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
              len = extract_unsigned_integer (valaddr + embedded_offset
                                              + length_pos, length_size,
                                              byte_order);
-             LA_PRINT_STRING (stream, char_type, 
+             LA_PRINT_STRING (stream, char_type,
                               valaddr + embedded_offset + string_pos,
                               len, NULL, 0, options);
            }
@@ -590,7 +599,7 @@ pascal_value_print (struct value *val, struct ui_file *stream,
     {
       /* Hack:  remove (char *) for char strings.  Their
          type is indicated by the quoted string anyway.  */
-      if (TYPE_CODE (type) == TYPE_CODE_PTR 
+      if (TYPE_CODE (type) == TYPE_CODE_PTR
          && TYPE_NAME (type) == NULL
          && TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
          && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
@@ -640,7 +649,7 @@ const char pascal_vtbl_ptr_name[] =
 int
 pascal_object_is_vtbl_ptr_type (struct type *type)
 {
-  char *typename = type_name_no_tag (type);
+  const char *typename = type_name_no_tag (type);
 
   return (typename != NULL
          && strcmp (typename, pascal_vtbl_ptr_name) == 0);
@@ -903,7 +912,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
     {
       int boffset = 0;
       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
-      char *basename = type_name_no_tag (baseclass);
+      const char *basename = type_name_no_tag (baseclass);
       const gdb_byte *base_valaddr = NULL;
       int thisoffset;
       volatile struct gdb_exception ex;
This page took 0.027381 seconds and 4 git commands to generate.