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 B6F033858C56 for ; Sun, 21 Jan 2024 03:57:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6F033858C56 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 B6F033858C56 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=1705809430; cv=none; b=W/DZJ1fCAVKnLTjvsOg6Q0u3PKzTFyirEyIKhmluyorrCxEMu8btROV5bbY+GHRGt9MW3pEany9D9lBPZ3WCOCrBhdni0AV3/gb0XqoPiYVp51LEdBBIEUSv8CSHb2X9BVKX1vUp9JURbPfGXgIfpM5tCAtAGIL0J9Wg/BMc5qg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705809430; c=relaxed/simple; bh=GetMc2S/7Y+wRNsSFZg2alU2rXJkoKPAAE07G/akMG4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=WudnsphVE68ABJlacqj+U6SsG2i6YZzdeN41qmM9VlIifls5wTnHggERHh7jcWXLuAmdUNYGHta+JgCvEFUwHoTV2vHtHRBOe0P269exeBDqj+8n5mnbYgV+jh7PyqvkjqnHKVHwoTjnbB/lsymUC7VakE6K4KjrKrb+k5KU5Lo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705809428; 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=0OrfA5z6twquAhJK+1O5XCjL21LZOKWQmHwL8IE1e0Y=; b=ZyNT7ZCoJ3JoSN6xyX/R2tf/L9poCoisvbcq3pJ1ynejNrzhOj/hkvtV6SMEm4HSH/4GeC gfVbzz4TWOr9NsH01DnNLsAGO8fEPnDzg3tUCa9mxpXiaq3B5fWcNIzOGm0QBs+6CjhdUT HH6+Qke8fSGPfJ0Gv3JW8f4UT0gQySI= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-EG8yJZqNP3ibbBp_2SwRLQ-1; Sat, 20 Jan 2024 22:57:06 -0500 X-MC-Unique: EG8yJZqNP3ibbBp_2SwRLQ-1 Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-28c05e74e36so2432343a91.0 for ; Sat, 20 Jan 2024 19:57:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705809425; x=1706414225; 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=0OrfA5z6twquAhJK+1O5XCjL21LZOKWQmHwL8IE1e0Y=; b=e6let5dhGV2BX0lO5QcnNNwc4NesJrqMzETCMdiFLDUgcUEJSS8EBBh2n9pOxl5oge 42zg/muPIluSyUC6Zvk5yhkxW8rpYQdDS2i4vS+gdXFm8rzuoXc7EaypnbaExqfwjWt4 qGBdAJWolOPdgxmCH7ePWM+tK5JA/IEGE3GEGsluvr5/qfDYdS6MS5fyImOlekdq9je6 7+ojN3WiHZUdk0vrHf8/e60X0/8o0+S8FBTmS2SHcMpVSTKSttuzpVZCxKtpNeN3AGHP CKzqdOou58fMIPtCdno2Y+WucDkIjL0eOosgCDg0Mj2s6SXMnyQReUhxk9y7Xx79jKzh 2bDg== X-Gm-Message-State: AOJu0YyR6e1+X6K2kI8fh4qsXqaF8BMaGhhE6KeH6QDdb1mIkhhZX0QC 4ybF34IGolvJclBOoZkR2wN2DmjG7B2Bx07zeDUyekVX0/CVENo6H4ecJsgIoIeQseU6wTCqziu N39vNdr+MKhoPYJhuL9LEt7DP4Fq93IHMSC6qyrETRxO6ZIlxLoBuoonik0306pZLpog= X-Received: by 2002:a05:6a20:7a98:b0:199:d6ea:a39a with SMTP id u24-20020a056a207a9800b00199d6eaa39amr2432054pzh.120.1705809425579; Sat, 20 Jan 2024 19:57:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/FdkmpCvx1WynoiUaHVmSVPpum6fo8H8TeNPAwcBJvL0oRN836M+8KRsbKgUDhRVEI3heDg== X-Received: by 2002:a05:6a20:7a98:b0:199:d6ea:a39a with SMTP id u24-20020a056a207a9800b00199d6eaa39amr2432050pzh.120.1705809425271; Sat, 20 Jan 2024 19:57:05 -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.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Jan 2024 19:57:04 -0800 (PST) Message-ID: <54234798-74fa-44d0-9194-771cb6c2f1f8@redhat.com> Date: Sat, 20 Jan 2024 19:57:04 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 08/16] gdb: move remote arg splitting and joining into gdbsupport/ To: Andrew Burgess , gdb-patches@sourceware.org References: <0b19b3f83eb1df36d1d4bfa2ccdb5ca9754f095f.1704809585.git.aburgess@redhat.com> From: Keith Seitz In-Reply-To: <0b19b3f83eb1df36d1d4bfa2ccdb5ca9754f095f.1704809585.git.aburgess@redhat.com> 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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,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: > diff --git a/gdbsupport/remote-args.h b/gdbsupport/remote-args.h > new file mode 100644 > index 00000000000..c0acce9b7c4 > --- /dev/null > +++ b/gdbsupport/remote-args.h > @@ -0,0 +1,44 @@ > +/* Functions to help when passing arguments between GDB and gdbserver. > + > + Copyright (C) 2023 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +namespace gdb > +{ > + > +namespace remote_args > +{ > + I feel like a (generic?) statement about escaping characters would be nice to have here. Maybe even just a reference to point folks at gdb_argv? Keith > +/* ARGS is an inferior argument string. This function splits ARGS into > + individual arguments and returns a vector containing each argument. */ > + > +extern std::vector split (std::string args); > + > +/* Join together the separate arguments in ARGS and build a single > + inferior argument string. The string returned by this function will be > + equivalent, but not necessarily identical to the string passed to > + ::split, for example passing the string '"a b"' (without the single > + quotes, but including the double quotes) to ::split, will return an > + argument of 'a b' (without the single quotes). When this argument is > + passed through ::join we will get back the string 'a\ b' (without the > + single quotes), that is, we choose to escape the white space, rather > + than wrap the argument in quotes. */ > +extern std::string join (std::vector &args); > + > +} /* namespace remote_args */ > + > +} /* namespac gdb */