From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 8E0DC3858D32 for ; Mon, 16 Jan 2023 19:35:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E0DC3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 30GJZEXd017466 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Jan 2023 14:35:19 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 30GJZEXd017466 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1673897720; bh=yhvympxujziNWCGNFyd/kKfdz2M4PvBfiLG5trKqdVI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=f3mzkGUupZ8DN/3IVQf1F53sQkyt3WNTcqbdz8VWvCr+dxaIm9vpPjwVfY5OgXgIL W47QWPbRYCgD554TDKMDzw2BbwPQeVTUJp8TKmQfVifH2q9cYVl1tA8DtyaBvlMG7r CmnRYG7gKRH/DFwyh7WIjklikEvc5gi6uTG/Vj5k= Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6BF871E0D3; Mon, 16 Jan 2023 14:35:14 -0500 (EST) Message-ID: <50d5003a-b5ff-aba0-24db-c0c2048e96d7@polymtl.ca> Date: Mon, 16 Jan 2023 14:35:14 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v8 5/6] GDB: Add a character string limiting option Content-Language: en-US To: "Maciej W. Rozycki" , gdb-patches@sourceware.org Cc: Andrew Burgess , Tom Tromey , Simon Sobisch References: From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 16 Jan 2023 19:35:15 +0000 X-Spam-Status: No, score=-3032.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/24/22 06:22, Maciej W. Rozycki wrote: > From: Andrew Burgess > > This commit splits the `set/show print elements' option into two. We > retain `set/show print elements' for controlling how many elements of an > array we print, but a new `set/show print characters' setting is added > which is used for controlling how many characters of a string are > printed. > > The motivation behind this change is to allow users a finer level of > control over how data is printed, reflecting that, although strings can > be thought of as arrays of characters, users often want to treat these > two things differently. > > For compatibility reasons by default the `set/show print characters' > option is set to `elements', which makes the limit for character strings > follow the setting of the `set/show print elements' option, as it used > to. Using `set print characters' with any other value makes the limit > independent from the `set/show print elements' setting, however it can > be restored to the default with the `set print characters elements' > command at any time. > > A corresponding `-characters' option for the `print' command is added, > with the same semantics, i.e. one can use `elements' to make a given > `print' invocation follow the limit of elements, be it set with the > `-elements' option also given with the same invocation or taken from the > `set/show print elements' setting, for characters as well regardless of > the current setting of the `set/show print characters' option. > > The GDB changes are all pretty straightforward, just changing references > to the old 'print_max' to use a new `get_print_max_chars' helper which > figures out which of the two of `print_max' and `print_max_chars' values > to use. > > Likewise, the documentation is just updated to reference the new setting > where appropriate. > > To make people's life easier the message shown by `show print elements' > now indicates if the setting also applies to character strings: > > (gdb) set print characters elements > (gdb) show print elements > Limit on string chars or array elements to print is 200. > (gdb) set print characters unlimited > (gdb) show print elements > Limit on array elements to print is 200. > (gdb) > > which keeps it the same as it used to be, although in other contexts the > setting is described as applying to array elements only, e.g.: > > (gdb) help set print elements > Set limit on array elements to print. > "unlimited" causes there to be no limit. I think it would be helpful to say here that if this value influences "set print characters", if "set print characters" is set to "elements". Otherwise, the patch LGTM: Approved-By: Simon Marchi Simon