-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use TracePoint.allow_reentry
when available
#540
Conversation
b62a4d7
to
b800c28
Compare
This 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
b945a93
Compare
@casperisfine I'm not sure why the tests are failing and I can't reproduce them locally 😕 |
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 ExampleScriptdef foo
10
end
binding.b Commands
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. |
Yes, supporting nested subsession should be supported with this change.
We can say "please update to 3.1". |
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. |
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. |
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.