From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Nm8uJ3gllGGMLAAAWB0awg (envelope-from ) for ; Tue, 16 Nov 2021 16:41:12 -0500 Received: by simark.ca (Postfix, from userid 112) id 8D7D91F0C1; Tue, 16 Nov 2021 16:41:12 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 079261E813 for ; Tue, 16 Nov 2021 16:41:12 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B5E3385AC2B for ; Tue, 16 Nov 2021 21:41:11 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 543B93858037 for ; Tue, 16 Nov 2021 21:41:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 543B93858037 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 7BF2D1E813; Tue, 16 Nov 2021 16:40:59 -0500 (EST) Subject: Re: [PATCH 1/4] gdb: fix length of array view returned by some value_contents functions To: Tom Tromey , Simon Marchi via Gdb-patches References: <20211108210609.353208-1-simon.marchi@efficios.com> <87lf1nesu0.fsf@tromey.com> From: Simon Marchi Message-ID: <703da9ad-b42a-5690-b299-4dac7fa7a798@simark.ca> Date: Tue, 16 Nov 2021 16:40:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <87lf1nesu0.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl 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: , Cc: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-11-16 3:41 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> From: Simon Marchi > Simon> In commit 50888e42dcd3 ("gdb: change functions returning value contents > Simon> to use gdb::array_view"), I believe I made a mistake with the length of > Simon> the array views returned by some functions. All functions return a view > Simon> of `TYPE_LENGTH (value_type (type))` length. This is not correct when > Simon> the value's enclosing type is larger than the value's type. In that > Simon> case, the value's contents buffer is of the size of the enclosing type, > Simon> and the value's actual contents is a slice of that (as returned by > Simon> value_contents). So, functions value_contents_all_raw, > Simon> value_contents_for_printing and value_contents_for_printing_const are > Simon> not correct. Since they are meant to return the value's contents buffer > Simon> as a whole, they should have the size of the enclosing type. > > This looks good to me. > > Tom > Thanks, I pushed that one. Simon