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

Thread::Backtrace::Location#label/base_label incompatible with MRI top level description #5790

piotrmurach opened this issue Jul 14, 2019 · 2 comments


Copy link

commented Jul 14, 2019


Expected Behavior

Expect JRuby label and base_label to match MRI behaviour.

Actual Behavior

The Thread::Backtrace::Location#label when referring to top-level scope returns "<main>" as the method description. In comparison the CRuby/MRI returns "<top (required)>" for both #label and #base_label.


This comment has been minimized.

Copy link

commented Jul 15, 2019

Aha... the (required) in that string refers to the fact that this is a file loaded via a require (or a load?) rather than being the actual "main" file.

For a target "main" script, the result is actually the same as JRuby:

$ rvm ruby-2.5.3 do ruby -e 'p caller(0, 1)'
["-e:1:in `<main>'"]

So we won't be changing main to top...but we need to have a different way to identify the top frame for required (versus directly executed) scripts.


This comment has been minimized.

Copy link

commented Jul 15, 2019

Ok, I won't have time to work on this right now, but here's what needs to happen:

  • The "" comes from and this is likely the place we need to add support for a different top-level frame name.
  • The logic here gets called via from four places in
  • Those four places are themselves called from either the "main" startup logic or from the "load" paths used during load/require.

I believe this is the path that needs additional smarts for when the target script is running as a load/require.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.