From patchwork Tue Dec 12 17:32:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 81987 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 99F6D385AC22 for ; Tue, 12 Dec 2023 17:33:36 +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 [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 882C83858000 for ; Tue, 12 Dec 2023 17:32:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 882C83858000 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 882C83858000 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=1702402346; cv=none; b=w6AJjskYR2AstEExxZgiZj53706ghZOCO4uCWKMFU4xDRsUYlM6aWIeb0Y3nsE/IMFxZH4sHy3YGD5BCfxVZH+afKgA7lAScG79Nqd0zTer1JwwIasCQSOpTiY47/zJ1D3TSEmK7jaRAF7cg7+hBkReV1vW3GlgsyiE/eOQ539k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702402346; c=relaxed/simple; bh=Rxo40YLAJEs4rIH3G22hrJ6iPjR6Z19NJr/PgdPm/G8=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=u69n7NYPILw1Pz17wK7uMXZf+jz9XD+Nvxdb8Vbz1/sXYQzxV6R/2fCDhw6wPIsdSVoj9+HWvYc7OIfIiK/ruycOD2Yh8Z81gFzaamOug8upQAugg0/Qz7h1q8ZqmhrODvIFvjvLD43QqUiN0W+lN8InsuBghq1bWf3EsMk19C4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [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 3CF5021DB1 for ; Tue, 12 Dec 2023 17:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702402343; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0LWlkfVMzFg4u40qeeFb5nQDWcLYiJatZiDjSk+3Ccw=; b=H4N8CpoglSSrTYgDxFVpninnCPOmJyuxh/A/5GbXK7Dy6ijAKQIAVvSriu6oylmz2BbuZc CNsYMbETzFubb+7C3q/2G6JijYuZOG2p3bqbqbUl9Jel3BWfWARsv6SnEjfq27JxAoHmbH x6pp6UTCZLLq6xC4AARm5zDCrX6W258= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702402343; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0LWlkfVMzFg4u40qeeFb5nQDWcLYiJatZiDjSk+3Ccw=; b=L4iU1srszNLoSB8bh0SPG0aieiZ0Ns9AX0HGKG4AdtiyD5tGLLiLHOkVbMp/q5BjaaMopk 2GYwQ6oouNAtrqAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702402343; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0LWlkfVMzFg4u40qeeFb5nQDWcLYiJatZiDjSk+3Ccw=; b=H4N8CpoglSSrTYgDxFVpninnCPOmJyuxh/A/5GbXK7Dy6ijAKQIAVvSriu6oylmz2BbuZc CNsYMbETzFubb+7C3q/2G6JijYuZOG2p3bqbqbUl9Jel3BWfWARsv6SnEjfq27JxAoHmbH x6pp6UTCZLLq6xC4AARm5zDCrX6W258= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702402343; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0LWlkfVMzFg4u40qeeFb5nQDWcLYiJatZiDjSk+3Ccw=; b=L4iU1srszNLoSB8bh0SPG0aieiZ0Ns9AX0HGKG4AdtiyD5tGLLiLHOkVbMp/q5BjaaMopk 2GYwQ6oouNAtrqAg== 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 2712B13A9D for ; Tue, 12 Dec 2023 17:32:23 +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 4F5FCCeZeGVaPQAAD6G6ig (envelope-from ) for ; Tue, 12 Dec 2023 17:32:23 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v2 13/13] [gdb/symtab] Fix DW_TAG_inlined_subroutine entries in the cooked index Date: Tue, 12 Dec 2023 18:32:39 +0100 Message-Id: <20231212173239.16793-14-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231212173239.16793-1-tdevries@suse.de> References: <20231212173239.16793-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Level: X-Spam-Score: 0.70 X-Spam-Level: X-Spam-Flag: NO Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [0.90 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[sourceware.org:url]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Score: 0.90 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, T_SCC_BODY_TEXT_LINE 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 We get incorrect qualified names in the cooked index for DW_TAG_inlined_subroutine DIEs with abstract origin, due to the fact that the DIE parent is used instead of the abstract origin. Fix this by preferring the abstract origin parent, if available. Tested on x86_64-linux. PR symtab/30728 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30728 --- gdb/dwarf2/read.c | 67 ++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 652bcda3704..7537cb6b7f2 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -16224,52 +16224,49 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, const gdb_byte *new_info_ptr = (new_reader->buffer + to_underlying (origin_offset)); - if (*parent_entry == nullptr) + gdb_assert (reader->cu->per_cu->is_debug_types + == new_reader->cu->per_cu->is_debug_types); + CORE_ADDR addr + = parent_map::form_addr (origin_offset, origin_is_dwz, + reader->cu->per_cu->is_debug_types); + if (new_reader->cu == reader->cu) { - gdb_assert (reader->cu->per_cu->is_debug_types - == new_reader->cu->per_cu->is_debug_types); - CORE_ADDR addr - = parent_map::form_addr (origin_offset, origin_is_dwz, - reader->cu->per_cu->is_debug_types); - if (new_reader->cu == reader->cu) + /* Intra-CU case. */ + if (new_info_ptr > watermark_ptr) { - /* Intra-CU case. */ - if (new_info_ptr > watermark_ptr) - { - /* Defer because origin is not read yet. */ - *maybe_defer = addr; - } - else - { - auto tmp = find_parent (addr); - if (tmp == &parent_map::deferred) - { - /* Defer because origin is deferred. */ - *maybe_defer = addr; - } - else - *parent_entry = tmp; - } + /* Defer because origin is not read yet. */ + *maybe_defer = addr; } else { - /* Inter-CU case. */ - if (parent_valid (addr)) + auto tmp = find_parent (addr); + if (tmp == &parent_map::deferred) { - auto tmp = find_parent (addr); - if (tmp == &parent_map::deferred) - { - /* Defer because origin is deferred. */ - *maybe_defer = addr; - } - else - *parent_entry = tmp; + /* Defer because origin is deferred. */ + *maybe_defer = addr; } else + *parent_entry = tmp; + } + } + else + { + /* Inter-CU case. */ + if (parent_valid (addr)) + { + auto tmp = find_parent (addr); + if (tmp == &parent_map::deferred) { - /* Defer because origin is in other shard. */ + /* Defer because origin is deferred. */ *maybe_defer = addr; } + else + *parent_entry = tmp; + } + else + { + /* Defer because origin is in other shard. */ + *maybe_defer = addr; } }