/** * @deprecated use {@link #logCaller(org.jruby.RubyArray)} */ public static void dumpCaller(RubyArray trace) { logCaller(trace); }
/** * @deprecated use {@link #logCaller(org.jruby.RubyArray)} */ public static void dumpCaller(RubyArray trace) { logCaller(trace); }
/** * @deprecated use {@link #logCaller(org.jruby.runtime.backtrace.RubyStackTraceElement[]) } */ public static void dumpCaller(RubyStackTraceElement[] trace) { logCaller(trace); }
/** * @deprecated use {@link #logCaller(org.jruby.runtime.backtrace.RubyStackTraceElement[]) } */ public static void dumpCaller(RubyStackTraceElement[] trace) { logCaller(trace); }
/** * Create an array containing Thread::Backtrace::Location objects for the * requested caller trace level and length. * * @param level the level at which the trace should start * @param length the length of the trace * @return an Array with the backtrace locations */ public IRubyObject createCallerLocations(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(); RubyArray backTrace = RubyThread.Location.newLocationArray(runtime, fullTrace, level, traceLength); if (RubyInstanceConfig.LOG_CALLERS) TraceType.logCaller(backTrace); return backTrace; }
/** * Create an array containing Thread::Backtrace::Location objects for the * requested caller trace level and length. * * @param level the level at which the trace should start * @param length the length of the trace * @return an Array with the backtrace locations */ public IRubyObject createCallerLocations(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(); RubyArray backTrace = RubyThread.Location.newLocationArray(runtime, fullTrace, level, traceLength); 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; }
/** * 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; }