From patchwork Thu Jul 25 09:03:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 33794 Received: (qmail 115840 invoked by alias); 25 Jul 2019 09:03:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 115823 invoked by uid 89); 25 Jul 2019 09:03:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=ok, catchcatch, 24830, portions X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Jul 2019 09:03:31 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BA57BACD1; Thu, 25 Jul 2019 09:03:28 +0000 (UTC) Date: Thu, 25 Jul 2019 11:03:27 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH][gdb/testsuite] Test skip_libstdcxx_probe_tests in mi-catch-cpp-exceptions.exp Message-ID: <20190725090326.GA19297@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, On a system without SDT probes in libstdc++, we run into: ... FAIL: gdb.mi/mi-catch-cpp-exceptions.exp: all with invalid regexp: run until \ breakpoint in main (unknown output after running) ... The test-case uses a regexp argument for the catch throw/rethrow/catch command, which is only supported on systems with SDT probes in libstdc++. Fix this by marking the portions of the test-case that use a regexp argument as unsupported on a system without SDT probes. Tested on x86_64-linux. OK for trunk? Thanks, - Tom [gdb/testsuite] Test skip_libstdcxx_probe_tests in mi-catch-cpp-exceptions.exp gdb/testsuite/ChangeLog: 2019-07-25 Tom de Vries PR testsuite/24830 * gdb.mi/mi-catch-cpp-exceptions.exp: Call mi_skip_libstdcxx_probe_tests, and skip unsupported tests. * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Factor out of ... (skip_libstdcxx_probe_tests): ... here. * lib/mi-support.exp (mi_skip_libstdcxx_probe_tests): New proc. --- gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp | 99 +++++++++++++++--------- gdb/testsuite/lib/gdb.exp | 17 ++-- gdb/testsuite/lib/mi-support.exp | 7 ++ 3 files changed, 79 insertions(+), 44 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp index 9b64fb14f2..029dc1bd02 100644 --- a/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp +++ b/gdb/testsuite/gdb.mi/mi-catch-cpp-exceptions.exp @@ -27,6 +27,17 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb return -1 } +if [mi_gdb_start] { + continue +} +mi_delete_breakpoints +mi_gdb_reinitialize_dir $srcdir/$subdir +mi_gdb_load ${binfile} +if {![mi_run_to_main]} { + return -1 +} +set libstdcxx_probe_tests_supported [mi_skip_libstdcxx_probe_tests] + # Grab some line numbers we'll need. set catch_1_lineno [gdb_get_line_number "Catch 1"] set catch_2_lineno [gdb_get_line_number "Catch 2"] @@ -123,36 +134,44 @@ with_test_prefix "-catch-catch" { continue_to_breakpoint_in_main } -# Now check that all of the command with a regexp that doesn't match, -# don't trigger. -with_test_prefix "all with invalid regexp" { - restart_for_test - setup_catchpoint "throw" "-r blahblah" - setup_catchpoint "rethrow" "-r woofwoof" - setup_catchpoint "catch" "-r miowmiow" - continue_to_breakpoint_in_main +if { $libstdcxx_probe_tests_supported == 1 } { + # Now check that all of the command with a regexp that doesn't match, + # don't trigger. + with_test_prefix "all with invalid regexp" { + restart_for_test + setup_catchpoint "throw" "-r blahblah" + setup_catchpoint "rethrow" "-r woofwoof" + setup_catchpoint "catch" "-r miowmiow" + continue_to_breakpoint_in_main + } +} else { + unsupported "all with invalid regexp" } -# Now check that all of the commands with a regexp that does match, -# still trigger. -with_test_prefix "all with valid regexp" { - restart_for_test - setup_catchpoint "throw" "-r my_ex" - setup_catchpoint "rethrow" "-r _except" - setup_catchpoint "catch" "-r my_exception" - continue_to_next_exception "bar" "${throw_1_lineno}" "throw 1" - continue_to_next_exception "foo" "${catch_1_lineno}" "catch 1" - continue_to_next_exception "bar" "${throw_1_lineno}" "throw 2" - continue_to_next_exception "foo" "${catch_1_lineno}" "catch 2" - continue_to_next_exception "foo" "${throw_2_lineno}" "rethrow 1" - continue_to_next_exception "main" "${catch_2_lineno}" "catch 3" - continue_to_next_exception "bar" "${throw_1_lineno}" "throw 3" - continue_to_next_exception "foo" "${catch_1_lineno}" "catch 4" - continue_to_next_exception "bar" "${throw_1_lineno}" "throw 4" - continue_to_next_exception "foo" "${catch_1_lineno}" "catch 5" - continue_to_next_exception "foo" "${throw_2_lineno}" "rethrow 2" - continue_to_next_exception "main" "${catch_2_lineno}" "catch 6" - continue_to_breakpoint_in_main +if { $libstdcxx_probe_tests_supported == 1 } { + # Now check that all of the commands with a regexp that does match, + # still trigger. + with_test_prefix "all with valid regexp" { + restart_for_test + setup_catchpoint "throw" "-r my_ex" + setup_catchpoint "rethrow" "-r _except" + setup_catchpoint "catch" "-r my_exception" + continue_to_next_exception "bar" "${throw_1_lineno}" "throw 1" + continue_to_next_exception "foo" "${catch_1_lineno}" "catch 1" + continue_to_next_exception "bar" "${throw_1_lineno}" "throw 2" + continue_to_next_exception "foo" "${catch_1_lineno}" "catch 2" + continue_to_next_exception "foo" "${throw_2_lineno}" "rethrow 1" + continue_to_next_exception "main" "${catch_2_lineno}" "catch 3" + continue_to_next_exception "bar" "${throw_1_lineno}" "throw 3" + continue_to_next_exception "foo" "${catch_1_lineno}" "catch 4" + continue_to_next_exception "bar" "${throw_1_lineno}" "throw 4" + continue_to_next_exception "foo" "${catch_1_lineno}" "catch 5" + continue_to_next_exception "foo" "${throw_2_lineno}" "rethrow 2" + continue_to_next_exception "main" "${catch_2_lineno}" "catch 6" + continue_to_breakpoint_in_main + } +} else { + unsupported "all with valid regexp" } # Check that the temporary switch works on its own. @@ -167,14 +186,18 @@ with_test_prefix "all with -t" { continue_to_breakpoint_in_main } -# Check that the temporary switch works when used with a regexp. -restart_for_test -with_test_prefix "all with -t and regexp" { - setup_catchpoint "throw" "-t -r my_ex" - setup_catchpoint "rethrow" "-t -r _except" - setup_catchpoint "catch" "-t -r my_exception" - continue_to_next_exception "bar" "${throw_1_lineno}" "throw 1" - continue_to_next_exception "foo" "${catch_1_lineno}" "catch 1" - continue_to_next_exception "foo" "${throw_2_lineno}" "rethrow 1" - continue_to_breakpoint_in_main +if { $libstdcxx_probe_tests_supported == 1 } { + # Check that the temporary switch works when used with a regexp. + restart_for_test + with_test_prefix "all with -t and regexp" { + setup_catchpoint "throw" "-t -r my_ex" + setup_catchpoint "rethrow" "-t -r _except" + setup_catchpoint "catch" "-t -r my_exception" + continue_to_next_exception "bar" "${throw_1_lineno}" "throw 1" + continue_to_next_exception "foo" "${catch_1_lineno}" "catch 1" + continue_to_next_exception "foo" "${throw_2_lineno}" "rethrow 1" + continue_to_breakpoint_in_main + } +} else { + unsupported "all with -t and regexp" } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 49ec8b2a55..54cee2ec41 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3104,22 +3104,27 @@ proc skip_unwinder_tests {} { # Return 0 if we should skip tests that require the libstdc++ stap # probes. This must be invoked while gdb is running, after shared -# libraries have been loaded. - -proc skip_libstdcxx_probe_tests {} { - global gdb_prompt +# libraries have been loaded. PROMPT_REGEXP is the expected prompt. +proc skip_libstdcxx_probe_tests_prompt { prompt_regexp } { set ok 0 gdb_test_multiple "info probe" "check for stap probe in libstdc++" { - -re ".*libstdcxx.*catch.*\r\n$gdb_prompt $" { + -re ".*libstdcxx.*catch.*\r\n$prompt_regexp" { set ok 1 } - -re "\r\n$gdb_prompt $" { + -re "\r\n$prompt_regexp" { } } return $ok } +# As skip_libstdcxx_probe_tests_prompt, with gdb_prompt. + +proc skip_libstdcxx_probe_tests {} { + global gdb_prompt + return [skip_libstdcxx_probe_tests_prompt "$gdb_prompt $"] +} + # Return 1 if we should skip tests of the "compile" feature. # This must be invoked after the inferior has been started. diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 8c2c7c84ed..dcb472b1d6 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -2601,6 +2601,13 @@ proc mi_skip_python_tests {} { return [skip_python_tests_prompt "$mi_gdb_prompt$"] } +# As skip_libstdcxx_probe_tests_prompt, with mi_gdb_prompt. + +proc mi_skip_libstdcxx_probe_tests {} { + global mi_gdb_prompt + return [skip_libstdcxx_probe_tests_prompt "$mi_gdb_prompt$"] +} + # Check whether we're testing with the remote or extended-remote # targets.