| OLD | NEW |
| 1 # Copyright (C) 2011-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2011-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 # This file is part of the GDB testsuite. It tests automagic loading of | 16 # This file is part of the GDB testsuite. It tests automagic loading of |
| 17 # -gdb.py scripts. | 17 # -gdb.py scripts. |
| 18 | 18 |
| 19 if $tracelevel then { | 19 standard_testfile |
| 20 strace $tracelevel | |
| 21 } | |
| 22 | 20 |
| 23 set testfile "py-objfile-script" | 21 if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { |
| 24 set srcfile ${testfile}.c | |
| 25 set binfile ${objdir}/${subdir}/${testfile} | |
| 26 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
g}] != "" } { | |
| 27 untested "Couldn't compile ${srcfile}" | |
| 28 return -1 | 22 return -1 |
| 29 } | 23 } |
| 30 | 24 |
| 31 # Start with a fresh gdb. | 25 # Start with a fresh gdb. |
| 32 gdb_exit | 26 gdb_exit |
| 33 gdb_start | 27 gdb_start |
| 34 | 28 |
| 35 # Skip all tests if Python scripting is not enabled. | 29 # Skip all tests if Python scripting is not enabled. |
| 36 if { [skip_python_tests] } { continue } | 30 if { [skip_python_tests] } { continue } |
| 37 | 31 |
| 38 # Make the -gdb.py script available to gdb, it is automagically loaded by gdb. | 32 # Make the -gdb.py script available to gdb, it is automagically loaded by gdb. |
| 39 # Care is taken to put it in the same directory as the binary so that | 33 # Care is taken to put it in the same directory as the binary so that |
| 40 # gdb will find it. | 34 # gdb will find it. |
| 41 set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}-gdb
.py.in ${subdir}/${testfile}-gdb.py] | 35 set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}-gdb
.py.in ${subdir}/${testfile}-gdb.py] |
| 42 | 36 |
| 43 gdb_reinitialize_dir $srcdir/$subdir | 37 gdb_reinitialize_dir $srcdir/$subdir |
| 38 gdb_test_no_output "set auto-load safe-path ${remote_python_file}" "set auto-loa
d safe-path" |
| 44 gdb_load ${binfile} | 39 gdb_load ${binfile} |
| 45 | 40 |
| 46 # Verify gdb loaded the script. | 41 # Verify gdb loaded the script. |
| 47 gdb_test "info auto-load-scripts" "Yes.*/${testfile}-gdb.py.*" | 42 gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" |
| 48 | 43 |
| 49 if ![runto_main] { | 44 if ![runto_main] { |
| 50 perror "couldn't run to main" | 45 perror "couldn't run to main" |
| 51 return | 46 return |
| 52 } | 47 } |
| 53 | 48 |
| 54 gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \ | 49 gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \ |
| 55 ".*Breakpoint.*" | 50 ".*Breakpoint.*" |
| 56 gdb_test "continue" ".*Breakpoint.*" | 51 gdb_test "continue" ".*Breakpoint.*" |
| 57 | 52 |
| 58 gdb_test "print ss" " = a=<1> b=<2>" | 53 gdb_test "print ss" " = a=<1> b=<2>" |
| 59 | 54 |
| 60 remote_file host delete ${remote_python_file} | 55 remote_file host delete ${remote_python_file} |
| OLD | NEW |