Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
MRI backtrace should not include native lines
At some point, we started including native .java lines in the MRI-
formatted trace. This was probably unintended, since MRI-format
traces should always follow CRuby's standard of replacing native
call frames with the most recent Ruby frame.

See #9154 for some discussion of filtering and omitting
internal frames (that PR is about Ruby, but the same filtering
already applied to native frames used in `caller`).

This patch uses the same backtrace gathering logic for the MRI
format as it does for `caller`, since in both cases users expect
not to see .java frames for internal methods, and now with Ruby 4.0
they will also expect not to see internal Ruby sources.
  • Loading branch information
headius committed Jan 6, 2026
commit dc7674ae4428d12922f6efe43dedd2667d518020
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/runtime/backtrace/TraceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public static TraceType traceTypeFor(String style) {
else if (style.equalsIgnoreCase("ruby_framed")) return new TraceType(Gather.NORMAL, Format.JRUBY);
else if (style.equalsIgnoreCase("normal")) return new TraceType(Gather.NORMAL, Format.JRUBY);
else if (style.equalsIgnoreCase("full")) return new TraceType(Gather.FULL, Format.JRUBY);
else if (style.equalsIgnoreCase("mri")) return new TraceType(Gather.NORMAL, Format.MRI);
else if (style.equalsIgnoreCase("mri")) return new TraceType(Gather.CALLER, Format.MRI);
else return new TraceType(Gather.NORMAL, Format.JRUBY);
}

Expand Down Expand Up @@ -228,7 +228,7 @@ public BacktraceData getBacktraceData(ThreadContext context, Stream<StackWalker.
},

/**
* Normal Ruby-style backtrace, showing only Ruby and core class methods.
* Normal JRuby-style backtrace, showing internal and external Ruby lines and bound core class methods.
*/
NORMAL {
public BacktraceData getBacktraceData(ThreadContext context, Stream<StackWalker.StackFrame> stackStream) {
Expand Down
Loading