JLang icon indicating copy to clipboard operation
JLang copied to clipboard

Stack traces for exceptions

Open dz333 opened this issue 6 years ago • 2 comments

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

dz333 avatar Aug 22 '18 15:08 dz333

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.

dz333 avatar Aug 22 '18 15:08 dz333

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.

dz333 avatar Aug 22 '18 15:08 dz333