From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id avcoBX8+AmP9/SoAWB0awg (envelope-from ) for ; Sun, 21 Aug 2022 10:17:35 -0400 Received: by simark.ca (Postfix, from userid 112) id 08B851E4A7; Sun, 21 Aug 2022 10:17:35 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=tHyU5dZ3; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 A44421E13B for ; Sun, 21 Aug 2022 10:17:34 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7F1133858282 for ; Sun, 21 Aug 2022 14:17:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F1133858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661091453; bh=Mn0WFhpbhHz+xDaExY243yVhtSJOw5mpHt31b2/HjQM=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=tHyU5dZ32dpChDz4iXdxQTPtHD4JYsZt0UfO0mJvYv5N9CYjpHfgBV+UJ+TkFOvzz G8IQlu9XIK3UEvtLWXisVCSh5vaC7aD4kGyYEuon8uCEldRXSu8+eDLcYnmZTkLNN2 2IFAsOIl+mGUNe7WDOJGQROD58Eep3VS1nxGf82k= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id E82C63858C83 for ; Sun, 21 Aug 2022 14:17:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E82C63858C83 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 27LEH85C007814 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 21 Aug 2022 10:17:13 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 27LEH85C007814 Received: from [10.0.0.11] (unknown [217.28.27.60]) (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 EBFE01E13B; Sun, 21 Aug 2022 10:17:05 -0400 (EDT) Message-ID: Date: Sun, 21 Aug 2022 10:17:05 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] dwarf2: Fix dwarf stack fetch array view size mismatch Content-Language: en-US To: Denis Lukianov , gdb-patches@sourceware.org References: <36c80f43b57fcfce3b9db6619e75366db360ae9c.camel@voxelsoft.com> <8bfea13a0966a62eca9cd39617918cff04915b34.camel@voxelsoft.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sun, 21 Aug 2022 14:17:08 +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: andrew.burgess@embecosm.com Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-08-19 21:55, Denis Lukianov wrote: > On Sat, 2022-08-20 at 02:38 +0100, Denis Lukianov wrote: >> >> I know nothing about gdb internals, just reading code in the file: >> >> copy (value_contents_all (val).slice (subobj_offset, len), >>                   value_contents_raw (retval)); >> >> We know val is allocated to be the length of subobj_type. >> We know retval is allocated to be the length of subobj_type. >> We know len is the length of subobj_type. >> We know slice only gives a view same size or smaller. >> >> So, the source array_view length must be len - subobj_offset. >> >> Therefore source array_view size will be of the length of subobj_type >> and match the destination only in the event that subobj_offset >> happens >> to be zero. The line above does not guarantee it: >> >> subobj_offset += n - max; >> >> So it looks broken for big endian systems. And maybe any subtype that >> is not the first element of a type on the others. >> > > My bad, val is allocated to be length of type. > > So I'm wrong about all this and the code is fine :) > Ok, thanks for digging into it, the more eyes on the code the better. Simon