This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix BZ#24331 -- set print elem doesn't limit repeated elements correctly


>>>>> "Paul" == Paul Pluzhnikov via gdb-patches <gdb-patches@sourceware.org> writes:

Paul> Attached patch fixes https://sourceware.org/bugzilla/show_bug.cgi?id=24331.
Paul> I did not add a new test: since existing test already recorded
Paul> incorrect behavior, I adjusted it instead.

Thanks for the patch.
It looks good but there are some formatting nits.

Paul> --- a/gdb/testsuite/gdb.python/py-format-string.exp
Paul> +++ b/gdb/testsuite/gdb.python/py-format-string.exp
Paul> @@ -621,7 +621,7 @@ proc test_max_elements {} {
Paul>      # This will print four characters instead of three, see
Paul>      # <https://sourceware.org/bugzilla/show_bug.cgi?id=24331>.

I think this comment can be removed now.

Paul> +      if (i + r > options->print_max)
Paul> +        /* Printing "r" repeats would push over print_max.
Paul> +         * Adjust repeats down.  Note: converted_chars.back() is the next
Paul> +	 * character.  */
Paul> +        r = (&converted_chars.back () - 1)->repeat_count
Paul> +	  = options->print_max - i;

Normally gdb doesn't use "*" at the start of the body lines of a
comment.  Nor does it generally use multiple assignments like this.
Finally, multi-line if bodies, even when some of the lines are comments,
are braced.

This is ok with the nits fixed, thanks again.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]