From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id K78KMyBnOGjpWTkAWB0awg (envelope-from ) for ; Thu, 29 May 2025 09:54:40 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bpr3EXbv; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B94B91E11C; Thu, 29 May 2025 09:54:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-10.1 required=5.0 tests=ARC_SIGNED,ARC_VALID, BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D47E31E100 for ; Thu, 29 May 2025 09:54:39 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B9773857BA2 for ; Thu, 29 May 2025 13:54:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B9773857BA2 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bpr3EXbv Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id AE8C33858D32 for ; Thu, 29 May 2025 13:54:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE8C33858D32 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AE8C33858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1748526840; cv=none; b=ejRzkRsDUa3Aeqy3vS7uP8Az+MXLpF+SxwHqDDvhuezI82k4L+JTrG0/xWE9byL8xJjXnI3soboifFz+1AtE/xT5fUP2nGGXsNPHyoai9NaqiTs1xMqcU4yW20UE5HnN8ejQCARD4KbULvDYynmI7xAQymszPS1sRJsKWf4B8J8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1748526840; c=relaxed/simple; bh=tGqltKZqrS62h1Qd05KnZsQXK9TIASxanq21GcHFLdo=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=KveR1ss10eHPfajMdMjnGtZqbP2uA5KikOEHY+Pl90Cet9J5iYt5JoAIsYVjq3WR0oAdJOf96JuLLKgRsdVP4/2lSXCmDxiv+Zv3/n2QR8NruBl6d/0KTTPPzU9u9hBZyZwcUBLJO6v3oOOPKK3dBKj8FPXi0Gxw1pGBiaAEEQc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE8C33858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748526840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KBPp3EOohVudg7ha1fdbqSd43nwMzFUKtsJ1vMOem7k=; b=bpr3EXbv6elwiEY+WDdqlirc6Au7H6ZKskAitfnsSfhzGLXgksDRxzk3T3wZUujGR6ozLX Kz71hHTnzdmlP3DI7RB1zSTZZH3cCo5z/vijPzVImuWq9BJsUQGvpt2bC0Ieq4BbiMCtxq qPUwJ2DyIkWOuSOn+OtKOQr6IN+3p1o= Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com [209.85.221.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-283-SjesMlVKN6KkqIEDIs9YKw-1; Thu, 29 May 2025 09:53:59 -0400 X-MC-Unique: SjesMlVKN6KkqIEDIs9YKw-1 X-Mimecast-MFC-AGG-ID: SjesMlVKN6KkqIEDIs9YKw_1748526838 Received: by mail-vk1-f199.google.com with SMTP id 71dfb90a1353d-52f1dc13f83so237050e0c.0 for ; Thu, 29 May 2025 06:53:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748526838; x=1749131638; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KBPp3EOohVudg7ha1fdbqSd43nwMzFUKtsJ1vMOem7k=; b=ivuTTFLfpjJuGTzLBfT7T0mfZiG9EgKeseGNG43agwZucPcsyviYOIcS+xBpjzyN4s +RpqxZ7srP4WpO+S9o+EC+zhCt4OhC02sv7+lh5y2lLlUGuVuo3r7+1vQtPmDbt8Ywc2 tQezFlca4+VTWM3ZS9iHjGkWeZw+1nDIybrc3IB8GNivJkfi86LuDLZ0e8HgHxj8ZoFc q/UBng9/MqDDJtPNJ4Dxt33EKBreperJ+oSVYECGHT3C3NcjT9a3w1Faz144elViYEfy MkKIRYrnDmY7TFV0a/zelPo5G0H5iF0UGcV6sFBeHE7KYHT2w8laXDTwyqinxIVFGk6n mSxg== X-Gm-Message-State: AOJu0YwSMheVpFKGjZSh5mR7WinkdLQ/9B4l8lpN6bMCpN34aHKO6Bz8 oEuvzdjKeEPjdfY6jFE/t6ei/0CDlp/k1pdyWVzrz48AEyO+LyU1b3JOJ/QdqtgojcEq8bz9ZDI fp8C9MlVhl+heQ3eJmI+dAOVXHDwtsyoCu+JQUVzmxsJ6+VItNcPHLkh26cSK1n4= X-Gm-Gg: ASbGnct3/uISG+VK4VUv4KhdmSYmGI/eqd7M1Q2kBybBS+HAk+KXanat+D/Lu8r7GAW xgGU9GvM9jIwNNfUPQ+AIBRdFsNkjEyOOIbUucGI9t2z0Znol1m8cV9GCvIXWa9oEb6xMiPQSRH RfOBYfCYmJP7+mHuuPiOymKZXwnY7oxiLBMU0jhi06YkIoXHnHhVFdiqDZafVBSYa5BTXF3t+1r Z2AonSQQR0un0TuLp1JOU01PwqZG+ha79BpO1h24H4K9mNdblyERab+dx9Rl2wrspnrnCpIMLWv lQIlEBARW5TSd7qMKbvxYrI= X-Received: by 2002:a05:6122:8c0c:b0:526:2210:5b64 with SMTP id 71dfb90a1353d-530669b6963mr5458498e0c.9.1748526838404; Thu, 29 May 2025 06:53:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwby0EYf5LGwiModdOR3ERcd3QpB+sCNeGx+mI8y5tXH7+mwqumemcghNmNLcl/m2x302uiA== X-Received: by 2002:a05:6122:8c0c:b0:526:2210:5b64 with SMTP id 71dfb90a1353d-530669b6963mr5458475e0c.9.1748526838074; Thu, 29 May 2025 06:53:58 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:9a69::1000? ([2804:14d:8084:9a69::1000]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-53074ad8bb1sm1207194e0c.13.2025.05.29.06.53.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 May 2025 06:53:57 -0700 (PDT) Message-ID: <80eeb206-6685-4e3e-93f7-599aa9c0c77b@redhat.com> Date: Thu, 29 May 2025 10:53:54 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] RFC: gdb: redo whitespace-stripping from commands To: Tom Tromey , "Kartik K. Agaram" Cc: gdb-patches@sourceware.org References: <20250529125138.1118538-1-ak@akkartik.com> <87y0ufy1wi.fsf@tromey.com> From: Guinevere Larsen In-Reply-To: <87y0ufy1wi.fsf@tromey.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4S4tFIf_KK3eYmCuEEtU2IThy-_4ci968UIIvNNsPFE_1748526838 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 5/29/25 10:36 AM, Tom Tromey wrote: >>>>>> "Kartik" == Kartik K Agaram writes: > Thanks for the patch. > > Kartik> Before this patch, trailing whitespace was not stripped: > Kartik> - from 'set'/'show' commands > Kartik> - from 'complete' commands > > Kartik> Now I've added the 'with' commands to that list because it contains a > Kartik> 'complete' subcommand. To accomplish this, I'm trying to fix a TODO to > Kartik> provide a per-command flag controlling whitespace-stripping. > > Kartik> I've also cleaned up some seemingly TODOs that are either fixed by this > Kartik> patch or obsolete. > > Kartik> Open question: This patch stops stripping trailing whitespace from all > Kartik> 'with' commands. Might that create issues with other 'with' commands > Kartik> besides 'with ... -- complete'? > > Maybe it would cause problems with trailing whitespace showing up in > filenames? Or with commands that don't expect an argument. For those > commands, completion might add a trailing space, causing the function to > be called with " " rather than nullptr. > > I wonder if the 'with' command itself -- and any other commands that > invoke commands, like 'eval' -- should strip whitespace as appropriate > before invocation. That is, move the whitespace stripping code > somewhere else. (Assuming it's in the wrong spot, I don't recall off > the top of my head where this stuff happens.) Removing trailing whitespace is done in the execute_command function in top.c. The command "with" will already call execute_command itself to invoke the correct command, so I think the correct way to go about it is for those commands to never strip whitespace, and then always call execute_command, which will do the right thing based on the inner command. > > Kartik> + complete_cmd->strip_trailing_white_space_p = 0; > > Kartik> + c->strip_trailing_white_space_p = 0; > > Kartik> + strip_trailing_white_space_p (1), > > Kartik> + unsigned int strip_trailing_white_space_p : 1; > > This should be bool and the constants above should be true/false. Should the name end in _p? I would think _p is for pointers, and this is just a bool, but maybe I'm mistaken. -- Cheers, Guinevere Larsen She/Her/Hers > > Tom >