From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 221583858031 for ; Mon, 2 Oct 2023 12:50:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 221583858031 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 27E0C21860 for ; Mon, 2 Oct 2023 12:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1696251047; 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=dJMeCrADgj2+WtRM3xT7i87Y6fgcaFSXPyl/1hBqwYw=; b=jaPdfOkada8W3Z0lA5gkdrGUMXXB4b3ELga9FWC9EU6BnaDujp0PYtf0Le4kdqOJPy4f8m fHSZrZZwmShgEzFViNmq5vDvzDOQY7/lrMHUPAjLkWjD3LIwtWPphW6FuotZPzLCOYVS6f DN0H6QKAbmQxS4PrOujLSGkr+o2axAU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1696251047; 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=dJMeCrADgj2+WtRM3xT7i87Y6fgcaFSXPyl/1hBqwYw=; b=cJPZkVbE3nQCauyJtmPhcMtz3Gm6ZMZLu9q91wajySfdKR0NMU+TGq87rFsG5suygiNT61 NvYuF4J+GA6OkeBA== 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 15F35139C2 for ; Mon, 2 Oct 2023 12:50:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mG9xBKe8GmVZMgAAMHmgww (envelope-from ) for ; Mon, 02 Oct 2023 12:50:47 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 08/13] [gdb/testsuite] Add gdb.dwarf2/forward-spec-inter-cu.exp Date: Mon, 2 Oct 2023 14:50:46 +0200 Message-Id: <20231002125051.29911-9-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231002125051.29911-1-tdevries@suse.de> References: <20231002125051.29911-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 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 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: Add a regression test for PR symtab/30846. Tested on x86_64-linux. --- .../gdb.dwarf2/forward-spec-inter-cu.exp | 107 ++++++++++++++++++ 1 file changed, 107 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..bb3b6b4b92f --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp @@ -0,0 +1,107 @@ +# 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 {[prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $asm_file] {nodebug}]} { + return -1 +} + +set in_v 0 +gdb_test_multiple "maint print objfiles" "v has a parent" { + -re "^ *\\\[\[0-9\]\\\] *\\(\\(cooked_index_entry\[^\r\n\]*" { + set in_v 0 + exp_continue + } + -re "^ *name: *v\[\r\n\]*" { + set in_v 1 + exp_continue + } + -re "^ *parent: *\\(\\(cooked_index_entry \\*\\) (0|$hex)\\)" { + if {$in_v} { + if {$expect_out(1,string) == "0"} { + fail $gdb_test_name + } else { + pass $gdb_test_name + } + set in_v 0 + } + exp_continue + } + -re "^\[^\r\n\]*\[\r\n\]+" { + exp_continue + } + -re "$gdb_prompt " { + # Done. + } +} -- 2.35.3