From patchwork Sat Nov 19 10:32:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60878 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 796203858281 for ; Sat, 19 Nov 2022 10:32:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 796203858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668853965; bh=eKcErWmlQu50w1va8zlA0A1+H/avXHXMONePgPYJ86o=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=lQu6TnRH4Pd5U1Xu80Vm5pJiTCGcat9phyx0l5I7wpyGtvgQi6Zhz7euGWI3H39HD gFk2AcMZktFe1p3adoMNnaUvTbM6zsrk3j1fphCJseCt/EubBqQpLVTi2a16D5/49e 4G5wXOUXWAoogoeexLCB4rJJTilpIMKkr128Z8Rw= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id B1C8E3858C54 for ; Sat, 19 Nov 2022 10:32:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B1C8E3858C54 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-out2.suse.de (Postfix) with ESMTPS id EEBD31F8AC; Sat, 19 Nov 2022 10:32:16 +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 D66D013B08; Sat, 19 Nov 2022 10:32:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OP83M7CweGP1LwAAMHmgww (envelope-from ); Sat, 19 Nov 2022 10:32:16 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] [gdb/symtab] Handle failure to open .gnu_debugaltlink file Date: Sat, 19 Nov 2022 11:32:16 +0100 Message-Id: <20221119103216.19369-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" If we instrument cc-with-tweaks.sh to remove the .gnu_debugaltlink file after dwz has created it, with test-case gdb.threads/access-mem-running-thread-exit.exp and target board cc-with-dwz-m we run into: ... (gdb) file access-mem-running-thread-exit^M Reading symbols from access-mem-running-thread-exit...^M could not find '.gnu_debugaltlink' file for access-mem-running-thread-exit^M ... followed a bit later by: ... (gdb) file access-mem-running-thread-exit^M Reading symbols from access-mem-running-thread-exit...^M gdb/dwarf2/read.c:7284: internal-error: create_all_units: \ Assertion `per_objfile->per_bfd->all_units.empty ()' failed.^M ... The problem is that create_units does not catch the error thrown by dwarf2_get_dwz_file. Fix this by catching the error and performing the necessary cleanup, getting the same result for the first and second file command. PR symtab/29805 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29805 --- gdb/dwarf2/read.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) base-commit: 15253318be0995200cc59929ca32eedbfd041e45 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 60e120a9d76..53a6a8b5e6d 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7291,7 +7291,16 @@ create_all_units (dwarf2_per_objfile *per_objfile) &per_objfile->per_bfd->abbrev, 0, types_htab, rcuh_kind::TYPE); - dwz_file *dwz = dwarf2_get_dwz_file (per_objfile->per_bfd); + dwz_file *dwz; + try + { + dwz = dwarf2_get_dwz_file (per_objfile->per_bfd); + } + catch (const gdb_exception_error &) + { + per_objfile->per_bfd->all_units.clear (); + throw; + } if (dwz != NULL) { /* Pre-read the sections we'll need to construct an index. */