From patchwork Tue Dec 12 17:32:32 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: 81983 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 9076D385C019 for ; Tue, 12 Dec 2023 17:33:12 +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 [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id D0D493858029 for ; Tue, 12 Dec 2023 17:32:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0D493858029 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 D0D493858029 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702402347; cv=none; b=Pbe7yC2F3etrhZLvjrCvjuXJdebTY4/UTZN/dxQO0TVSpqJI4Tw2qegP8lK5EGQeknnqkJJVxMpbI+Ed0tNwCPso8xwPTKXiU8R78/jljHFw8+WWNDDHI+kj9PR6tV2O15NMy4VzZY/78PSEX+9IFsyhA3HXWRIGoFDU3H3qELU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702402347; c=relaxed/simple; bh=9wAltjCW5yDfj/NnWpwNGZgVlXMJ7JAjgv1TVHY4xd8=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=X8fErz5GXiyXAphRoRkJExyPcoP+LlMYJE2ShKUKEFg4mde+hWJ3DDj0tDL0Ix08DA7mrh6RTmGkP056LAQHQCGzgaPhZWjm4agLE9bAI3V9E4+vSic5xihEFR5Aotqg+GgOWXasDWb8T79JBg/JPUJyWBWHEVuff/FrCGPftmg= 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 9EDF01FB9D 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=9YKNcqhe3qqtXGNUHj15Lmv3Hk+Ew/xOqySTIb81e50=; b=RxV5IaiuFwiA/6ikTqJLkc3xwFt4hY4j/DwNTISeJlytYw5SHh6Pp/z31L0ohXuYeZJN4L Ai7204IxnzMxoSCpdWXgT1SmbEfMntu0Bped+epmQvEAdWe/E/3dL/icL17SLrBit+mOZr cS6a4KjJNA0NXL3q8PkhFtk6SHLPYgE= 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=9YKNcqhe3qqtXGNUHj15Lmv3Hk+Ew/xOqySTIb81e50=; b=IbADzxvlYyNRpG5IouhAM4koqtMjTk2jBecEX3xZyDVm/hKDTmjjfJUSrnmnCDesmsid3z xJeW6gO+qjZx8gAQ== 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=9YKNcqhe3qqtXGNUHj15Lmv3Hk+Ew/xOqySTIb81e50=; b=RxV5IaiuFwiA/6ikTqJLkc3xwFt4hY4j/DwNTISeJlytYw5SHh6Pp/z31L0ohXuYeZJN4L Ai7204IxnzMxoSCpdWXgT1SmbEfMntu0Bped+epmQvEAdWe/E/3dL/icL17SLrBit+mOZr cS6a4KjJNA0NXL3q8PkhFtk6SHLPYgE= 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=9YKNcqhe3qqtXGNUHj15Lmv3Hk+Ew/xOqySTIb81e50=; b=IbADzxvlYyNRpG5IouhAM4koqtMjTk2jBecEX3xZyDVm/hKDTmjjfJUSrnmnCDesmsid3z xJeW6gO+qjZx8gAQ== 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 5DD5313A9A 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 IJmuFSaZeGVaPQAAD6G6ig (envelope-from ) for ; Tue, 12 Dec 2023 17:32:22 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v2 06/13] [gdb/testsuite] Add gdb.dwarf2/forward-spec-inter-cu.exp Date: Tue, 12 Dec 2023 18:32:32 +0100 Message-Id: <20231212173239.16793-7-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 Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: 8.80 X-Spamd-Result: default: False [8.80 / 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]; NEURAL_HAM_SHORT(-0.20)[-1.000]; 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-Flag: NO 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 a regression test for PR symtab/30846. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30846 --- .../gdb.dwarf2/forward-spec-inter-cu.exp | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp diff --git a/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp new file mode 100644 index 00000000000..d8367b0a162 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/forward-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 a later 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} + } { + # 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} + } + } + } + + 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} + } + } + } + } +} + +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" +}