From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 68EAA3861004 for ; Thu, 18 Feb 2021 17:33:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 68EAA3861004 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-218-249Vbb3KM1ayZgdcH_YPLA-1; Thu, 18 Feb 2021 12:33:01 -0500 X-MC-Unique: 249Vbb3KM1ayZgdcH_YPLA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9359DF8A7; Thu, 18 Feb 2021 17:32:59 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-197.ams2.redhat.com [10.36.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72B6F6F7E6; Thu, 18 Feb 2021 17:32:59 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 11IHWuL22533702 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 18 Feb 2021 18:32:56 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 11IHWtE12533701; Thu, 18 Feb 2021 18:32:55 +0100 Date: Thu, 18 Feb 2021 18:32:55 +0100 From: Jakub Jelinek To: Mark Wielaard , dwz@sourceware.org Subject: Re: [PATCH] Don't handle blocks as exprlocs for DWARF version 4 or higher. Message-ID: <20210218173255.GK4020736@tucnak> Reply-To: Jakub Jelinek References: <20210213224622.16521-1-mark@klomp.org> <3fd1ebde0c9e1b8cbe09ea858a3e0f0a84af44b4.camel@klomp.org> <20210218140947.GG4020736@tucnak> <20210218165940.GJ4020736@tucnak> MIME-Version: 1.0 In-Reply-To: <20210218165940.GJ4020736@tucnak> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:33:07 -0000 On Thu, Feb 18, 2021 at 05:59:40PM +0100, Jakub Jelinek via Dwz wrote: > Anyway, looking around some more, > if (unlikely (low_mem_phase1) > && add_locexpr_dummy_dies (dso, cu, die, ptr, form, > t->attr[i].attr, len)) > goto fail; > looks incorrect to me, form in that case will be DW_FORM_block{2,4,} > and won't be canonicalized to DW_FORM_block1. And furthermore > len will be always 0. It is preceded only by > size_t len = 0; > and a loop handling DW_FORM_indirect. So, ptr will always be > the pointer to the block count too. Another possibility would be (if we don't want to slow down non-low mem case) to just repeat that > switch (form) > { > case DW_FORM_block1: > len = *ptr++; > break; > case DW_FORM_block2: > len = read_16 (ptr); > form = DW_FORM_block1; > break; > case DW_FORM_block4: > len = read_32 (ptr); > form = DW_FORM_block1; > break; > case DW_FORM_block: > len = read_uleb128 (ptr); > form = DW_FORM_block1; > break; > case DW_FORM_exprloc: > len = read_uleb128 (ptr); > break; > default: > break; > } at the start of add_locexpr_dummy_dies (and not pass len to that function and have it instead as a local var. Perhaps even by doing: size_t len = 0; if (cu->cu_version < 4) { switch (form) { ... // the above switch without DW_FORM_exprloc in there } if (form == DW_FORM_block1) ... } if (form == DW_FORM_exprloc) { len = read_uleb128 (ptr); return read_exprloc_low_mem_phase1 (dso, die, ptr, len); } ... Jakub