-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid setting @tc in thread_begin event
This event will be triggered before the new thread even has a ThreadClient. So in this case, the @tc will be overridden to just nil, which is wrong. However, we also don't want to just set @tc to the new thread's newly created ThreadClient. This is because a thread's creation can happen during a subsession, and promptly switching @tc to another thread's ThreadClient will misfire thread suspension.
- Loading branch information
Showing
2 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require_relative '../support/console_test_case' | ||
|
||
module DEBUGGER__ | ||
class ThreadControlTest < ConsoleTestCase | ||
def program | ||
<<~RUBY | ||
1| def foo | ||
2| Thread.new { sleep 5 } | ||
3| end | ||
4| | ||
5| 5.times do | ||
6| foo | ||
7| binding.b(do: "1 == 2") # eval Ruby code in debugger | ||
8| end | ||
RUBY | ||
end | ||
|
||
def test_debugger_isnt_hung_by_new_threads | ||
debug_code(program) do | ||
type "c" | ||
end | ||
end | ||
end | ||
end |