From patchwork Tue Dec 12 17:32:33 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: 81986 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 3D7703860778 for ; Tue, 12 Dec 2023 17:33:29 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 30BD43857BB5 for ; Tue, 12 Dec 2023 17:32:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 30BD43857BB5 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 30BD43857BB5 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702402347; cv=none; b=OaF4aD4Dnxh7A0TFpbRCvajXtK43MvRnZQzHQYIWNCPmXsYNPz5GfjQZHf+fFjJpB4DnpO7nj75b9u08C1jOcK2IgSqS/qfk/Cv//9HFI6cJ5oYYn+Z8sPN3pCLHQpE57DvOSTF2O7ORhaeAEB648NjLU4/wqv1lLu/fK2fKvUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702402347; c=relaxed/simple; bh=e5Fix0QeAt0IYioK6DILA7QSKAZJot3fENt4pybe8sU=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=ioVNK0hK188ZZ56LBGMYEgr5QDUKOCyx/zsLBOLG5uD6fnW/PjeADz+rtka0VVv4UAickFN/Pe288uYPX17y2w8Jn79eI2vw5Oz4uOIQ0zvTQcshQGIaRtgfOP2rWFgMF8Sw9Ao2H67LNcaz0gutwOzegR7sW6mJ75GmD5CbJbg= 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-out2.suse.de (Postfix) with ESMTPS id 468671FB91 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=/xDeedSyGh8pWxX6bkcT3FqjxzURVIrvmEDhDILivvo=; b=JHWOerMbzRm/N18lF7+FAI5TlKrRms7USneom7eLqlxAESy7+4QRq8KH2tlXqChmlGYuTi dbGVxqCLQLJMjB+f4Dla0VAsrSKVICFWSNTUmir76CrgQWGc2e6DSmgGqz6at5umwwkhMp cn61RvynlaaW97amU7HHEVnQKf/aILE= 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=/xDeedSyGh8pWxX6bkcT3FqjxzURVIrvmEDhDILivvo=; b=Yl813LD7YxG60NkUPYOKawBkzJPZBCb6+U2zuSU/KbaINiXNKqAC7oTsI48FFVYoIyR3IV kgSMYcpz33d+wICQ== 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=/xDeedSyGh8pWxX6bkcT3FqjxzURVIrvmEDhDILivvo=; b=JHWOerMbzRm/N18lF7+FAI5TlKrRms7USneom7eLqlxAESy7+4QRq8KH2tlXqChmlGYuTi dbGVxqCLQLJMjB+f4Dla0VAsrSKVICFWSNTUmir76CrgQWGc2e6DSmgGqz6at5umwwkhMp cn61RvynlaaW97amU7HHEVnQKf/aILE= 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=/xDeedSyGh8pWxX6bkcT3FqjxzURVIrvmEDhDILivvo=; b=Yl813LD7YxG60NkUPYOKawBkzJPZBCb6+U2zuSU/KbaINiXNKqAC7oTsI48FFVYoIyR3IV kgSMYcpz33d+wICQ== 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 76B18139E7 for ; Tue, 12 Dec 2023 17:32:22 +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 6ObEGyaZeGVaPQAAD6G6ig (envelope-from ) for ; Tue, 12 Dec 2023 17:32:22 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v2 07/13] [gdb/testsuite] Add gdb.dwarf2/backward-spec-inter-cu.exp Date: Tue, 12 Dec 2023 18:32:33 +0100 Message-Id: <20231212173239.16793-8-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-Score: 8.80 X-Spam-Flag: NO Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [9.00 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_SPAM(5.10)[100.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)[gnu.org:url,sourceware.org:url]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: 9.00 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, KAM_SHORT, 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 Add another regression test for PR symtab/30846. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30846 --- .../gdb.dwarf2/backward-spec-inter-cu.exp | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp diff --git a/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp b/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp new file mode 100644 index 00000000000..59b3db50dbb --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp @@ -0,0 +1,103 @@ +# Copyright 2023 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Check that the DWARF reader works with a a DW_AT_specification that +# refers to an earlier DIE. Inter-cu variant of forward-spec.exp. + +load_lib dwarf.exp + +# This test can only be run on targets which support DWARF-2 and use gas. +require dwarf2_support + +standard_testfile main.c -debug.S + +# Set up the DWARF for the test. +set asm_file [standard_output_file $srcfile2] +Dwarf::assemble $asm_file { + global srcfile + + declare_labels spec + + cu {} { + DW_TAG_compile_unit { + {DW_AT_language @DW_LANG_C_plus_plus} + } { + declare_labels myint + + myint: DW_TAG_base_type { + {DW_AT_byte_size 4 DW_FORM_sdata} + {DW_AT_encoding @DW_ATE_signed} + {DW_AT_name myint} + } + + DW_TAG_namespace { + {DW_AT_name ns} + } { + spec: DW_TAG_variable { + {DW_AT_name v} + {DW_AT_type :$myint} + {DW_AT_declaration 1 DW_FORM_flag_present} + } + } + } + } + + cu {} { + DW_TAG_compile_unit { + {DW_AT_language @DW_LANG_C_plus_plus} + } { + # The new indexer has special code to compute the full + # name of an object that uses a specification that appears + # later in the DWARF. + DW_TAG_variable { + {DW_AT_specification %$spec} + {DW_AT_location { + DW_OP_const1u 23 + DW_OP_stack_value + } SPECIAL_expr} + } + } + } +} + +if {[build_executable "failed to build executable" ${testfile} \ + [list $srcfile $asm_file] {nodebug}]} { + return -1 +} + +set eol "\r\n" +set ws "\[ \t\]" + +set worker_threads_list {} + +# Exercises the intra-shard case. +lappend worker_threads_list 0 + +# Might exercise the inter-shard case. +lappend worker_threads_list default + +foreach_with_prefix worker_threads $worker_threads_list { + + clean_restart + + if { $worker_threads != "default" } { + gdb_test_no_output "maint set worker-threads $worker_threads" + } + + gdb_load $binfile + + gdb_test "maint print objfiles" "$eol$ws+qualified:$ws+ns::v$eol.*" \ + "v has parent ns" +}