* [PATCH] Share the "multi_line" helper among all Ada testcases @ 2015-03-10 11:55 Pierre-Marie de Rodat 2015-03-17 20:08 ` Joel Brobecker 0 siblings, 1 reply; 14+ messages in thread From: Pierre-Marie de Rodat @ 2015-03-10 11:55 UTC (permalink / raw) To: GDB Patches [-- Attachment #1: Type: text/plain, Size: 753 bytes --] Hello, This patch is a tiny cleanup for the Ada testsuite: it put the "multi_line" helper (currently defined in 6 testcases) in a common place: ada.exp. It triggers no regression (tested on x86_64-linux). Ok to push? Thank you in advance, gdb/testsuite/ChangeLog: 2015-03-10 Pierre-Marie de Rodat <derodat@adacore.com> * 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". * lib/ada.exp: Add the "multi_line" helper. -- Pierre-Marie de Rodat [-- Attachment #2: 0001-Share-the-multi_line-helper-among-all-Ada-testcases.patch --] [-- Type: text/x-diff, Size: 6979 bytes --] From 855c84ea47c0b4f873af31f7cf10b6eefff3f6c2 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat <derodat@adacore.com> Date: Tue, 10 Mar 2015 09:51:27 +0100 Subject: [PATCH] Share the "multi_line" helper among all Ada testcases gdb/testsuite/ChangeLog: 2015-03-10 Pierre-Marie de Rodat <derodat@adacore.com> * 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". * lib/ada.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/lib/ada.exp | 11 +++++++++++ 7 files changed, 11 insertions(+), 65 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/lib/ada.exp b/gdb/testsuite/lib/ada.exp index 6a1e192..903ef45 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -60,3 +60,14 @@ proc standard_ada_testfile {base_file {dir ""}} { file mkdir [standard_output_file $testdir] } + +# 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\]*"] +} -- 2.3.1 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-03-10 11:55 [PATCH] Share the "multi_line" helper among all Ada testcases Pierre-Marie de Rodat @ 2015-03-17 20:08 ` Joel Brobecker 2015-03-18 9:45 ` Pedro Alves 0 siblings, 1 reply; 14+ messages in thread From: Joel Brobecker @ 2015-03-17 20:08 UTC (permalink / raw) To: Pierre-Marie de Rodat; +Cc: GDB Patches > This patch is a tiny cleanup for the Ada testsuite: it put the > "multi_line" helper (currently defined in 6 testcases) in a common > place: ada.exp. It triggers no regression (tested on x86_64-linux). > > Ok to push? > Thank you in advance, > > gdb/testsuite/ChangeLog: > 2015-03-10 Pierre-Marie de Rodat <derodat@adacore.com> > > * 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". > * lib/ada.exp: Add the "multi_line" helper. At the time I introduced this function, I thought it should even be in gdb.exp, but others did not agree with its usefulness, which explains why I ended up duplicating it everywhere. Let's do the following: Let's give people a week to comment on this, and if there are no objection, let's put it in ada.exp. If others agree that this should be in gdb.exp, then let's do that instead, and then add some documentation in our "testcase cookbook" wiki page about this routine. Thanks, Pierre-Marie. -- Joel ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-03-17 20:08 ` Joel Brobecker @ 2015-03-18 9:45 ` Pedro Alves 2015-03-18 14:12 ` Joel Brobecker 0 siblings, 1 reply; 14+ messages in thread From: Pedro Alves @ 2015-03-18 9:45 UTC (permalink / raw) To: Joel Brobecker, Pierre-Marie de Rodat; +Cc: GDB Patches On 03/17/2015 08:08 PM, Joel Brobecker wrote: > At the time I introduced this function, I thought it should even > be in gdb.exp, but others did not agree with its usefulness, which > explains why I ended up duplicating it everywhere. Do you have a pointer? I'm curious to see the alternatives proposed. If there's something better, I'd argue for instead converting the Ada tests to use it. All I found was this though: https://sourceware.org/ml/gdb-patches/2008-01/msg00824.html which didn't sound like an objection, only a pointer to existing functions that may or not cover your use case. Note gdb_expect_list does not work for this though, as that has an implicit ".*" between elements of the expected list. Meanwhile, we grew many tests that do [join [list ... "\r\n"]], like this: # start by listing all functions gdb_test "record function-call-history /ci 1, +20" [join [list \ "1\tmain\tinst 1,1" \ "2\t fun4\tinst 2,4" \ "3\t fun1\tinst 5,8" \ "4\t fun4\tinst 9,9" \ "5\t fun2\tinst 10,12" \ "6\t fun1\tinst 13,16" \ "7\t fun2\tinst 17,18" \ "8\t fun4\tinst 19,19" \ "9\t fun3\tinst 20,22" \ "10\t fun1\tinst 23,26" \ "11\t fun3\tinst 27,27" \ "12\t fun2\tinst 28,30" \ "13\t fun1\tinst 31,34" \ "14\t fun2\tinst 35,36" \ "15\t fun3\tinst 37,38" \ "16\t fun4\tinst 39,40" \ ] "\r\n"] Your multi_line looks like almost the same, except that it's a tiny bit more lax: proc multi_line { args } { return [join $args "\[\r\n\]*"] } That will accept _no_ newline between list elements, and multiple newlines too. 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"] > Let's do the following: Let's give people a week to comment on > this, and if there are no objection, let's put it in ada.exp. > If others agree that this should be in gdb.exp, then let's do that > instead, and then add some documentation in our "testcase cookbook" > wiki page about this routine. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-03-18 9:45 ` Pedro Alves @ 2015-03-18 14:12 ` Joel Brobecker 2015-03-20 12:18 ` Pierre-Marie de Rodat 0 siblings, 1 reply; 14+ messages in thread From: Joel Brobecker @ 2015-03-18 14:12 UTC (permalink / raw) To: Pedro Alves; +Cc: Pierre-Marie de Rodat, GDB Patches > Meanwhile, we grew many tests that do [join [list ... "\r\n"]], > like this: > > # start by listing all functions > gdb_test "record function-call-history /ci 1, +20" [join [list \ > "1\tmain\tinst 1,1" \ > "2\t fun4\tinst 2,4" \ > "3\t fun1\tinst 5,8" \ > "4\t fun4\tinst 9,9" \ > "5\t fun2\tinst 10,12" \ > "6\t fun1\tinst 13,16" \ > "7\t fun2\tinst 17,18" \ > "8\t fun4\tinst 19,19" \ > "9\t fun3\tinst 20,22" \ > "10\t fun1\tinst 23,26" \ > "11\t fun3\tinst 27,27" \ > "12\t fun2\tinst 28,30" \ > "13\t fun1\tinst 31,34" \ > "14\t fun2\tinst 35,36" \ > "15\t fun3\tinst 37,38" \ > "16\t fun4\tinst 39,40" \ > ] "\r\n"] > > Your multi_line looks like almost the same, except that it's > a tiny bit more lax: > > proc multi_line { args } { > return [join $args "\[\r\n\]*"] > } > > That will accept _no_ newline between list elements, and > multiple newlines too. 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? -- Joel ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-03-18 14:12 ` Joel Brobecker @ 2015-03-20 12:18 ` Pierre-Marie de Rodat 2015-03-20 18:00 ` Pedro Alves 2015-07-18 0:35 ` Sergio Durigan Junior 0 siblings, 2 replies; 14+ messages in thread From: Pierre-Marie de Rodat @ 2015-03-20 12:18 UTC (permalink / raw) To: Joel Brobecker, Pedro Alves; +Cc: GDB Patches [-- Attachment #1: Type: text/plain, Size: 2104 bytes --] 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 <derodat@adacore.com> * 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. -- Pierre-Marie de Rodat [-- Attachment #2: 0001-Share-the-multi_line-helper-among-all-testcases.patch --] [-- Type: text/x-diff, Size: 37772 bytes --] From cd542150b7b4814107dc8c7b8a66405c454f5f7d Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat <derodat@adacore.com> 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 <derodat@adacore.com> * 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\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "4\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\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\]+ <loop\\+\[0-9\]+>" \ "4\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\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\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "4\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \ "5\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\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\]+ <loop\\+\[0-9\]+>" \ "4\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \ - ] "\r\n"] + ] gdb_test "record instruction-history 3,3" "3\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\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 "<not saved>". -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 = <not saved>" \ " 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 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-03-20 12:18 ` Pierre-Marie de Rodat @ 2015-03-20 18:00 ` Pedro Alves 2015-04-01 8:50 ` Pierre-Marie de Rodat 2015-07-18 0:35 ` Sergio Durigan Junior 1 sibling, 1 reply; 14+ messages in thread From: Pedro Alves @ 2015-03-20 18:00 UTC (permalink / raw) To: Pierre-Marie de Rodat, Joel Brobecker; +Cc: GDB Patches Looks great to me. Many thanks for doing this. Spotted a tiny typo: On 03/20/2015 12:18 PM, Pierre-Marie de Rodat wrote: > +# with a regexp that matches exactly one end of lines in between "end of line" Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-03-20 18:00 ` Pedro Alves @ 2015-04-01 8:50 ` Pierre-Marie de Rodat 2015-04-01 10:26 ` Pedro Alves 0 siblings, 1 reply; 14+ messages in thread From: Pierre-Marie de Rodat @ 2015-04-01 8:50 UTC (permalink / raw) To: Pedro Alves, Joel Brobecker; +Cc: GDB Patches [-- Attachment #1: Type: text/plain, Size: 417 bytes --] On 03/20/2015 07:00 PM, Pedro Alves wrote: > Spotted a tiny typo: > > On 03/20/2015 12:18 PM, Pierre-Marie de Rodat wrote: >> +# with a regexp that matches exactly one end of lines in between > > "end of line" Thank you! This is fixed in the attached update. I also rebased this on master: several affected testcases changed recently. Still no regression on x86_64-linux. Ok for trunk? -- Pierre-Marie de Rodat [-- Attachment #2: 0001-Share-the-multi_line-helper-among-all-testcases.patch --] [-- Type: text/x-diff, Size: 33649 bytes --] From ef1aa3d06084e1ff3d3651a7b5423b3292b8a668 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat <derodat@adacore.com> Date: Tue, 10 Mar 2015 09:51:27 +0100 Subject: [PATCH] Share the "multi_line" helper among all testcases gdb/testsuite/ChangeLog: 2015-03-23 Pierre-Marie de Rodat <derodat@adacore.com> * 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/function_call_history.exp: Likewise. * gdb.btrace/instruction_history.exp: Likewise. * gdb.btrace/nohist.exp: Likewise. * gdb.btrace/record_goto.exp: Likewise. * gdb.btrace/segv.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/function_call_history.exp | 44 ++++++++--------- gdb/testsuite/gdb.btrace/instruction_history.exp | 16 +++---- 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/stepi.exp | 12 ++--- 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 +++++ 19 files changed, 107 insertions(+), 161 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 fed22f1..88f7ba5 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 0c43273..075e6cf 100755 --- a/gdb/testsuite/gdb.btrace/exception.exp +++ b/gdb/testsuite/gdb.btrace/exception.exp @@ -48,25 +48,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/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\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "4\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\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\]+ <loop\\+\[0-9\]+>" \ "4\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\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\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "4\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec %eax" \ "5\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\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\]+ <loop\\+\[0-9\]+>" \ "4\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>" \ "6\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ "7\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" \ - ] "\r\n"] + ] gdb_test "record instruction-history 3,3" "3\t 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r" diff --git a/gdb/testsuite/gdb.btrace/nohist.exp b/gdb/testsuite/gdb.btrace/nohist.exp index 0084f5a..f926ed0 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 7485fc7..f4096e0 100644 --- a/gdb/testsuite/gdb.btrace/record_goto.exp +++ b/gdb/testsuite/gdb.btrace/record_goto.exp @@ -58,7 +58,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" \ @@ -75,118 +75,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/stepi.exp b/gdb/testsuite/gdb.btrace/stepi.exp index fd018ac..7e24628 100644 --- a/gdb/testsuite/gdb.btrace/stepi.exp +++ b/gdb/testsuite/gdb.btrace/stepi.exp @@ -47,12 +47,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" \ ".*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] + ] } # trace the call to the test function @@ -72,11 +72,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" \ ".*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "stepi to live" + ] "stepi to live" # let's try nexti gdb_test "reverse-nexti" ".*main\.2.*" @@ -88,11 +88,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" \ ".*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "nexti back" + ] "nexti back" # 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 b2ce415..18b26cb 100644 --- a/gdb/testsuite/gdb.btrace/tailcall.exp +++ b/gdb/testsuite/gdb.btrace/tailcall.exp @@ -56,31 +56,31 @@ gdb_test_no_output "record btrace" gdb_test "next 2" # 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 .*tailcall.c:24\r\n.*" # check the backtrace -gdb_test "backtrace" [join [list \ +gdb_test "backtrace" [multi_line \ "#0.*bar \\(\\) at tailcall.c:24" \ "#1.*foo \\(\\) at tailcall.c:29" \ "#2.*main \\(\\) at 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 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 "<not saved>". -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 = <not saved>" \ " 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 0041adf..6b42997 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 line 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.4 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-04-01 8:50 ` Pierre-Marie de Rodat @ 2015-04-01 10:26 ` Pedro Alves 2015-04-01 13:08 ` Pierre-Marie de Rodat 0 siblings, 1 reply; 14+ messages in thread From: Pedro Alves @ 2015-04-01 10:26 UTC (permalink / raw) To: Pierre-Marie de Rodat, Joel Brobecker; +Cc: GDB Patches On 04/01/2015 09:50 AM, Pierre-Marie de Rodat wrote: > On 03/20/2015 07:00 PM, Pedro Alves wrote: >> Spotted a tiny typo: >> >> On 03/20/2015 12:18 PM, Pierre-Marie de Rodat wrote: >>> +# with a regexp that matches exactly one end of lines in between >> >> "end of line" > > Thank you! This is fixed in the attached update. I also rebased this on > master: several affected testcases changed recently. Still no regression > on x86_64-linux. > > Ok for trunk? Still looks great to me. :-) OK. Thanks, Pedro Alves ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-04-01 10:26 ` Pedro Alves @ 2015-04-01 13:08 ` Pierre-Marie de Rodat 0 siblings, 0 replies; 14+ messages in thread From: Pierre-Marie de Rodat @ 2015-04-01 13:08 UTC (permalink / raw) To: Pedro Alves, Joel Brobecker; +Cc: GDB Patches On 04/01/2015 12:26 PM, Pedro Alves wrote: > Still looks great to me. :-) OK. Great, thank you! I've just pushed this. -- Pierre-Marie de Rodat ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-03-20 12:18 ` Pierre-Marie de Rodat 2015-03-20 18:00 ` Pedro Alves @ 2015-07-18 0:35 ` Sergio Durigan Junior 2015-07-20 14:49 ` Pierre-Marie de Rodat 1 sibling, 1 reply; 14+ messages in thread From: Sergio Durigan Junior @ 2015-07-18 0:35 UTC (permalink / raw) To: Pierre-Marie de Rodat; +Cc: Joel Brobecker, Pedro Alves, GDB Patches On Friday, March 20 2015, Pierre-Marie de Rodat wrote: > 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. Hmm, I am seeing a regression on gdb.ada/info_exc.exp because of this patch. Because of the way multi_line was rewritten it is not possibe anymore to mean "anything" again; it will always be at least a newline (\r\n). I've rewritten the test to expect the exact output from "info exceptions" (i.e., removing the ".*" parts), but I am not sure this is the right thing to do. Joel/Pierre? This was a regression introduced in the 7.10 branch, BTW. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/ gdb/testsuite/ChangeLog: 2015-07-17 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.ada/info_exc.exp (info exceptions): Remove ".*" match. diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp index add83c5..4f7b1d4 100644 --- a/gdb/testsuite/gdb.ada/info_exc.exp +++ b/gdb/testsuite/gdb.ada/info_exc.exp @@ -34,9 +34,7 @@ gdb_test "info exceptions" \ "program_error: $hex" \ "storage_error: $hex" \ "tasking_error: $hex" \ - ".*" \ - "const.aint_global_gdb_e: $hex" \ - ".*"] + "const.aint_global_gdb_e: $hex"] gdb_test "info exceptions task" \ [multi_line "All Ada exceptions matching regular expression \"task\":" \ ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-07-18 0:35 ` Sergio Durigan Junior @ 2015-07-20 14:49 ` Pierre-Marie de Rodat 2015-07-20 15:35 ` Sergio Durigan Junior 0 siblings, 1 reply; 14+ messages in thread From: Pierre-Marie de Rodat @ 2015-07-20 14:49 UTC (permalink / raw) To: Sergio Durigan Junior; +Cc: Joel Brobecker, Pedro Alves, GDB Patches Sergio, On 07/18/2015 02:35 AM, Sergio Durigan Junior wrote: > Hmm, I am seeing a regression on gdb.ada/info_exc.exp because of this > patch. Because of the way multi_line was rewritten it is not possibe > anymore to mean "anything" again; it will always be at least a newline > (\r\n). > > I've rewritten the test to expect the exact output from "info > exceptions" (i.e., removing the ".*" parts), but I am not sure this is > the right thing to do. Joel/Pierre? Thank you for the heads-up! I did not notice this when submitting the patch... Anyway, I had a look at what commit introduced the ".*" parts: commit 391d3400084c6a2d805cd0efd925f29347fa7a18 Author: Joel Brobecker <brobecker@adacore.com> Date: Fri Nov 15 20:34:09 2013 +0400 gdb.ada/info_exc.exp,mi_exc_info.exp: handle runtimes with full debug info. If the runtime has full debug info, then the non-standard exceptions declared in the GNAT runtime will appear in the list of exceptions printed by GDB ("info exceptions" or "-info-ada-exceptions"). This is valid output, so this patch allows for it. So it looks like they are needed for some configuration. Then, what about this: diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp index add83c5..448882b 100644 --- a/gdb/testsuite/gdb.ada/info_exc.exp +++ b/gdb/testsuite/gdb.ada/info_exc.exp @@ -34,9 +34,7 @@ gdb_test "info exceptions" \ "program_error: $hex" \ "storage_error: $hex" \ "tasking_error: $hex" \ - ".*" \ - "const.aint_global_gdb_e: $hex" \ - ".*"] + "\(.*\r\n\)*const.aint_global_gdb_e: $hex\(.*\r\n\)*"] gdb_test "info exceptions task" \ [multi_line "All Ada exceptions matching regular expression \"task\":" \ -- Pierre-Marie de Rodat ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-07-20 14:49 ` Pierre-Marie de Rodat @ 2015-07-20 15:35 ` Sergio Durigan Junior 2015-07-20 22:23 ` Joel Brobecker 0 siblings, 1 reply; 14+ messages in thread From: Sergio Durigan Junior @ 2015-07-20 15:35 UTC (permalink / raw) To: Pierre-Marie de Rodat; +Cc: Joel Brobecker, Pedro Alves, GDB Patches Hey Pierre, On Monday, July 20 2015, Pierre-Marie de Rodat wrote: > On 07/18/2015 02:35 AM, Sergio Durigan Junior wrote: >> Hmm, I am seeing a regression on gdb.ada/info_exc.exp because of this >> patch. Because of the way multi_line was rewritten it is not possibe >> anymore to mean "anything" again; it will always be at least a newline >> (\r\n). >> >> I've rewritten the test to expect the exact output from "info >> exceptions" (i.e., removing the ".*" parts), but I am not sure this is >> the right thing to do. Joel/Pierre? > > Thank you for the heads-up! I did not notice this when submitting the > patch... Anyway, I had a look at what commit introduced the ".*" > parts: > > commit 391d3400084c6a2d805cd0efd925f29347fa7a18 > Author: Joel Brobecker <brobecker@adacore.com> > Date: Fri Nov 15 20:34:09 2013 +0400 > > gdb.ada/info_exc.exp,mi_exc_info.exp: handle runtimes with full > debug info. > > If the runtime has full debug info, then the non-standard exceptions > declared in the GNAT runtime will appear in the list of exceptions > printed by GDB ("info exceptions" or "-info-ada-exceptions"). > This is valid output, so this patch allows for it. > > So it looks like they are needed for some configuration. Then, what > about this: Hm, right, thanks for checking this. I suspected that the ".*" had a reason to exist... > diff --git a/gdb/testsuite/gdb.ada/info_exc.exp > b/gdb/testsuite/gdb.ada/info_exc.exp > index add83c5..448882b 100644 > --- a/gdb/testsuite/gdb.ada/info_exc.exp > +++ b/gdb/testsuite/gdb.ada/info_exc.exp > @@ -34,9 +34,7 @@ gdb_test "info exceptions" \ > "program_error: $hex" \ > "storage_error: $hex" \ > "tasking_error: $hex" \ > - ".*" \ > - "const.aint_global_gdb_e: $hex" \ > - ".*"] > + "\(.*\r\n\)*const.aint_global_gdb_e: $hex\(.*\r\n\)*"] > > gdb_test "info exceptions task" \ > [multi_line "All Ada exceptions matching regular expression > \"task\":" \ The patch looks good to me and works fine here (though I haven't tested the case when the output contains more lines than expected). I'm not a maintainer of this area, so I cannot really approve this. Thanks! -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/ ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-07-20 15:35 ` Sergio Durigan Junior @ 2015-07-20 22:23 ` Joel Brobecker 2015-07-20 22:42 ` Sergio Durigan Junior 0 siblings, 1 reply; 14+ messages in thread From: Joel Brobecker @ 2015-07-20 22:23 UTC (permalink / raw) To: Sergio Durigan Junior; +Cc: Pierre-Marie de Rodat, Pedro Alves, GDB Patches [-- Attachment #1: Type: text/plain, Size: 1126 bytes --] > > --- a/gdb/testsuite/gdb.ada/info_exc.exp > > +++ b/gdb/testsuite/gdb.ada/info_exc.exp > > @@ -34,9 +34,7 @@ gdb_test "info exceptions" \ > > "program_error: $hex" \ > > "storage_error: $hex" \ > > "tasking_error: $hex" \ > > - ".*" \ > > - "const.aint_global_gdb_e: $hex" \ > > - ".*"] > > + "\(.*\r\n\)*const.aint_global_gdb_e: $hex\(.*\r\n\)*"] > > > > gdb_test "info exceptions task" \ > > [multi_line "All Ada exceptions matching regular expression > > \"task\":" \ I missed that answer, and came up with something very similar, which I checked in. Here it is: gdb/testsuite/ChangeLog: * gdb.ada/info_exc.exp: Adjust "info exceptions" expected output. Tested on x86_64-linux. I thought about using join directly with the relaxed end-of-line sequence to restore the original behavior, but then decided against it, because this expected output is stricter, and I think that's better. So I came up with the attached patch, which is another way of doing what Pierre Marie had done. -- Joel [-- Attachment #2: 0001-gdb.ada-info_exc.exp-Adjust-expected-output-in-info-.patch --] [-- Type: text/x-diff, Size: 2007 bytes --] From 8b558f797a3a63aaa8de119ddf53c8afdd1dc6eb Mon Sep 17 00:00:00 2001 From: Joel Brobecker <brobecker@adacore.com> Date: Mon, 20 Jul 2015 15:09:44 -0700 Subject: [PATCH] gdb.ada/info_exc.exp: Adjust expected output in "info exception" test. Since multi_line was moved to gdb.exp in a slightly stricter form, The gdb.ada/info_exc.exp:info exceptions test has been failing. This is because it now expects a new-line sequence at the end of each argument given to multi_line, including ".*". But the intent when writing the test was to signify "could-be-nothing-at-all". As a result, the test fails on x86_64-linux with a runtime built as recommended, because of that extra new-line sequence. gdb/testsuite/ChangeLog: * gdb.ada/info_exc.exp: Adjust "info exceptions" expected output. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.ada/info_exc.exp | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 520f606..17af4fc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-07-20 Joel Brobecker <brobecker@adacore.com> + + * gdb.ada/info_exc.exp: Adjust "info exceptions" expected output. + 2015-07-16 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.arch/i386-biarch-core.exp: Replace istarget diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp index add83c5..d6ea5da 100644 --- a/gdb/testsuite/gdb.ada/info_exc.exp +++ b/gdb/testsuite/gdb.ada/info_exc.exp @@ -34,9 +34,7 @@ gdb_test "info exceptions" \ "program_error: $hex" \ "storage_error: $hex" \ "tasking_error: $hex" \ - ".*" \ - "const.aint_global_gdb_e: $hex" \ - ".*"] + ".*\[\r\n\]*const.aint_global_gdb_e: $hex\[\r\n\]*.*" ] gdb_test "info exceptions task" \ [multi_line "All Ada exceptions matching regular expression \"task\":" \ -- 2.1.4 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Share the "multi_line" helper among all Ada testcases 2015-07-20 22:23 ` Joel Brobecker @ 2015-07-20 22:42 ` Sergio Durigan Junior 0 siblings, 0 replies; 14+ messages in thread From: Sergio Durigan Junior @ 2015-07-20 22:42 UTC (permalink / raw) To: Joel Brobecker; +Cc: Pierre-Marie de Rodat, Pedro Alves, GDB Patches On Monday, July 20 2015, Joel Brobecker wrote: >> > --- a/gdb/testsuite/gdb.ada/info_exc.exp >> > +++ b/gdb/testsuite/gdb.ada/info_exc.exp >> > @@ -34,9 +34,7 @@ gdb_test "info exceptions" \ >> > "program_error: $hex" \ >> > "storage_error: $hex" \ >> > "tasking_error: $hex" \ >> > - ".*" \ >> > - "const.aint_global_gdb_e: $hex" \ >> > - ".*"] >> > + "\(.*\r\n\)*const.aint_global_gdb_e: $hex\(.*\r\n\)*"] >> > >> > gdb_test "info exceptions task" \ >> > [multi_line "All Ada exceptions matching regular expression >> > \"task\":" \ > > I missed that answer, and came up with something very similar, > which I checked in. Here it is: Thanks, Joel and Pierre! -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/ ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-07-20 22:42 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-03-10 11:55 [PATCH] Share the "multi_line" helper among all Ada testcases Pierre-Marie de Rodat 2015-03-17 20:08 ` Joel Brobecker 2015-03-18 9:45 ` Pedro Alves 2015-03-18 14:12 ` Joel Brobecker 2015-03-20 12:18 ` Pierre-Marie de Rodat 2015-03-20 18:00 ` Pedro Alves 2015-04-01 8:50 ` Pierre-Marie de Rodat 2015-04-01 10:26 ` Pedro Alves 2015-04-01 13:08 ` Pierre-Marie de Rodat 2015-07-18 0:35 ` Sergio Durigan Junior 2015-07-20 14:49 ` Pierre-Marie de Rodat 2015-07-20 15:35 ` Sergio Durigan Junior 2015-07-20 22:23 ` Joel Brobecker 2015-07-20 22:42 ` Sergio Durigan Junior
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).