Skip to content

Commit b0e4c91

Browse files
committed
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.
1 parent 9eae064 commit b0e4c91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/org/jruby/runtime/backtrace/TraceType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public static TraceType traceTypeFor(String style) {
174174
else if (style.equalsIgnoreCase("ruby_framed")) return new TraceType(Gather.NORMAL, Format.JRUBY);
175175
else if (style.equalsIgnoreCase("normal")) return new TraceType(Gather.NORMAL, Format.JRUBY);
176176
else if (style.equalsIgnoreCase("full")) return new TraceType(Gather.FULL, Format.JRUBY);
177-
else if (style.equalsIgnoreCase("mri")) return new TraceType(Gather.NORMAL, Format.MRI);
177+
else if (style.equalsIgnoreCase("mri")) return new TraceType(Gather.CALLER, Format.MRI);
178178
else return new TraceType(Gather.NORMAL, Format.JRUBY);
179179
}
180180

@@ -228,7 +228,7 @@ public BacktraceData getBacktraceData(ThreadContext context, Stream<StackWalker.
228228
},
229229

230230
/**
231-
* Normal Ruby-style backtrace, showing only Ruby and core class methods.
231+
* Normal JRuby-style backtrace, showing internal and external Ruby lines and bound core class methods.
232232
*/
233233
NORMAL {
234234
public BacktraceData getBacktraceData(ThreadContext context, Stream<StackWalker.StackFrame> stackStream) {

0 commit comments

Comments
 (0)