From patchwork Fri Mar 20 12:18:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 5718 Received: (qmail 83148 invoked by alias); 20 Mar 2015 12:18:30 -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 83130 invoked by uid 89); 20 Mar 2015 12:18:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 20 Mar 2015 12:18:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 7456F2D0AF07; Fri, 20 Mar 2015 13:18:21 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XdicnARC4_4a; Fri, 20 Mar 2015 13:18:21 +0100 (CET) Received: from [10.10.1.112] (cacatoes.act-europe.fr [10.10.1.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 392C82D0AEFF; Fri, 20 Mar 2015 13:18:21 +0100 (CET) Message-ID: <550C100D.5000500@adacore.com> Date: Fri, 20 Mar 2015 13:18:21 +0100 From: Pierre-Marie de Rodat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Joel Brobecker , Pedro Alves CC: GDB Patches Subject: Re: [PATCH] Share the "multi_line" helper among all Ada testcases References: <54FEDB92.9060808@adacore.com> <20150317200809.GD7494@adacore.com> <5509492C.5000604@redhat.com> <20150318141238.GE7494@adacore.com> In-Reply-To: <20150318141238.GE7494@adacore.com> X-IsSubscribed: yes On 03/18/2015 03:12 PM, Joel Brobecker wrote: >> How about making multi_line join with strict "\r\n" too? Then if >> you need to match one empty line, you can do: >> >> [multi_line "line1" \ >> "" >> "line3"] >> >> and if you need multiple, you can always do: >> >> [multi_line "line1" \ >> "\[\r\n\]*" >> "lineNN"] > > Very good suggestion, I like it! Pierre-Marie? I do like it too: thank you for the suggestion! Here is the updated patch: I moved multi_line to gdb.exp, updated it according to what you said and updated all testcases matching "[join [list" to use it. The good news is that it seems no testcase actually needs the [\r\n]* laxism. Still no regression (tested on x86_64-linux). gdb/testsuite/ChangeLog: 2015-03-20 Pierre-Marie de Rodat * gdb.ada/complete.exp: Remove "multi_line". * gdb.ada/info_exc.exp: Remove "multi_line". * gdb.ada/packed_tagged.exp: Remove "multi_line". * gdb.ada/ptype_field.exp: Remove "multi_line". * gdb.ada/sym_print_name.exp: Remove "multi_line". * gdb.ada/tagged.exp: Remove "multi_line". * gdb.btrace/buffer-size.exp: Replace [join [list ...]] with [multi_line ...] * gdb.btrace/delta.exp: Likewise. * gdb.btrace/exception.exp: Likewise. * gdb.btrace/finish.exp: Likewise. * gdb.btrace/function_call_history.exp: Likewise. * gdb.btrace/instruction_history.exp: Likewise. * gdb.btrace/next.exp: Likewise. * gdb.btrace/nexti.exp: Likewise. * gdb.btrace/nohist.exp: Likewise. * gdb.btrace/record_goto.exp: Likewise. * gdb.btrace/segv.exp: Likewise. * gdb.btrace/step.exp: Likewise. * gdb.btrace/stepi.exp: Likewise. * gdb.btrace/tailcall.exp: Likewise. * gdb.btrace/unknown_functions.exp: Likewise. * gdb.dwarf2/dw2-undefined-ret-addr.exp: Likewise. * lib/gdb.exp: Add the "multi_line" helper. From cd542150b7b4814107dc8c7b8a66405c454f5f7d Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Tue, 10 Mar 2015 09:51:27 +0100 Subject: [PATCH] Share the "multi_line" helper among all testcases gdb/testsuite/ChangeLog: 2015-03-20 Pierre-Marie de Rodat * gdb.ada/complete.exp: Remove "multi_line". * gdb.ada/info_exc.exp: Remove "multi_line". * gdb.ada/packed_tagged.exp: Remove "multi_line". * gdb.ada/ptype_field.exp: Remove "multi_line". * gdb.ada/sym_print_name.exp: Remove "multi_line". * gdb.ada/tagged.exp: Remove "multi_line". * gdb.btrace/buffer-size.exp: Replace [join [list ...]] with [multi_line ...] * gdb.btrace/delta.exp: Likewise. * gdb.btrace/exception.exp: Likewise. * gdb.btrace/finish.exp: Likewise. * gdb.btrace/function_call_history.exp: Likewise. * gdb.btrace/instruction_history.exp: Likewise. * gdb.btrace/next.exp: Likewise. * gdb.btrace/nexti.exp: Likewise. * gdb.btrace/nohist.exp: Likewise. * gdb.btrace/record_goto.exp: Likewise. * gdb.btrace/segv.exp: Likewise. * gdb.btrace/step.exp: Likewise. * gdb.btrace/stepi.exp: Likewise. * gdb.btrace/tailcall.exp: Likewise. * gdb.btrace/unknown_functions.exp: Likewise. * gdb.dwarf2/dw2-undefined-ret-addr.exp: Likewise. * lib/gdb.exp: Add the "multi_line" helper. --- gdb/testsuite/gdb.ada/complete.exp | 10 ---- gdb/testsuite/gdb.ada/info_exc.exp | 11 ----- gdb/testsuite/gdb.ada/packed_tagged.exp | 11 ----- gdb/testsuite/gdb.ada/ptype_field.exp | 11 ----- gdb/testsuite/gdb.ada/sym_print_name.exp | 11 ----- gdb/testsuite/gdb.ada/tagged.exp | 11 ----- gdb/testsuite/gdb.btrace/buffer-size.exp | 8 ++-- gdb/testsuite/gdb.btrace/delta.exp | 16 +++---- gdb/testsuite/gdb.btrace/exception.exp | 8 ++-- gdb/testsuite/gdb.btrace/finish.exp | 4 +- gdb/testsuite/gdb.btrace/function_call_history.exp | 44 ++++++++--------- gdb/testsuite/gdb.btrace/instruction_history.exp | 16 +++---- gdb/testsuite/gdb.btrace/next.exp | 8 ++-- gdb/testsuite/gdb.btrace/nexti.exp | 8 ++-- gdb/testsuite/gdb.btrace/nohist.exp | 4 +- gdb/testsuite/gdb.btrace/record_goto.exp | 56 +++++++++++----------- gdb/testsuite/gdb.btrace/segv.exp | 4 +- gdb/testsuite/gdb.btrace/step.exp | 8 ++-- gdb/testsuite/gdb.btrace/stepi.exp | 8 ++-- gdb/testsuite/gdb.btrace/tailcall.exp | 12 ++--- gdb/testsuite/gdb.btrace/unknown_functions.exp | 8 ++-- .../gdb.dwarf2/dw2-undefined-ret-addr.exp | 4 +- gdb/testsuite/lib/gdb.exp | 11 +++++ 23 files changed, 119 insertions(+), 173 deletions(-) diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/complete.exp index 1dc9cba..9919bdf 100644 --- a/gdb/testsuite/gdb.ada/complete.exp +++ b/gdb/testsuite/gdb.ada/complete.exp @@ -44,16 +44,6 @@ proc test_gdb_no_completion { expr } { gdb_test_no_output "complete p $expr" } -# A convenience function that joins all the arguments together, -# with a regexp that matches zero-or-more end of lines in between -# each argument. This function is ideal to write the expected output -# of a GDB command that generates more than a couple of lines, as -# this allows us to write each line as a separate string, which is -# easier to read by a human being. - -proc multi_line { args } { - return [join $args "\[\r\n\]*"] -} # Try a global variable, only one match should be found: test_gdb_complete "my_glob" \ diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp index 3f21218..add83c5 100644 --- a/gdb/testsuite/gdb.ada/info_exc.exp +++ b/gdb/testsuite/gdb.ada/info_exc.exp @@ -21,17 +21,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } return -1 } -# A convenience function that joins all the arguments together, -# with a regexp that matches zero-or-more end of lines in between -# each argument. This function is ideal to write the expected output -# of a GDB command that generates more than a couple of lines, as -# this allows us to write each line as a separate string, which is -# easier to read by a human being. - -proc multi_line { args } { - return [join $args "\[\r\n\]*"] -} - clean_restart ${testfile} if ![runto_main] then { diff --git a/gdb/testsuite/gdb.ada/packed_tagged.exp b/gdb/testsuite/gdb.ada/packed_tagged.exp index 02e02ea..4187702 100644 --- a/gdb/testsuite/gdb.ada/packed_tagged.exp +++ b/gdb/testsuite/gdb.ada/packed_tagged.exp @@ -21,17 +21,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } return -1 } -# A convenience function that joins all the arguments together, -# with a regexp that matches zero-or-more end of lines in between -# each argument. This function is ideal to write the expected output -# of a GDB command that generates more than a couple of lines, as -# this allows us to write each line as a separate string, which is -# easier to read by a human being. - -proc multi_line { args } { - return [join $args "\[\r\n\]*"] -} - clean_restart ${testfile} set bp_location [gdb_get_line_number "STOP" ${testdir}/comp_bug.adb] diff --git a/gdb/testsuite/gdb.ada/ptype_field.exp b/gdb/testsuite/gdb.ada/ptype_field.exp index caf99ba..b4eb8f6 100644 --- a/gdb/testsuite/gdb.ada/ptype_field.exp +++ b/gdb/testsuite/gdb.ada/ptype_field.exp @@ -21,17 +21,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional return -1 } -# A convenience function that joins all the arguments together, -# with a regexp that matches zero-or-more end of lines in between -# each argument. This function is ideal to write the expected output -# of a GDB command that generates more than a couple of lines, as -# this allows us to write each line as a separate string, which is -# easier to read by a human being. - -proc multi_line { args } { - return [join $args "\[\r\n\]*"] -} - clean_restart ${testfile} set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb] diff --git a/gdb/testsuite/gdb.ada/sym_print_name.exp b/gdb/testsuite/gdb.ada/sym_print_name.exp index c78793e..f942fdf 100644 --- a/gdb/testsuite/gdb.ada/sym_print_name.exp +++ b/gdb/testsuite/gdb.ada/sym_print_name.exp @@ -21,17 +21,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } return -1 } -# A convenience function that joins all the arguments together, -# with a regexp that matches zero-or-more end of lines in between -# each argument. This function is ideal to write the expected output -# of a GDB command that generates more than a couple of lines, as -# this allows us to write each line as a separate string, which is -# easier to read by a human being. - -proc multi_line { args } { - return [join $args "\[\r\n\]*"] -} - clean_restart ${testfile} set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb] diff --git a/gdb/testsuite/gdb.ada/tagged.exp b/gdb/testsuite/gdb.ada/tagged.exp index 9f40a96..f428148 100644 --- a/gdb/testsuite/gdb.ada/tagged.exp +++ b/gdb/testsuite/gdb.ada/tagged.exp @@ -21,17 +21,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } return -1 } -# A convenience function that joins all the arguments together, -# with a regexp that matches zero-or-more end of lines in between -# each argument. This function is ideal to write the expected output -# of a GDB command that generates more than a couple of lines, as -# this allows us to write each line as a separate string, which is -# easier to read by a human being. - -proc multi_line { args } { - return [join $args "\[\r\n\]*"] -} - clean_restart ${testfile} set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb] diff --git a/gdb/testsuite/gdb.btrace/buffer-size.exp b/gdb/testsuite/gdb.btrace/buffer-size.exp index 1f10668..86d8270 100644 --- a/gdb/testsuite/gdb.btrace/buffer-size.exp +++ b/gdb/testsuite/gdb.btrace/buffer-size.exp @@ -35,12 +35,12 @@ gdb_test "show record btrace bts buffer-size" "The record/replay bts buffer size gdb_test_no_output "record btrace bts" gdb_test "show record btrace bts buffer-size" "The record/replay bts buffer size is 1\.\r" "bts buffer size while recording" -gdb_test "info record" [join [list \ +gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: Branch Trace Store\." \ "Buffer size: 4kB\." \ "Recorded 0 instructions in 0 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "info record with small bts buffer" + ] "info record with small bts buffer" gdb_test "record stop" ".*" "stop recording with small bts buffer" gdb_test_no_output "set record btrace bts buffer-size 0" @@ -48,10 +48,10 @@ gdb_test "show record btrace bts buffer-size" "The record/replay bts buffer size gdb_test_no_output "record btrace bts" gdb_test "show record btrace bts buffer-size" "The record/replay bts buffer size is unlimited\.\r" "unlimited bts buffer size while recording" -gdb_test "info record" [join [list \ +gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: Branch Trace Store\." \ "Buffer size: .*\." \ "Recorded 0 instructions in 0 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "info record with unlimited bts buffer" + ] "info record with unlimited bts buffer" gdb_test "record stop" ".*" "stop recording with unlimited bts buffer" diff --git a/gdb/testsuite/gdb.btrace/delta.exp b/gdb/testsuite/gdb.btrace/delta.exp index 38b6e26..98532dc 100644 --- a/gdb/testsuite/gdb.btrace/delta.exp +++ b/gdb/testsuite/gdb.btrace/delta.exp @@ -37,11 +37,11 @@ gdb_test_no_output "record btrace" # we start without trace with_test_prefix "no trace" { - gdb_test "info record" [join [list \ + gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 0 instructions in 0 functions \\\(0 gaps\\\) for .*" \ - ] "\r\n"] + ] gdb_test "record instruction-history" "No trace\." gdb_test "record function-call-history" "No trace\." } @@ -50,11 +50,11 @@ with_test_prefix "no trace" { gdb_test "stepi" proc check_trace {} { - gdb_test "info record" [join [list \ + gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 1 instructions in 1 functions \\\(0 gaps\\\) for .*" \ - ] "\r\n"] + ] gdb_test "record instruction-history /f 1" \ "1\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tmov *\\\$0x0,%eax\r" gdb_test "record function-call-history /c 1" "1\tmain" @@ -71,17 +71,17 @@ with_test_prefix "twice" { # check that we can reverse-stepi that instruction gdb_test "reverse-stepi" -gdb_test "info record" [join [list \ +gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 1 instructions in 1 functions \\\(0 gaps\\\) for .*" \ "Replay in progress\. At instruction 1\." \ - ] "\r\n"] "reverse-stepi" + ] "reverse-stepi" # and back gdb_test "stepi" -gdb_test "info record" [join [list \ +gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 1 instructions in 1 functions \\\(0 gaps\\\) for .*" \ - ] "\r\n"] "and back" + ] "and back" diff --git a/gdb/testsuite/gdb.btrace/exception.exp b/gdb/testsuite/gdb.btrace/exception.exp index 9148eb1..c3f7b87 100755 --- a/gdb/testsuite/gdb.btrace/exception.exp +++ b/gdb/testsuite/gdb.btrace/exception.exp @@ -46,25 +46,25 @@ gdb_continue_to_breakpoint "cont to bp.2" ".*$srcfile:$bp_2\r\n.*" # show the flat branch trace send_gdb "record function-call-history 1\n" gdb_expect_list "flat" "\r\n$gdb_prompt $" [list \ - [join [list \ + [multi_line \ "1\tmain\\(\\)" \ "2\ttest\\(\\)" \ "3\tfoo\\(\\)" \ "4\tbar\\(\\)" \ "5\tbad\\(\\)\r" \ - ] "\r\n"] \ + ] \ "" \ "\[0-9\]*\ttest\\(\\)"] # show the branch trace with calls indented send_gdb "record function-call-history /c 1\n" gdb_expect_list "indented" "\r\n$gdb_prompt $" [list \ - [join [list \ + [multi_line \ "1\tmain\\(\\)" \ "2\t test\\(\\)" \ "3\t foo\\(\\)" \ "4\t bar\\(\\)" \ "5\t bad\\(\\)\r" \ - ] "\r\n"] \ + ] \ "" \ "\[0-9\]*\t test\\(\\)"] diff --git a/gdb/testsuite/gdb.btrace/finish.exp b/gdb/testsuite/gdb.btrace/finish.exp index 6881e3b..1f55c18 100644 --- a/gdb/testsuite/gdb.btrace/finish.exp +++ b/gdb/testsuite/gdb.btrace/finish.exp @@ -35,12 +35,12 @@ gdb_test_no_output "record btrace" gdb_test "next" proc check_replay_at { insn } { - gdb_test "info record" [join [list \ + gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] + ] } # let's go somewhere where we can finish diff --git a/gdb/testsuite/gdb.btrace/function_call_history.exp b/gdb/testsuite/gdb.btrace/function_call_history.exp index 2914bf2..af4cae9 100644 --- a/gdb/testsuite/gdb.btrace/function_call_history.exp +++ b/gdb/testsuite/gdb.btrace/function_call_history.exp @@ -38,7 +38,7 @@ gdb_breakpoint $bp_location gdb_continue_to_breakpoint "cont to $bp_location" ".*$testfile.c:$bp_location.*" proc rec_fun_all {} { - gdb_test "record function-call-history 1" [join [list \ + gdb_test "record function-call-history 1" [multi_line \ "1\tmain" \ "2\tinc" \ "3\tmain" \ @@ -59,7 +59,7 @@ proc rec_fun_all {} { "18\tinc" \ "19\tmain" \ "20\tinc" \ - "21\tmain"] "\r\n"] + "21\tmain"] } # show function call history with unlimited size, we expect to see all 21 entries @@ -72,7 +72,7 @@ with_test_prefix "size 21" rec_fun_all # show first 15 entries gdb_test_no_output "set record function-call-history-size 15" -gdb_test "record function-call-history 1" [join [list \ +gdb_test "record function-call-history 1" [multi_line \ "1\tmain" \ "2\tinc" \ "3\tmain" \ @@ -87,16 +87,16 @@ gdb_test "record function-call-history 1" [join [list \ "12\tinc" \ "13\tmain" \ "14\tinc" \ - "15\tmain"] "\r\n"] "forward - 1" + "15\tmain"] "forward - 1" # show last 6 entries -gdb_test "record function-call-history +" [join [list \ +gdb_test "record function-call-history +" [multi_line \ "16\tinc" \ "17\tmain" \ "18\tinc" \ "19\tmain" \ "20\tinc" \ - "21\tmain"] "\r\n"] "forward - 2" + "21\tmain"] "forward - 2" # moving further should not work gdb_test "record function-call-history +" "At the end of the branch trace record\\." "forward - 3" @@ -105,7 +105,7 @@ gdb_test "record function-call-history +" "At the end of the branch trace record gdb_test "record function-call-history +" "At the end of the branch trace record\\." "forward - 4" # moving back showing the latest 15 function calls -gdb_test "record function-call-history -" [join [list \ +gdb_test "record function-call-history -" [multi_line \ "7\tmain" \ "8\tinc" \ "9\tmain" \ @@ -120,16 +120,16 @@ gdb_test "record function-call-history -" [join [list \ "18\tinc" \ "19\tmain" \ "20\tinc" \ - "21\tmain"] "\r\n"] "backward - 1" + "21\tmain"] "backward - 1" # moving further back shows the 6 first function calls -gdb_test "record function-call-history -" [join [list \ +gdb_test "record function-call-history -" [multi_line \ "1\tmain" \ "2\tinc" \ "3\tmain" \ "4\tinc" \ "5\tmain" \ - "6\tinc"] "\r\n"] "backward - 2" + "6\tinc"] "backward - 2" # moving further back shouldn't work gdb_test "record function-call-history -" "At the start of the branch trace record\\." "backward - 3" @@ -141,7 +141,7 @@ gdb_test "record function-call-history -" "At the start of the branch trace reco gdb_test_no_output "set filename-display basename" # moving forward again, but this time with file and line number, expected to see the first 15 entries -gdb_test "record function-call-history /l +" [join [list \ +gdb_test "record function-call-history /l +" [multi_line \ "\[0-9\]*\tmain\tat $srcfile:40,41" \ "\[0-9\]*\tinc\tat $srcfile:22,24" \ "\[0-9\]*\tmain\tat $srcfile:40,41" \ @@ -157,30 +157,30 @@ gdb_test "record function-call-history /l +" [join [list \ "\[0-9\]*\tmain\tat $srcfile:40,41" \ "\[0-9\]*\tinc\tat $srcfile:22,24" \ "\[0-9\]*\tmain\tat $srcfile:40,41" \ - ] "\r\n"] "forward /l - 1" + ] "forward /l - 1" # moving forward and expect to see the latest 6 entries -gdb_test "record function-call-history /l +" [join [list \ +gdb_test "record function-call-history /l +" [multi_line \ "\[0-9\]*\tinc\tat $srcfile:22,24" \ "\[0-9\]*\tmain\tat $srcfile:40,41" \ "\[0-9\]*\tinc\tat $srcfile:22,24" \ "\[0-9\]*\tmain\tat $srcfile:40,41" \ "\[0-9\]*\tinc\tat $srcfile:22,24" \ "\[0-9\]*\tmain\tat $srcfile:40,43" \ - ] "\r\n"] "forward /l - 2" + ] "forward /l - 2" # moving further forward shouldn't work gdb_test "record function-call-history /l +" "At the end of the branch trace record\\." "forward /l - 3" gdb_test "record function-call-history /l" "At the end of the branch trace record\\." "forward /l - 4" -set expected_range [join [list \ +set expected_range [multi_line \ "4\tinc" \ "5\tmain" \ "6\tinc" \ "7\tmain" \ "8\tinc" \ "9\tmain" \ - "10\tinc"] "\r\n"] + "10\tinc"] # show functions in instruction range gdb_test "record function-call-history 4,10" $expected_range @@ -196,7 +196,7 @@ gdb_continue_to_breakpoint "cont to $bp_location" ".*$testfile.c:$bp_location.*" # at this point we expect to have main, fib, ..., fib, main, where fib occurs 9 times, # so we limit the output to only show the latest 11 function calls gdb_test_no_output "set record function-call-history-size 11" -gdb_test "record function-call-history" [join [list \ +gdb_test "record function-call-history" [multi_line \ "21\tmain" \ "22\tfib" \ "23\tfib" \ @@ -207,10 +207,10 @@ gdb_test "record function-call-history" [join [list \ "28\tfib" \ "29\tfib" \ "30\tfib" \ - "31\tmain"] "\r\n"] "recursive" + "31\tmain"] "recursive" # show indented function call history for fib -gdb_test "record function-call-history /c 21, +11" [join [list \ +gdb_test "record function-call-history /c 21, +11" [multi_line \ "21\tmain" \ "22\t fib" \ "23\t fib" \ @@ -222,7 +222,7 @@ gdb_test "record function-call-history /c 21, +11" [join [list \ "29\t fib" \ "30\t fib" \ "31\tmain" \ - ] "\r\n"] "indented" + ] "indented" # make sure we can handle incomplete trace with respect to indentation if ![runto_main] { @@ -245,11 +245,11 @@ gdb_breakpoint $bp_location gdb_continue_to_breakpoint "cont to bp.2" ".*$testfile.c:$bp_location\r\n.*" # let's look at the trace. we expect to see the tail of the above listing. -gdb_test "record function-call-history /c" [join [list \ +gdb_test "record function-call-history /c" [multi_line \ "1\t fib" \ "2\t fib" \ "3\t fib" \ "4\t fib" \ "5\t fib" \ "6\tmain" \ - ] "\r\n"] "indented tail" + ] "indented tail" diff --git a/gdb/testsuite/gdb.btrace/instruction_history.exp b/gdb/testsuite/gdb.btrace/instruction_history.exp index a7b57e5..ba06647 100644 --- a/gdb/testsuite/gdb.btrace/instruction_history.exp +++ b/gdb/testsuite/gdb.btrace/instruction_history.exp @@ -65,37 +65,37 @@ if { $traced != 11 } { } # test that we see the expected instructions -gdb_test "record instruction-history 3,7" [join [list \ +gdb_test "record instruction-history 3,7" [multi_line \ "3\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ " \ "4\t 0x\[0-9a-f\]+ :\tdec %eax" \ "5\t 0x\[0-9a-f\]+ :\tjmp 0x\[0-9a-f\]+ " \ "6\t 0x\[0-9a-f\]+ :\tcmp \\\$0x0,%eax" \ "7\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ \r" \ - ] "\r\n"] + ] -gdb_test "record instruction-history /f 3,+5" [join [list \ +gdb_test "record instruction-history /f 3,+5" [multi_line \ "3\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ " \ "4\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ " \ "6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ \r" \ - ] "\r\n"] + ] -gdb_test "record instruction-history /p 7,-5" [join [list \ +gdb_test "record instruction-history /p 7,-5" [multi_line \ "3\t0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ " \ "4\t0x\[0-9a-f\]+ :\tdec %eax" \ "5\t0x\[0-9a-f\]+ :\tjmp 0x\[0-9a-f\]+ " \ "6\t0x\[0-9a-f\]+ :\tcmp \\\$0x0,%eax" \ "7\t0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ \r" \ - ] "\r\n"] + ] -gdb_test "record instruction-history /pf 3,7" [join [list \ +gdb_test "record instruction-history /pf 3,7" [multi_line \ "3\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ " \ "4\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ " \ "6\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ \r" \ - ] "\r\n"] + ] gdb_test "record instruction-history 3,3" "3\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ \r" diff --git a/gdb/testsuite/gdb.btrace/next.exp b/gdb/testsuite/gdb.btrace/next.exp index 3d2fa10..3866478 100644 --- a/gdb/testsuite/gdb.btrace/next.exp +++ b/gdb/testsuite/gdb.btrace/next.exp @@ -35,12 +35,12 @@ gdb_test_no_output "record btrace" gdb_test "next" proc check_replay_at { insn } { - gdb_test "info record" [join [list \ + gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] + ] } # we start with stepping to make sure that the trace is fetched automatically @@ -54,11 +54,11 @@ with_test_prefix "reverse-next - 2" { check_replay_at 1 } # but we can step back again gdb_test "next" ".*main\.3.*" -gdb_test "info record" [join [list \ +gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "next back" + ] "next back" # let's go somewhere where we can step some more gdb_test "record goto 22" ".*fun3\.2.*" diff --git a/gdb/testsuite/gdb.btrace/nexti.exp b/gdb/testsuite/gdb.btrace/nexti.exp index 911ad86..77bcf7c 100644 --- a/gdb/testsuite/gdb.btrace/nexti.exp +++ b/gdb/testsuite/gdb.btrace/nexti.exp @@ -35,12 +35,12 @@ gdb_test_no_output "record btrace" gdb_test "next" proc check_replay_at { insn } { - gdb_test "info record" [join [list \ + gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] + ] } # we start with stepping to make sure that the trace is fetched automatically @@ -54,11 +54,11 @@ with_test_prefix "reverse-nexti - 1" { check_replay_at 1 } # but we can step back again gdb_test "nexti" ".*main\.3.*" "next, 1.5" -gdb_test "info record" [join [list \ +gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "nexti back" + ] "nexti back" # let's go somewhere where we can step some more gdb_test "record goto 22" ".*fun3\.2.*" diff --git a/gdb/testsuite/gdb.btrace/nohist.exp b/gdb/testsuite/gdb.btrace/nohist.exp index f267250..c0c42e0 100644 --- a/gdb/testsuite/gdb.btrace/nohist.exp +++ b/gdb/testsuite/gdb.btrace/nohist.exp @@ -31,11 +31,11 @@ if ![runto_main] { } proc check_not_replaying {} { - gdb_test "info record" [join [list \ + gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 0 instructions in 0 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] + ] } gdb_test_no_output "record btrace" diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp index c932900..2dcb6eb 100644 --- a/gdb/testsuite/gdb.btrace/record_goto.exp +++ b/gdb/testsuite/gdb.btrace/record_goto.exp @@ -49,7 +49,7 @@ gdb_test_no_output "record btrace" gdb_test "next" # start by listing all functions -gdb_test "record function-call-history /ci 1, +20" [join [list \ +gdb_test "record function-call-history /ci 1, +20" [multi_line \ "1\tmain\tinst 1,1" \ "2\t fun4\tinst 2,4" \ "3\t fun1\tinst 5,8" \ @@ -66,118 +66,118 @@ gdb_test "record function-call-history /ci 1, +20" [join [list \ "14\t fun2\tinst 35,36" \ "15\t fun3\tinst 37,38" \ "16\t fun4\tinst 39,40" \ - ] "\r\n"] + ] # let's see if we can go back in history gdb_test "record goto 19" ".*fun4 \\(\\) at record_goto.c:43.*" # the function call history should start at the new location -gdb_test "record function-call-history /ci" [join [list \ +gdb_test "record function-call-history /ci" [multi_line \ "8\t fun4\tinst 19,19" \ "9\t fun3\tinst 20,22" \ "10\t fun1\tinst 23,26" \ - ] "\r\n"] "function-call-history from 19 forwards" + ] "function-call-history from 19 forwards" # the instruction history should start at the new location -gdb_test "record instruction-history" [join [list \ +gdb_test "record instruction-history" [multi_line \ "19.*" \ "20.*" \ "21.*" \ - ] "\r\n"] "instruction-history from 19 forwards" + ] "instruction-history from 19 forwards" # let's go to another place in the history gdb_test "record goto 27" ".*fun3 \\(\\) at record_goto.c:35.*" # check the back trace at that location -gdb_test "backtrace" [join [list \ +gdb_test "backtrace" [multi_line \ "#0.*fun3.*at record_goto.c:35.*" \ "#1.*fun4.*at record_goto.c:43.*" \ "#2.*main.*at record_goto.c:49.*" \ "Backtrace stopped: not enough registers or memory available to unwind further" \ - ] "\r\n"] + ] # walk the backtrace gdb_test "up" ".*fun4.*at record_goto.c:43.*" "up to fun4" gdb_test "up" ".*main.*at record_goto.c:49.*" "up to main" # the function call history should start at the new location -gdb_test "record function-call-history /ci -" [join [list \ +gdb_test "record function-call-history /ci -" [multi_line \ "9\t fun3\tinst 20,22" \ "10\t fun1\tinst 23,26" \ "11\t fun3\tinst 27,27" \ - ] "\r\n"] "function-call-history from 27 backwards" + ] "function-call-history from 27 backwards" # the instruction history should start at the new location -gdb_test "record instruction-history -" [join [list \ +gdb_test "record instruction-history -" [multi_line \ "25.*" \ "26.*" \ "27.*" \ - ] "\r\n"] "instruction-history from 27 backwards" + ] "instruction-history from 27 backwards" # test that we can go to the begin of the trace gdb_test "record goto begin" ".*main \\(\\) at record_goto.c:49.*" # check that we're filling up the context correctly -gdb_test "record function-call-history /ci -" [join [list \ +gdb_test "record function-call-history /ci -" [multi_line \ "1\tmain\tinst 1,1" \ "2\t fun4\tinst 2,4" \ "3\t fun1\tinst 5,8" \ - ] "\r\n"] "function-call-history from begin backwards" + ] "function-call-history from begin backwards" # check that we're filling up the context correctly -gdb_test "record instruction-history -" [join [list \ +gdb_test "record instruction-history -" [multi_line \ "1.*" \ "2.*" \ "3.*" \ - ] "\r\n"] "instruction-history from begin backwards" + ] "instruction-history from begin backwards" # we should get the exact same history from the first instruction gdb_test "record goto 2" ".*fun4 \\(\\) at record_goto.c:40.*" # check that we're filling up the context correctly -gdb_test "record function-call-history /ci -" [join [list \ +gdb_test "record function-call-history /ci -" [multi_line \ "1\tmain\tinst 1,1" \ "2\t fun4\tinst 2,4" \ "3\t fun1\tinst 5,8\r" \ - ] "\r\n"] "function-call-history from 2 backwards" + ] "function-call-history from 2 backwards" # check that we're filling up the context correctly -gdb_test "record instruction-history -" [join [list \ +gdb_test "record instruction-history -" [multi_line \ "1.*" \ "2.*" \ "3.*" \ - ] "\r\n"] "instruction-history from 2 backwards" + ] "instruction-history from 2 backwards" # check that we can go to the end of the trace gdb_test "record goto end" ".*main \\(\\) at record_goto.c:50.*" # check that we're filling up the context correctly -gdb_test "record function-call-history /ci" [join [list \ +gdb_test "record function-call-history /ci" [multi_line \ "14\t fun2\tinst 35,36" \ "15\t fun3\tinst 37,38" \ "16\t fun4\tinst 39,40" \ - ] "\r\n"] "function-call-history from end forwards" + ] "function-call-history from end forwards" # check that we're filling up the context correctly -gdb_test "record instruction-history" [join [list \ +gdb_test "record instruction-history" [multi_line \ "38.*" \ "39.*" \ "40.*\r" \ - ] "\r\n"] "instruction-history from end forwards" + ] "instruction-history from end forwards" # we should get the exact same history from the second to last instruction gdb_test "record goto 39" ".*fun4 \\(\\) at record_goto.c:44.*" # check that we're filling up the context correctly -gdb_test "record function-call-history /ci" [join [list \ +gdb_test "record function-call-history /ci" [multi_line \ "14\t fun2\tinst 35,36" \ "15\t fun3\tinst 37,38" \ "16\t fun4\tinst 39,40\r" \ - ] "\r\n"] "function-call-history from 39 forwards" + ] "function-call-history from 39 forwards" # check that we're filling up the context correctly -gdb_test "record instruction-history" [join [list \ +gdb_test "record instruction-history" [multi_line \ "38.*" \ "39.*" \ "40.*\r" \ - ] "\r\n"] "instruction-history from 39 forwards" + ] "instruction-history from 39 forwards" diff --git a/gdb/testsuite/gdb.btrace/segv.exp b/gdb/testsuite/gdb.btrace/segv.exp index cc7e032..71958cf 100644 --- a/gdb/testsuite/gdb.btrace/segv.exp +++ b/gdb/testsuite/gdb.btrace/segv.exp @@ -31,10 +31,10 @@ if ![runto_main] { # trace the test code gdb_test_no_output "record btrace" -gdb_test "continue" [join [list \ +gdb_test "continue" [multi_line \ "Program received signal SIGSEGV, Segmentation fault\." \ "0x0* in \\\?\\\? \\\(\\\)" \ - ] "\r\n"] "cont to segv" + ] "cont to segv" # we cannot do any high-level stepping gdb_test "reverse-finish" "Cannot find bounds of current function" diff --git a/gdb/testsuite/gdb.btrace/step.exp b/gdb/testsuite/gdb.btrace/step.exp index 22aded8..0901ecc 100644 --- a/gdb/testsuite/gdb.btrace/step.exp +++ b/gdb/testsuite/gdb.btrace/step.exp @@ -35,12 +35,12 @@ gdb_test_no_output "record btrace" gdb_test "next" proc check_replay_at { insn } { - gdb_test "info record" [join [list \ + gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] + ] } # let's start by stepping back into the function we just returned from @@ -84,8 +84,8 @@ gdb_test "step" ".*fun4\.5.*" with_test_prefix "step to 39" { check_replay_at 39 } gdb_test "step" ".*main\.3.*" -gdb_test "info record" [join [list \ +gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "step to live" + ] "step to live" diff --git a/gdb/testsuite/gdb.btrace/stepi.exp b/gdb/testsuite/gdb.btrace/stepi.exp index a663f87..288aab0 100644 --- a/gdb/testsuite/gdb.btrace/stepi.exp +++ b/gdb/testsuite/gdb.btrace/stepi.exp @@ -33,12 +33,12 @@ if ![runto_main] { } proc check_replay_at { insn } { - gdb_test "info record" [join [list \ + gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] + ] } # trace the call to the test function @@ -58,11 +58,11 @@ with_test_prefix "stepi to 40" { check_replay_at 40 } # with the next step, we stop replaying gdb_test "stepi" ".*main\.3.*" -gdb_test "info record" [join [list \ +gdb_test "info record" [multi_line \ "Active record target: record-btrace" \ "Recording format: .*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "stepi to live" + ] "stepi to live" # let's step from a goto position somewhere in the middle gdb_test "record goto 22" ".*fun3\.2.*" diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp index 30acffc..f262c1f 100644 --- a/gdb/testsuite/gdb.btrace/tailcall.exp +++ b/gdb/testsuite/gdb.btrace/tailcall.exp @@ -48,31 +48,31 @@ gdb_test_no_output "record btrace" gdb_test "next" # show the flat branch trace -gdb_test "record function-call-history 1" [join [list \ +gdb_test "record function-call-history 1" [multi_line \ "1\tmain" \ "2\tfoo" \ "3\tbar" \ "4\tmain" \ - ] "\r\n"] "flat" + ] "flat" # show the branch trace with calls indented -gdb_test "record function-call-history /c 1" [join [list \ +gdb_test "record function-call-history /c 1" [multi_line \ "1\tmain" \ "2\t foo" \ "3\t bar" \ "4\tmain" \ - ] "\r\n"] "indented" + ] "indented" # go into bar gdb_test "record goto 4" ".*bar \\(\\) at .*x86-tailcall.c:24\r\n.*" # check the backtrace -gdb_test "backtrace" [join [list \ +gdb_test "backtrace" [multi_line \ "#0.*bar \\(\\) at x86-tailcall.c:24" \ "#1.*foo \\(\\) at x86-tailcall.c:29" \ "#2.*main \\(\\) at x86-tailcall.c:37" \ "Backtrace stopped: not enough registers or memory available to unwind further" \ - ] "\r\n"] + ] # walk the backtrace gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" "up to foo" diff --git a/gdb/testsuite/gdb.btrace/unknown_functions.exp b/gdb/testsuite/gdb.btrace/unknown_functions.exp index 12e35ff..dbeae69 100644 --- a/gdb/testsuite/gdb.btrace/unknown_functions.exp +++ b/gdb/testsuite/gdb.btrace/unknown_functions.exp @@ -40,7 +40,7 @@ gdb_test_no_output "record btrace" gdb_continue_to_breakpoint "cont to test" ".*test.*" # show the flat branch trace -gdb_test "record function-call-history 1" [join [list \ +gdb_test "record function-call-history 1" [multi_line \ "1\ttest" \ "2\t\\\?\\\?" \ "3\t\\\?\\\?" \ @@ -48,10 +48,10 @@ gdb_test "record function-call-history 1" [join [list \ "5\ttest" \ "6\tmain" \ "7\ttest" \ - ] "\r\n"] "flat" + ] "flat" # show the branch trace with calls indented -gdb_test "record function-call-history /c 1" [join [list \ +gdb_test "record function-call-history /c 1" [multi_line \ "1\t test" \ "2\t \\\?\\\?" \ "3\t \\\?\\\?" \ @@ -59,4 +59,4 @@ gdb_test "record function-call-history /c 1" [join [list \ "5\t test" \ "6\tmain" \ "7\t test" \ - ] "\r\n"] "indented" + ] "indented" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp index 5fd77c0..94e6629 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp @@ -46,7 +46,7 @@ gdb_test "up" \ # "info frame" unwinds the PC for "saved ... = ". Make sure that # doesn't cause an error, and shows "". -gdb_test "info frame" [join [list \ +gdb_test "info frame" [multi_line \ "Stack level 0, frame at $hex\:" \ " rip = $hex in stop_frame \\(dw2-undefined-ret-addr\\.c:22\\); saved rip = " \ " Outermost frame: outermost" \ @@ -55,4 +55,4 @@ gdb_test "info frame" [join [list \ " Locals at $hex, Previous frame's sp is $hex" \ " Saved registers\:" \ " rbp at $hex.*" \ -] "\r\n"] +] diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f274b64..f80762a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5119,5 +5119,16 @@ proc capture_command_output { command prefix } { return $output_string } +# A convenience function that joins all the arguments together, +# with a regexp that matches exactly one end of lines in between +# each argument. This function is ideal to write the expected output +# of a GDB command that generates more than a couple of lines, as +# this allows us to write each line as a separate string, which is +# easier to read by a human being. + +proc multi_line { args } { + return [join $args "\r\n"] +} + # Always load compatibility stuff. load_lib future.exp -- 2.3.3