From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2EbmMfNz5V+FTAAAWB0awg (envelope-from ) for ; Fri, 25 Dec 2020 00:09:07 -0500 Received: by simark.ca (Postfix, from userid 112) id C50101F0AA; Fri, 25 Dec 2020 00:09:07 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0A8451E590 for ; Fri, 25 Dec 2020 00:09:07 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC1033858026; Fri, 25 Dec 2020 05:09:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC1033858026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608872946; bh=fXj5aRjpkBic3RGa/Q+igM8FS4PF5BUbvy8smFBk46g=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=WkeN0GFlkWIfCz4hceSxEBJm/it+YGhNB//h0/VYgjXengZ4MSDOlvOuEmcK6OFnH +PGTzRp9jSEHpvedGQs/CZ5q5D7uzG2WqEbB6bV/LT3cY92HS0aPMMTr1cD4dTpUUr 8G0b3yMgSsS8Re+lybltpF3Nv5qBK7ZuYY2Bk/TM= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 0B9CF3858026 for ; Fri, 25 Dec 2020 05:09:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0B9CF3858026 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 0BP58wCB022007 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Dec 2020 00:09:03 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 0BP58wCB022007 Received: from [10.0.0.213] (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)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CB7691E590; Fri, 25 Dec 2020 00:08:58 -0500 (EST) Subject: Re: [PATCH v3 03/24] Add GDB-side remote target support for memory tagging To: Luis Machado , gdb-patches@sourceware.org References: <20201109170435.15766-1-luis.machado@linaro.org> <20201109170435.15766-4-luis.machado@linaro.org> Message-ID: <5af302d3-8488-c6c6-cb69-69ab4ced67b1@polymtl.ca> Date: Fri, 25 Dec 2020 00:08:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20201109170435.15766-4-luis.machado@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 25 Dec 2020 05:08:58 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: david.spickett@linaro.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2020-11-09 12:04 p.m., Luis Machado via Gdb-patches wrote: > Updates for v2: > > - Add type field to target hooks. > - Add type data to qMemTags and QMemTags. The packets now look like this: > > qMemTags:
,: > QMemTags:
,:: > > -- > > This patch adds memory tagging support to GDB's remote side, with > packet string checks, new packet support and an implementation of > the two new tags methods fetch_atags and store_atags. fetch_memtags / store_memtags ? > > GDBserver needs to know how to read/write allocation tags, since that is > done via ptrace. It doesn't need to know about logical tags. > > The new packets are: > > qMemTags:
, > -- > > Reads tags from the address range [
,
) > > QMemTags:
,: > -- > Writes the tags represented by the uninterpreted bytes to the address range > [
,
). Should the packet description above be updated to include the "type" field? > @@ -14404,7 +14422,65 @@ set_range_stepping (const char *ignore_args, int from_tty, > bool > remote_target::supports_memory_tagging () > { > - return false; > + return remote_memory_tagging_p (); > +} > + > +/* Create the qMemTags packet given ADDRESS, LEN and TYPE. > + > + Return 0 if successful, non-zero otherwise. */ > + > +static void > +create_fmemtags_request (gdb::char_vector &packet, CORE_ADDR address, > + size_t len, int type) The comment is wrong, the function does not return anything. Why "fmemtags"? Oh, it's for "fetch". I'd prefer if you spelled it completely (create_fetch_memtags_request), it's not very clear otherwise (same for smemtags). > +{ > + int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8; > + > + std::string request = string_printf ("qMemTags:%s,%s:%s", > + phex_nz (address, addr_size), > + phex_nz (len, sizeof (len)), > + phex_nz (type, sizeof (type))); > + > + strcpy (packet.data (), request.c_str ()); > +} > + > +/* Parse the qMemTags packet reply into TAGS. > + > + Return 0 if successful, non-zero otherwise. */ > + > +static int > +parse_fmemtags_reply (gdb::char_vector &reply, gdb::byte_vector &tags) reply should be const, the return value should be bool. Otherwise, LGTM. Simon