oops - typo correction.
[deliverable/binutils-gdb.git] / gdb / p-valprint.c
index be28f938d1b9b71793d013e53566f23b4ef8aff5..a403bc7228b05501e5936a1f80c754d681476d6a 100644 (file)
@@ -1,7 +1,6 @@
 /* Support for printing Pascal values for GDB, the GNU debugger.
 
-   Copyright (C) 2000-2001, 2003, 2005-2012 Free Software Foundation,
-   Inc.
+   Copyright (C) 2000-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -72,7 +71,6 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
   unsigned eltlen;
   int length_pos, length_size, string_pos;
   struct type *char_type;
-  LONGEST val;
   CORE_ADDR addr;
   int want_space = 0;
 
@@ -226,7 +224,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          struct minimal_symbol *msymbol =
            lookup_minimal_symbol_by_pc (vt_address);
 
-         if ((msymbol != NULL)
+         /* If 'symbol_print' is set, we did the work above.  */
+         if (!options->symbol_print
+             && (msymbol != NULL)
              && (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
            {
              if (want_space)
@@ -242,7 +242,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
              struct symbol *wsym = (struct symbol *) NULL;
              struct type *wtype;
              struct block *block = (struct block *) NULL;
-             int is_this_fld;
+             struct field_of_this_result is_this_fld;
 
              if (want_space)
                fputs_filtered (" ", stream);
@@ -333,7 +333,6 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
        }
       break;
 
-    case TYPE_CODE_BITSTRING:
     case TYPE_CODE_SET:
       elttype = TYPE_INDEX_TYPE (type);
       CHECK_TYPEDEF (elttype);
@@ -348,13 +347,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
          struct type *range = elttype;
          LONGEST low_bound, high_bound;
          int i;
-         int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
          int need_comma = 0;
 
-         if (is_bitstring)
-           fputs_filtered ("B'", stream);
-         else
-           fputs_filtered ("[", stream);
+         fputs_filtered ("[", stream);
 
          i = get_discrete_bounds (range, &low_bound, &high_bound);
          if (low_bound == 0 && high_bound == -1 && TYPE_LENGTH (type) > 0)
@@ -382,9 +377,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
                  i = element;
                  goto maybe_bad_bstring;
                }
-             if (is_bitstring)
-               fprintf_filtered (stream, "%d", element);
-             else if (element)
+             if (element)
                {
                  if (need_comma)
                    fputs_filtered (", ", stream);
@@ -408,10 +401,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
                }
            }
        done:
-         if (is_bitstring)
-           fputs_filtered ("'", stream);
-         else
-           fputs_filtered ("]", stream);
+         fputs_filtered ("]", stream);
        }
       break;
 
@@ -796,8 +786,11 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 
          if (boffset < 0 || boffset >= TYPE_LENGTH (type))
            {
-             /* FIXME (alloc): not safe is baseclass is really really big. */
-             gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
+             gdb_byte *buf;
+             struct cleanup *back_to;
+
+             buf = xmalloc (TYPE_LENGTH (baseclass));
+             back_to = make_cleanup (xfree, buf);
 
              base_valaddr = buf;
              if (target_read_memory (address + boffset, buf,
@@ -806,6 +799,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
              address = address + boffset;
              thisoffset = 0;
              boffset = 0;
+             do_cleanups (back_to);
            }
          else
            base_valaddr = valaddr;
This page took 0.026048 seconds and 4 git commands to generate.