| OLD | NEW |
| 1 # Copyright 1999, 2001-2012 Free Software Foundation, Inc. | 1 # Copyright 1999, 2001-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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #### However, if all goes well, Linux will soon have a libthread_db | 26 #### However, if all goes well, Linux will soon have a libthread_db |
| 27 #### interface, and GDB will manage it the same way it does other | 27 #### interface, and GDB will manage it the same way it does other |
| 28 #### libthread_db-based systems. Then, we can adjust this file to | 28 #### libthread_db-based systems. Then, we can adjust this file to |
| 29 #### work with any such system. | 29 #### work with any such system. |
| 30 | 30 |
| 31 ### Other things we ought to test: | 31 ### Other things we ought to test: |
| 32 ### stepping a thread while others are running | 32 ### stepping a thread while others are running |
| 33 ### killing and restarting | 33 ### killing and restarting |
| 34 ### quitting gracefully | 34 ### quitting gracefully |
| 35 | 35 |
| 36 if $tracelevel then { | |
| 37 strace $tracelevel | |
| 38 } | |
| 39 | |
| 40 | 36 |
| 41 # This only works with Linux configurations. | 37 # This only works with Linux configurations. |
| 42 if ![istarget *-*-linux-gnu*] then { | 38 if ![istarget *-*-linux-gnu*] then { |
| 43 return | 39 return |
| 44 } | 40 } |
| 45 | 41 |
| 46 set testfile "linux-dp" | 42 standard_testfile |
| 47 set srcfile ${testfile}.c | |
| 48 set binfile ${objdir}/${subdir}/${testfile} | |
| 49 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
le {debug}] != ""} { | 43 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
le {debug}] != ""} { |
| 50 return -1 | 44 return -1 |
| 51 } | 45 } |
| 52 | 46 |
| 53 gdb_start | 47 clean_restart ${binfile} |
| 54 gdb_reinitialize_dir $srcdir/$subdir | |
| 55 gdb_load ${binfile} | |
| 56 gdb_test_no_output "set print sevenbit-strings" | 48 gdb_test_no_output "set print sevenbit-strings" |
| 57 runto_main | 49 runto_main |
| 58 | 50 |
| 59 # There should be no threads initially. | 51 # There should be no threads initially. |
| 60 gdb_test "info threads" ".*" "info threads 1" | 52 gdb_test "info threads" ".*" "info threads 1" |
| 61 | 53 |
| 62 # Try stepping over the thread creation function. | 54 # Try stepping over the thread creation function. |
| 63 gdb_breakpoint [gdb_get_line_number "linuxthreads.exp: create philosopher"] | 55 gdb_breakpoint [gdb_get_line_number "linuxthreads.exp: create philosopher"] |
| 64 set expect_manager -1 | 56 set expect_manager -1 |
| 65 for {set i 0} {$i < 5} {incr i} { | 57 for {set i 0} {$i < 5} {incr i} { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 ## test suite totals. But in my heart, I think it should | 328 ## test suite totals. But in my heart, I think it should |
| 337 ## be an xfail. | 329 ## be an xfail. |
| 338 pass $name | 330 pass $name |
| 339 } | 331 } |
| 340 } | 332 } |
| 341 | 333 |
| 342 return $interesting | 334 return $interesting |
| 343 } | 335 } |
| 344 | 336 |
| 345 set any_interesting 0 | 337 set any_interesting 0 |
| 338 catch {unset seen} |
| 346 array set seen {} | 339 array set seen {} |
| 347 unset seen | |
| 348 for {set i 1} {$i <= $nthreads} {incr i} { | 340 for {set i 1} {$i <= $nthreads} {incr i} { |
| 349 if [check_philosopher_stack $i seen] { | 341 if [check_philosopher_stack $i seen] { |
| 350 set any_interesting 1 | 342 set any_interesting 1 |
| 351 } | 343 } |
| 352 } | 344 } |
| 345 unset seen |
| 353 | 346 |
| 354 if {$any_interesting} { | 347 if {$any_interesting} { |
| 355 pass "found an interesting thread" | 348 pass "found an interesting thread" |
| 356 } else { | 349 } else { |
| 357 fail "found an interesting thread" | 350 fail "found an interesting thread" |
| 358 } | 351 } |
| 359 | 352 |
| 360 if {$manager_seen == $expect_manager} { | 353 if {$manager_seen == $expect_manager} { |
| 361 pass "manager thread found (not found) when expected" | 354 pass "manager thread found (not found) when expected" |
| 362 } else { | 355 } else { |
| 363 fail "manager thread found (not found) when expected" | 356 fail "manager thread found (not found) when expected" |
| 364 } | 357 } |
| OLD | NEW |