From patchwork Wed Jun 19 16:06:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 33218 Received: (qmail 17656 invoked by alias); 19 Jun 2019 16:06:50 -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 17509 invoked by uid 89); 19 Jun 2019 16:06:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=Near X-HELO: mailsec117.isp.belgacom.be Received: from mailsec117.isp.belgacom.be (HELO mailsec117.isp.belgacom.be) (195.238.20.113) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Jun 2019 16:06:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1560960405; x=1592496405; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nPwKfIs26xSwTkWMmAv3NQImLDfW2yVi4WwlKF6dLjQ=; b=NYoS5O8AJDXqp/zb5x9SvlaHI6MHdco05pwEzRAWRLg+bmHmEQxqzZq+ L5ZhGQpopbPeBMGAWx439uA3KFHorw==; Received: from 96.218-128-109.adsl-dyn.isp.belgacom.be (HELO md.home) ([109.128.218.96]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 19 Jun 2019 18:06:35 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFAv3 2/3] Test 'set print frame-info|frame-arguments presence'. Date: Wed, 19 Jun 2019 18:06:26 +0200 Message-Id: <20190619160627.12531-3-philippe.waroquiers@skynet.be> In-Reply-To: <20190619160627.12531-1-philippe.waroquiers@skynet.be> References: <20190619160627.12531-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes Updated tests to test the new options and new values. Test the default for print_what in python frame filtering. Updated the tests impacted by the default in python frame filtering which is now consistent with the backtrace command. gdb/testsuite/ChangeLog 2019-06-19 Philippe Waroquiers * gdb.base/options.exp: Update backtrace - completion to new option -frame-info. * gdb.base/frame-args.exp: Test new 'frame-arguments presence'. Test new 'set print frame-info'. Test backtrace -frame-info overriding 'set print frame-info'. * gdb.python/py-framefilter.exp: Test new 'frame-arguments presence'. Test new 'set print frame-info'. Verify consistency of backtrace with and without filters, with and without -no-filters. * gdb.python/py-framefilter-invalidarg.exp: Update to new print_what default. --- gdb/testsuite/gdb.base/frame-args.exp | 60 ++++++++++++++++ gdb/testsuite/gdb.base/options.exp | 1 + .../gdb.python/py-framefilter-invalidarg.exp | 2 +- gdb/testsuite/gdb.python/py-framefilter.exp | 72 +++++++++++++++++-- 4 files changed, 130 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.base/frame-args.exp b/gdb/testsuite/gdb.base/frame-args.exp index 77f136c064..71115a020a 100644 --- a/gdb/testsuite/gdb.base/frame-args.exp +++ b/gdb/testsuite/gdb.base/frame-args.exp @@ -50,4 +50,64 @@ gdb_test "frame 1" \ ".*in call_me \\(i=\\.\\.\\., f=\\.\\.\\., s=\\.\\.\\., ss=\\.\\.\\., u=\\.\\.\\., e=\\.\\.\\.\\) at .*frame-args\\.c:.*" \ "frame 1 with print frame-arguments set to none" +# Test with "print frame-arguments" set to "presence" +gdb_test_no_output "set print frame-arguments presence" \ + "set print frame-arguments presence" +gdb_test "frame 1" \ + ".*in call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*" \ + "frame 1 with print frame-arguments set to presence" +gdb_test "frame 2" \ + ".*in main \\(\\) at .*frame-args\\.c:.*" \ + "frame 2 (no args) with print frame-arguments set to presence" + + +# Test with "print frame-info" set to "location-and-address" +gdb_test_no_output "set print frame-info location-and-address" \ + "set print frame-info location-and-address" +gdb_test "frame 1" \ + ".*0x.* in call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*" \ + "frame 1 with print frame-info set to location-and-address" + +# Test with "print address" set to "off" ... +gdb_test_no_output "set print address off" \ + "set print address off" + +# ... and "location-and-address" (previously set) +gdb_test "frame 1" \ + "#1 call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*" \ + "frame 1 with print frame-info set to location-and-address and address off" + +# ... and "location" +gdb_test_no_output "set print frame-info location" \ + "set print frame-info location" +gdb_test "frame 1" \ + "#1 call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*" \ + "frame 1 with print frame-info set to location and address off" + +# ... and "short-location" +gdb_test_no_output "set print frame-info short-location" \ + "set print frame-info short-location" +gdb_test "frame 1" \ + "#1 call_me \\(\\.\\.\\.\\)" \ + "frame 1 with print frame-info set to short-location and address off" + +# ... and "source-and-location" +gdb_test_no_output "set print frame-info source-and-location" \ + "set print frame-info source-and-location" +gdb_test "frame 1" \ + "#1 call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*\r\n\[1-9\]\[0-9\]*\[ \t\]*break_me \\(\\);" \ + "frame 1 with print frame-info set to source-and-location and address off" + +# ... and "source-line". +gdb_test_no_output "set print frame-info source-line" \ + "set print frame-info source-line" +gdb_test "frame 1" \ + "\[1-9\]\[0-9\]*\[ \t\]*break_me \\(\\);" \ + "frame 1 with print frame-info set to source-line and address off" + + +# Verify overriding of the global setting by the backtrace -frame-info option. +gdb_test "backtrace -frame-info source-and-location 2" \ + ".*\r\n.*\r\n#1 call_me \\(\\.\\.\\.\\) at .*frame-args\\.c:.*\r\n\[1-9\]\[0-9\]*\[ \t\]*break_me \\(\\);.*" \ + "backtrace -frame-info source-and-location 2 overriding print frame-info set to source-line" diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp index 4570c2a93d..17efa2a651 100644 --- a/gdb/testsuite/gdb.base/options.exp +++ b/gdb/testsuite/gdb.base/options.exp @@ -253,6 +253,7 @@ proc_with_prefix test-backtrace {} { test_gdb_complete_multiple "backtrace " "-" "" { "-entry-values" "-frame-arguments" + "-frame-info" "-full" "-hide" "-no-filters" diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp index 8d5fb72f2a..2213bcffb2 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp +++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp @@ -63,4 +63,4 @@ set remote_python_file [gdb_remote_download host \ ${srcdir}/${subdir}/${testfile}.py] gdb_test_no_output "source ${remote_python_file}" "load python file" -gdb_test "bt" " in niam \\(argc=, argv=0x\[0-9a-f\]+\\) at py-framefilter-invalidarg.c:\[0-9\]+" "bt full with filters" +gdb_test "bt" "niam \\(argc=, argv=0x\[0-9a-f\]+\\) at py-framefilter-invalidarg.c:\[0-9\]+" "bt full with filters" diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp index a88e37f8c2..e3aed24c16 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.exp +++ b/gdb/testsuite/gdb.python/py-framefilter.exp @@ -60,11 +60,26 @@ if ![runto_main] then { gdb_test_no_output "set python print-stack full" \ "set python print-stack to full" +# Verify that 'bt', 'bt -no-filters' print the same info +# when there are no filters, no matching filters, or matching filters. +# In particular, no address should be printed, as the default for +# backtrace -frame-info is 'location', and the breakpoint we just hit +# is at the beginning of a line. +# Same tests done again after having loaded the filters. +gdb_test "bt 1" "#0 main .*" "bt 1, no filter loaded" +gdb_test "bt -no-filters 1" "#0 main .*" "bt -no-filters 1, no filter loaded" + + # Load global frame-filters set remote_python_file [gdb_remote_download host \ ${srcdir}/${subdir}/${testfile}.py] gdb_test_no_output "source ${remote_python_file}" "load python file" +# Re-verify the frame-info printed once filters are loaded. +# For the first check, the Reverse filter is matching. +gdb_test "bt 1" "#0 niam .*" "bt 1, filters loaded" +gdb_test "bt -no-filters 1" "#0 main .*" "bt -no-filters 1, filters loaded" + gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"] gdb_breakpoint [gdb_get_line_number "Inner test breakpoint"] gdb_continue_to_breakpoint "Inner test breakpoint" @@ -161,6 +176,10 @@ gdb_test "bt full hide" \ ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\)\[^#\]*#24.*in func3 \\(i=3\\).*" \ "bt full hide with Reverse disabled" +# Re-enable Reverse +gdb_test_no_output "enable frame-filter global Reverse" \ + "re-enable frame-filter global Reverse" + # Test set print frame-arguments # none gdb_test_no_output "set print frame-arguments none" \ @@ -169,7 +188,7 @@ gdb_test "bt no-filter 1" \ "#0.*end_func \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \ "bt no-filter 1 no args" gdb_test "bt 1" \ - "#0.*end_func \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \ + "#0.*cnuf_dneThe End \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \ "bt 1 no args" # scalars @@ -179,9 +198,54 @@ gdb_test "bt no-filter 1" \ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \ "bt no-filter 1 scalars" gdb_test "bt 1" \ - "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \ + "#0.*cnuf_dneThe End \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \ "bt 1 scalars" +# presence +gdb_test_no_output "set print frame-arguments presence" \ + "turn frame arguments to presence only" +gdb_test "bt no-filter 1" \ + "#0.*end_func \\(\.\.\.\\) at .*py-framefilter.c.*" \ + "bt no-filter 1 presence" +gdb_test "bt 1" \ + "#0.*cnuf_dneThe End \\(\.\.\.\\) at .*py-framefilter.c.*" \ + "bt 1 presence" + +# Test set print frame-info, with only presence for args. +# short-location +gdb_test_no_output "set print frame-info short-location" \ + "frame-info short-location" +gdb_test "bt no-filter 1" \ + "#0.*end_func \\(\.\.\.\\)\r\n.*" \ + "bt no-filter 1 short-location" +gdb_test "bt 1" \ + "#0.*cnuf_dneThe End \\(\.\.\.\\)\r\n.*" \ + "bt 1 short-location" + +# source-and-location +gdb_test_no_output "set print frame-info source-and-location" \ + "frame-info source-and-location" +gdb_test "bt no-filter 1" \ + "#0.*end_func \\(\.\.\.\\) at .*py-framefilter.c.*\r\n.*\[1-9\]\[0-9\]*.*" \ + "bt no-filter 1 source-and-location" +gdb_test "bt 1" \ + "#0.*cnuf_dneThe End \\(\.\.\.\\) at .*py-framefilter.c.*\r\n.*\[1-9\]\[0-9\]*.*" \ + "bt 1 source-and-location" + +# source-line +gdb_test_no_output "set print frame-info source-line" \ + "frame-info source-line" +gdb_test "bt no-filter 1" \ + "\[1-9\]\[0-9\]*\[ \t\]*return; /\\* Backtrace end breakpoint \\*/.*" \ + "bt no-filter 1 source-line" +gdb_test "bt 1" \ + "\[1-9\]\[0-9\]*\[ \t\]*return; /\\* Backtrace end breakpoint \\*/.*" \ + "bt 1 source-line" + +# set print frame-info back to auto. +gdb_test_no_output "set print frame-info auto" \ + "frame-info auto" + # all gdb_test_no_output "set print frame-arguments all" \ "turn on frame arguments" @@ -189,7 +253,7 @@ gdb_test "bt no-filter 1" \ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ "bt no-filter 1 all args" gdb_test "bt 1" \ - "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ + "#0.*cnuf_dneThe End \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ "bt 1 all args" # set print address off @@ -199,7 +263,7 @@ gdb_test "bt no-filter 1" \ "#0 end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ "bt no-filter 1 no address" gdb_test "bt 1" \ - "#0 end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ + "#0 cnuf_dneThe End \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ "bt 1 no addresss" gdb_test_no_output "set python print-stack message" \