diff options
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/attach.c | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/attach.exp | 8 |
3 files changed, 15 insertions, 6 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4c3d587..46ffa75 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2014-09-12 Jan Kratochvil <jan.kratochvil@redhat.com> + + * gdb.base/attach.c: Include unistd.h. + (main): Call alarm. Add label postloop. + * gdb.base/attach.exp (do_attach_tests): Use gdb_get_line_number, + gdb_breakpoint, gdb_continue_to_breakpoint. + (test_command_line_attach_run): Kill ${testpid} in one exit path. + 2014-09-11 Pedro Alves <palves@redhat.com> PR gdb/17347 diff --git a/gdb/testsuite/gdb.base/attach.c b/gdb/testsuite/gdb.base/attach.c index 0041b47..91b180c 100644 --- a/gdb/testsuite/gdb.base/attach.c +++ b/gdb/testsuite/gdb.base/attach.c @@ -5,6 +5,7 @@ exit unless/until gdb sets the variable to non-zero.) */ #include <stdio.h> +#include <unistd.h> int should_exit = 0; @@ -12,9 +13,11 @@ int main () { int local_i = 0; + alarm (60); + while (! should_exit) { local_i++; } - return 0; + return 0; /* postloop */ } diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index 6340496..5fb5c53 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -256,11 +256,8 @@ proc do_attach_tests {} { # Verify that the modification really happened. - gdb_test "tbreak 19" "Temporary breakpoint .*at.*$srcfile, line 19.*" \ - "after attach2, set tbreak postloop" - - gdb_test "continue" "main.*at.*$srcfile:19.*" \ - "after attach2, reach tbreak postloop" + gdb_breakpoint [gdb_get_line_number "postloop"] temporary + gdb_continue_to_breakpoint "postloop" ".* postloop .*" # Allow the test process to exit, to cleanup after ourselves. @@ -418,6 +415,7 @@ proc test_command_line_attach_run {} { "-iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""] if { $res != 0} { fail $test + remote_exec build "kill -9 ${testpid}" return $res } gdb_test_multiple "" $test { |