From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.web.de (mout.web.de [212.227.17.11]) by sourceware.org (Postfix) with ESMTPS id BAD1F3858014 for ; Thu, 6 Jan 2022 07:58:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BAD1F3858014 X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.111.41] ([95.90.141.53]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MTOli-1mxjEz0Mns-00TuQG for ; Thu, 06 Jan 2022 08:58:41 +0100 Message-ID: <111e4bb6-d781-ff80-f64b-125ad665f502@web.de> Date: Thu, 6 Jan 2022 08:58:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Content-Language: en-US To: gdb-patches@sourceware.org From: Simon Sobisch Subject: Re: [PATCH v2] gdb: split array and string limiting options Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:hVA1DueePE07QosjK+i6JGW3acES1YEByxtBqs7BmP09W5Tl/k2 umvYuGAnpkAZxS9sbDVDiO9OvZVurS5h3iUwqR8oPFacrqGmUWJ4HaQbIwU0XTgAbjTGFMX jlXGF9WfUSEP2Vgd26Hkt6b0Fes4flwCe9L+t4vxTo0kDHKDm48RBEVm7Mejqhxfk/l2N0U FhgI0OLo66PGKjLENC9lA== X-UI-Out-Filterresults: notjunk:1;V03:K0:BarZg+yBv1Y=:8XCgFjVBpKf6FnytM1iJ72 FNG/PlvjNBNOz7afUA7/XHloSs+U4dpoO/Z/zcF2IqBO5jivI3WT/jCkhDXM9yIxeUx1SkSNP 5ZOGS2dVYc7yqh4T30aiOTe+NrzhsChxnIqQHp7UoWk5m/A824k/Ao67q5Xj8b0bzYuW3NkH9 v+rRzS2zGlsMcJ2UJrLT2AYA7y9BNZyJF8jwuLfBXpdRAH3IkpTU/jW6VURUwAeMUxKZsMRP7 LGWe+BVAndkFr+Vai8mpJf78sb/IGogwlDVQVOfwyN7mGOaEU7IUH+0LNWZWq6as/EiUTt9ky teVDLxXc6kJYiDPe2SsFtVT1MpuGOlIvxKnWIeySdo4PM0HpRMIOsV5YKrUwQE1ddtzqcVrVO 3O2hApaMw9H7obtGMSsDLq/AtyZBCwgQ5e/XV4nK1CbucdocG4SrZsPdLYaT6mO8yxw47+9qx MQsGEWxZ9DGBw5GIFSDK/piJ/gGml5Wwvu9REClo5UHjO8Z4ZcW5pmDTKzFb2PDRlFe7THAMN XDUo9GVQUlC/kqQ3kLee5lRjarnOdsB1EE2XqSZRqDTlplhVay1iTafbGN3OcHmFJSBYbDFpi STJUGrDL+1tW+R1DFIqPHKvyIOkE04ieIFqa7GJRSjoYioNpFkdi/IC9+U+t5UnQJ/hk8mHLK F3OZMORXksvvafvYNkmOUCdtCs7aJwZFQ02HMmbOHgwycDr8SmChWI+r23VkhBjXd4IyLabCg 7v92exrlm15A9/2MJmlJCqkAuuRQcyPITc4avBMnJHWETKWwH8IzUPHeFbD2odt74YW0hWdg0 3qvhOUQgu0lurCKEE0/H7uGhEpEn3JYF2c34kENtyX628+yN+djuMQS+ewzGBjcvAL2U4QZts Hi5bo0WE/axkJ0BDym7cLh3kYWFq3UWqhjkdwxsdysaqUsHYsO1AwuA4UxEkAWnAirZXN2c/Y kC4q1E30yWgc6Mw+LqlPSalk1lF/fOAbXxaZKAizJ0dVWFuEMwMI4Dn7UdFYbsvB/feQf4hyn pxtjIe2/FRfelqilH65QqyG/OcPcrExqzVmeUm/lM+of2d9LHTXhwsbBzz1ICaZz1hgQFxGHl HSKYBDKivgL130= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, 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, 06 Jan 2022 07:58:45 -0000 > From: Andrew Burgess > > This commit splits the set/show print elements options 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 is added which is > used for controlling how many characters of a string are printed. > [...] Reference to the full patch: https://sourceware.org/pipermail/gdb-patches/2021-December/184467.html I really like the general idea and would like to see this added, but I think the patch goes too far and will break both old and new usage. In my opinion there should be only 1 new test for the new setting and the other should be left unchanged while still working, because then existing usages will still work, too. To do so the new parameter cannot be directly used as it is in the patch but must be fowarded to a new function or duplicated. As an example this would mean instead of : =2D-- src.orig/gdb/c-valprint.c +++ src/gdb/c-valprint.c @@ -271,7 +271,7 @@ c_value_print_array (struct value *val, for (temp_len =3D 0; (temp_len < len - && temp_len < options->print_max + && temp_len < options->print_max_chars && extract_unsigned_integer (valaddr + temp_len * eltlen, eltlen, byte_order) !=3D 0); ++temp_len) have the following + const int print_max_chars =3D (options->print_max_chars !=3D -1) ? options->print_max_chars : options->print_max; for (temp_len =3D 0; (temp_len < len - && temp_len < options->print_max + && temp_len < print_max_chars && extract_unsigned_integer (valaddr + temp_len * eltlen, eltlen, byte_order) !=3D 0); ++temp_len) This effectively means that until you explicit set the new "print characters" the existing "print elements" setting will be used, and if you "set print characters off" (or similar, that would internally resolve to -1) you get the length depending on "print elements" again. The parameter type in python for "print elements" is (guessed) gdb.PARAM_UINTEGER, the type for "print characters" would be gdb.PARAM_INTEGER with -1 meaning "take the other parameter". If those changes are done there is no breakage whatever which could also speedup the inclusion s it hopefully lands in GDB 11.2. Simon