From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7876) id 60614395A027; Tue, 31 May 2022 14:46:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60614395A027 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nils-Christian Kempke To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb, testsuite, fortran: fixup mixed-lang-stack for Intel/LLVM compilers X-Act-Checkin: binutils-gdb X-Git-Author: Nils-Christian Kempke X-Git-Refname: refs/heads/master X-Git-Oldrev: a60ead5ded5f9fc548018637d4810cb5f313ad8c X-Git-Newrev: 0df017fbca3070682ffa62a3b302a30e028adfb6 Message-Id: <20220531144624.60614395A027@sourceware.org> Date: Tue, 31 May 2022 14:46:24 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2022 14:46:24 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0df017fbca30= 70682ffa62a3b302a30e028adfb6 commit 0df017fbca3070682ffa62a3b302a30e028adfb6 Author: Nils-Christian Kempke Date: Tue May 31 16:43:45 2022 +0200 gdb, testsuite, fortran: fixup mixed-lang-stack for Intel/LLVM compilers =20 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=3D'clang' CXX_FOR_TARGET=3D'clang' F90_FOR_TARGET=3D'flang'" =20 (gdb) b 37 (gdb) r (gdb) f 6 (gdb) info args a =3D 1 b =3D 2 c =3D 3 d =3D 4 + 5i f =3D 0x419ed0 "abcdef" g =3D 0x4041a0 <.BSS4> =20 or CC_FOR_TARGET=3D'icx' CXX_FOR_TARGET=3D'icpx' F90_FOR_TARGET=3D'ifx'" =20 (gdb) b 37 (gdb) r (gdb) f 6 (gdb) info args a =3D 1 b =3D 2 c =3D 3 d =3D 4 + 5i f =3D 0x52eee0 "abcdef" g =3D 0x4ca210 =20 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. =20 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. =20 The given changes reduce the test fails for Intel/LLVM stack by 4 each. Diff: --- gdb/testsuite/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 eace4d439bd..5bed3be8697 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\"" } =20 + # 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 =3D 1" \ "b =3D 2" \ "c =3D 3" \ "d =3D ${d_pattern}" \ "f =3D ${f_pattern}" \ - "g =3D $hex" ] + "g =3D ${g_pattern}" ] =20 gdb_test "info args" $args_pattern \ "info args in frame #6" if { $lang =3D=3D "fortran" } { - set g_pattern " =3D \\( a =3D 1\\.5, b =3D 2\\.5 \\)" + set g_val_pattern " =3D \\( a =3D 1\\.5, b =3D 2\\.5 \\)" } else { - set g_pattern " =3D \\{a =3D 1\\.5, b =3D 2\\.5\\}" + set g_val_pattern " =3D \\{a =3D 1\\.5, b =3D 2\\.5\\}" } - gdb_test "print *g" "${g_pattern}" \ + gdb_test "print *g" "${g_val_pattern}" \ "print object pointed to by g" =20 gdb_test "up" "#7\\s+$hex in mixed_func_1b .*" \ @@ -155,11 +162,11 @@ proc run_tests { lang } { if { $lang =3D=3D "c" || $lang =3D=3D "c++" } { set d_pattern "4 \\+ 5i" set e_pattern "\"abcdef\"" - set g_pattern "\{a =3D 1.5, b =3D 2.5\}" + set g_val_pattern "\{a =3D 1.5, b =3D 2.5\}" } else { set d_pattern "\\(4,5\\)" set e_pattern "'abcdef'" - set g_pattern "\\( a =3D 1.5, b =3D 2.5 \\)" + set g_val_pattern "\\( a =3D 1.5, b =3D 2.5 \\)" } =20 set args_pattern [multi_line \ @@ -168,7 +175,7 @@ proc run_tests { lang } { "c =3D 3" \ "d =3D ${d_pattern}" \ "e =3D ${e_pattern}" \ - "g =3D ${g_pattern}" \ + "g =3D ${g_val_pattern}" \ "_e =3D 6" ] =20 gdb_test "info args" $args_pattern \