Message ID | 20250120085723.5693-1-tdevries@suse.de |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> 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 A75683858283 for <patchwork@sourceware.org>; Mon, 20 Jan 2025 08:57:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A75683858283 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Dpw8tOMK; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=4ogH+Rzo; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Dpw8tOMK; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=4ogH+Rzo X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id EC095385841C for <gdb-patches@sourceware.org>; Mon, 20 Jan 2025 08:57:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC095385841C 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 EC095385841C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737363431; cv=none; b=ri7JUEw8YfoxZovnfdBs9zf5ZAsqFGzv8TZtrS6mjpDrxgxlC1Ct74qkzQLyMtHiPn6T6C4M4XcKQsE/kRO+hDdCJihhc2sqpf5fecpzOABIV3Fo78F7UFTUS5+spq9G9WUs+QzKkwbtABE99YymPDgK4I1zQdDtCgbn7EKwnlY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737363431; c=relaxed/simple; bh=y/dsZeC/SMxljLPo8zMlt/aRs9iqTdS9GNcUNE/fyhs=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=Mg16DPrDbDqj1TH1eRpCnrhnKL+mm7QJmM0LaSGVOtO8rI0LuuS1/yjIuaqYPnGPux3EOsqRYXlYjUGvF9FvGMSLZspFm9qhOwW+kCfdPJWo0EnUrWwSWHKGWDJz6S5XoprgFyIFELuPfXvj1EPLyyOaDRObTIFV9+X9v77KVFw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC095385841C 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 5818D211A7 for <gdb-patches@sourceware.org>; Mon, 20 Jan 2025 08:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1737363429; 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=Y/ylqUCTqsWN1nXFJ4eL7VAF9UpS4azb0I+r7PJXzUo=; b=Dpw8tOMKaP/gThm0TDkZaRw741/Urk212QG1864XgFJngshtkV73MStKiC4c+qy55lGGY9 nmKI5J5b5OWhBDgLkyv9NlgJJn6ZD2I06guq/wpUS5NV9aWAvd1O6Ow2Dxlzf8XvRVXlHp Gs3gMLTZQwRsbCyHs2Q0ubSYZ0LIYQg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1737363429; 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=Y/ylqUCTqsWN1nXFJ4eL7VAF9UpS4azb0I+r7PJXzUo=; b=4ogH+RzorIp5ILUTA55mGOc9aA7mNq7j1gc6XpTgS7k0G/207IpNyBj0Rzm8rJPB0xIQ7P P7D3APA4LPIWyGBA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1737363429; 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=Y/ylqUCTqsWN1nXFJ4eL7VAF9UpS4azb0I+r7PJXzUo=; b=Dpw8tOMKaP/gThm0TDkZaRw741/Urk212QG1864XgFJngshtkV73MStKiC4c+qy55lGGY9 nmKI5J5b5OWhBDgLkyv9NlgJJn6ZD2I06guq/wpUS5NV9aWAvd1O6Ow2Dxlzf8XvRVXlHp Gs3gMLTZQwRsbCyHs2Q0ubSYZ0LIYQg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1737363429; 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=Y/ylqUCTqsWN1nXFJ4eL7VAF9UpS4azb0I+r7PJXzUo=; b=4ogH+RzorIp5ILUTA55mGOc9aA7mNq7j1gc6XpTgS7k0G/207IpNyBj0Rzm8rJPB0xIQ7P P7D3APA4LPIWyGBA== 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 441B5139CB for <gdb-patches@sourceware.org>; Mon, 20 Jan 2025 08:57:09 +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 hlxcD+UPjmdNYwAAD6G6ig (envelope-from <tdevries@suse.de>) for <gdb-patches@sourceware.org>; Mon, 20 Jan 2025 08:57:09 +0000 From: Tom de Vries <tdevries@suse.de> To: gdb-patches@sourceware.org Subject: [PATCH v2] [gdb/symtab] Fix dwarf version of DWO TU Date: Mon, 20 Jan 2025 09:57:23 +0100 Message-ID: <20250120085723.5693-1-tdevries@suse.de> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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)[imap1.dmz-prg2.suse.org:helo,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, 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
Series |
[v2,gdb/symtab] Fix dwarf version of DWO TU
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Build passed |
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Test passed |
linaro-tcwg-bot/tcwg_gdb_check--master-arm | success | Test passed |
Commit Message
Tom de Vries
Jan. 20, 2025, 8:57 a.m. UTC
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 using cu->header.version instead. Tested on aarch64-linux. PR symtab/32309 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32309 --- gdb/dwarf2/read.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: c99345db064e1bd645bc08db65174bae7ac20b0e
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> When running test-case gdb.ada/access_tagged_param.exp with target board
Tom> fission, we run into:
Tom> ...
Tom> (gdb) break pck.adb:19^M
Tom> gdb/dwarf2/read.h:289: internal-error: version: \
Tom> Assertion `m_dwarf_version != 0' failed.^M
Tom> ...
Tom> - && (cu->per_cu->version () == 2
Tom> + && (cu->header.version == 2
All the stuff in this area seems kind of horrible to me. Like, first of
all, how can this even fail? It seems like the CU version should be set
when setting up the reader. And if not, what's gone wrong there?
Relatedly, can the other callers of version() fail in the same way?
Finally there aren't really that many callers of this method so I wonder
if it can be removed, maybe making this code less fragile. Looking at
it, I feel pretty sure if I needed a version check I'd probably write
code to call this method but ... maybe that's unsafe?
Tom
On 1/21/25 14:32, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes: > > Tom> When running test-case gdb.ada/access_tagged_param.exp with target board > Tom> fission, we run into: > Tom> ... > Tom> (gdb) break pck.adb:19^M > Tom> gdb/dwarf2/read.h:289: internal-error: version: \ > Tom> Assertion `m_dwarf_version != 0' failed.^M > Tom> ... > > Tom> - && (cu->per_cu->version () == 2 > Tom> + && (cu->header.version == 2 > > All the stuff in this area seems kind of horrible to me. Like, first of > all, how can this even fail? It seems like the CU version should be set > when setting up the reader. Hi Tom, thanks for the review. The v1 ( https://sourceware.org/pipermail/gdb-patches/2024-October/212676.html ) takes the approach of making sure "cu->per_cu->version ()" is set. Do you prefer that one? Thanks, - Tom > And if not, what's gone wrong there? > Relatedly, can the other callers of version() fail in the same way? > Finally there aren't really that many callers of this method so I wonder > if it can be removed, maybe making this code less fragile. Looking at > it, I feel pretty sure if I needed a version check I'd probably write > code to call this method but ... maybe that's unsafe? > > Tom
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4503977d62b..824604261f5 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -14019,7 +14019,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) if (type->code () == TYPE_CODE_VOID && !type->is_stub () && die->child == nullptr - && (cu->per_cu->version () == 2 + && (cu->header.version == 2 || producer_is_gas_2_39 (cu))) { /* Work around PR gas/29517, pretend we have an DW_TAG_unspecified_type