Uh oh!
There was an error while loading. Please reload this page.
Use TracePoint.allow_reentry when available - #540
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
b62a4d7 to
b800c28CompareThis fixes compatibility with TracePoint users such as Zeitwerk
Test script:
```ruby
require 'fileutils'
FileUtils.mkdir_p('/tmp/lib/foo')
File.write('/tmp/lib/foo.rb', 'module Foo; end')
File.write('/tmp/lib/foo/bar.rb', 'Foo::Bar = 1')
require 'zeitwerk'
loader = Zeitwerk::Loader.new
loader.push_dir('/tmp/lib')
loader.setup
require 'debug'
binding.break
p Foo::Bar
```
before:
```
[8, 16] in /tmp/debug-zeitwerk.rb
8| loader = Zeitwerk::Loader.new
9| loader.push_dir('/tmp/lib')
10| loader.setup
11|
12| require 'debug'
=> 13| binding.break
14| p Foo::Bar
15|
16| p :done
=>#0 <main> at /tmp/debug-zeitwerk.rb:13
(rdbg) p Foo::Bar # command
eval error: uninitialized constant Foo::Bar
(rdbg)//tmp/debug-zeitwerk.rb:1:in `<main>'
=> nil
```
after:
```
[8, 16] in /tmp/debug-zeitwerk.rb
8| loader = Zeitwerk::Loader.new
9| loader.push_dir('/tmp/lib')
10| loader.setup
11|
12| require 'debug'
=> 13| binding.break
14| p Foo::Bar
15|
16| p :done
=>#0 <main> at /tmp/debug-zeitwerk.rb:13
(rdbg) p Foo::Bar # command
=> 1
```b800c28 to
b945a93Compare@casperisfine I'm not sure why the tests are failing and I can't reproduce them locally 😕 |
st0012
commented
Feb 16, 2022
There is an issue that breakpoints can now be triggered inside another breakpoint's subsession. The debugger hasn't supported nested suspension yet. So currently, having multiple subsessions can only be caused by bugs and the debugger raises an exception when that happens. But with ExampleScriptdeffoo10endbinding.bCommands
Result(debug log are enabled by merging #469 locally) I think to solve #408 we probably need more preparation, like
But this is @ko1's call. |
ko1
commented
Feb 18, 2022
Yes, supporting nested subsession should be supported with this change.
We can say "please update to 3.1". |
casperisfine
commented
Feb 18, 2022
Yeah, Zeitwerk users have been confused for a while by debuggers breaking Zeitwerk in specific circumstances, It wouldn't make sense to me to delay the fix for consistency. Inconsistently working is better than consistently broken. |
st0012
commented
Feb 18, 2022
To be clear, I didn't mean keep the broken behavior. I only mean triggering breakpoint inside another breakpoint will be ignored (no nested subsessions) but this conflict with Zeitwerk (and other TracePoint using gems) will be fixed. |
ko1
commented
Feb 21, 2022
I think nested subsession (nested breakpoint) should be supported, if it is possible. |
Fix: #408
This fixes compatibility with TracePoint users such as Zeitwerk
Test script:
before:
after:
Note that I'm fairly unfamiliar with this codebase, so I'll try to see how to add tests, but it may take me a while. I figured it was worth starting a PR anyway.