From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NeyLE6tHsmAJegAAWB0awg (envelope-from ) for ; Sat, 29 May 2021 09:54:51 -0400 Received: by simark.ca (Postfix, from userid 112) id 3A0F91F11E; Sat, 29 May 2021 09:54:51 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,RDNS_DYNAMIC,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 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 5D2AC1E54D for ; Sat, 29 May 2021 09:54:50 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A364E383541C; Sat, 29 May 2021 13:54:49 +0000 (GMT) Received: from gateway33.websitewelcome.com (gateway33.websitewelcome.com [192.185.146.119]) by sourceware.org (Postfix) with ESMTPS id 8DAA0386FC37 for ; Sat, 29 May 2021 13:54:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8DAA0386FC37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 075D02BBB0 for ; Sat, 29 May 2021 08:54:46 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id mzQLl6vQBx8DpmzQLlsgJM; Sat, 29 May 2021 08:54:46 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WIqOu+TvJ/KTVXCYskzw/E4n1Z7U5lSxkTDlbVz5ENU=; b=Nia5GQJ5DzVaQaO1DIhotNgY28 O6iuXTa/eBQ/D9z2aqbbywikwUOa+spa21zYY9NXz6qaSY0796um0JmbRQ5pcZVRKRKYsmwhN2Cfv npFGtyTScdQmgdCrKiMqAp72R; Received: from 75-166-146-111.hlrn.qwest.net ([75.166.146.111]:52106 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lmzQL-0042F2-ND; Sat, 29 May 2021 07:54:45 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 1/4] Fix oddity in write_gdbindex Date: Sat, 29 May 2021 07:54:40 -0600 Message-Id: <20210529135443.1446279-2-tom@tromey.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210529135443.1446279-1-tom@tromey.com> References: <20210529135443.1446279-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.146.111 X-Source-L: No X-Exim-ID: 1lmzQL-0042F2-ND X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-146-111.hlrn.qwest.net (localhost.localdomain) [75.166.146.111]:52106 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes 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: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" My recent patch to unify CUs and TUs introduced an oddity in write_gdbindex. Here, we pass 'i' to recursively_write_psymbols, but we must instead pass 'counter', to handle the situation where a TU is mixed in with the CUs. I am not sure a test case for this is possible. I think it can only happen when using DWARF 5, where a TU appears in .debug_info. However, this situation is already not handled correctly by .gdb_index. I filed a bug about this. gdb/ChangeLog 2021-05-28 Tom Tromey * dwarf2/index-write.c (write_gdbindex): Pass 'counter' to recursively_write_psymbols. --- gdb/ChangeLog | 5 +++++ gdb/dwarf2/index-write.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index 4b78add0a5a..ffc49e8ba82 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -1446,7 +1446,7 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, FILE *out_file, { if (psymtab->user == NULL) recursively_write_psymbols (objfile, psymtab, &symtab, - psyms_seen, i); + psyms_seen, counter); const auto insertpair = cu_index_htab.emplace (psymtab, counter); gdb_assert (insertpair.second); -- 2.26.3