From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MwRRF7EH6l+ZRwAAWB0awg (envelope-from ) for ; Mon, 28 Dec 2020 11:28:33 -0500 Received: by simark.ca (Postfix, from userid 112) id 4FF6C1F0AA; Mon, 28 Dec 2020 11:28:33 -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 748881E552 for ; Mon, 28 Dec 2020 11:28:32 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E53F33857011; Mon, 28 Dec 2020 16:28:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E53F33857011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609172911; bh=0wNTO2XVVl+9FWvFQsO/5FMpmxb62TWdk7sD0qqQHxw=; 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=LxCNODjQHRiHGF0VqiN/dzl+qy5IHLB5MKWl5zaYFLKt7obsYe88yXJEWWEsMH75C QDjDTayIdnoPUQHRRESwpqfwrxZflfqY4Qj6LF8Z6spayQ8P3pu8Q2caKUiplwZ2Q7 8YgGLDDwiZcB0Atlrieh+x1oOmfK58g2vXvco22o= Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by sourceware.org (Postfix) with ESMTPS id 23CBB3857011 for ; Mon, 28 Dec 2020 16:28:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 23CBB3857011 Received: by mail-qt1-x82b.google.com with SMTP id v5so7192012qtv.7 for ; Mon, 28 Dec 2020 08:28:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0wNTO2XVVl+9FWvFQsO/5FMpmxb62TWdk7sD0qqQHxw=; b=XRIXzheayDYWXBEj/eKkklXaaBYPg0JXkaG7yVM8z3BiuNtMqDkyzODYXgqPuzpq4V 8Uz0AoBet29K/NqEx+4xUqW1tac9LmjJlFGb29e8IpdayeUkt/jLufSgQ1JZSwl6+0Bt i42DBzf8sZ5VaqnjQZOSSfdmRMamLF/xfXj8PiWwlUcLA2TAMmOoegDyU/fRbep0Yiqf tHJpa6euFfH19TEsfMik/itzsJTgq1PVujpsGmkW+GzhQBQ/etKBzc6CBgV+0mJuWuk+ bdZpK+YpvjWSgRu2WgbYA4OrRhuydwIPCMIIuGb4BaytT1CvoJduprAkPVw71DBn8yw1 tMWQ== X-Gm-Message-State: AOAM533ZhQoIaJx+9Jn3HNFaP4Yp9XC89CVYAl9uHcH7t+ZcIs9x2L/r aV48SBMD1CNEFAdABLBKo10O+g== X-Google-Smtp-Source: ABdhPJwNoBPVpFJrZUKvIxXi7s0aQi2r08ealSQXkppCoAuu1yvCYTwySPaTyRMcnTHVdDhtTOXB6w== X-Received: by 2002:ac8:5802:: with SMTP id g2mr45409571qtg.383.1609172908633; Mon, 28 Dec 2020 08:28:28 -0800 (PST) Received: from ?IPv6:2804:7f0:8284:370e:19e7:527f:e109:2734? ([2804:7f0:8284:370e:19e7:527f:e109:2734]) by smtp.gmail.com with ESMTPSA id t5sm23211326qte.20.2020.12.28.08.28.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Dec 2020 08:28:28 -0800 (PST) Subject: Re: [PATCH v3 03/24] Add GDB-side remote target support for memory tagging To: Simon Marchi , gdb-patches@sourceware.org References: <20201109170435.15766-1-luis.machado@linaro.org> <20201109170435.15766-4-luis.machado@linaro.org> <5af302d3-8488-c6c6-cb69-69ab4ced67b1@polymtl.ca> Message-ID: Date: Mon, 28 Dec 2020 13:28:23 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <5af302d3-8488-c6c6-cb69-69ab4ced67b1@polymtl.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Luis Machado via Gdb-patches Reply-To: Luis Machado Cc: david.spickett@linaro.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 12/25/20 2:08 AM, Simon Marchi wrote: > 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 ? > Yeah. This (and others below) are an artifact of some back-and-forth on reasonable names. Fixed now. >> >> 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? > Yes. Fixed now. >> @@ -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). > Exactly. Updated now to spell it completely. >> +{ >> + 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. > Fixed now. > Otherwise, LGTM. > > Simon > Thanks!