* elf64-ppc.c (dec_dynrel_count): Don't error when elf_gc_sweep_symbol
[external/binutils.git] / gdb / c-valprint.c
index 7a1bb02..cf7f5b7 100644 (file)
@@ -1,7 +1,6 @@
 /* Support for printing C values for GDB, the GNU debugger.
 
-   Copyright (C) 1986, 1988-1989, 1991-2001, 2003, 2005-2012 Free
-   Software Foundation, Inc.
+   Copyright (C) 1986-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -177,6 +176,8 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
                                   TARGET_CHAR_BIT * embedded_offset,
                                   TARGET_CHAR_BIT * TYPE_LENGTH (type)))
            {
+             int force_ellipses = 0;
+
              /* If requested, look for the first null char and only
                 print elements up to it.  */
              if (options->stop_print_at_null)
@@ -191,12 +192,26 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
                                                     eltlen, byte_order) != 0);
                       ++temp_len)
                    ;
+
+                 /* Force LA_PRINT_STRING to print ellipses if
+                    we've printed the maximum characters and
+                    the next character is not \000.  */
+                 if (temp_len == options->print_max && temp_len < len)
+                   {
+                     ULONGEST val
+                       = extract_unsigned_integer (valaddr + embedded_offset
+                                                   + temp_len * eltlen,
+                                                   eltlen, byte_order);
+                     if (val != 0)
+                       force_ellipses = 1;
+                   }
+
                  len = temp_len;
                }
 
              LA_PRINT_STRING (stream, unresolved_elttype,
                               valaddr + embedded_offset, len,
-                              NULL, 0, options);
+                              NULL, force_ellipses, options);
              i = len;
            }
          else
@@ -317,7 +332,7 @@ c_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);