From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6AP/FF5A72XStQIAWB0awg (envelope-from ) for ; Mon, 11 Mar 2024 13:33:18 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=amB7iZ/9; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5121D1E0D2; Mon, 11 Mar 2024 13:33:18 -0400 (EDT) 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 4202B1E0AC for ; Mon, 11 Mar 2024 13:33:16 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E2D923858289 for ; Mon, 11 Mar 2024 17:33:15 +0000 (GMT) Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 5E2183858418 for ; Mon, 11 Mar 2024 17:32:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E2183858418 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5E2183858418 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710178376; cv=none; b=OwF5xZyeKODpqj8ki/zW9fDAiYMG15QD+xr7xOqcep9c7O8P9Mst5/QnpRUet5puTd+TfMJpxl+LzJoJubLGvwqoeyjj+sB43Tn0SQ/FlsWumq+y7bGVZBcEZaAsVLNNKr5DpP+Ea8La+qbOmp66YpwZRT33cTwg68e+E1hDpiQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710178376; c=relaxed/simple; bh=hGc7LIhlYDDkBDmUaqcpvpJabyO1iYGv+itwsN4M+p0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qTGOlaWwAl8LE7G7/XIxHQ12j3c10+SoYnRMqGvWlmjUHlAQfi2KRs3+zTKR+Q8zFErXxyM8nLI1nhtI70CcmSB7pQHoOY6RhJxPbMCXRHTZhgTtvM6Cra4qTs3Kuk+e8E56tZZBwYeoKvpAlaJN82Ba7Sv4B8+MAg8XsvTKS7k= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6002a.ext.cloudfilter.net ([10.0.30.222]) by cmsmtp with ESMTPS id jiMsr0W9NPM1hjjW9r8sKE; Mon, 11 Mar 2024 17:32:53 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id jjW8rLMUyvjpRjjW8ra9h0; Mon, 11 Mar 2024 17:32:52 +0000 X-Authority-Analysis: v=2.4 cv=WsEtM8fv c=1 sm=1 tr=0 ts=65ef4044 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=K6JAEmCyrfEA:10 a=Qbun_eYptAEA:10 a=dzWzf_mpAAAA:8 a=82NTtCil8c-cRHavEwsA:9 a=b4DR9a7p2ZdsqdHBznES:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=QbEzS1sBOpBySHC5DxIk9JoIl/3NA4E3rlaR5nMvYmg=; b=amB7iZ/9YjjISL9Y5Lsn+rIUr5 iWyZYWv7RLKGqLj4bi89QhPvhiMbm0LJvMGLjQoPJ6KMvFhZwW222IpJKq8lMKgk8KI3LOSRgsgic mnWe710j4JekDe3EXQprRDMwx; Received: from 97-122-82-115.hlrn.qwest.net ([97.122.82.115]:47106 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rjjW7-001bmX-2g; Mon, 11 Mar 2024 11:32:51 -0600 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Print type name when printing Rust slice References: <20240311151451.3745299-1-tromey@adacore.com> <9f9871c5-fccd-49c3-bc16-ace61a527786@simark.ca> X-Attribution: Tom Date: Mon, 11 Mar 2024 11:32:50 -0600 In-Reply-To: <9f9871c5-fccd-49c3-bc16-ace61a527786@simark.ca> (Simon Marchi's message of "Mon, 11 Mar 2024 12:19:17 -0400") Message-ID: <87h6hcptbx.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.82.115 X-Source-L: No X-Exim-ID: 1rjjW7-001bmX-2g X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-82-115.hlrn.qwest.net (murgatroyd) [97.122.82.115]:47106 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfPpfd5XFRQl8qL1iTzimZfpXs/hE27CEHFl9sO5rus4k1a07aBWnKEOgHEamEthme/yQHA1yXjnIeaq2IUmYfT7q6G1L1Y/Ea/TjwG9YYqrVNQLU6Xy4 PfeBizn2FdJlwWe1JlnMHddmNJzX1Myeu3p9Oo+dIOuzMXi0y+6sI162+URg2MA939b8WvbJOgvEvvZ0UCMn4iFwbC/OzyfrPvw= X-Spam-Status: No, score=-3015.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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 >>>>> "Simon" == Simon Marchi writes: Simon> Just for me education, how are slices represented in the GDB type Simon> system, as opposed to arrays? What are the value types that Simon> rust_language::val_print_slice expects to receive, other than Simon> TYPE_CODE_ARRAY? Under the hood a slice is a structure holding a pointer and a length. However to the Rust programmer these look somewhat like arrays. For example, you can index into them like arrays. rust_slice_type_p determines if something is "slice-like". An "unsized" type is basically the same thing, but where the payload is some object with an array at the end, like the C struct hack. rust-lang.c calls these both "slice" at some spots, mainly because I didn't understand this when I first wrote the code. FWIW Ada has a similar concept but it is more general, because Ada has multi-dimensional arrays and range types. Tom