From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7862) id 9375938582BF; Thu, 22 Sep 2022 09:05:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9375938582BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663837504; bh=7usbUaWttfZUS3jQxZKUeTJ1BQniAYxh8cAJeEQ03Sw=; h=From:To:Subject:Date:From; b=L0E3wAqf1BOoM9vpHufZYsUBgjq8UM6Er3JzbF1n8rZCfFtFMoF7QGE+adS3F3Ezw 363BCZT1DvxM4PEN+5FpBLmrQ6joPzTv5Ahcs1crq6ppeBCqTEIkbv1bUnmZukw8xs 2DvqLUYSXRvBi0lZn3r5X00liVrbp7cS7zh/h51s= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Bruno Larsen To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: fix testing gdb.base/skip-inline.exp with clang X-Act-Checkin: binutils-gdb X-Git-Author: Bruno Larsen X-Git-Refname: refs/heads/master X-Git-Oldrev: d5bcff0343ae1a4a8be76fd8646b22f20f9ed94a X-Git-Newrev: 4037b4191a0ed4f8fc51564416519886bc88a1b7 Message-Id: <20220922090504.9375938582BF@sourceware.org> Date: Thu, 22 Sep 2022 09:05:04 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4037b4191a0e= d4f8fc51564416519886bc88a1b7 commit 4037b4191a0ed4f8fc51564416519886bc88a1b7 Author: Bruno Larsen Date: Tue Sep 13 18:56:23 2022 +0200 gdb/testsuite: fix testing gdb.base/skip-inline.exp with clang =20 When testing gdb.base/skip-inline.exp using clang, we get failures when trying to step out of functions, since clang requires one fewer step when compared to gcc. The inferior gets increasingly out of sync as the test continues because of this difference, which generates those failures. =20 This commit fixes this by switching those hardcoded steps to gdb_step_until, to guarantee that the inferior is always synced to what the test expects. This approach does not work for the parts that use step 2 or step 3, so when we identify that clang is being used, those tests are skipped. Diff: --- gdb/testsuite/gdb.base/skip-inline.exp | 107 +++++++++++++++++++----------= ---- 1 file changed, 62 insertions(+), 45 deletions(-) diff --git a/gdb/testsuite/gdb.base/skip-inline.exp b/gdb/testsuite/gdb.bas= e/skip-inline.exp index f6e9926b66c..b7d519e60c1 100644 --- a/gdb/testsuite/gdb.base/skip-inline.exp +++ b/gdb/testsuite/gdb.base/skip-inline.exp @@ -15,6 +15,8 @@ =20 standard_testfile =20 +set epilogue [have_epilogue_line_info] + if { [prepare_for_testing "failed to prepare" "skip-inline" \ {skip-inline.c skip1.c } \ {debug nowarnings}] } { @@ -24,65 +26,80 @@ if { [prepare_for_testing "failed to prepare" "skip-inl= ine" \ set srcfile skip-inline.c set srcfile1 skip1.c =20 -if ![runto_main] { - return -} - -# Create a skiplist entry for a specified file and function. - -gdb_test "skip function foo" "Function foo will be skipped when stepping\." +proc_with_prefix single_step { } { + if ![runto_main] { + return + } =20 -gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" -gdb_test "step" ".*" "step into baz, since foo will be skipped" -gdb_test "bt" "\\s*\\#0\\s+baz.*" "in the baz, since foo was skipped" -gdb_test "step" ".*" "step in the baz" -gdb_test "bt" "\\s*\\#0\\s+baz.*" "still in the baz" -gdb_test "step" ".*" "step back to main" -gdb_test "bt" "\\s*\\#0\\s+main.*" "again in the main" -gdb_test "step" ".*" "step again into baz, since foo will be skipped" -gdb_test "bt" "\\s*\\#0\\s+baz.*" "again in the baz" -gdb_test "step" ".*" "step in the baz, again" -gdb_test "bt" "\\s*\\#0\\s+baz.*" "still in the baz, again" -gdb_test "step" ".*" "step back to main, again" -gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main" - -if ![runto_main] { - return -} - -with_test_prefix "double step" { gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" - gdb_test "step 2" ".*" "step into baz, since foo will be skipped" - gdb_test "bt" "\\s*\\#0\\s+baz.*" "still in the baz" - gdb_test "step" ".*" "step back to main" + gdb_test "step" ".*" "step into baz, since foo will be skipped" + gdb_test "bt" "\\s*\\#0\\s+baz.*" "in the baz, since foo was skipped" + gdb_step_until ".*x =3D 0; x =3D baz \\(foo \\(\\)\\).*" gdb_test "bt" "\\s*\\#0\\s+main.*" "again in the main" - gdb_test "step 2" ".*" "step again into baz, since foo will be skipped" + gdb_test "step" ".*" "step again into baz, since foo will be skipped" gdb_test "bt" "\\s*\\#0\\s+baz.*" "again in the baz" - gdb_test "step" ".*" "step back to main, again" - gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main" + gdb_step_until "main \\(\\) at .*" "step back to main, again" + gdb_test "bt" "\\s*\\#0.*main.*" "again back to main" } =20 -if ![runto_main] { - return -} +proc_with_prefix double_step { } { + if ![runto_main] { + return + } =20 -with_test_prefix "triple step" { - gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" - gdb_test "step 3" ".*" "step over baz" - gdb_test "bt" "\\s*\\#0\\s+main.*" "again in the main" - gdb_test "step 3" ".*" "step over baz, again" - gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main" + with_test_prefix "double step" { + gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" + gdb_test "step 2" ".*" "step into baz, since foo will be skipped" + gdb_test "bt" "\\s*\\#0\\s+baz.*" "still in the baz" + gdb_test "step" ".*" "step back to main" + gdb_test "bt" "\\s*\\#0\\s+main.*" "again in the main" + gdb_test "step 2" ".*" "step again into baz, since foo will be skipped" + gdb_test "bt" "\\s*\\#0\\s+baz.*" "again in the baz" + gdb_test "step" ".*" "step back to main, again" + gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main" + } } =20 -if ![runto_main] { - return +proc_with_prefix triple_step { } { + if ![runto_main] { + return + } + + with_test_prefix "triple step" { + gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" + gdb_test "step 3" ".*" "step over baz" + gdb_test "bt" "\\s*\\#0\\s+main.*" "again in the main" + gdb_test "step 3" ".*" "step over baz, again" + gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main" + } } =20 -gdb_test "skip delete" ".*" "skip delete" +proc_with_prefix skip_current_frame { } { + if ![runto_main] { + return + } + + gdb_test "skip delete" ".*" "skip delete" =20 -with_test_prefix "skip current frame" { gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" gdb_test "step" ".*" "step into foo" gdb_test "bt" "\\s*\\#0\\s+foo.*" "in the foo" gdb_test "skip" "Function foo will be skipped when stepping\." "skip" } + +# Create a skiplist entry for a specified file and function. + +gdb_test "skip function foo" "Function foo will be skipped when stepping\." + +single_step + +# Some compilers link the epilogue of functions to the line containing the +# closing brace, while others dont. The behavior ends up so out of sync +# with multiple steps at a time, that completely different procs would need +# to be made, and it is frankly unnecessary. +if {$epilogue} { + double_step + triple_step +} + +skip_current_frame