From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id C08AD3858D32 for ; Thu, 10 Aug 2023 16:08:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C08AD3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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-out1.suse.de (Postfix) with ESMTPS id F3A7521873; Thu, 10 Aug 2023 16:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691683693; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=WUcSOOlb5hvSZjh48m0GdL0koARl0sn69uZI1HhlwE0=; b=WahEQ15z7L62kcg6PLqawjEeKp1I/dPXq4j3/OKI+aDO6SWJgFFNA2feU4oN+Hi1CXi26K Cbtu+FLYrkn98rhm1qVbIm7VokOoqjxP35YfN4oW1WPgBx0/7jkLEJlqO8w/D83QYPTS6j 3shTRPRe7FoVWqOEUpUbPGsZTUfLxFs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691683693; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=WUcSOOlb5hvSZjh48m0GdL0koARl0sn69uZI1HhlwE0=; b=UC34ZnQW0FL1A+2ySBSo/fL6aiskTAnq365EbA1dRIZXE8WK6XCEGdQaPyd9SpJFHOd5Bu KqCPTJj9ZWZplACA== 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 D8E71138E0; Thu, 10 Aug 2023 16:08:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id beLYM20L1WRNMQAAMHmgww (envelope-from ); Thu, 10 Aug 2023 16:08:13 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 1/2] [gdb/symtab] Dump qualified name of cooked_index_entry Date: Thu, 10 Aug 2023 18:07:57 +0200 Message-Id: <20230810160758.9760-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 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_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: When doing "maint print objfiles" for the exec of test-case gdb.dwarf2/pr13961.exp, we get: ... [25] ((cooked_index_entry *) 0x37b25d0) name: foo canonical: foo DWARF tag: DW_TAG_class_type flags: 0x0 [] DIE offset: 0x2a parent: ((cooked_index_entry *) 0) [26] ((cooked_index_entry *) 0x37b2630) name: foo canonical: foo DWARF tag: DW_TAG_class_type flags: 0x0 [] DIE offset: 0x25 parent: ((cooked_index_entry *) 0x37b25d0) [foo] ... By following the parent links in the text, we can conclude that the qualified name of DIE 0x25 is foo::foo (which is incorrect, that's PR symtab/30739). But it's not evident, and also hard to verify in a test-case. Add dumping of the qualified name, such that we have: ... [25] ((cooked_index_entry *) 0x333b5d0) name: foo canonical: foo qualified: foo DWARF tag: DW_TAG_class_type flags: 0x0 [] DIE offset: 0x2a parent: ((cooked_index_entry *) 0) [26] ((cooked_index_entry *) 0x333b630) name: foo canonical: foo qualified: foo::foo DWARF tag: DW_TAG_class_type flags: 0x0 [] DIE offset: 0x25 parent: ((cooked_index_entry *) 0x333b5d0) [foo] ... Tested on x86_64-linux. --- gdb/dwarf2/cooked-index.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 92ef0e35c5e..351f0016402 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -565,6 +565,8 @@ cooked_index::get_main () const void cooked_index::dump (gdbarch *arch) const { + auto_obstack temp_storage; + /* Ensure the index is done building. */ this->wait (); @@ -579,6 +581,7 @@ cooked_index::dump (gdbarch *arch) const gdb_printf (" [%zu] ((cooked_index_entry *) %p)\n", i++, entry); gdb_printf (" name: %s\n", entry->name); gdb_printf (" canonical: %s\n", entry->canonical); + gdb_printf (" qualified: %s\n", entry->full_name (&temp_storage, false)); gdb_printf (" DWARF tag: %s\n", dwarf_tag_name (entry->tag)); gdb_printf (" flags: %s\n", to_string (entry->flags).c_str ()); gdb_printf (" DIE offset: 0x%" PRIx64 "\n", base-commit: 67bed49ec852aee39172fc867a89ec78c4903883 -- 2.35.3