From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gw0pJkMd8WKyySIAWB0awg (envelope-from ) for ; Mon, 08 Aug 2022 10:27:15 -0400 Received: by simark.ca (Postfix, from userid 112) id 90C541EA06; Mon, 8 Aug 2022 10:27:15 -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=QDs9VWLK; 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 336751E9ED for ; Mon, 8 Aug 2022 10:27:15 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B73EB385737C for ; Mon, 8 Aug 2022 14:27:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B73EB385737C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659968834; bh=rHhIXZXLIbiuev68aUEJmYTYSiCFM18ElkeVE+3I3pQ=; 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=QDs9VWLKqGd4URh0RVZnHKyQtyAOspD9mmrXo2jnVvnN5ToEzHksUAGTbU/YkggUc nlCDqGDHCRN/j3khGM7VWdYTrtb5yOIoEfmazlkHE2ShiGQ8Az9glNTT/iuQNnZWtR v7W3RPJlnrr8kC8S7CaR0UW0tCv42Wo5Lc+l0qaM= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 6C4AE3858023 for ; Mon, 8 Aug 2022 14:26:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6C4AE3858023 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A00173441F; Mon, 8 Aug 2022 14:26:54 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 89D2213A7C; Mon, 8 Aug 2022 14:26:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id E5BlIC4d8WLsfwAAMHmgww (envelope-from ); Mon, 08 Aug 2022 14:26:54 +0000 Message-ID: Date: Mon, 8 Aug 2022 16:26:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH][gdb/symtab] Force usage of all_comp_units.size (CU/TU/CUTU) Content-Language: en-US To: gdb-patches@sourceware.org References: <20220714144351.GA31826@delia.home> In-Reply-To: <20220714144351.GA31826@delia.home> Content-Type: text/plain; charset=UTF-8; format=flowed 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 7/14/22 16:43, Tom de Vries wrote: > It's hard to produce a test-case for this, but let's try at least to trigger > the complaint somehow. We start out by creating an exec with .debug_types and > .debug_names: > ... > $ gcc -g ~/hello.c -fdebug-types-section > $ gdb-add-index -dwarf-5 a.out > ... > and verify that we don't see any complaints: > ... > $ gdb -q -batch -iex "set complaints 100" ./a.out > ... > > We look at the CU and TU table using readelf -w and conclude that we have > nr_cus == 6 and nr_tus == 1. > > Now override ull in dw2_debug_names_iterator::next for the DW_IDX_compile_unit > case to 6, and we have: > ... > $ gdb -q -batch -iex "set complaints 100" ./a.out > During symbol reading: .debug_names entry has bad CU index 6 [in module a.out] > ... > > [ After this, it still crashes because this code in > dw2_debug_names_iterator::next: > ... > /* Skip if already read in. */ > if (m_per_objfile->symtab_set_p (per_cu)) > goto again; > ... > is called with per_cu == nullptr, but I consider this a separate issue. ] > > Now revert the fix (all_comp_units.size (CU) -> all_comp_units.size (CUTU)) > and observe that the complaint disappears, so we've confirmed that the fix is > required. I've submitted a test-case for this here ( https://sourceware.org/pipermail/gdb-patches/2022-August/191274.html ). Thanks, - Tom