Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.threads / dlopen-libpthread.exp
CommitLineData
88b9d363 1# Copyright 2011-2022 Free Software Foundation, Inc.
a29a3fb7
GB
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
345bcc73 16if {![isnative] || ![istarget *-linux*] || [skip_shlib_tests]} {
a29a3fb7
GB
17 return 0
18}
19
20load_lib prelink-support.exp
21
22set testfile "dlopen-libpthread"
23set srcmainfile ${testfile}.c
24set srclibfile ${testfile}-lib.c
25set executable ${testfile}
c2f901df 26set binfile_lib [standard_output_file ${executable}.so]
a29a3fb7
GB
27set lib_dlopen [shlib_target_file ${executable}.so]
28
29# Use build_executable_own_libs as prelinked libpthread.so can produce false
30# PASS - it is OK if GDB processes it still before relocation.
31
32set relink_args [build_executable_own_libs ${testfile}.exp ${executable}.so $srclibfile {debug shlib_pthreads} no]
33if {$relink_args == "" || ![prelink_no $relink_args]
5b362f04 34 || [prepare_for_testing "failed to prepare" ${executable} ${srcmainfile} {debug shlib_load}] } {
a29a3fb7
GB
35 return -1
36}
d9019901 37gdb_load_shlib $binfile_lib
a29a3fb7
GB
38
39if { ![runto_main] } {
40 return -1
41}
42
43set test "info probes all rtld rtld_map_complete"
44gdb_test_multiple $test $test {
45 -re "\[ \t\]rtld_map_complete\[ \t\]+0x\[0-9a-f\]+.*\r\n$gdb_prompt $" {
46 pass $test
47 }
48 -re "No probes matched\\.\r\n$gdb_prompt $" {
49 xfail $test
5b362f04 50 untested "no matching probes"
a29a3fb7
GB
51 return
52 }
53}
54
55set test "libpthread.so not found"
56gdb_test_multiple "info sharedlibrary" $test {
57 -re "/libpthread\\.so.*\r\n$gdb_prompt $" {
58 fail $test
59 }
60 -re "/libc\\.so.*\r\n$gdb_prompt $" {
61 pass $test
62 }
63}
64
65gdb_test "set variable filename=\"$lib_dlopen\""
66
67gdb_breakpoint "notify"
68
69# The error was:
70# Cannot find new threads: generic error
71gdb_continue_to_breakpoint "notify" ".* notify-here .*"
72
73gdb_test "info sharedlibrary" {/libpthread\.so.*} "libpthread.so found"
This page took 1.347287 seconds and 4 git commands to generate.