From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 9A777385828C for ; Sun, 21 Jan 2024 03:57:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A777385828C Authentication-Results: sourceware.org; dmarc=pass (p=none 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 9A777385828C 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=1705809459; cv=none; b=wNGPI5uZDepSnnFCNxKg9VcfkYCrZZbAJqzYGadEjxh7kgNaZZRbkARE9R50m+bd15mvLqTeHYr6xvPp1hMKwHGM69QGURrLq5yVZOArZszXflYK9iOHv0cmXVH/b18nFaBgSVcXtE+a/6eyLAEEzu+J3CD6hnluyM5AZo0QRCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705809459; c=relaxed/simple; bh=ftyV6G/qCP6bcFt1R8wMrIO1XkEojmzb8N7VYK59Rn4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=K4g4pQsefHAih59mxTtMnOFwLWkLkJmTjWyeuw08CKdfPMAVNnFkiQvQjqHmjC1c9ndzMxgu2djKRd9h15YeiarhUm5GYLtqB62QRk5+/9IOudQG0xBTgylLVWTc/EnERvVk0IPTOieqb0PIlD3PETdg7J4L13QF+G8UGNoNDDM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705809457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0LJcQvih7RkM3slUDF9ioS6oO0Uu/E6/ZwtWzdznY/g=; b=PWZMlRlrp3qBEatXzbgwwArhszEsECvZpx5G3T9rbKrtT/VmsGRfFaajE1XdKL1e7+eZj9 XtrOEYFp5Q0gT3szMvoYNFOBqoIwq75Ka7Aube4L7zL/HNysYTU8sc25FbBR0KiOSofhyt zMNkCfSQ0h0fRO3nkVrlwP9EAREmxnI= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-361-rGFUmxkHONGJTW-wGIFYnQ-1; Sat, 20 Jan 2024 22:57:35 -0500 X-MC-Unique: rGFUmxkHONGJTW-wGIFYnQ-1 Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-5cf555b2a53so2503126a12.1 for ; Sat, 20 Jan 2024 19:57:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705809455; x=1706414255; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0LJcQvih7RkM3slUDF9ioS6oO0Uu/E6/ZwtWzdznY/g=; b=mn7na5nAxXZMv8WN1KYE5Qp+1M5urE2fDkrOjLxa9uF6MXA3bw7GupMHHJ7+p1Jfc+ iz7SbGv5qHpwTHMKhnbOFjwDdDFe+OdVZcApKUKwOolMPs3b4T7OFnP0NHOTRXdFe9Er WyV2zfPxza03NiHyaTGejYF5YXETPXR2iLs9SFEmRDxUbt2PNgwlVtuB7uT7oLjfGQLb Re8rWvwXBYFCMx+1pFtsSgL7/Q2Ic9hCvuaphS7NYE2qppgM2lwqzU7+84ZoUgbCC+jV 9ReBOy7ZqsPlxT9pdItX993A4/jo0L1174IfQWhUsf9PcIArSMmg5BmwAu6XeD9aFmbg kj/g== X-Gm-Message-State: AOJu0YwmVj7RonI3cIzUcQOLab1KbhU1e5sGcRkrFfvnJAwQOWKOkbKN +q3E83aKofWB1+4sLLx+GNUwNLSeX5nQg10m4tn1G63iFiSl+5RrHusBb3A8cMErQLhLUKqXHqb SFVf67crn4nOeWk2uuZ1xpPHeFvNfND9LfCyrw/vB3R2LyvVbBQGNm4V5knM= X-Received: by 2002:a17:90b:11d8:b0:28e:3189:f78e with SMTP id gv24-20020a17090b11d800b0028e3189f78emr2550154pjb.42.1705809454854; Sat, 20 Jan 2024 19:57:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnyzMMQtPQiFqNNekD7ImgTc4DTFXEmo0I2Mrid6qqxv2z9iF8WBIfhyn5FtRC+MypO9t0GA== X-Received: by 2002:a17:90b:11d8:b0:28e:3189:f78e with SMTP id gv24-20020a17090b11d800b0028e3189f78emr2550149pjb.42.1705809454438; Sat, 20 Jan 2024 19:57:34 -0800 (PST) Received: from [150.1.200.12] (174-21-92-140.tukw.qwest.net. [174.21.92.140]) by smtp.gmail.com with ESMTPSA id db11-20020a17090ad64b00b002900eeada1asm6834134pjb.43.2024.01.20.19.57.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Jan 2024 19:57:34 -0800 (PST) Message-ID: Date: Sat, 20 Jan 2024 19:57:33 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 16/16] gdb/gdbserver: rework argument splitting and joining To: Andrew Burgess , gdb-patches@sourceware.org References: From: Keith Seitz In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 1/9/24 06:26, Andrew Burgess wrote: > I propose that the rules be something like: > > + GDB removes the quotes, and escapes all special shell characters > except for the following: > > + Whitespace is not escaped, the remote is expected to escape any > whitespace within an argument, > > + Quote characters are not escaped, the remote is expected to escape > any single or double quote characters within an argument. > > + Any other special shell characters will have been escaped, if > needed, by GDB, and the escaping included in the transmitted > argument. This is a difficult situation to resolve, isn't it? After reading through your tests, I believe I have a tiny understanding of what these rules are doing. In the end, you've given this far more thought (and play) than I have while attempting to review this. Having said that, I only have typos to point out. > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 6ff059d14ed..cc9c5ef0ccc 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -43137,6 +43137,19 @@ > @var{argument} string, which includes all inferior arguments, > separated with whitespace. > > +If @value{GDBN} didn't offer @samp{single-inf-arg+}, or the remote > +didn't choose to use this feature, then @value{GDBN} will split the > +inferior arguments before passing them to the remote target. Single > +and double quotes surrounding any argument will have been removed by > +@value{GDBN}. Any special shell characters within each argument will > +have been escaped with a backslash character except for quote and > +whitespace characters, these will not be escaped within the arguments, > +the remote target is expected to escape these characters itself. > + > +These slightly complex rules exist for backward compatibility reasons. > +When implementing a new remote target it is suggested that the > +@samp{single-inf-arg} feature be supported. "When implementing a new remote target," (missing comma) > + > @c FIXME: What about non-stop mode? > > This packet is only available in extended mode (@pxref{extended mode}). Keith