From patchwork Mon Oct 28 12:40:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 99702 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 6361B3858424 for ; Mon, 28 Oct 2024 12:41:24 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 0C9973858D26 for ; Mon, 28 Oct 2024 12:40:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C9973858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0C9973858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730119260; cv=none; b=U8r2wSWxgeAz4882+j7pJoFjSWZOaCeHfdPb6i/WEPROxE9nfg/M4vb9++BMRE3jRq0T7NsoCqvguDwjDnBBXlsDq9T+YV3KlY7etykssYSTx/FmX9tmPnlw8bkDKYxHQMxFyDlikagypt1iyyV4kdVxE9pfcQg8vLenjpVKJ2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730119260; c=relaxed/simple; bh=+5b8wJA/0UaSesVzHDoPs9FGEMVBYGkHP9+XbN/whls=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=oEVFH7I10OygZpPggt49m/hCffkjhto6zbdWh5TjRJTFb+0TE6QPamGZTTAWX0rUkU+IiXXTozqBjgeNEpZjLdS4G79ZPILJOEpQGFf7lz5EVvyOxTs7BI+9Ov8+GXRxsONfqURbeXyunYoHSQCkVEBH5SzJyCSsqSLJGiVFugQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DBBC021C18 for ; Mon, 28 Oct 2024 12:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730119256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GBrmrJqn3/aoQ6smcxCIH/6p7E3t8kba4cCW/fmoL3g=; b=1m4/acKgjxLCQyoH5DUPknwiXM+nSNDjqFgeVUp+Ub8j5yxs+xpugSoCPu1SEd7GogTsy0 o2QGIJckRE5SSpT28iSB6KESQ3cluNnlgeBphEptW7vTwtZM9LO1ithdhsCBx0p6/XN8Bv X+T/sQObmFnIRZ/ERx9n06cYqRo69wk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730119256; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GBrmrJqn3/aoQ6smcxCIH/6p7E3t8kba4cCW/fmoL3g=; b=ekc1vkSPIE9TzjlgGwN/PEnpitsNARls19XLP/t0Og/Za+jOWCAwr5H1VhE+TOBiT36Myj UhvW96/Ba3Et4XBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1730119255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GBrmrJqn3/aoQ6smcxCIH/6p7E3t8kba4cCW/fmoL3g=; b=SejRIC2HaplDuTyuMDg0X8kxZGbK4MUYjzi2po9xr4amiTQOI4+glhIpHR9z6GzVC43NXm cZWdDmyzgA/HBWeH8DI1SnND6hCQPy39igCuzNM1XcXuja5iGsZztiZT2WWstxemTw9eGA oeNoZHF1+TuHfFJoNBL+gTjJgtikyAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1730119255; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GBrmrJqn3/aoQ6smcxCIH/6p7E3t8kba4cCW/fmoL3g=; b=JgPZSpsOSbxUeCi6XKoOSjJrBmxxs0wHpSrBgKJEsCdgat72VlfYsDcta5j/yzXzyt1V8G sLY04Bt+5t1TajCA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C49B8137D4 for ; Mon, 28 Oct 2024 12:40:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id IlmBLleGH2cjYAAAD6G6ig (envelope-from ) for ; Mon, 28 Oct 2024 12:40:55 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 1/2] [gdb/symtab] Fix dwarf version of DWO TU Date: Mon, 28 Oct 2024 13:40:39 +0100 Message-Id: <20241028124040.19601-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org When running test-case gdb.ada/access_tagged_param.exp with target board fission, we run into: ... (gdb) break pck.adb:19^M gdb/dwarf2/read.h:289: internal-error: version: \ Assertion `m_dwarf_version != 0' failed.^M ... The assertion happens when calling cu->per_cu->version () in this workaround in read_subroutine_type: ... /* PR gas/29517 occurs in 2.39, and is fixed in 2.40, but it's only fixed for dwarf version >= 3 which supports DW_TAG_unspecified_type. */ if (type->code () == TYPE_CODE_VOID && !type->is_stub () && die->child == nullptr && (cu->per_cu->version () == 2 || producer_is_gas_2_39 (cu))) { ... for a TU in a dwo file. Fix this by: - adding a dwarf_version field to struct dwo_unit, - initializing the new field in create_debug_type_hash_table, and - using the new field in fill_in_sig_entry_from_dwo_entry to set the sig_entry dwarf version. Tested on aarch64-linux. PR symtab/32309 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32309 --- gdb/dwarf2/read.c | 5 +++++ 1 file changed, 5 insertions(+) base-commit: 917ed12066382c48459f85124cbeca1286c3bb53 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 6ac6f7c6a39..b407f0a47aa 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -324,6 +324,9 @@ struct dwo_unit /* For types, offset in the type's DIE of the type defined by this TU. */ cu_offset type_offset_in_tu; + + /* DWARF standard version of this DWO unit. */ + unsigned char dwarf_version; }; /* include/dwarf2.h defines the DWP section codes. @@ -3449,6 +3452,7 @@ create_debug_type_hash_table (dwarf2_per_objfile *per_objfile, dwo_tu->section = section; dwo_tu->sect_off = sect_off; dwo_tu->length = length; + dwo_tu->dwarf_version = header.version; slot = htab_find_slot (types_htab.get (), dwo_tu, INSERT); gdb_assert (slot != NULL); @@ -3545,6 +3549,7 @@ fill_in_sig_entry_from_dwo_entry (dwarf2_per_objfile *per_objfile, sig_entry->per_bfd = per_bfd; sig_entry->type_offset_in_tu = dwo_entry->type_offset_in_tu; sig_entry->dwo_unit = dwo_entry; + sig_entry->set_version (dwo_entry->dwarf_version); } /* Subroutine of lookup_signatured_type.