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 882FC3858D35 for ; Thu, 9 Dec 2021 03:01:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 882FC3858D35 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 1B931M2I018764 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 8 Dec 2021 22:01:27 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 1B931M2I018764 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 3AADC1ECEB; Wed, 8 Dec 2021 22:01:22 -0500 (EST) Message-ID: <79a90d9f-15a7-c1e9-cc2b-5c7bfa0fc470@polymtl.ca> Date: Wed, 8 Dec 2021 22:01:21 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH] gdb: split array and string limiting options Content-Language: en-US To: gdb-patches@sourceware.org, "aciej W. Rozycki" References: <20211007131451.849029-1-andrew.burgess@embecosm.com> From: Simon Marchi In-Reply-To: <20211007131451.849029-1-andrew.burgess@embecosm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 9 Dec 2021 03:01:22 +0000 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2021 03:01:30 -0000 > 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