thread_check.exp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Copyright (C) 2004-2022 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. # This file was written by Manoj Iyer. (manjo@austin.ibm.com)
  15. # Test break points and single step on thread functions.
  16. #
  17. # Test Purpose:
  18. # - Test that breakpoints, continue in a threaded application works.
  19. # On powerpc64-unknown-linux-gnu system, running kernel version
  20. # 2.6.5-7.71-pseries64 this test is known to fail due to kernel bug
  21. # in ptrace system call.
  22. #
  23. # Test Strategy:
  24. # - thread_check.c creates 2 threads
  25. # - start gdb
  26. # - create 2 breakpoints #1 main() #2 tf() (the thread function)
  27. # - run gdb till #1 main() breakpoint is reached
  28. # - continue to breakpoint #2 tf()
  29. # - delete all breakpoints
  30. # - exit gdb.
  31. standard_testfile
  32. if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
  33. return -1
  34. }
  35. clean_restart ${binfile}
  36. if ![runto_main] then {
  37. return 1
  38. }
  39. #
  40. # set breakpoint at thread fucntion tf
  41. #
  42. gdb_test "break tf" \
  43. "Breakpoint.*at.* file .*$srcfile, line.*" \
  44. "breakpoint at tf"
  45. #
  46. #
  47. # continue to tf() breakpoint #2
  48. #
  49. gdb_test "continue" \
  50. ".*Breakpoint 2,.*tf.*at.*$srcfile:.*" \
  51. "continue to tf"
  52. #
  53. # backtrace from thread function.
  54. #
  55. gdb_test "backtrace" \
  56. "#0 .*tf .*at .*$srcfile:.*" \
  57. "backtrace from thread function"
  58. #
  59. # delete all breakpoints
  60. #
  61. delete_breakpoints
  62. #
  63. # exit gdb
  64. #
  65. gdb_exit