JLang
JLang copied to clipboard
Stack traces for exceptions
From @gharrma on March 14, 2018 15:40
This should be an optional feature, so that (for example) an implementation of tunneled exceptions could disable stack trace collection for checked exceptions.
Stack traces will probably need to be collected as part of the unwinding code in the runtime.
Copied from original issue: gharrma/polyllvm#46
From @gharrma on May 15, 2018 19:3
Update: for now I've been using the following C++ code to get a stack trace:
constexpr int max_frames = 256;
void* callstack[max_frames];
int frames = backtrace(callstack, max_frames);
backtrace_symbols_fd(callstack, frames, fileno(stderr));
However, it seems to only give partial stack traces, stopping at the last Java (non-native) frame on the stack. Using clang's fno-omit-frame-pointer
does not seem to help.
From @gharrma on May 24, 2018 17:10
Eventually we should implement the native method JVM_FillInStackTrace(JNIEnv *env, jobject throwable)
so that the stack trace exists in Java-land, as the JDK expects.