From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id nUCYFTBvvl+3DwAAWB0awg (envelope-from ) for ; Wed, 25 Nov 2020 09:50:24 -0500 Received: by simark.ca (Postfix, from userid 112) id 4F3501E58E; Wed, 25 Nov 2020 09:50:24 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6E11A1E58E for ; Wed, 25 Nov 2020 09:50:23 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D1D22395C84B; Wed, 25 Nov 2020 14:50:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D1D22395C84B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1606315822; bh=9BZlArXlMz3qMYVgDi1/Qi+Vin0BiGQ3yalz5CsiE9o=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=mtwl+xoF/VTMhRbTEJd58K1mnUu7FV9wef3u+iIdBG98N2Z3/b///x0iEADRjeox5 d60SbQXQ01QCnk5nnR66d4wA8tLe8ZDvbJe/Iv1yZoZcNhuLR2mfKGIja0XgPbzQkX kbcQgcHMLZ+wbaIEj71CwW3/qurzgX0HG2dDjrrs= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 86E2A395C847 for ; Wed, 25 Nov 2020 14:50:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 86E2A395C847 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-JHUVa13kPbaU9QjryvxjDQ-1; Wed, 25 Nov 2020 09:50:17 -0500 X-MC-Unique: JHUVa13kPbaU9QjryvxjDQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 46BEA612AF; Wed, 25 Nov 2020 14:50:16 +0000 (UTC) Received: from blade.nx (ovpn-115-133.ams2.redhat.com [10.36.115.133]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC07C60BE2; Wed, 25 Nov 2020 14:50:15 +0000 (UTC) Received: by blade.nx (Postfix, from userid 1000) id 0FDBA816CD2E; Wed, 25 Nov 2020 14:50:14 +0000 (GMT) Date: Wed, 25 Nov 2020 14:50:14 +0000 To: Tom de Vries Subject: Re: [PATCH][gdb/symtab] Fix gdb.base/vla-optimized-out.exp with clang Message-ID: <20201125145014.GA16439@blade.nx> References: <1605547055-25778-1-git-send-email-gbenson@redhat.com> <87mtzek5fv.fsf@tromey.com> <0a3f590c-2a76-e470-136f-e8f88aef1d17@suse.de> <87y2iwgh90.fsf@tromey.com> <55e92b95-8b3b-6c4f-a572-9d7f836a1758@suse.de> <874klkgeff.fsf@tromey.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: Gary Benson via Gdb-patches Reply-To: Gary Benson Cc: Tom Tromey , Gary Benson via Gdb-patches Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Tom de Vries wrote: > [ was: Re: [PATCH] KFAIL variable-length array tests which fail with Clang ] > On 11/20/20 5:51 PM, Tom Tromey wrote: > >>> I don't really understand the is_reference stuff > > > > Tom> In case a dwarf expression is used for an DW_AT_location attribute, by > > Tom> default it represents an address, and needs to be dereferenced to get > > Tom> the value. > > > > Yeah, I guess I'd need to see some examples to understand why this > > decision is made here and not at the point of use. > > > >>> Anyway, gdb can't do this sort of check. It will fail if the expression > >>> has a different shape, which is completely allowed by the spec. > > > > Tom> AFAIU, the spec specifically says how to interpret a DW_OP_stack_value > > Tom> at the end of the dwarf expression which is used a location description, > > Tom> and the code in the patch follows that reasoning. > > ... > > Tom> So, for my understanding, can you give an example of the problem you're > > Tom> envisioning? > > > > Nothing prevents an expression from ending with some other DW_OP_* with > > 0x9f as an operand to the opcode. This would confuse this simple > > checker. Or to put it another way, nothing guarantees that the last > > byte of an expression is an opcode. I think it could even be both, > > depending on a runtime condition, because AFAIK nothing prevents a DWARF > > expression from branching to the middle of some other operation. > > Hmm, indeed, thanks for pointing this out. That means that this needs > to be dealt with in the evaluator. AFAICT, DWARF_VALUE_STACK is used > already to represent the DW_OP_stack_value op in the evaluator, it's > just not used for this scenario. > > Another try below. Any more comments? Thank you for picking this up Tom (de Vries). Your patch looks good, however I wanted to point out that the location expressions Clang generates for gdb.base/vla-ptr.exp don't end with DW_OP_stack_value: < 2><0x000000a3> DW_TAG_variable DW_AT_location len 0x0002: 9168: DW_OP_fbreg -24 DW_AT_name __vla_expr0 DW_AT_type <0x00000118> DW_AT_artificial yes(1) < 2><0x000000af> DW_TAG_variable DW_AT_location len 0x0002: 9160: DW_OP_fbreg -32 DW_AT_name __vla_expr1 DW_AT_type <0x00000118> DW_AT_artificial yes(1) It wasn't obvious to me how GDB with your patch would handle these. Did you check your patch using that test? Thanks, Gary -- Gary Benson - he / him / his Principal Software Engineer, Red Hat