From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 1D6DF3858C52 for ; Sat, 20 Aug 2022 00:55:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1D6DF3858C52 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 27K0tN9b023887 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Aug 2022 20:55:28 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 27K0tN9b023887 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 3355F1E222; Fri, 19 Aug 2022 20:55:23 -0400 (EDT) Message-ID: Date: Fri, 19 Aug 2022 20:55:22 -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 Cc: andrew.burgess@embecosm.com References: <36c80f43b57fcfce3b9db6619e75366db360ae9c.camel@voxelsoft.com> <8bfea13a0966a62eca9cd39617918cff04915b34.camel@voxelsoft.com> From: Simon Marchi In-Reply-To: <8bfea13a0966a62eca9cd39617918cff04915b34.camel@voxelsoft.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sat, 20 Aug 2022 00:55:23 +0000 X-Spam-Status: No, score=-3033.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2022 00:55:31 -0000 On 2022-08-19 17:33, Denis Lukianov wrote: > On Thu, 2022-08-18 at 12:27 -0400, Simon Marchi wrote: >> On 8/8/22 07:24, Denis Lukianov wrote: >> >> >> Your patch reminded me of a pending patch I had in the same area, >> which >> I just merged: >> >> >> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bde195b84a862f31ac111c0881ad13b89ee89492 >> >> Maybe you were seeing the same problem as described there? >> >> Simon > > Hi Simon, > > Your check_typedef fixes my use case on little endian architectures. > > However, note that DWARF_VALUE_STACK case also re-slices the source > val. It looks like after that it remains mismatched to the destination > which also must be re-sliced to match (as per my patch, or implicitly > back when this was a simple memcpy with a single length). I have no big > endian resource configured to test this. I don't understand what you are saying. All I can see is that the source array_view size will be of the length of subobj_type: we call slice with length == len, where len is `TYPE_LENGTH (subobj_type)`. And the destination array_view size is also of the length of subobj_type: retval was allocated as `allocate_value (subobj_type)`, so its contents are of the length of subobj_type. Simon