diff options
author | Tom Tromey <tromey@redhat.com> | 2011-04-29 19:23:36 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2011-04-29 19:23:36 +0000 |
commit | b327aaae6e923f7628fd4774f357203d21caddf6 (patch) | |
tree | 0efd0626b9c0304de031dceec265e3a86b53d285 /gdb/valprint.c | |
parent | e098a905f9c5f84825c67ae950078de5507e5d6a (diff) | |
download | gdb-b327aaae6e923f7628fd4774f357203d21caddf6.tar.gz |
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.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r-- | gdb/valprint.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c index 286ef9e74cd..9bf19f4b469 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) |