]>
Commit | Line | Data |
---|---|---|
c5a57081 | 1 | # Copyright (C) 2008-2012 Free Software Foundation, Inc. |
e7fbb131 PA |
2 | |
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 | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
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/>. | |
15 | ||
16 | # This file is part of the GDB testsuite. | |
17 | ||
a2c09bd0 DE |
18 | load_lib gdb-python.exp |
19 | ||
e7fbb131 PA |
20 | if {[skip_shlib_tests]} { |
21 | return 0 | |
22 | } | |
23 | ||
24 | set testfile "py-shared" | |
25 | set srcfile ${testfile}.c | |
26 | set libfile "py-shared-sl" | |
27 | set libsrc ${libfile}.c | |
28 | set library ${objdir}/${subdir}/${libfile}.sl | |
29 | set binfile ${objdir}/${subdir}/${testfile} | |
30 | ||
31 | if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != "" } { | |
32 | untested "Could not compile shared library." | |
33 | return -1 | |
34 | } | |
35 | ||
36 | set exec_opts [list debug shlib=${library}] | |
37 | ||
38 | if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opts] != "" } { | |
39 | untested "Could not compile $binfile." | |
40 | return -1 | |
41 | } | |
42 | ||
e7fbb131 PA |
43 | # Start with a fresh gdb. |
44 | gdb_exit | |
45 | gdb_start | |
46 | gdb_reinitialize_dir $srcdir/$subdir | |
47 | gdb_load ${binfile} | |
e6052b5d | 48 | gdb_load_shlibs ${library} |
e7fbb131 PA |
49 | |
50 | # Skip all tests if Python scripting is not enabled. | |
51 | if { [skip_python_tests] } { continue } | |
52 | ||
53 | # The following tests require execution. | |
54 | ||
55 | if ![runto_main] then { | |
56 | fail "Can't run to main" | |
57 | return 0 | |
58 | } | |
59 | ||
60 | runto [gdb_get_line_number "Break to end."] | |
61 | ||
62 | # Test gdb.solib_name | |
63 | gdb_test "p &func1" "" "func1 address" | |
64 | gdb_py_test_silent_cmd "python func1 = gdb.history(0)" "Aquire func1 address" 1 | |
fac7ceb3 | 65 | gdb_test "python print gdb.solib_name(long(func1))" "py-shared-sl.sl" "test func1 solib location" |
e7fbb131 PA |
66 | |
67 | gdb_test "p &main" "" "main address" | |
68 | 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 location" |