aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-04-29 19:23:39 +0000
committerTom Tromey <tromey@redhat.com>2011-04-29 19:23:39 +0000
commit35bef4fd1da1a34515582ef8cf88162301e5f73a (patch)
tree270a262b5b511ed8877441380923bfc9842ad9f4
parent38a714bb6f2ead72198b2be9e02b48e140715156 (diff)
downloadgdb-35bef4fd1da1a34515582ef8cf88162301e5f73a.zip
gdb-35bef4fd1da1a34515582ef8cf88162301e5f73a.tar.gz
gdb-35bef4fd1da1a34515582ef8cf88162301e5f73a.tar.bz2
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.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/valprint.c22
2 files changed, 20 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 37cf2cf..323d6d5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 286ef9e..9bf19f4 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -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)