Skip to content

Commit

Permalink
Showing 3 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -25,12 +25,4 @@ public CoreSourceSection(String className, String methodName) {
this.methodName = methodName;
}

public String getClassName() {
return className;
}

public String getMethodName() {
return methodName;
}

}
Original file line number Diff line number Diff line change
@@ -12,12 +12,14 @@
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.source.SourceSection;

import org.jruby.truffle.nodes.CoreSourceSection;
import org.jruby.truffle.runtime.DebugOperations;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.TruffleFatalException;
import org.jruby.truffle.runtime.core.RubyException;
import org.jruby.truffle.runtime.methods.InternalMethod;
import org.jruby.util.cli.Options;

import java.util.ArrayList;
@@ -74,10 +76,10 @@ public static String formatBasicLine(Activation activation) {
final SourceSection sourceSection = activation.getCallNode().getEncapsulatingSourceSection();

if (sourceSection instanceof CoreSourceSection) {
final CoreSourceSection coreSourceSection = (CoreSourceSection) sourceSection;
builder.append(coreSourceSection.getClassName());
final InternalMethod method = RubyArguments.getMethod(activation.getMaterializedFrame().getArguments());
builder.append(method.getDeclaringModule().getName());
builder.append("#");
builder.append(coreSourceSection.getMethodName());
builder.append(method.getName());
} else {
builder.append(sourceSection.getSource().getName());
builder.append(":");
Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@

import com.oracle.truffle.api.source.NullSourceSection;
import com.oracle.truffle.api.source.SourceSection;

import org.jruby.truffle.nodes.CoreSourceSection;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.TruffleFatalException;
import org.jruby.truffle.runtime.core.RubyException;
@@ -49,13 +51,14 @@ public String[] format(RubyContext context, RubyException exception, Backtrace b
private static String formatInLine(List<Activation> activations, RubyException exception) {
final StringBuilder builder = new StringBuilder();

final SourceSection sourceSection = activations.get(0).getCallNode().getEncapsulatingSourceSection();
final Activation activation = activations.get(0);
final SourceSection sourceSection = activation.getCallNode().getEncapsulatingSourceSection();
final SourceSection reportedSourceSection;
final String reportedName;

if (sourceSection instanceof CoreSourceSection) {
reportedSourceSection = nextUserSourceSection(activations, 1);
reportedName = ((CoreSourceSection) sourceSection).getMethodName();
reportedName = RubyArguments.getMethod(activation.getMaterializedFrame().getArguments()).getName();
} else {
reportedSourceSection = sourceSection;
reportedName = reportedSourceSection.getIdentifier();
@@ -92,13 +95,14 @@ private static String formatFromLine(List<Activation> activations, int n) {
}

public static String formatCallerLine(List<Activation> activations, int n) {
final SourceSection sourceSection = activations.get(n).getCallNode().getEncapsulatingSourceSection();
final Activation activation = activations.get(n);
final SourceSection sourceSection = activation.getCallNode().getEncapsulatingSourceSection();
final SourceSection reportedSourceSection;
final String reportedName;

if (sourceSection instanceof CoreSourceSection) {
reportedSourceSection = activations.get(n + 1).getCallNode().getEncapsulatingSourceSection();
reportedName = ((CoreSourceSection) sourceSection).getMethodName();
reportedName = RubyArguments.getMethod(activation.getMaterializedFrame().getArguments()).getName();
} else {
reportedSourceSection = sourceSection;
reportedName = sourceSection.getIdentifier();

0 comments on commit 02c7ed8

Please sign in to comment.