From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gCEHEcp3emIidAUAWB0awg (envelope-from ) for ; Tue, 10 May 2022 10:33:46 -0400 Received: by simark.ca (Postfix, from userid 112) id 423441E21F; Tue, 10 May 2022 10:33:46 -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=mPDMasCb; 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 B66831E01D for ; Tue, 10 May 2022 10:33:45 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B3633954444 for ; Tue, 10 May 2022 14:33:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B3633954444 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1652193225; bh=jn2K5AcoNWpvwTRv7JQ4qVj4HZbSEGOE/4L+kAidoqA=; 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=mPDMasCb8pIrGGrGyXHZef8zArCFsWgv6wg4GdmNnjI6rTS85FROQPPAEQtag05vk xYyJTXL2ycC1DeSsdhab5DpbBBg0B9nXV1VB70GtLuzbZOe9b7Bhyv3MKDWDs346Uz OSuxY5AfyJ0aqQvpOSz8HFCQ8DIEMstaQt9R6ktY= Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by sourceware.org (Postfix) with ESMTPS id 3D0D3395440F for ; Tue, 10 May 2022 14:26:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D0D3395440F X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="256926274" X-IronPort-AV: E=Sophos;i="5.91,214,1647327600"; d="scan'208";a="256926274" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 07:26:03 -0700 X-IronPort-AV: E=Sophos;i="5.91,214,1647327600"; d="scan'208";a="711043324" Received: from labpcdell3650-003.iul.intel.com (HELO localhost) ([172.28.49.87]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 07:26:01 -0700 To: gdb-patches@sourceware.org Subject: [PATCH 17/18] gdb, testsuite, fortran: fixup mixed-lang-stack for Intel/LLVM compilers Date: Tue, 10 May 2022 16:24:36 +0200 Message-Id: <20220510142437.1397399-18-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" When value-printing a pointer within GDB by default GDB will look for defined symbols residing at the address of the pointer. For the given test the Intel/LLVM compiler stacks both display a symbol associated with a printed pointer while the gnu stack does not. This leads to failures in the test when running the test with CC_FOR_TARGET='clang' CXX_FOR_TARGET='clang' F90_FOR_TARGET='flang'" (gdb) b 37 (gdb) r (gdb) f 6 (gdb) info args a = 1 b = 2 c = 3 d = 4 + 5i f = 0x419ed0 "abcdef" g = 0x4041a0 <.BSS4> or CC_FOR_TARGET='icx' CXX_FOR_TARGET='icpx' F90_FOR_TARGET='ifx'" (gdb) b 37 (gdb) r (gdb) f 6 (gdb) info args a = 1 b = 2 c = 3 d = 4 + 5i f = 0x52eee0 "abcdef" g = 0x4ca210 For the compiled binary the Intel/LLVM compilers both decide to move the local variable g into the .bss section of their executable. The gnu stack will keep the variable locally on the stack and not define a symbol for it. Since the behavior for Intel/LLVM is actually expected I adapted the testcase at this point to be a bit more allowing for other outputs. I added the optional "" to the regex testing for g. The given changes reduce the test fails for Intel/LLVM stack by 4 each. --- .../gdb.fortran/mixed-lang-stack.exp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp index eace4d439b..5bed3be869 100644 --- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp +++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp @@ -129,22 +129,29 @@ proc run_tests { lang } { set f_pattern "$hex \"abcdef\"" } + # When value-printing pointers in GDB, GDB will try and look for any + # associated symbol and print it after the pointer as "". For + # this test Intel and LLVM compilers move g to the .bss section, thus + # creating a symbol, while the GNU compiler stack keeps g purely on the + # stack. + set g_pattern "$hex\( <\[^\r\n\]+>\)?" + set args_pattern [multi_line \ "a = 1" \ "b = 2" \ "c = 3" \ "d = ${d_pattern}" \ "f = ${f_pattern}" \ - "g = $hex" ] + "g = ${g_pattern}" ] gdb_test "info args" $args_pattern \ "info args in frame #6" if { $lang == "fortran" } { - set g_pattern " = \\( a = 1\\.5, b = 2\\.5 \\)" + set g_val_pattern " = \\( a = 1\\.5, b = 2\\.5 \\)" } else { - set g_pattern " = \\{a = 1\\.5, b = 2\\.5\\}" + set g_val_pattern " = \\{a = 1\\.5, b = 2\\.5\\}" } - gdb_test "print *g" "${g_pattern}" \ + gdb_test "print *g" "${g_val_pattern}" \ "print object pointed to by g" gdb_test "up" "#7\\s+$hex in mixed_func_1b .*" \ @@ -155,11 +162,11 @@ proc run_tests { lang } { if { $lang == "c" || $lang == "c++" } { set d_pattern "4 \\+ 5i" set e_pattern "\"abcdef\"" - set g_pattern "\{a = 1.5, b = 2.5\}" + set g_val_pattern "\{a = 1.5, b = 2.5\}" } else { set d_pattern "\\(4,5\\)" set e_pattern "'abcdef'" - set g_pattern "\\( a = 1.5, b = 2.5 \\)" + set g_val_pattern "\\( a = 1.5, b = 2.5 \\)" } set args_pattern [multi_line \ @@ -168,7 +175,7 @@ proc run_tests { lang } { "c = 3" \ "d = ${d_pattern}" \ "e = ${e_pattern}" \ - "g = ${g_pattern}" \ + "g = ${g_val_pattern}" \ "_e = 6" ] gdb_test "info args" $args_pattern \ -- 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