]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.python/py-shared.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-shared.exp
1 # Copyright (C) 2008-2024 Free Software Foundation, Inc.
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
18 load_lib gdb-python.exp
19
20 require allow_shlib_tests allow_python_tests
21
22 standard_testfile
23
24 set libfile "py-shared-sl"
25 set libsrc ${libfile}.c
26 set library [standard_output_file ${libfile}.sl]
27
28 if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != "" } {
29 untested "failed to compile shared library"
30 return -1
31 }
32
33 set exec_opts [list debug shlib=${library}]
34
35 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opts] != "" } {
36 untested "failed to compile"
37 return -1
38 }
39
40 # Start with a fresh gdb.
41 clean_restart $testfile
42 gdb_load_shlib ${library}
43
44 # The following tests require execution.
45
46 if {![runto_main]} {
47 return 0
48 }
49
50 runto [gdb_get_line_number "Break to end."]
51
52 # Test gdb.solib_name
53 gdb_test "p &func1" "" "func1 address"
54 gdb_py_test_silent_cmd "python func1 = gdb.history(0)" "Acquire func1 address" 1
55 gdb_test "python print (gdb.solib_name(int(func1)))" "py-shared-sl.sl" \
56 "test func1 solib location"
57 gdb_test "python print (gdb.solib_name(func1))" "py-shared-sl.sl" \
58 "test func1 solib location using Value"
59
60 gdb_test "p &main" "" "main address"
61 gdb_py_test_silent_cmd "python main = gdb.history(0)" "Acquire main address" 1
62 gdb_test "python print (gdb.solib_name(int(main)))" "None" "test main solib location"
63
64 if {[is_lp64_target]} {
65 gdb_test "python print (len(\[gdb.solib_name(0xffffffffffffffff)\]))" "1"
66 }