From eceb0c5f4943501e17f3296e2348789ccba62522 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 9 Mar 2011 14:17:05 +0000 Subject: [PATCH] * lib/gdb.exp (inferior_exited_re): Match. leading `['. Wrap in parentheses. (gdb_continue_to_end): Add "allow_extra" parameter. Use $command. * gdb.threads/thread-unwindonsignal.exp: Pass "allow_extra" argument to gdb_continue_to_end. * gdb.threads/interrupted-hand-call.exp: Pass "allow_extra" argument to gdb_continue_to_end. * gdb.cp/annota3.exp: Fix regex. * gdb.cp/annota2.exp: Fix regex. * gdb.base/shlib-call.exp: Pass "allow_extra" argument to gdb_continue_to_end. * gdb.base/call-signal-resume.exp: Revert earlier patch. * gdb.ada/tasks.exp: Pass "allow_extra" argument to gdb_continue_to_end. --- gdb/testsuite/ChangeLog | 18 ++++++++++++++++++ gdb/testsuite/gdb.ada/tasks.exp | 3 +-- gdb/testsuite/gdb.base/call-signal-resume.exp | 3 ++- gdb/testsuite/gdb.base/shlib-call.exp | 4 ++-- gdb/testsuite/gdb.cp/annota2.exp | 2 +- gdb/testsuite/gdb.cp/annota3.exp | 7 +++---- gdb/testsuite/gdb.threads/interrupted-hand-call.exp | 2 +- gdb/testsuite/gdb.threads/thread-unwindonsignal.exp | 2 +- gdb/testsuite/lib/gdb.exp | 19 ++++++++++++++----- 9 files changed, 43 insertions(+), 17 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6ff5c10..44926d6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2011-03-09 Tom Tromey + + * lib/gdb.exp (inferior_exited_re): Match. leading `['. Wrap in + parentheses. + (gdb_continue_to_end): Add "allow_extra" parameter. Use + $command. + * gdb.threads/thread-unwindonsignal.exp: Pass "allow_extra" + argument to gdb_continue_to_end. + * gdb.threads/interrupted-hand-call.exp: Pass "allow_extra" + argument to gdb_continue_to_end. + * gdb.cp/annota3.exp: Fix regex. + * gdb.cp/annota2.exp: Fix regex. + * gdb.base/shlib-call.exp: Pass "allow_extra" argument to + gdb_continue_to_end. + * gdb.base/call-signal-resume.exp: Revert earlier patch. + * gdb.ada/tasks.exp: Pass "allow_extra" argument to + gdb_continue_to_end. + 2011-03-08 Jan Kratochvil * gdb.server/ext-run.exp diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp index aa8bf46..1ba1bb8 100644 --- a/gdb/testsuite/gdb.ada/tasks.exp +++ b/gdb/testsuite/gdb.ada/tasks.exp @@ -70,5 +70,4 @@ gdb_test "info tasks" \ # Now, resume the execution and make sure that GDB does not stop when # task 4 hits the breakpoint. Continuing thus results in our program # running to completion. -gdb_continue_to_end - +gdb_continue_to_end "" continue 1 diff --git a/gdb/testsuite/gdb.base/call-signal-resume.exp b/gdb/testsuite/gdb.base/call-signal-resume.exp index c8ca941..cf39b96 100644 --- a/gdb/testsuite/gdb.base/call-signal-resume.exp +++ b/gdb/testsuite/gdb.base/call-signal-resume.exp @@ -146,6 +146,7 @@ gdb_test "continue" "Breakpoint \[0-9\]*, handle_signal.*" \ # Continue one last time, the program should exit normally. -gdb_continue_to_end +gdb_test "continue" "$inferior_exited_re normally." \ + "continue to program exit" return 0 diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index ba484f0..1f93f78 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -182,12 +182,12 @@ if ![is_remote target] { gdb_test "run" "Starting program:.*Breakpoint .,.*" \ "run to bp in shared library" - gdb_continue_to_end + gdb_continue_to_end "" continue 1 gdb_test "run" "Starting program:.*Breakpoint .,.*" \ "re-run to bp in shared library (PR's 16495, 18213)" - gdb_continue_to_end + gdb_continue_to_end "" continue 1 } return 0 diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp index 4092a43..9aafaf8 100644 --- a/gdb/testsuite/gdb.cp/annota2.exp +++ b/gdb/testsuite/gdb.cp/annota2.exp @@ -116,7 +116,7 @@ gdb_test_multiple "print a" "print class" { # `a.x is 1' is asynchronous regarding to `frames-invalid'. # gdb_test_multiple "continue" "continue until exit" { - -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n.$inferior_exited_re normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" { + -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n$inferior_exited_re normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" { pass "continue until exit" } } diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp index a2b5d22..ce267de 100644 --- a/gdb/testsuite/gdb.cp/annota3.exp +++ b/gdb/testsuite/gdb.cp/annota3.exp @@ -116,15 +116,14 @@ gdb_expect_list "print class" "$gdb_prompt$" { # annotate-exited # send_gdb "continue\n" -gdb_expect_list "continue to exit" "$gdb_prompt$" { +gdb_expect_list "continue to exit" "$gdb_prompt$" [concat { "\r\n\032\032post-prompt\r\n" "Continuing.\r\n" "\r\n\032\032starting\r\n" "a.x is 1\r\n" - "\r\n\032\032exited 0\r\n" - ".$inferior_exited_re normally.\r\n" + "\r\n\032\032exited 0\r\n"} [list "$inferior_exited_re normally.\r\n"] { "\r\n\032\032stopped\r\n" -} +}] # # delete all breakpoints diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp index 865bc2f..fb276aa 100644 --- a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp +++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp @@ -86,6 +86,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" { # Continue one last time, the program should exit normally. -gdb_continue_to_end +gdb_continue_to_end "" continue 1 return 0 diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp index c6ae1a5..5fbf507 100644 --- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp +++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp @@ -110,6 +110,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" { # Continue one last time, the program should exit normally. -gdb_continue_to_end +gdb_continue_to_end "" continue 1 return 0 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3af8568..1b601af 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -99,7 +99,7 @@ if ![info exists env(EXEEXT)] { set octal "\[0-7\]+" -set inferior_exited_re "Inferior \[0-9\]+ \\(.*\\) exited" +set inferior_exited_re "(\\\[Inferior \[0-9\]+ \\(.*\\) exited)" ### Only procedures should come after this point. @@ -3062,8 +3062,12 @@ proc gdb_get_line_number { text { file "" } } { # default is used. # COMMAND is the command to invoke. If not given, "continue" is # used. +# ALLOW_EXTRA is a flag indicating whether the test should expect +# extra output between the "Continuing." line and the program +# exiting. By default it is zero; if nonzero, any extra output +# is accepted. -proc gdb_continue_to_end {{mssg ""} {command continue}} { +proc gdb_continue_to_end {{mssg ""} {command continue} {allow_extra 0}} { global inferior_exited_re if {$mssg == ""} { @@ -3071,18 +3075,23 @@ proc gdb_continue_to_end {{mssg ""} {command continue}} { } else { set text "continue until exit at $mssg" } + if {$allow_extra} { + set extra ".*" + } else { + set extra "" + } if [target_info exists use_gdb_stub] { if {![gdb_breakpoint "exit"]} { return 0 } - gdb_test "continue" "Continuing..*Breakpoint .*exit.*" \ + gdb_test $command "Continuing..*Breakpoint .*exit.*" \ $text } else { # Continue until we exit. Should not stop again. # Don't bother to check the output of the program, that may be # extremely tough for some remote systems. - gdb_test "continue"\ - "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\ + gdb_test $command \ + "Continuing.\[\r\n0-9\]+${extra}(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\ $text } } -- 2.7.4