From patchwork Mon Apr 8 21:11:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 88203 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 E0A6A3861021 for ; Mon, 8 Apr 2024 21:12:35 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id 06C3B385840B for ; Mon, 8 Apr 2024 21:11:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 06C3B385840B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 06C3B385840B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712610706; cv=none; b=qjXvgBGZLk8po8Tj4gfNPzFlJd7zyFIFYkuUOE2vJsGQiuC/SFpMFdwixKc7npvcsx3wZ5qmmnXgjkskuyx/nTTEcR7rPNT3Q0fp/TIv25hXmcq+EXVXMguVOcVfO73QAQCqrAfcz1L58DVxD17eWhsjKxE07PBQ+DWwGTFkrLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712610706; c=relaxed/simple; bh=eOb9ju1ueAm7O5fsk/IM3dyg0PkuIOo9vfolQNzTZyw=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=UUqMuUz5jzBw+bUu7GsMxPPD4nDNWX4ULw8kuzzmIRS5d2tFkmKnmF5JLj6ryTbsId5i4xYXe3YYJaY4tu8JOO74tpmRRw5OWXEMrsUpBJwP6RUGqaqvRva2ik8WdNwL9SoEnmUI1lQYpOpzNRnV44hqc4P9hu7Ml2AOqwSTmeQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6007a.ext.cloudfilter.net ([10.0.30.247]) by cmsmtp with ESMTPS id tKdLrPfcFl9dRtwHGreYnH; Mon, 08 Apr 2024 21:11:42 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id twHGrsIXGVdentwHGrF2pK; Mon, 08 Apr 2024 21:11:42 +0000 X-Authority-Analysis: v=2.4 cv=M4FLKTws c=1 sm=1 tr=0 ts=66145d8e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=raytVjVEu-sA:10 a=Qbun_eYptAEA:10 a=CCpqsmhAAAAA:8 a=mDV3o1hIAAAA:8 a=FynSyykwWHE-Aet8Js8A:9 a=QEXdDO2ut3YA:10 a=ul9cdbp4aOFLsgKbc677:22 a=_FVE-zBwftR9WsbkzFJk:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=V/JY53WNHTJwdloozXtOWAWTmIFTovQ4XtlWqxPdZ2A=; b=FR4CG41LEDt6lYPC3t7c5mA3Rd N54vqNEE4BOs9YdQUlrjJxZvs5o7hVdory8avW2jf/NV+uUSYn2CZz6HMhMWokjD/ox3PEHxTNVCP /FE688t+Iq74mfMUzFh1w8SOn; Received: from 97-122-82-115.hlrn.qwest.net ([97.122.82.115]:54230 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rtwHF-001uXf-2m; Mon, 08 Apr 2024 15:11:41 -0600 From: Tom Tromey Date: Mon, 08 Apr 2024 15:11:42 -0600 Subject: [PATCH gdb/testsuite v2 6/7] Add gdb.dwarf2/forward-spec-inter-cu.exp MIME-Version: 1.0 Message-Id: <20240408-die-map-madness-v2-6-6741626d544d@tromey.com> References: <20240408-die-map-madness-v2-0-6741626d544d@tromey.com> In-Reply-To: <20240408-die-map-madness-v2-0-6741626d544d@tromey.com> To: gdb-patches@sourceware.org Cc: Tom de Vries X-Mailer: b4 0.12.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.82.115 X-Source-L: No X-Exim-ID: 1rtwHF-001uXf-2m X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-82-115.hlrn.qwest.net ([192.168.0.21]) [97.122.82.115]:54230 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfIsgW1f5eASRDSHkXLG5gTnmejyqZ7ibUXvAtwhXQfAsG6AT6G+wIBFh2JHDcfIJ7Ifatf1OVSqvJLn+1sUC8ZlEZdsNEK1Kutz2bAutp848xPnPkOPf LEKaKb8X6wAFsEsQYE8KrmFXvVy5TCBLNx4f8EehRDoEo/GgVTMFFIwVf0y9ffldlep5R+ruhwDDPb1LMO2Rr1434+mroT3NeJU= X-Spam-Status: No, score=-3021.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org From: Tom de Vries Add a regression test for PR symtab/30846. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30846 --- gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) 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" +}