| OLD | NEW |
| 1 # Copyright (C) 2009-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2009-2012 Free Software Foundation, Inc. |
| 2 | 2 |
| 3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
| 4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
| 5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
| 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 15 |
| 16 # Test that GDB doesn't get stuck when stepping over an exec call done | 16 # Test that GDB doesn't get stuck when stepping over an exec call done |
| 17 # by a thread other than the main thread. | 17 # by a thread other than the main thread. |
| 18 | 18 |
| 19 # There's no support for exec events in the remote protocol. | 19 # There's no support for exec events in the remote protocol. |
| 20 if { [is_remote target] } { | 20 if { [is_remote target] } { |
| 21 return 0 | 21 return 0 |
| 22 } | 22 } |
| 23 | 23 |
| 24 set testfile "thread-execl" | 24 standard_testfile |
| 25 set srcfile ${testfile}.c | |
| 26 set binfile ${objdir}/${subdir}/${testfile} | |
| 27 | 25 |
| 28 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ | 26 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ |
| 29 » executable [list debug "incdir=${objdir}"]] != "" } { | 27 » executable debug] != "" } { |
| 30 return -1 | 28 return -1 |
| 31 } | 29 } |
| 32 | 30 |
| 33 # Start with a fresh gdb. | 31 clean_restart ${binfile} |
| 34 | |
| 35 gdb_exit | |
| 36 gdb_start | |
| 37 gdb_reinitialize_dir $srcdir/$subdir | |
| 38 gdb_load ${binfile} | |
| 39 | 32 |
| 40 runto_main | 33 runto_main |
| 41 | 34 |
| 42 # Get ourselves to the thread that execs | 35 # Get ourselves to the thread that execs |
| 43 gdb_breakpoint "thread_execler" | 36 gdb_breakpoint "thread_execler" |
| 44 gdb_test "continue" ".*thread_execler.*" "continue to thread start" | 37 gdb_test "continue" ".*thread_execler.*" "continue to thread start" |
| 45 | 38 |
| 46 # Now set a breakpoint at `main', and step over the execl call. The | 39 # Now set a breakpoint at `main', and step over the execl call. The |
| 47 # breakpoint at main should be reached. GDB should not try to revert | 40 # breakpoint at main should be reached. GDB should not try to revert |
| 48 # back to the old thread from the old image and resume stepping it | 41 # back to the old thread from the old image and resume stepping it |
| 49 # (since it is gone). | 42 # (since it is gone). |
| 50 gdb_breakpoint "main" | 43 gdb_breakpoint "main" |
| 51 gdb_test "next" ".*main.*" "get to main in new image" | 44 gdb_test "next" ".*main.*" "get to main in new image" |
| 52 | 45 |
| 53 return 0 | 46 return 0 |
| OLD | NEW |