| OLD | NEW |
| 1 # Copyright 1997, 1999, 2007-2008, 2010-2012 Free Software Foundation, | 1 # Copyright 1997, 1999, 2007-2008, 2010-2012 Free Software Foundation, |
| 2 # Inc. | 2 # Inc. |
| 3 | 3 |
| 4 # This program is free software; you can redistribute it and/or modify | 4 # This program is free software; you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License as published by | 5 # it under the terms of the GNU General Public License as published by |
| 6 # the Free Software Foundation; either version 3 of the License, or | 6 # the Free Software Foundation; either version 3 of the License, or |
| 7 # (at your option) any later version. | 7 # (at your option) any later version. |
| 8 # | 8 # |
| 9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
| 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
| 13 # | 13 # |
| 14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
| 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | 16 |
| 17 | 17 |
| 18 # This program tests the 'catch syscall' functionality. | 18 # This program tests the 'catch syscall' functionality. |
| 19 # | 19 # |
| 20 # It was written by Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com> | 20 # It was written by Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com> |
| 21 # on September/2008. | 21 # on September/2008. |
| 22 | 22 |
| 23 if { [is_remote target] || ![isnative] } then { | 23 if { [is_remote target] || ![isnative] } then { |
| 24 continue | 24 continue |
| 25 } | 25 } |
| 26 | 26 |
| 27 # Until "catch syscall" is implemented on other targets... |
| 28 if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then { |
| 29 continue |
| 30 } |
| 31 |
| 32 # This shall be updated whenever 'catch syscall' is implemented |
| 33 # on some architecture. |
| 34 #if { ![istarget "i\[34567\]86-*-linux*"] |
| 35 if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"] |
| 36 && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"] |
| 37 && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] |
| 38 && ![istarget "mips*-linux*"] } { |
| 39 continue |
| 40 } |
| 27 | 41 |
| 28 global srcfile | 42 global srcfile |
| 29 set testfile "catch-syscall" | 43 set testfile "catch-syscall" |
| 30 set srcfile ${testfile}.c | 44 set srcfile ${testfile}.c |
| 31 set binfile ${objdir}/${subdir}/${testfile} | 45 set binfile ${objdir}/${subdir}/${testfile} |
| 32 | 46 |
| 33 # All (but the last) syscalls from the example code | 47 # All (but the last) syscalls from the example code |
| 34 # They are ordered according to the file, so do not change this. | 48 # They are ordered according to the file, so do not change this. |
| 35 set all_syscalls { "close" "chroot" } | 49 set all_syscalls { "close" "chroot" } |
| 36 set all_syscalls_numbers { } | 50 set all_syscalls_numbers { } |
| 37 # The last syscall (exit()) does not return, so | 51 # The last syscall (exit()) does not return, so |
| 38 # we cannot expect the catchpoint to be triggered | 52 # we cannot expect the catchpoint to be triggered |
| 39 # twice. It is a special case. | 53 # twice. It is a special case. |
| 40 set last_syscall "exit_group" | 54 set last_syscall "exit_group" |
| 41 | 55 |
| 42 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { | 56 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { |
| 43 untested catch-syscall.exp | 57 untested catch-syscall.exp |
| 44 return -1 | 58 return -1 |
| 45 } | 59 } |
| 46 | 60 |
| 47 # Until "catch syscall" is implemented on other targets... | |
| 48 if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then { | |
| 49 continue | |
| 50 } | |
| 51 | |
| 52 # This shall be updated whenever 'catch syscall' is implemented | |
| 53 # on some architecture. | |
| 54 #if { ![istarget "i\[34567\]86-*-linux*"] | |
| 55 if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"] | |
| 56 && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"] | |
| 57 && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] | |
| 58 && ![istarget "mips*-linux*"] } { | |
| 59 continue | |
| 60 } | |
| 61 | |
| 62 # Internal procedure used to check if, after issuing a 'catch syscall' | 61 # Internal procedure used to check if, after issuing a 'catch syscall' |
| 63 # command (without arguments), the 'info breakpoints' command displays | 62 # command (without arguments), the 'info breakpoints' command displays |
| 64 # that '"any syscall"' is to be caught. | 63 # that '"any syscall"' is to be caught. |
| 65 proc check_info_bp_any_syscall {} { | 64 proc check_info_bp_any_syscall {} { |
| 66 global gdb_prompt | 65 global gdb_prompt |
| 67 | 66 |
| 68 # Verifying that the catchpoint appears in the 'info breakpoints' | 67 # Verifying that the catchpoint appears in the 'info breakpoints' |
| 69 # command, but with "<any syscall>". | 68 # command, but with "<any syscall>". |
| 70 set thistest "catch syscall appears in 'info breakpoints'" | 69 set thistest "catch syscall appears in 'info breakpoints'" |
| 71 gdb_test "info breakpoints" ".*catchpoint.*keep y.*syscall \"<any syscall>\"
.*" $thistest | 70 gdb_test "info breakpoints" ".*catchpoint.*keep y.*syscall \"<any syscall>\"
.*" $thistest |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 # Restart gdb | 440 # Restart gdb |
| 442 | 441 |
| 443 gdb_exit | 442 gdb_exit |
| 444 gdb_start | 443 gdb_start |
| 445 gdb_reinitialize_dir $srcdir/$subdir | 444 gdb_reinitialize_dir $srcdir/$subdir |
| 446 gdb_load ${binfile} | 445 gdb_load ${binfile} |
| 447 | 446 |
| 448 # Execute the tests, without XML support. In this case, GDB will | 447 # Execute the tests, without XML support. In this case, GDB will |
| 449 # only display syscall numbers, and not syscall names. | 448 # only display syscall numbers, and not syscall names. |
| 450 do_syscall_tests_without_xml | 449 do_syscall_tests_without_xml |
| OLD | NEW |