[PATCH] gdb: split array and string limiting options
Simon Marchi
simon.marchi@polymtl.ca
Thu Dec 9 03:01:21 GMT 2021
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index a6f207a41a7..a92727bb3f1 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -9994,10 +9994,15 @@
> Set printing of array indexes.
> Related setting: @ref{set print array-indexes}.
>
> +@item -characters @var{number-of-characters}|@code{unlimited}
> +Set limit on string character to print. The value @code{unlimited}
character -> characters?
> diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
> index d45df5fd113..98b5cceed3f 100644
> --- a/gdb/python/py-value.c
> +++ b/gdb/python/py-value.c
> @@ -623,6 +623,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
> "actual_objects", /* See set print object on|off. */
> "static_members", /* See set print static-members on|off. */
> /* C non-bool options. */
> + "max_characters", /* See set print elements N. */
I guess the comment should say "see set print characters N".
We would need a corresponding doc update for this, in python.texi.
> diff --git a/gdb/valprint.h b/gdb/valprint.h
> index e1dae2cc8fc..f58d6ba7b0e 100644
> --- a/gdb/valprint.h
> +++ b/gdb/valprint.h
> @@ -54,6 +54,9 @@ struct value_print_options
> "unlimited". */
> unsigned int print_max;
>
> + /* Maxiumum number of string chars to print */
Maxiumum -> Maximum. End with a period + 2 spaces.
> + unsigned int print_smax;
I would suggest using a clearer name, like print_max_chars.
Although Eli raised a good question, do we limit the number bytes of
characters? What would happen if we print a wide char or UTF-8 string?
Simon
More information about the Gdb-patches
mailing list