dlopen-libpthread.exp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Copyright 2011-2022 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. if {![isnative] || ![istarget *-linux*] || [skip_shlib_tests]} {
  16. return 0
  17. }
  18. load_lib prelink-support.exp
  19. set testfile "dlopen-libpthread"
  20. set srcmainfile ${testfile}.c
  21. set srclibfile ${testfile}-lib.c
  22. set executable ${testfile}
  23. set binfile_lib [standard_output_file ${executable}.so]
  24. set lib_dlopen [shlib_target_file ${executable}.so]
  25. # Use build_executable_own_libs as prelinked libpthread.so can produce false
  26. # PASS - it is OK if GDB processes it still before relocation.
  27. set relink_args [build_executable_own_libs ${testfile}.exp ${executable}.so $srclibfile {debug shlib_pthreads} no]
  28. if {$relink_args == "" || ![prelink_no $relink_args]
  29. || [prepare_for_testing "failed to prepare" ${executable} ${srcmainfile} {debug shlib_load}] } {
  30. return -1
  31. }
  32. gdb_load_shlib $binfile_lib
  33. if { ![runto_main] } {
  34. return -1
  35. }
  36. set test "info probes all rtld rtld_map_complete"
  37. gdb_test_multiple $test $test {
  38. -re "\[ \t\]rtld_map_complete\[ \t\]+0x\[0-9a-f\]+.*\r\n$gdb_prompt $" {
  39. pass $test
  40. }
  41. -re "No probes matched\\.\r\n$gdb_prompt $" {
  42. xfail $test
  43. untested "no matching probes"
  44. return
  45. }
  46. }
  47. set test "libpthread.so not found"
  48. gdb_test_multiple "info sharedlibrary" $test {
  49. -re "/libpthread\\.so.*\r\n$gdb_prompt $" {
  50. fail $test
  51. }
  52. -re "/libc\\.so.*\r\n$gdb_prompt $" {
  53. pass $test
  54. }
  55. }
  56. gdb_test "set variable filename=\"$lib_dlopen\""
  57. gdb_breakpoint "notify"
  58. # The error was:
  59. # Cannot find new threads: generic error
  60. gdb_continue_to_breakpoint "notify" ".* notify-here .*"
  61. gdb_test "info sharedlibrary" {/libpthread\.so.*} "libpthread.so found"