From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 60BAE3858D37 for ; Fri, 28 Apr 2023 15:51:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60BAE3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682697070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cSYr/5yytikH/H81qApqKM/3z5VEqXslJ0xf6knFAUA=; b=QpmH2RfpGvccG0A1gn46WyGbSURLHPw4PlFHMn56vIFbToaP9giEulr+/x9GZBlBxXlg7H aw/1A7vnDv8qJqPsTpWmfUB4+XjB2Q3xZ6ingJ88amuRke1YizvYo2xHPqYIQ+R0uBY6Tp OJGAH3J6KJSUVryfiIJZ2gTCOQEweNw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-391-xag05L4uPbq7wx2yo7pBYA-1; Fri, 28 Apr 2023 11:51:07 -0400 X-MC-Unique: xag05L4uPbq7wx2yo7pBYA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f168827701so38902625e9.0 for ; Fri, 28 Apr 2023 08:51:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682697066; x=1685289066; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cSYr/5yytikH/H81qApqKM/3z5VEqXslJ0xf6knFAUA=; b=MvLaJT5eDdaSha6i931TGsuUF3gq0S6vH+Dp0NNUx22AGpK1OJFm/hAy5kQDaUWJGz 4xsHBFz0wU79Ml0elJrK0+GLHj0Ivm2X2MAA4h8iHhrXqhVTgey6loLftUOxXqF/XshZ PUECJc4fmCv6t5+3ylZQeop0D1W+X6Q6dqeRT+F2JRHc4c7VkzsUpKysjGBnvJOAshnr iIc/dpg2dzCjwJ1QfiGqEYfhc6n5/VI7PUygrOmoX8wPYrxO3+Ghsz1vjoISbgSPQPng jCROiQKTNbB/simixeuOyZp6Cvd+GAm0dN3FamsjCNKtuVKFlEG91xhOvb43PRAacmgA MoFw== X-Gm-Message-State: AC+VfDzUrhqQdLchcFe7kSi2Y2XKwgOKGykA7jpLJZyqb03loRzhhu3R h1W8D3G4I2xnmB0LadiGjlLQYuYMNOuw0VNZgTFeB6nZCxb7hvqKZBA7KHnEZyQ/qFJGhGWnnxn l7L2L1IKdkXb4I3uY+ZczrzGxHa8e9Q== X-Received: by 2002:a7b:cb8c:0:b0:3f1:76d0:8bb0 with SMTP id m12-20020a7bcb8c000000b003f176d08bb0mr4553216wmi.36.1682697065852; Fri, 28 Apr 2023 08:51:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5nZbdPy9pagFc+bpq8+kIXdjGUzguC2Q78FIzxWQFlrdNETLLtqa+r5EWy527vIs+MZ6d69A== X-Received: by 2002:a7b:cb8c:0:b0:3f1:76d0:8bb0 with SMTP id m12-20020a7bcb8c000000b003f176d08bb0mr4553196wmi.36.1682697065233; Fri, 28 Apr 2023 08:51:05 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id v11-20020a1cf70b000000b003f25b40fc24sm10234414wmh.6.2023.04.28.08.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 08:51:04 -0700 (PDT) From: Andrew Burgess To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH 4/5] gdb/testsuite: change newline patterns used in gdb_test In-Reply-To: <9c4e4ce6-9986-1c3a-9885-f4f3388e95f6@simark.ca> References: <464e64e3a3483c228f0a73c778bcaf79e4595abd.1680293848.git.aburgess@redhat.com> <9c4e4ce6-9986-1c3a-9885-f4f3388e95f6@simark.ca> Date: Fri, 28 Apr 2023 16:51:03 +0100 Message-ID: <87r0s49fa0.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Simon Marchi writes: > On 3/31/23 16:20, Andrew Burgess via Gdb-patches wrote: >> This commit makes two changes to how we match newline characters in >> the gdb_test proc. >> >> First, for the newline pattern between the command output and the >> prompt, I propose changing from '[\r\n]+' to an explicit '\r\n'. >> >> The old pattern would spot multiple newlines, and so there are a few >> places where, as part of this commit, I've needed to add an extra >> trailing '\r\n' to the pattern in the main test file, where GDB's >> output actually includes a blank line. >> >> But I think this is a good thing. If a command produces a blank line >> then we should be checking for it, the current test doesn't. >> >> Additionally, the existing pattern will happily match a partial >> newline. There are a strangely large number of tests that end with a >> random '.' character. Not matching a literal period, but matching any >> single character, this is then matching half of the trailing newline >> sequence, while the \[\r\n\]+ in gdb_test is matching the other half >> of the sequence. I can think of no reason why this would be >> intentional. All of these are cleaned up after this commit. >> >> The basic rule of gdb_test after this is that the expected pattern >> needs to match everything up to, but not including the newline >> sequence immediately before the GDB prompt. >> >> Second, while I was cleaning up newline matching in gdb_test, I've >> also removed the '[\r\n]*' that was added to the start of the pattern >> passed to gdb_test_multiple. >> >> The addition of this pattern adds no value. If the user pattern >> matches at the start of a line then this would match against the >> newline sequence. But, due to the '*', if the user pattern doesn't >> match at the start of a line then this group doesn't care, it'll >> happily match nothing. >> >> As such, there's no value to it, it just adds more complexity for no >> gain, so I'm removing it. No tests will need updating as a >> consequence of this part of the patch. > > Hi Andrew, > > Starting with this patch, I see many new failures in gdb.trace (using > one of the gdbserver boards), for instance the first one being: > > FAIL: gdb.trace/collection.exp: collect args collectively: collected arg char I've pushed the patch below which fixes all the regressions I see when using the native-gdbserver board. I'm still testing with the native-extended-gdbserver board, but I'm a little short of time, so might not be able to fix any regressions that throws up until next week. So I've pushed this fix for now, and will follow up with any additional fixes I find later. Sorry for causing the regressions. Thanks, Andrew --- commit 1f7f972f59470104734ec705c985ab319eb580db Author: Andrew Burgess Date: Fri Apr 28 14:39:03 2023 +0100 gdb/testsuite: additional test fixes after gdb_test changes 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. diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp index 2a2158886d8..879690ddffb 100644 --- a/gdb/testsuite/gdb.trace/actions.exp +++ b/gdb/testsuite/gdb.trace/actions.exp @@ -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. diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp index 1315a6d9028..e79f1f1559d 100644 --- a/gdb/testsuite/gdb.trace/change-loc.exp +++ b/gdb/testsuite/gdb.trace/change-loc.exp @@ -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} diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp index 966e313d3bd..0bbf98b27b4 100644 --- a/gdb/testsuite/gdb.trace/collection.exp +++ b/gdb/testsuite/gdb.trace/collection.exp @@ -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" \ diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp index 97ef66b8df2..cff6ab06e00 100644 --- a/gdb/testsuite/gdb.trace/infotrace.exp +++ b/gdb/testsuite/gdb.trace/infotrace.exp @@ -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)" diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp index da355bcdaee..a2db61729d1 100644 --- a/gdb/testsuite/gdb.trace/pending.exp +++ b/gdb/testsuite/gdb.trace/pending.exp @@ -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" \ diff --git a/gdb/testsuite/gdb.trace/stap-trace.exp b/gdb/testsuite/gdb.trace/stap-trace.exp index 39c2fa02ca1..5b556f50a07 100644 --- a/gdb/testsuite/gdb.trace/stap-trace.exp +++ b/gdb/testsuite/gdb.trace/stap-trace.exp @@ -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" } diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp index dfb1067d198..3e2e2c95f55 100644 --- a/gdb/testsuite/gdb.trace/unavailable.exp +++ b/gdb/testsuite/gdb.trace/unavailable.exp @@ -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 = ${cr}" - set r "${r}argi = ${cr}" - set r "${r}argf = ${cr}" - set r "${r}argd = ${cr}" - set r "${r}argstruct = ${cr}" - set r "${r}argarray = ${cr}" + set r [multi_line \ + "argc = " \ + "argi = " \ + "argf = " \ + "argd = " \ + "argstruct = " \ + "argarray = "] 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" " = " gdb_test "print loci" " = " gdb_test "print locf" " = " @@ -236,16 +229,16 @@ proc gdb_collect_locals_test_1 { func } { # Test "info locals" set r "" - set r "${r}locf = ${cr}" - set r "${r}locd = ${cr}" - set r "${r}locst = ${cr}" - set r "${r}locar = ${cr}" - set r "${r}i = ${cr}" + set r "${r}locf = " + set r "${r}locd = " + set r "${r}locst = " + set r "${r}locar = " + set r "${r}i = " if { $func == "local_test_func" } { - set r "${r}locdefst = ${cr}" + set r "${r}locdefst = " } - set r "${r}locc = ${cr}" - set r "${r}loci = ${cr}" + set r "${r}locc = " + set r "${r}loci = " 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\]+ = $cr" \ + "\\$\[0-9\]+ = " \ "referenced integer was not collected (taking address of reference)" gdb_test "print *g_structref_p" " = " @@ -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 without error. set msg "examining partially collected object" gdb_test_multiple "x /10x &struct_b" "$msg" { - -re "$hex :${ws}${ws}${ws}${ws}$cr$hex :${ws}${ws}${ws}0xaaaaaaaa${ws}$cr$hex :${ws}${ws}$cr$gdb_prompt $" { + -re "$hex :${ws}${ws}${ws}${ws}\r\n$hex :${ws}${ws}${ws}0xaaaaaaaa${ws}\r\n$hex :${ws}${ws}\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} { diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp index 21cc2ee8298..c2bb55ea278 100644 --- a/gdb/testsuite/gdb.trace/while-stepping.exp +++ b/gdb/testsuite/gdb.trace/while-stepping.exp @@ -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.