| OLD | NEW |
| 1 # Copyright (C) 2008-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2008-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. | 16 # This file is part of the GDB testsuite. |
| 17 | 17 |
| 18 load_lib gdb-python.exp | 18 load_lib gdb-python.exp |
| 19 | 19 |
| 20 if {[skip_shlib_tests]} { | 20 if {[skip_shlib_tests]} { |
| 21 return 0 | 21 return 0 |
| 22 } | 22 } |
| 23 | 23 |
| 24 set testfile "py-shared" | 24 standard_testfile |
| 25 set srcfile ${testfile}.c | 25 |
| 26 set libfile "py-shared-sl" | 26 set libfile "py-shared-sl" |
| 27 set libsrc ${libfile}.c | 27 set libsrc ${libfile}.c |
| 28 set library ${objdir}/${subdir}/${libfile}.sl | 28 set library [standard_output_file ${libfile}.sl] |
| 29 set binfile ${objdir}/${subdir}/${testfile} | |
| 30 | 29 |
| 31 if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != ""
} { | 30 if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != ""
} { |
| 32 untested "Could not compile shared library." | 31 untested "Could not compile shared library." |
| 33 return -1 | 32 return -1 |
| 34 } | 33 } |
| 35 | 34 |
| 36 set exec_opts [list debug shlib=${library}] | 35 set exec_opts [list debug shlib=${library}] |
| 37 | 36 |
| 38 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opt
s] != "" } { | 37 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opt
s] != "" } { |
| 39 untested "Could not compile $binfile." | 38 untested "Could not compile $binfile." |
| 40 return -1 | 39 return -1 |
| 41 } | 40 } |
| 42 | 41 |
| 43 # Start with a fresh gdb. | 42 # Start with a fresh gdb. |
| 44 gdb_exit | 43 clean_restart $testfile |
| 45 gdb_start | |
| 46 gdb_reinitialize_dir $srcdir/$subdir | |
| 47 gdb_load ${binfile} | |
| 48 gdb_load_shlibs ${library} | 44 gdb_load_shlibs ${library} |
| 49 | 45 |
| 50 # Skip all tests if Python scripting is not enabled. | 46 # Skip all tests if Python scripting is not enabled. |
| 51 if { [skip_python_tests] } { continue } | 47 if { [skip_python_tests] } { continue } |
| 52 | 48 |
| 53 # The following tests require execution. | 49 # The following tests require execution. |
| 54 | 50 |
| 55 if ![runto_main] then { | 51 if ![runto_main] then { |
| 56 fail "Can't run to main" | 52 fail "Can't run to main" |
| 57 return 0 | 53 return 0 |
| 58 } | 54 } |
| 59 | 55 |
| 60 runto [gdb_get_line_number "Break to end."] | 56 runto [gdb_get_line_number "Break to end."] |
| 61 | 57 |
| 62 # Test gdb.solib_name | 58 # Test gdb.solib_name |
| 63 gdb_test "p &func1" "" "func1 address" | 59 gdb_test "p &func1" "" "func1 address" |
| 64 gdb_py_test_silent_cmd "python func1 = gdb.history(0)" "Aquire func1 address" 1 | 60 gdb_py_test_silent_cmd "python func1 = gdb.history(0)" "Aquire func1 address" 1 |
| 65 gdb_test "python print gdb.solib_name(long(func1))" "py-shared-sl.sl" "test func
1 solib location" | 61 gdb_test "python print gdb.solib_name(long(func1))" "py-shared-sl.sl" "test func
1 solib location" |
| 66 | 62 |
| 67 gdb_test "p &main" "" "main address" | 63 gdb_test "p &main" "" "main address" |
| 68 gdb_py_test_silent_cmd "python main = gdb.history(0)" "Aquire main address" 1 | 64 gdb_py_test_silent_cmd "python main = gdb.history(0)" "Aquire main address" 1 |
| 69 gdb_test "python print gdb.solib_name(long(main))" "None" "test main solib locat
ion" | 65 gdb_test "python print gdb.solib_name(long(main))" "None" "test main solib locat
ion" |
| OLD | NEW |