@JRubyMethod public IRubyObject to_s(ThreadContext context) { return RubyStackTraceElement.to_s_mri(context, element); }
@JRubyMethod public IRubyObject to_s(ThreadContext context) { return RubyStackTraceElement.to_s_mri(context, element); }
public static IRubyObject generateMRIBacktrace(Ruby runtime, RubyStackTraceElement[] trace) { if (trace == null) return runtime.getNil(); ThreadContext context = runtime.getCurrentContext(); final IRubyObject[] traceArray = new IRubyObject[trace.length]; for (int i = 0; i < trace.length; i++) { traceArray[i] = RubyStackTraceElement.to_s_mri(context, trace[i]); } return RubyArray.newArrayMayCopy(runtime, traceArray); }
public static IRubyObject generateMRIBacktrace(Ruby runtime, RubyStackTraceElement[] trace) { if (trace == null) return runtime.getNil(); ThreadContext context = runtime.getCurrentContext(); final IRubyObject[] traceArray = new IRubyObject[trace.length]; for (int i = 0; i < trace.length; i++) { traceArray[i] = RubyStackTraceElement.to_s_mri(context, trace[i]); } return RubyArray.newArrayMayCopy(runtime, traceArray); }
/** * Create an Array with backtrace information for Kernel#caller * @param level * @param length * @return an Array with the backtrace */ public IRubyObject createCallerBacktrace(int level, Integer length, StackTraceElement[] stacktrace) { runtime.incrementCallerCount(); RubyStackTraceElement[] fullTrace = getFullTrace(length, stacktrace); int traceLength = safeLength(level, length, fullTrace); // MRI started returning [] instead of nil some time after 1.9 (#4891) if (traceLength < 0) return runtime.newEmptyArray(); final IRubyObject[] traceArray = new IRubyObject[traceLength]; for (int i = 0; i < traceLength; i++) { traceArray[i] = RubyStackTraceElement.to_s_mri(this, fullTrace[i + level]); } RubyArray backTrace = RubyArray.newArrayMayCopy(runtime, traceArray); if (RubyInstanceConfig.LOG_CALLERS) TraceType.logCaller(backTrace); return backTrace; }
/** * Create an Array with backtrace information for Kernel#caller * @param level * @param length * @return an Array with the backtrace */ public IRubyObject createCallerBacktrace(int level, Integer length, StackTraceElement[] stacktrace) { runtime.incrementCallerCount(); RubyStackTraceElement[] fullTrace = getFullTrace(length, stacktrace); int traceLength = safeLength(level, length, fullTrace); // MRI started returning [] instead of nil some time after 1.9 (#4891) if (traceLength < 0) return runtime.newEmptyArray(); final IRubyObject[] traceArray = new IRubyObject[traceLength]; for (int i = 0; i < traceLength; i++) { traceArray[i] = RubyStackTraceElement.to_s_mri(this, fullTrace[i + level]); } RubyArray backTrace = RubyArray.newArrayMayCopy(runtime, traceArray); if (RubyInstanceConfig.LOG_CALLERS) TraceType.logCaller(backTrace); return backTrace; }