Skip to content

Commit 6bdc55f

Browse files
committedJun 14, 2018
Fixes #5164. Thread::Backtrace::Location#label inside eval does not return enclosing method name.
This one is pretty weird. I just switched to method.name from <eval> and the test ran fine. I noticed that top-level evals were not printing out <main>, so I tweaked a few things. JIT will apparently set frame method name to '' vs null so I am not sure what is up there. # Conflicts: # core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
1 parent 3b448cc commit 6bdc55f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎core/src/main/java/org/jruby/ir/interpreter/Interpreter.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333

3434
public class Interpreter extends IRTranslator<IRubyObject, IRubyObject> {
3535
public static final Logger LOG = LoggerFactory.getLogger(Interpreter.class);
36-
public static final String ROOT = "(root)";
36+
public static final String ROOT = "<main>";
37+
3738
static int interpInstrsCount = 0;
3839

3940
public static void dumpStats() {

‎core/src/main/java/org/jruby/runtime/backtrace/BacktraceData.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ private RubyStackTraceElement[] constructBacktrace(Map<String, Map<String, Strin
133133
case MODULE: newName = "<module:" + rubyFrame.method + '>'; break;
134134
case METACLASS: newName = "singleton class"; break;
135135
case ROOT: newName = "<main>"; break;
136-
case EVAL: newName = "<eval>"; break;
136+
case EVAL:
137+
newName = rubyFrame.method == null || rubyFrame.method.isEmpty() ? "<main>" : rubyFrame.method;
138+
break;
137139
default: newName = rubyFrame.method;
138140
}
139141
RubyStackTraceElement rubyElement = new RubyStackTraceElement("RUBY", newName, rubyFrame.filename, rubyFrame.line + 1, false, frameType);

0 commit comments

Comments
 (0)
Please sign in to comment.