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();