This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] gdb: New set/show max-value-size command.
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, Joel Brobecker <brobecker at adacore dot com>, Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 05 Jan 2016 15:55:54 +0000
- Subject: Re: [PATCH 1/3] gdb: New set/show max-value-size command.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1449869721 dot git dot andrew dot burgess at embecosm dot com> <57e2731e179d11c584e8cde994ab1e822a9893b0 dot 1449869722 dot git dot andrew dot burgess at embecosm dot com> <20160101094309 dot GC12416 at adacore dot com> <20160105141241 dot GG4242 at embecosm dot com>
On 01/05/2016 02:12 PM, Andrew Burgess wrote:
> +/* It is critical that the MAX_VALUE_SIZE is always greater than the size
> + of LONGEST, otherwise GDB will not be able to parse integer values from
> + the CLI; for example if the MAX_VALUE_SIZE could be set to 1 then GDB
> + would be unable to parse "set max-value-size 2".
> +
> + As we want a consistent GDB experience across hosts with different sizes
> + of LONGEST, this arbitrary minimum value was selected, so long as this
> + is bigger than LONGEST of all GDB supported hosts we're fine. */
> +
> +#define MIN_VALUE_FOR_MAX_VALUE_SIZE 16
> +
> +/* Implement the "set max-value-size" command. */
> +
> +static void
> +set_max_value_size (char *args, int from_tty,
> + struct cmd_list_element *c)
> +{
> + gdb_assert (max_value_size == -1 || max_value_size >= 0);
> + gdb_assert (sizeof (LONGEST) < MIN_VALUE_FOR_MAX_VALUE_SIZE);
Make the second one a gdb_static_assert, and put it next to the
MIN_VALUE_FOR_MAX_VALUE_SIZE definition.
Thanks,
Pedro Alves