public static void dumpBacktrace(RubyException exception) { Ruby runtime = exception.getRuntime(); System.err.println("Backtrace generated:\n" + Format.JRUBY.printBacktrace(exception, runtime.getPosix().isatty(FileDescriptor.err))); }
@JRubyMethod public IRubyObject full_message(ThreadContext context, IRubyObject opts) { Ruby runtime = context.runtime; IRubyObject optArg = ArgsUtil.getOptionsArg(runtime, opts); boolean highlight = false; boolean reverse = false; if (!optArg.isNil()) { IRubyObject[] highlightOrder = ArgsUtil.extractKeywordArgs(context, (RubyHash) optArg, FULL_MESSAGE_KEYS); IRubyObject vHigh = highlightOrder[0]; if (vHigh == UNDEF) vHigh = context.nil; if (vHigh != context.nil && vHigh != context.fals && vHigh != context.tru) { throw runtime.newArgumentError("expected true or false as highlight: " + vHigh); } highlight = vHigh.isTrue(); IRubyObject vOrder = highlightOrder[1]; if (vOrder != UNDEF) { vOrder = TypeConverter.checkID(vOrder); if (vOrder == runtime.newSymbol("bottom")) reverse = true; else if (vOrder == runtime.newSymbol("top")) reverse = false; else { throw runtime.newArgumentError("expected :top or :bottom as order: " + vOrder); } } } // TODO: reverse return RubyString.newString(runtime, TraceType.Format.MRI.printBacktrace(this, highlight)); }
@JRubyMethod public IRubyObject full_message(ThreadContext context, IRubyObject opts) { Ruby runtime = context.runtime; IRubyObject optArg = ArgsUtil.getOptionsArg(runtime, opts); boolean highlight = false; boolean reverse = false; if (!optArg.isNil()) { IRubyObject[] highlightOrder = ArgsUtil.extractKeywordArgs(context, (RubyHash) optArg, FULL_MESSAGE_KEYS); IRubyObject vHigh = highlightOrder[0]; if (vHigh == UNDEF) vHigh = context.nil; if (vHigh != context.nil && vHigh != context.fals && vHigh != context.tru) { throw runtime.newArgumentError("expected true or false as highlight: " + vHigh); } highlight = vHigh.isTrue(); IRubyObject vOrder = highlightOrder[1]; if (vOrder != UNDEF) { vOrder = TypeConverter.checkID(vOrder); if (vOrder == runtime.newSymbol("bottom")) reverse = true; else if (vOrder == runtime.newSymbol("top")) reverse = false; else { throw runtime.newArgumentError("expected :top or :bottom as order: " + vOrder); } } } // TODO: reverse return RubyString.newString(runtime, TraceType.Format.MRI.printBacktrace(this, highlight)); }
public String printBacktrace(RubyException exception, boolean console) { return format.printBacktrace(exception, console); }
public static void dumpBacktrace(RubyException exception) { Ruby runtime = exception.getRuntime(); System.err.println("Backtrace generated:\n" + Format.JRUBY.printBacktrace(exception, runtime.getPosix().isatty(FileDescriptor.err))); }
public String printBacktrace(RubyException exception, boolean console) { return format.printBacktrace(exception, console); }
public String printBacktrace(RubyException exception, boolean console) { return format.printBacktrace(exception, console); }
private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) { pw.println("Thread: " + th.getNativeThread().getName()); pw.println("Stack:"); ThreadContext tc = th.getContext(); if (tc != null) { RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump"); exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace())); pw.println(Format.MRI.printBacktrace(exc, false)); } else { pw.println(" [no longer alive]"); } pw.println(); }
public String printBacktrace(RubyException exception, boolean console) { return format.printBacktrace(exception, console); }
@JRubyMethod public IRubyObject full_message(ThreadContext context) { return RubyString.newString(context.runtime, TraceType.Format.MRI.printBacktrace(this, false)); }
/** * Render the current backtrace as a string to the given StringBuilder. This will honor the currently-configured * backtrace format and content. * * @param sb the StringBuilder to which to render the backtrace */ public void renderCurrentBacktrace(StringBuilder sb) { TraceType traceType = runtime.getInstanceConfig().getTraceType(); BacktraceData backtraceData = traceType.getBacktrace(this); traceType.getFormat().renderBacktrace(backtraceData.getBacktrace(runtime), sb, false); }
private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) { pw.println("Thread: " + th.getNativeThread().getName()); pw.println("Stack:"); ThreadContext tc = th.getContext(); if (tc != null) { RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump"); exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace(), true)); pw.println(Format.MRI.printBacktrace(exc, false)); } else { pw.println(" [no longer alive]"); } pw.println(); }
private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) { pw.println("Thread: " + th.getNativeThread().getName()); pw.println("Stack:"); ThreadContext tc = th.getContext(); if (tc != null) { RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump"); exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace(), true)); pw.println(Format.MRI.printBacktrace(exc, false)); } else { pw.println(" [no longer alive]"); } pw.println(); }
private static void dumpThread(Ruby ruby, RubyThread th, Gather gather, PrintWriter pw) { pw.println("Thread: " + th.getNativeThread().getName()); pw.println("Stack:"); ThreadContext tc = th.getContext(); if (tc != null) { RubyException exc = new RubyException(ruby, ruby.getRuntimeError(), "thread dump"); exc.setBacktraceData(gather.getBacktraceData(tc, th.getNativeThread().getStackTrace())); pw.println(Format.MRI.printBacktrace(exc, false)); } else { pw.println(" [no longer alive]"); } pw.println(); }
@JRubyMethod public IRubyObject full_message(ThreadContext context) { return RubyString.newString(context.runtime, TraceType.Format.MRI.printBacktrace(this, false)); }
/** * Render the current backtrace as a string to the given StringBuilder. This will honor the currently-configured * backtrace format and content. * * @param sb the StringBuilder to which to render the backtrace */ public void renderCurrentBacktrace(StringBuilder sb) { TraceType traceType = runtime.getInstanceConfig().getTraceType(); BacktraceData backtraceData = traceType.getBacktrace(this); traceType.getFormat().renderBacktrace(backtraceData.getBacktrace(runtime), sb, false); }