2011-04-26 Andrew Gontarek <andrewg@cray.com>
authorTom Tromey <tromey@redhat.com>
Fri, 29 Apr 2011 19:23:39 +0000 (19:23 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 29 Apr 2011 19:23:39 +0000 (19:23 +0000)
       * valprint.c (val_print_array_elements): Fixed poor performance
       of printing very large arrays with repeat_count_threshold set
       to unlimited.  New comment.

gdb/ChangeLog
gdb/valprint.c

index 37cf2cff8f4fd6119fab51a3bf330f46c024e873..323d6d50c1caf019eb3898057b2a8d2da56153a2 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-26  Andrew Gontarek  <andrewg@cray.com>
+
+       * valprint.c (val_print_array_elements): Fixed poor performance
+       of printing very large arrays with repeat_count_threshold set
+       to unlimited.  New comment.
+
 2011-04-29  Tom Tromey  <tromey@redhat.com>
 
        * mi/mi-parse.c (mi_parse): Remove incorrect sizeof.
index 286ef9e74cd4b7d29310c27b0982bd37ac308c74..9bf19f4b469bc31912b9ece503f2badd5e793491 100644 (file)
@@ -1247,15 +1247,21 @@ val_print_array_elements (struct type *type,
 
       rep1 = i + 1;
       reps = 1;
-      while (rep1 < len
-            && value_available_contents_eq (val,
-                                            embedded_offset + i * eltlen,
-                                            val,
-                                            embedded_offset + rep1 * eltlen,
-                                            eltlen))
+      /* Only check for reps if repeat_count_threshold is not set to
+        UINT_MAX (unlimited).  */
+      if (options->repeat_count_threshold < UINT_MAX)
        {
-         ++reps;
-         ++rep1;
+         while (rep1 < len
+                && value_available_contents_eq (val,
+                                                embedded_offset + i * eltlen,
+                                                val,
+                                                (embedded_offset
+                                                 + rep1 * eltlen),
+                                                eltlen))
+           {
+             ++reps;
+             ++rep1;
+           }
        }
 
       if (reps > options->repeat_count_threshold)