From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QJSsKRov72UGowIAWB0awg (envelope-from ) for ; Mon, 11 Mar 2024 12:19:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1710173978; bh=qkBTgXFKBqmK5GQeU7tfJPhhnR8MnBHeTNc+vLn5kaI=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=S3TF476Osm6Ff/7/4z0zJyMTSAon/Tqr1sdXzquuKq0+XXoLQ8q1sQEUo6EosHuC2 rxn9KRHnlLGqKOC+XHYDAXeWUmqMJvsua8CzYFCd5btsTX/fvnfiezAebvVsIim/Il AlTirbTn+QQ5zveOu3WHdOpqEpoyPz9n0qdpWikw= Received: by simark.ca (Postfix, from userid 112) id A71FE1E0D2; Mon, 11 Mar 2024 12:19:38 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=N1fvuSm/; dkim-atps=neutral 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 7455B1E0AC for ; Mon, 11 Mar 2024 12:19:36 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0A2353858410 for ; Mon, 11 Mar 2024 16:19:36 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 415CB3858D20 for ; Mon, 11 Mar 2024 16:19:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 415CB3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 415CB3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710173959; cv=none; b=ZOJZ2ERBaQyiGWLjnvwG1sUOxHYEXWGD0VW5sIO8O20cWQkh0ckwG/dip3NsJAVSM6kMdemFk6rGmszI48/1iP9RUkI57PtFiywBgPQz7ZE4xq74ES2DiHAL14VfB8BE82kgfYkdM1hUKgw5X7kpDtplZKiJIO5vCXOSa9lbbPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710173959; c=relaxed/simple; bh=qkBTgXFKBqmK5GQeU7tfJPhhnR8MnBHeTNc+vLn5kaI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=e5h/uhDr8SmBQzvhcOjzkAdKz9ue0ViNqNgq464jsfUyOLBHZeNbY529V7zTxzYk/90B5WlTNKjYvTG6DHz70uEC1+poKfEmuPmDU+b8wHtB3C/DPFdWuduy/hzWN7agflGshFFmwJyv8mLcMG4m4gWq/zdBkQryS/GLXIAnzas= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1710173957; bh=qkBTgXFKBqmK5GQeU7tfJPhhnR8MnBHeTNc+vLn5kaI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=N1fvuSm/atvz9G1zl/92IYbwB2U9+sja73Yz9d8B/B+845RQjDRL44G9qYITtlPQv 70/1wTed3pSYOvQFA+ceBXzilYzufJc0y5qNxKH/7rZRowHU0mATYEPxrhbOpkhGe8 U6JxEg4kZO4ghEPAXJsCpMu4GjlhCQGXbZyg/eMo= Received: from [172.16.0.192] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9B3581E0AC; Mon, 11 Mar 2024 12:19:17 -0400 (EDT) Message-ID: <9f9871c5-fccd-49c3-bc16-ace61a527786@simark.ca> Date: Mon, 11 Mar 2024 12:19:17 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Print type name when printing Rust slice Content-Language: fr To: Tom Tromey , gdb-patches@sourceware.org References: <20240311151451.3745299-1-tromey@adacore.com> From: Simon Marchi In-Reply-To: <20240311151451.3745299-1-tromey@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, 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 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 3/11/24 11:14, Tom Tromey wrote: > The recent change to how unsized Rust values are printed included a > small regression from past behavior. Previously, a slice's type would > be printed, like: > > (gdb) print slice > $80 = &[i32] [3] > > The patch changed this to just > > (gdb) print slice > $80 = [3] > > This patch restores the previous behavior. > --- > gdb/rust-lang.c | 11 +++++++++++ > gdb/testsuite/gdb.rust/simple.exp | 2 +- > gdb/testsuite/gdb.rust/unsized.exp | 2 +- > 3 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c > index ab537cc9752..d7265f72770 100644 > --- a/gdb/rust-lang.c > +++ b/gdb/rust-lang.c > @@ -476,6 +476,17 @@ rust_language::val_print_slice > } > } > > + /* Print the slice type here. This was gdb's historical behavior > + (from before unsized types were generically handled) and helps > + make it clear that the user is seeing a slice, not an array. > + Only arrays must be handled as the other cases are handled by > + value_print_inner. */ > + if (type->code () == TYPE_CODE_ARRAY) > + { > + type_print (orig_type, "", stream, -1); > + gdb_printf (stream, " "); > + } Just for me education, how are slices represented in the GDB type system, as opposed to arrays? What are the value types that rust_language::val_print_slice expects to receive, other than TYPE_CODE_ARRAY? You can add my: Reviewed-By: Simon Marchi ... although it's not worth much because I don't know this area. Simon