gdb/testsuite: additional test fixes after gdb_test changes
authorAndrew Burgess <aburgess@redhat.com>
Fri, 28 Apr 2023 13:39:03 +0000 (14:39 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 28 Apr 2023 15:48:21 +0000 (16:48 +0100)
After this commit:

  commit e2f620135d92f7cd670af4e524fffec7ac307666
  Date:   Thu Mar 30 13:26:25 2023 +0100

      gdb/testsuite: change newline patterns used in gdb_test

There were some regressions in gdb.trace/*.exp tests when run with the
native-gdbserver board.  This commit fixes these regressions.

All the problems are caused by unnecessary trailing newline characters
included in the patterns passed to gdb_test.  After the above commit
the testsuite is stricter when matching trailing newlines, and so the
additional trailing newline characters are now causing the test to
fail.  Fix by removing all the excess trailing newline characters.

In some cases this cleanup means we should use gdb_test_no_output,
I've done that where appropriate.  In a couple of other places I've
made use of multi_line to better build the expected output pattern.

gdb/testsuite/gdb.trace/actions.exp
gdb/testsuite/gdb.trace/change-loc.exp
gdb/testsuite/gdb.trace/collection.exp
gdb/testsuite/gdb.trace/infotrace.exp
gdb/testsuite/gdb.trace/pending.exp
gdb/testsuite/gdb.trace/stap-trace.exp
gdb/testsuite/gdb.trace/unavailable.exp
gdb/testsuite/gdb.trace/while-stepping.exp

index 2a2158886d8dd2711b9c7c41434810e708c8743b..879690ddffb0760a2ccda1e47bd985084d4a988b 100644 (file)
@@ -316,10 +316,10 @@ check_tracepoint "live"
 gdb_test_no_output "tstop" ""
 set tracefile [standard_output_file ${testfile}]
 gdb_test "tsave ${tracefile}.tf" \
-    "Trace data saved to file '${tracefile}.tf'\.\\r" \
+    "Trace data saved to file '${tracefile}.tf'\." \
     "tsave ${testfile}.tf"
 gdb_test "tsave -ctf ${tracefile}.ctf" \
-    "Trace data saved to directory '${tracefile}.ctf'\.\\r" \
+    "Trace data saved to directory '${tracefile}.ctf'\\." \
     "save ctf trace file"
 
 # Restart GDB and read the trace data in tfile target.
index 1315a6d9028b77351ec513bd30c63f78cec53246..e79f1f1559d56adb03d923059bf3218b6cd677fc 100644 (file)
@@ -190,7 +190,7 @@ proc tracepoint_change_loc_2 { trace_type } {
        # else is displayed.
        gdb_test "info trace" \
            "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
-\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*PENDING.*set_tracepoint\r\n\[\t \]+collect \\$$pcreg\r" \
+\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*PENDING.*set_tracepoint\r\n\[\t \]+collect \\$$pcreg" \
            "single pending tracepoint info (without symbols)"
 
        gdb_load ${binfile}
index 966e313d3bd806a257cbd1ebeb984d2bc0729a5c..0bbf98b27b44473ee127276a3808c07fc1304059 100644 (file)
@@ -34,21 +34,19 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarning
 # 8) expressions (lots of different kinds: local and global)
 
 set ws "\[\r\n\t \]+"
-set cr "\[\r\n\]+"
 
 #
 # Utility procs
 #
 
 proc test_register { reg test_id } {
-    global cr
     global gdb_prompt
 
     gdb_test_multiple "print /x $reg" "" {
-       -re "\\$\[0-9\]+ = \[x0\]+$cr$gdb_prompt $" {
+       -re "\\$\[0-9\]+ = \[x0\]+\r\n$gdb_prompt $" {
            fail "collect $test_id: collected $reg (zero)"
        }
-       -re "\\$\[0-9\]+ = \[x0-9a-fA-F\]+$cr$gdb_prompt $" {
+       -re "\\$\[0-9\]+ = \[x0-9a-fA-F\]+\r\n$gdb_prompt $" {
            pass "collect $test_id: collected $reg"
        }
        -re "\[Ee\]rror.*$gdb_prompt $" {
@@ -81,8 +79,7 @@ proc run_trace_experiment { test_func } {
        gdb_test "continue" \
            "Continuing.*Breakpoint \[0-9\]+, end.*" \
            "run trace experiment"
-       gdb_test "tstop" \
-           "\[\r\n\]+" \
+       gdb_test_no_output "tstop" \
            "stop trace experiment"
        gdb_test "tfind start" \
            "#0  $test_func .*" \
@@ -96,7 +93,6 @@ proc run_trace_experiment { test_func } {
 #
 
 proc gdb_collect_args_test { myargs msg } {
-    global cr
     global gdb_prompt
 
     with_test_prefix "collect $msg" {
@@ -133,30 +129,30 @@ proc gdb_collect_args_test { myargs msg } {
        }
 
        gdb_test "print argc" \
-           "\\$\[0-9\]+ = 1 '.001'$cr" \
+           "\\$\[0-9\]+ = 1 '.001'" \
            "collected arg char"
        gdb_test "print argi" \
-           "\\$\[0-9\]+ = 2$cr" \
+           "\\$\[0-9\]+ = 2" \
            "collected arg int"
        gdb_test "print argf" \
-           "\\$\[0-9\]+ = 3.\[23\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 3.\[23\]\[0-9\]*" \
            "collected arg float"
        gdb_test "print argd" \
-           "\\$\[0-9\]+ = 4.\[34\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 4.\[34\]\[0-9\]*" \
            "collected arg double"
 
        # struct arg as one of several args (near end of list)
        gdb_test "print argstruct.memberc" \
-           "\\$\[0-9\]+ = 101 'e'$cr" \
+           "\\$\[0-9\]+ = 101 'e'" \
            "collected arg struct member char"
        gdb_test "print argstruct.memberi" \
-           "\\$\[0-9\]+ = 102$cr" \
+           "\\$\[0-9\]+ = 102" \
            "collected arg struct member int"
        gdb_test "print argstruct.memberf" \
-           "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*" \
            "collected arg struct member float"
        gdb_test "print argstruct.memberd" \
-           "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*" \
            "collected arg struct member double"
 
        # array arg as one of several args (near end of list)
@@ -170,22 +166,22 @@ proc gdb_collect_args_test { myargs msg } {
 
        setup_xfail "*-*-*"
        gdb_test "print argarray\[0\]" \
-           "\\$\[0-9\]+ = 111$cr" \
+           "\\$\[0-9\]+ = 111" \
            "collected argarray #0"
 
        setup_xfail "*-*-*"
        gdb_test "print argarray\[1\]" \
-           "\\$\[0-9\]+ = 112$cr" \
+           "\\$\[0-9\]+ = 112" \
            "collected argarray #1"
 
        setup_xfail "*-*-*"
        gdb_test "print argarray\[2\]" \
-           "\\$\[0-9\]+ = 113$cr" \
+           "\\$\[0-9\]+ = 113" \
            "collected argarray #2"
 
        setup_xfail "*-*-*"
        gdb_test "print argarray\[3\]" \
-           "\\$\[0-9\]+ = 114$cr" \
+           "\\$\[0-9\]+ = 114" \
            "collected argarray #3"
 
        gdb_test "tfind none" \
@@ -195,7 +191,6 @@ proc gdb_collect_args_test { myargs msg } {
 }
 
 proc gdb_collect_argstruct_test { myargs msg } {
-    global cr
     global gdb_prompt
 
     with_test_prefix "collect $msg" {
@@ -213,16 +208,16 @@ proc gdb_collect_argstruct_test { myargs msg } {
 
        # struct argument as only argument
        gdb_test "print argstruct.memberc" \
-           "\\$\[0-9\]+ = 101 'e'$cr" \
+           "\\$\[0-9\]+ = 101 'e'" \
            "collected arg struct member char"
        gdb_test "print argstruct.memberi" \
-           "\\$\[0-9\]+ = 102$cr" \
+           "\\$\[0-9\]+ = 102" \
            "collected arg struct member int"
        gdb_test "print argstruct.memberf" \
-           "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*" \
            "collected arg struct member float"
        gdb_test "print argstruct.memberd" \
-           "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*" \
            "collected arg struct member double"
 
        gdb_test "tfind none" \
@@ -233,7 +228,6 @@ proc gdb_collect_argstruct_test { myargs msg } {
 
 
 proc gdb_collect_argarray_test { myargs msg } {
-    global cr
     global gdb_prompt
 
     with_test_prefix "collect $msg" {
@@ -261,22 +255,22 @@ proc gdb_collect_argarray_test { myargs msg } {
 
        setup_xfail "*-*-*"
        gdb_test "print argarray\[0\]" \
-           "\\$\[0-9\]+ = 111$cr" \
+           "\\$\[0-9\]+ = 111" \
            "collected argarray #0"
 
        setup_xfail "*-*-*"
        gdb_test "print argarray\[1\]" \
-           "\\$\[0-9\]+ = 112$cr" \
+           "\\$\[0-9\]+ = 112" \
            "collected argarray #1"
 
        setup_xfail "*-*-*"
        gdb_test "print argarray\[2\]" \
-           "\\$\[0-9\]+ = 113$cr" \
+           "\\$\[0-9\]+ = 113" \
            "collected argarray #2"
 
        setup_xfail "*-*-*"
        gdb_test "print argarray\[3\]" \
-           "\\$\[0-9\]+ = 114$cr" \
+           "\\$\[0-9\]+ = 114" \
            "collected argarray #3"
 
        gdb_test "tfind none" \
@@ -287,7 +281,6 @@ proc gdb_collect_argarray_test { myargs msg } {
 
 
 proc gdb_collect_locals_test { func mylocs msg } {
-    global cr
     global gdb_prompt
 
     with_test_prefix "collect $msg" {
@@ -321,42 +314,42 @@ proc gdb_collect_locals_test { func mylocs msg } {
        run_trace_experiment $func
 
        gdb_test "print locc" \
-           "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'$cr" \
+           "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'" \
            "collected local char"
        gdb_test "print loci" \
-           "\\$\[0-9\]+ = 12$cr" \
+           "\\$\[0-9\]+ = 12" \
            "collected local int"
        gdb_test "print locf" \
-           "\\$\[0-9\]+ = 13.\[23\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 13.\[23\]\[0-9\]*" \
            "collected local float"
        gdb_test "print locd" \
-           "\\$\[0-9\]+ = 14.\[34\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 14.\[34\]\[0-9\]*" \
            "collected local double"
 
        gdb_test "print locst.memberc" \
-           "\\$\[0-9\]+ = 15 '.017'$cr" \
+           "\\$\[0-9\]+ = 15 '.017'" \
            "collected local member char"
        gdb_test "print locst.memberi" \
-           "\\$\[0-9\]+ = 16$cr" \
+           "\\$\[0-9\]+ = 16" \
            "collected local member int"
        gdb_test "print locst.memberf" \
-           "\\$\[0-9\]+ = 17.\[67\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 17.\[67\]\[0-9\]*" \
            "collected local member float"
        gdb_test "print locst.memberd" \
-           "\\$\[0-9\]+ = 18.\[78\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 18.\[78\]\[0-9\]*" \
            "collected local member double"
 
        gdb_test "print locar\[0\]" \
-           "\\$\[0-9\]+ = 121$cr" \
+           "\\$\[0-9\]+ = 121" \
            "collected locarray #0"
        gdb_test "print locar\[1\]" \
-           "\\$\[0-9\]+ = 122$cr" \
+           "\\$\[0-9\]+ = 122" \
            "collected locarray #1"
        gdb_test "print locar\[2\]" \
-           "\\$\[0-9\]+ = 123$cr" \
+           "\\$\[0-9\]+ = 123" \
            "collected locarray #2"
        gdb_test "print locar\[3\]" \
-           "\\$\[0-9\]+ = 124$cr" \
+           "\\$\[0-9\]+ = 124" \
            "collected locarray #3"
 
        gdb_test "tfind none" \
@@ -366,7 +359,6 @@ proc gdb_collect_locals_test { func mylocs msg } {
 }
 
 proc gdb_collect_registers_test { myregs } {
-    global cr
     global gdb_prompt
     global fpreg
     global spreg
@@ -397,7 +389,6 @@ proc gdb_collect_registers_test { myregs } {
 }
 
 proc gdb_collect_expression_test { func expr val msg } {
-    global cr
     global gdb_prompt
 
     prepare_for_trace_test
@@ -431,7 +422,7 @@ proc gdb_collect_expression_test { func expr val msg } {
        run_trace_experiment $func
 
        gdb_test "print $expr" \
-           "\\$\[0-9\]+ = $val$cr" \
+           "\\$\[0-9\]+ = $val" \
            "got expected value '$val'"
 
        gdb_test "tfind none" \
@@ -441,7 +432,6 @@ proc gdb_collect_expression_test { func expr val msg } {
 }
 
 proc gdb_collect_globals_test { } {
-    global cr
     global gdb_prompt
 
     with_test_prefix "collect globals" {
@@ -493,49 +483,49 @@ proc gdb_collect_globals_test { } {
        run_trace_experiment globals_test_func
 
        gdb_test "print globalc" \
-           "\\$\[0-9\]+ = 71 'G'$cr" \
+           "\\$\[0-9\]+ = 71 'G'" \
            "collected global char"
        gdb_test "print globali" \
-           "\\$\[0-9\]+ = 72$cr" \
+           "\\$\[0-9\]+ = 72" \
            "collected global int"
        gdb_test "print globalf" \
-           "\\$\[0-9\]+ = 73.\[23\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 73.\[23\]\[0-9\]*" \
            "collected global float"
        gdb_test "print globald" \
-           "\\$\[0-9\]+ = 74.\[34\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 74.\[34\]\[0-9\]*" \
            "collected global double"
 
        gdb_test "print globalstruct.memberc" \
-           "\\$\[0-9\]+ = 81 'Q'$cr" \
+           "\\$\[0-9\]+ = 81 'Q'" \
            "collected struct char member"
        gdb_test "print globalstruct.memberi" \
-           "\\$\[0-9\]+ = 82$cr" \
+           "\\$\[0-9\]+ = 82" \
            "collected struct member int"
        gdb_test "print globalstruct.memberf" \
-           "\\$\[0-9\]+ = 83.\[23\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 83.\[23\]\[0-9\]*" \
            "collected struct member float"
        gdb_test "print globalstruct.memberd" \
-           "\\$\[0-9\]+ = 84.\[34\]\[0-9\]*$cr" \
+           "\\$\[0-9\]+ = 84.\[34\]\[0-9\]*" \
            "collected struct member double"
 
        gdb_test "print globalp == &globalstruct" \
-           "\\$\[0-9\]+ = 1$cr" \
+           "\\$\[0-9\]+ = 1" \
            "collected global pointer"
 
        gdb_test "print globalarr\[1\]" \
-           "\\$\[0-9\]+ = 1$cr" \
+           "\\$\[0-9\]+ = 1" \
            "collected global array element #1"
        gdb_test "print globalarr\[2\]" \
-           "\\$\[0-9\]+ = 2$cr" \
+           "\\$\[0-9\]+ = 2" \
            "collected global array element #2"
        gdb_test "print globalarr\[3\]" \
-           "\\$\[0-9\]+ = 3$cr" \
+           "\\$\[0-9\]+ = 3" \
            "collected global array element #3"
 
        # Check that we didn't mess up sort&merging memory ranges to
        # collect.
        gdb_test "print globalarr2" \
-           "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}$cr" \
+           "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}" \
            "collected global array 2"
 
        # GDB would internal error collecting UNOP_MEMVAL's whose address
@@ -543,7 +533,7 @@ proc gdb_collect_globals_test { } {
        # corresponding 'collect' action above).  This just double checks
        # we actually did collect what we wanted.
        gdb_test "print globalarr3" \
-           "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}$cr" \
+           "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}" \
            "collect globals: collected global array 3"
 
        gdb_test "tfind none" \
@@ -633,7 +623,6 @@ proc gdb_collect_return_test { } {
 
 proc gdb_collect_strings_test { func mystr myrslt mylim msg } {
     global hex
-    global cr
     global gdb_prompt
 
     with_test_prefix "collect $msg" {
@@ -667,7 +656,7 @@ proc gdb_collect_strings_test { func mystr myrslt mylim msg } {
        run_trace_experiment $func
 
        gdb_test "print $mystr" \
-           "\\$\[0-9\]+ = $hex \"$myrslt\".*$cr" \
+           "\\$\[0-9\]+ = $hex \"$myrslt\".*" \
            "collected local string"
 
        gdb_test "tfind none" \
index 97ef66b8df2a14762738500f491b7791f6863d08..cff6ab06e00841c1ee40d91763b99846476ae51c 100644 (file)
@@ -114,12 +114,13 @@ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
 gdb_test_no_output "tstop"
 gdb_test "tstatus"
 gdb_test "info tracepoints" \
-    "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
-\[0-9\]+\[\t \]+tracepoint     keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
-\[\t \]+tracepoint already hit 1 time.
-\[\t \]+trace buffer usage ${decimal} bytes.
-\[\t \]+collect gdb_struct1_test.
-\tinstalled on target.
-\[0-9\]+\[\t \]+tracepoint     keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
-\tinstalled on target." \
+    [multi_line \
+        "Num     Type\[ \]+Disp Enb Address\[ \]+What.*" \
+        "\[0-9\]+\[\t \]+tracepoint     keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \
+        "\[\t \]+tracepoint already hit 1 time" \
+        "\[\t \]+trace buffer usage ${decimal} bytes" \
+        "\[\t \]+collect gdb_struct1_test" \
+        "\tinstalled on target" \
+        "\[0-9\]+\[\t \]+tracepoint     keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \
+        "\tinstalled on target"] \
     "2.6: info tracepoints (trace buffer usage)"
index da355bcdaeef2b248261ff73c1e5bfca0489d07f..a2db61729d1fda94702b33f7a55fffcc609ed598 100644 (file)
@@ -154,7 +154,7 @@ proc pending_tracepoint_works { trace_type } {
        gdb_test "continue" "Continuing.\r\n\r\n(Thread .* hit )?Breakpoint.*marker.*at.*$srcfile.*" \
            "continue to marker"
 
-       gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"
+       gdb_test_no_output "tstop" "stop trace experiment"
 
        gdb_test "tfind start" "#0 .*" "tfind test frame 0"
        gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" \
@@ -222,7 +222,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
        }
     }
 
-    gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"
+    gdb_test_no_output "tstop" "stop trace experiment"
 
     # tracepoint should be resolved.
     gdb_test "info trace" \
@@ -294,7 +294,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
        }
     }
 
-    gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"
+    gdb_test_no_output "tstop" "stop trace experiment"
 
     # tracepoint should be resolved.
     gdb_test "info trace" \
@@ -466,7 +466,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
 
     }
 
-    gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"
+    gdb_test_no_output "tstop" "stop trace experiment"
 
     # tracepoint should be resolved.
     gdb_test "info trace" \
index 39c2fa02ca1d0de13dcc3e270cdd87acbe406aba..5b556f50a07172c44db1bfcedf72ea243b2ea2eb 100644 (file)
@@ -19,7 +19,6 @@ standard_testfile
 set executable ""
 
 set ws "\[\r\n\t \]+"
-set cr "\[\r\n\]+"
 
 # Only x86 and x86_64 targets are supported for now.
 
@@ -73,8 +72,7 @@ proc run_trace_experiment { test_probe msg } {
     gdb_test "continue" \
            "Continuing.*Breakpoint \[0-9\]+.*" \
            "collect $msg: run trace experiment"
-    gdb_test "tstop" \
-           "\[\r\n\]+" \
+    gdb_test_no_output "tstop" \
            "collect $msg: stop trace experiment"
     gdb_test "tfind start" \
            "#0 .*" \
@@ -83,7 +81,6 @@ proc run_trace_experiment { test_probe msg } {
 
 proc gdb_collect_probe_arg { msg probe val_arg0 } {
     global gdb_prompt
-    global cr
 
     prepare_for_trace_test
 
@@ -98,7 +95,7 @@ proc gdb_collect_probe_arg { msg probe val_arg0 } {
     run_trace_experiment $msg $probe
 
     gdb_test "print \$_probe_arg0" \
-           "\\$\[0-9\]+ = $val_arg0$cr" \
+           "\\$\[0-9\]+ = $val_arg0" \
            "collect $msg: collected probe arg0"
 }
 
index dfb1067d1987c7c062197ac93d655cd85cd62e89..3e2e2c95f55ad71c2aa7e0625f1c374ab32b07c8 100644 (file)
@@ -24,7 +24,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
 }
 
 set ws "\[\r\n\t \]+"
-set cr "\[\r\n\]+"
 
 #
 # Utility procs
@@ -33,13 +32,12 @@ set cr "\[\r\n\]+"
 proc test_register { reg } {
     global gdb_prompt
     global hex
-    global cr
 
     gdb_test_multiple "print /x $reg" "collected $reg" {
-       -re "\\$\[0-9\]+ = \[x0\]+$cr$gdb_prompt $" {
+       -re "\\$\[0-9\]+ = \[x0\]+\r\n$gdb_prompt $" {
            fail "collected $reg (zero)"
        }
-       -re "\\$\[0-9\]+ = $hex$cr$gdb_prompt $" {
+       -re "\\$\[0-9\]+ = $hex\r\n$gdb_prompt $" {
            pass "collected $reg"
        }
        -re "\[Ee\]rror.*$gdb_prompt $" {
@@ -77,8 +75,7 @@ proc run_trace_experiment { test_func } {
     gdb_test "continue" \
            "Continuing.*Breakpoint \[0-9\]+, end.*" \
            "run trace experiment"
-    gdb_test "tstop" \
-           "\[\r\n\]+" \
+    gdb_test_no_output "tstop" \
            "stop trace experiment"
     gdb_test "tfind start" \
            "#0  $test_func .*" \
@@ -120,8 +117,6 @@ proc test_maybe_regvar_display { var } {
 #
 
 proc gdb_collect_args_test_1 {} {
-    global cr
-
     # Test printing the variables, and also their addresses.  We
     # haven't collected any stack, so there's no way GDB can figure
     # out the latter.
@@ -159,13 +154,13 @@ proc gdb_collect_args_test_1 {} {
     gdb_test "print argarray\[0\]" "value is not available"
 
     # Test "info args"
-    set r ""
-    set r "${r}argc = <unavailable>${cr}"
-    set r "${r}argi = <unavailable>${cr}"
-    set r "${r}argf = <unavailable>${cr}"
-    set r "${r}argd = <unavailable>${cr}"
-    set r "${r}argstruct = <unavailable>${cr}"
-    set r "${r}argarray = <unavailable>${cr}"
+    set r [multi_line \
+              "argc = <unavailable>" \
+              "argi = <unavailable>" \
+              "argf = <unavailable>" \
+              "argd = <unavailable>" \
+              "argstruct = <unavailable>" \
+              "argarray = <unavailable>"]
     gdb_test "info args" "$r" "info args"
 
     test_maybe_regvar_display "argc"
@@ -194,10 +189,10 @@ proc gdb_collect_args_test {} {
 
        set tracefile [standard_output_file ${testfile}]
        gdb_test "tsave ${tracefile}.args.tfile" \
-           "Trace data saved to file '${tracefile}.args.tfile'\.\\r" \
+           "Trace data saved to file '${tracefile}.args.tfile'\\." \
            "tsave ${testfile}.args.tfile"
        gdb_test "tsave -ctf ${tracefile}.args.ctf" \
-           "Trace data saved to directory '${tracefile}.args.ctf'\.\\r" \
+           "Trace data saved to directory '${tracefile}.args.ctf'\\." \
            "save ctf trace file"
 
        foreach target_name ${trace_file_targets} {
@@ -217,8 +212,6 @@ proc gdb_collect_args_test {} {
 }
 
 proc gdb_collect_locals_test_1 { func } {
-    global cr
-
     gdb_test "print locc" " = <unavailable>"
     gdb_test "print loci" " = <unavailable>"
     gdb_test "print locf" " = <unavailable>"
@@ -236,16 +229,16 @@ proc gdb_collect_locals_test_1 { func } {
 
     # Test "info locals"
     set r ""
-    set r "${r}locf = <unavailable>${cr}"
-    set r "${r}locd = <unavailable>${cr}"
-    set r "${r}locst = <unavailable>${cr}"
-    set r "${r}locar = <unavailable>${cr}"
-    set r "${r}i = <unavailable>${cr}"
+    set r "${r}locf = <unavailable>"
+    set r "${r}locd = <unavailable>"
+    set r "${r}locst = <unavailable>"
+    set r "${r}locar = <unavailable>"
+    set r "${r}i = <unavailable>"
     if { $func == "local_test_func" } {
-       set r "${r}locdefst = <unavailable>${cr}"
+       set r "${r}locdefst = <unavailable>"
     }
-    set r "${r}locc = <unavailable>${cr}"
-    set r "${r}loci = <unavailable>${cr}"
+    set r "${r}locc = <unavailable>"
+    set r "${r}loci = <unavailable>"
     gdb_test "info locals" "$r" "info locals"
 
     test_maybe_regvar_display "loci"
@@ -276,10 +269,10 @@ proc gdb_collect_locals_test { func msg } {
 
        set tracefile [standard_output_file ${testfile}]
        gdb_test "tsave ${tracefile}.locals.tfile" \
-           "Trace data saved to file '${tracefile}.locals.tfile'\.\\r" \
+           "Trace data saved to file '${tracefile}.locals.tfile'\\." \
            "tsave ${testfile}.locals.tfile"
        gdb_test "tsave -ctf ${tracefile}.locals.ctf" \
-           "Trace data saved to directory '${tracefile}.locals.ctf'\.\\r" \
+           "Trace data saved to directory '${tracefile}.locals.ctf'\\." \
            "save ctf trace file"
 
        foreach target_name ${trace_file_targets} {
@@ -357,10 +350,10 @@ proc gdb_unavailable_registers_test { } {
 
        set tracefile [standard_output_file ${testfile}]
        gdb_test "tsave ${tracefile}.registers.tfile" \
-           "Trace data saved to file '${tracefile}.registers.tfile'\.\\r" \
+           "Trace data saved to file '${tracefile}.registers.tfile'\\." \
            "tsave ${testfile}.registers.tfile"
        gdb_test "tsave -ctf ${tracefile}.registers.ctf" \
-           "Trace data saved to directory '${tracefile}.registers.ctf'\.\\r" \
+           "Trace data saved to directory '${tracefile}.registers.ctf'\\." \
            "save ctf trace file"
 
        foreach target_name ${trace_file_targets} {
@@ -419,10 +412,10 @@ proc gdb_unavailable_floats { } {
 
        set tracefile [standard_output_file ${testfile}]
        gdb_test "tsave ${tracefile}.floats.tfile" \
-           "Trace data saved to file '${tracefile}.floats.tfile'\.\\r" \
+           "Trace data saved to file '${tracefile}.floats.tfile'\\." \
            "tsave ${testfile}.floats.tfile"
        gdb_test "tsave -ctf ${tracefile}.floats.ctf" \
-           "Trace data saved to directory '${tracefile}.floats.ctf'\.\\r" \
+           "Trace data saved to directory '${tracefile}.floats.ctf'\\." \
            "save ctf trace file"
 
        foreach target_name ${trace_file_targets} {
@@ -443,7 +436,6 @@ proc gdb_unavailable_floats { } {
 
 proc gdb_collect_globals_test_1 { } {
     global ws
-    global cr
     global gdb_prompt
     global hex
 
@@ -522,7 +514,7 @@ proc gdb_collect_globals_test_1 { } {
        "global reference shows address but not value"
 
     gdb_test "print *&g_ref" \
-       "\\$\[0-9\]+ = <unavailable>$cr" \
+       "\\$\[0-9\]+ = <unavailable>" \
        "referenced integer was not collected (taking address of reference)"
 
     gdb_test "print *g_structref_p" " = <unavailable>"
@@ -531,7 +523,7 @@ proc gdb_collect_globals_test_1 { } {
 
     # Const string is always available, even when not collected.
     gdb_test "print g_const_string" \
-       " = \"hello world\"$cr" \
+       " = \"hello world\"" \
        "non collected const string is still printable"
 
     gdb_test "print g_string_p" \
@@ -552,7 +544,7 @@ proc gdb_collect_globals_test_1 { } {
     # variable being set to <unavailable> without error.
     set msg "examining partially collected object"
     gdb_test_multiple "x /10x &struct_b" "$msg" {
-       -re "$hex <struct_b>:${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>$cr$hex <struct_b\\+16>:${ws}<unavailable>${ws}<unavailable>${ws}0xaaaaaaaa${ws}<unavailable>$cr$hex <struct_b\\+32>:${ws}<unavailable>${ws}<unavailable>$cr$gdb_prompt $" {
+       -re "$hex <struct_b>:${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>\r\n$hex <struct_b\\+16>:${ws}<unavailable>${ws}<unavailable>${ws}0xaaaaaaaa${ws}<unavailable>\r\n$hex <struct_b\\+32>:${ws}<unavailable>${ws}<unavailable>\r\n$gdb_prompt $" {
            pass "$msg"
        }
        -re "value is not available" {
@@ -685,10 +677,10 @@ proc gdb_collect_globals_test { } {
 
        set tracefile [standard_output_file ${testfile}]
        gdb_test "tsave ${tracefile}.globals.tfile" \
-           "Trace data saved to file '${tracefile}.globals.tfile'\.\\r" \
+           "Trace data saved to file '${tracefile}.globals.tfile'\\." \
            "tsave ${testfile}.globals.tfile"
        gdb_test "tsave -ctf ${tracefile}.globals.ctf" \
-           "Trace data saved to directory '${tracefile}.globals.ctf'\.\\r" \
+           "Trace data saved to directory '${tracefile}.globals.ctf'\\." \
            "save ctf trace file"
 
        foreach target_name ${trace_file_targets} {
index 21cc2ee8298fc73fd8db52570f63d0e1c3f95b62..c2bb55ea278cdf586dee54a2b9e3972a850b567f 100644 (file)
@@ -137,10 +137,10 @@ check_tracepoint "live"
 gdb_test_no_output "tstop"
 set tracefile [standard_output_file ${testfile}]
 gdb_test "tsave ${tracefile}.tf" \
-    "Trace data saved to file '${tracefile}.tf'\.\\r" \
+    "Trace data saved to file '${tracefile}.tf'\\." \
     "save tfile trace file"
 gdb_test "tsave -ctf ${tracefile}.ctf" \
-    "Trace data saved to directory '${tracefile}.ctf'\.\\r" \
+    "Trace data saved to directory '${tracefile}.ctf'\\." \
     "save ctf trace file"
 
 # Restart GDB and read the trace data in tfile target.