stop-with-handle.exp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright 2019-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. # This test covers a case where SIGSTOP has been configured to be
  16. # passed to the target with GDB's 'handle' command, and then a
  17. # multi-threaded inferior encounters an event that causes all threads
  18. # to be stopped.
  19. #
  20. # The problem that (used) to exist was that GDB would see the SIGSTOP,
  21. # but decide to ignore the signal based on the handle table.
  22. standard_testfile
  23. if {[prepare_for_testing "failed to prepare" \
  24. "${testfile}" "${srcfile}" {debug pthreads}]} {
  25. return -1
  26. }
  27. if ![runto_main] then {
  28. return 0
  29. }
  30. # Have SIGSTOP sent to the inferior.
  31. gdb_test "handle SIGSTOP nostop noprint pass" \
  32. [multi_line \
  33. "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description" \
  34. "SIGSTOP\[ \t\]+No\[ \t\]+No\[ \t\]+Yes\[ \t\]+Stopped \\(signal\\)"]
  35. # Create a breakpoint, and when we hit it automatically finish the
  36. # current frame.
  37. gdb_breakpoint breakpt
  38. # When the bug triggers this continue never completes. GDB hits the
  39. # breakpoint in thread 1, and then tries to stop the second thread by
  40. # sending it SIGSTOP. GDB sees the SIGSTOP arrive in thread 2 but
  41. # incorrect decides to pass the SIGSTOP to the thread rather than
  42. # bringing the thread to a stop.
  43. gdb_continue_to_breakpoint breakpt