Skip to content
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 stricter check in debug/prelude #865

Closed
st0012 opened this issue Dec 7, 2022 · 0 comments · Fixed by #867
Closed

Use stricter check in debug/prelude #865

st0012 opened this issue Dec 7, 2022 · 0 comments · Fixed by #867
Labels
bug Something isn't working
Milestone

Comments

@st0012
Copy link
Member

st0012 commented Dec 7, 2022

Your proposal

In prelude.rb, we use defined?(::DEBUGGER__) to check if debug/session has been loaded, which would have defined Kernel#debugger.

But it's also possible to have ::DEBUGGER__ defined and NOT having debug/session loaded, like require "debug/config", which we have in one of our gems.

It requires debug/config because we want to configure the debugger with these requirements:

  • The configuration can happen before/after require "debug", as we're not in control of gems' loading order.
  • We want to configure it in Ruby code.

So we have something like this:

require "debug/config"

sorbet_paths = Gem.loaded_specs["sorbet-runtime"].full_require_paths.freeze

# skip Sorbet related frames/backtrace when debugging
DEBUGGER__::CONFIG[:skip_path] = Array(DEBUGGER__::CONFIG[:skip_path]) + sorbet_paths

But that triggers prelude.rb's early return 😢

Therefore, I wonder if it's possible to make the condition a bit stricter, like if defined?(::DEBUGGER__::Session)?

@ko1 ko1 added the bug Something isn't working label Dec 8, 2022
@ko1 ko1 added this to the v1.7.1 milestone Dec 8, 2022
st0012 added a commit to st0012/debug that referenced this issue Dec 10, 2022
@ko1 ko1 closed this as completed in #867 Dec 22, 2022
ko1 pushed a commit that referenced this issue Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants