From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YJ/IAAV3emIAdAUAWB0awg (envelope-from ) for ; Tue, 10 May 2022 10:30:29 -0400 Received: by simark.ca (Postfix, from userid 112) id F41FB1E21F; Tue, 10 May 2022 10:30:28 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=p67yIrKC; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7BC1B1E01D for ; Tue, 10 May 2022 10:30:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EBF183954450 for ; Tue, 10 May 2022 14:30:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EBF183954450 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1652193028; bh=9pIG0jA02kFgkKNpqwsJ5X8xR25JHyvRrDaKbRlsmj0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=p67yIrKCfha4j/UHClAEtkPJrTALErj4cmpsTfHcTI5K1luWZoVgMnYeE/HuV9PLy 8YDch8YKBf+iKbdfU+HrEEfsPsPnj7+/JgUPYB9VylTowtb+O6FYhtEsdUWheS0+sn e1a4VRtfWAQL6O9LiCCYfRAg54lVjU/SoUq1SD5c= Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by sourceware.org (Postfix) with ESMTPS id 95D53395440B for ; Tue, 10 May 2022 14:25:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 95D53395440B X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="269325116" X-IronPort-AV: E=Sophos;i="5.91,214,1647327600"; d="scan'208";a="269325116" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 07:25:42 -0700 X-IronPort-AV: E=Sophos;i="5.91,214,1647327600"; d="scan'208";a="657667054" Received: from labpcdell3650-003.iul.intel.com (HELO localhost) ([172.28.49.87]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 07:25:41 -0700 To: gdb-patches@sourceware.org Subject: [PATCH 12/18] testsuite/lib: add check_optional_entry for GDBInfoSymbols Date: Tue, 10 May 2022 16:24:31 +0200 Message-Id: <20220510142437.1397399-13-nils-christian.kempke@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220510142437.1397399-1-nils-christian.kempke@intel.com> References: <20220510142437.1397399-1-nils-christian.kempke@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Nils-Christian Kempke via Gdb-patches Reply-To: Nils-Christian Kempke Cc: JiniSusan.George@amd.com, aburgess@redhat.com Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" There was already a similar functionality for the GDBInfoModuleSymbols. This just extends the GDBInfoSymbols. We will use this feature in a later commit to make a testcase less GNU specific and more flexible for other compilers. Namely, in gdb.fortran/info-types.exp currenlty GDBInfoSymbols::check_entry is used to verify and test the output of the info symbols command. The test, however was written with gfortran as a basis and some of the tests are not fair with e.g. ifx and ifort as they test for symbols that are not actually required to be emitted. The lines GDBInfoSymbols::check_entry "${srcfile}" "" "${character1}" and GDBInfoSymbols::check_entry "${srcfile}" "37" "Type s1;" check for types that are either not used in the source file (character1) or should not be emitted by the compiler at global scope (s1) thus no appearing in the info symbols command. In order to fix this we will later use the newly introduced check_optional_entry over check_entry. --- gdb/testsuite/lib/sym-info-cmds.exp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/lib/sym-info-cmds.exp b/gdb/testsuite/lib/sym-info-cmds.exp index f0272a0334..ce878f0d50 100644 --- a/gdb/testsuite/lib/sym-info-cmds.exp +++ b/gdb/testsuite/lib/sym-info-cmds.exp @@ -163,6 +163,16 @@ namespace eval GDBInfoSymbols { gdb_assert {[regexp -- $pattern $_header]} $testname } + # Call check_entry_1 with OPTIONAL == 0. + proc check_entry { filename lineno text { testname "" } } { + check_entry_1 $filename $lineno $text 0 $testname + } + + # Call check_entry_1 with OPTIONAL == 1. + proc check_optional_entry { filename lineno text { testname "" } } { + check_entry_1 $filename $lineno $text 1 $testname + } + # Check that we have an entry in _entries matching FILENAME, # LINENO, and TEXT. If LINENO is the empty string it is replaced # with the string NONE in order to match a similarly missing line @@ -174,7 +184,7 @@ namespace eval GDBInfoSymbols { # If a matching entry is found then it is removed from the # _entries list, this allows us to check for duplicates using the # check_no_entry call. - proc check_entry { filename lineno text { testname "" } } { + proc check_entry_1 { filename lineno text optional testname } { variable _entries variable _last_command @@ -209,7 +219,11 @@ namespace eval GDBInfoSymbols { } set _entries $new_entries - gdb_assert { $found_match } $testname + if { $optional && ! $found_match } { + unsupported $testname + } else { + gdb_assert { $found_match } $testname + } } # Check that there is no entry in the _entries list matching -- 2.25.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928