Skip to content

Commit

Permalink
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -151,6 +151,8 @@ public class Options {

public static final Option<Boolean> TRUFFLE_REQUIRE_SHOW_RESOLUTION = bool(TRUFFLE, "truffle.require.show_resolution", false, "So what files require statements resolve to.");

public static final Option<Boolean> TRUFFLE_INCLUDE_CORE_FILE_CALLERS_IN_SET_TRACE_FUNC = bool(TRUFFLE, "truffle.set_trace_func.include_core_file_callers", false, "Include internal core library calls in set_trace_func output.");

public static final Option<TruffleContextInterface.BacktraceFormatter> TRUFFLE_BACKTRACE_DISPLAY_FORMAT = enumeration(TRUFFLE, "truffle.backtrace.display_format", TruffleContextInterface.BacktraceFormatter.class, TruffleContextInterface.BacktraceFormatter.MRI, "How to format backtraces displayed to the user.");
public static final Option<TruffleContextInterface.BacktraceFormatter> TRUFFLE_BACKTRACE_DEBUG_FORMAT = enumeration(TRUFFLE, "truffle.backtrace.debug_format", TruffleContextInterface.BacktraceFormatter.class, TruffleContextInterface.BacktraceFormatter.DEBUG, "How to format backtraces displayed using TruffleDebug.dump_call_stack.");
public static final Option<TruffleContextInterface.BacktraceFormatter> TRUFFLE_BACKTRACE_EXCEPTION_FORMAT = enumeration(TRUFFLE, "truffle.backtrace.exception_format", TruffleContextInterface.BacktraceFormatter.class, TruffleContextInterface.BacktraceFormatter.MRI, "How to format backtraces in Exception objects.");
Original file line number Diff line number Diff line change
@@ -18,17 +18,15 @@
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.ConditionProfile;
import org.jruby.Ruby;
import org.jruby.truffle.nodes.core.ProcNodes;
import org.jruby.truffle.nodes.core.StringNodes;
import org.jruby.truffle.nodes.dispatch.RubyCallNode;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.RubySyntaxTag;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.core.RubyBinding;
import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.runtime.methods.InternalMethod;
import org.jruby.util.cli.Options;

import java.util.ArrayList;
import java.util.Collection;
@@ -37,6 +35,8 @@

public class TraceManager {

public static final boolean INCLUDE_CORE_FILE_CALLERS_IN_SET_TRACE_FUNC = Options.TRUFFLE_INCLUDE_CORE_FILE_CALLERS_IN_SET_TRACE_FUNC.load();

private final RubyContext context;

private Collection<Instrument> instruments;
@@ -158,7 +158,13 @@ public Object executeRoot(Node node, VirtualFrame frame) {
if (!inTraceFuncProfile.profile(isInTraceFunc)) {
// set_trace_func reports the file and line of the call site.
final SourceSection sourceSection = Truffle.getRuntime().getCallerFrame().getCallNode().getEncapsulatingSourceSection();
final RubyBasicObject file = StringNodes.createString(context.getCoreLibrary().getStringClass(), sourceSection.getSource().getName());
final String filename = sourceSection.getSource().getName();
final RubyBasicObject file = StringNodes.createString(context.getCoreLibrary().getStringClass(), filename);

if (! INCLUDE_CORE_FILE_CALLERS_IN_SET_TRACE_FUNC && filename.startsWith("core:")) {
return context.getCoreLibrary().getNilObject();
}

final int line = sourceSection.getStartLine();

final Object self = RubyArguments.getSelf(frame.getArguments());

0 comments on commit 6d1ed38

Please sign in to comment.