Search in sources :

Example 1 with SulongStackTrace

use of com.oracle.truffle.llvm.runtime.SulongStackTrace in project sulong by graalvm.

the class LLVMPrintStackTrace method doOp.

@TruffleBoundary
@Specialization
protected Object doOp() {
    SulongStackTrace trace = getStackTrace("__sulong_print_stacktrace");
    printCStackTrace(trace);
    return null;
}
Also used : SulongStackTrace(com.oracle.truffle.llvm.runtime.SulongStackTrace) Specialization(com.oracle.truffle.api.dsl.Specialization) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 2 with SulongStackTrace

use of com.oracle.truffle.llvm.runtime.SulongStackTrace in project sulong by graalvm.

the class LLVMPrintStackTrace method getStackTrace.

private SulongStackTrace getStackTrace(String message) {
    Throwable t = new CThrowable(this, message);
    TruffleStackTraceElement.fillIn(t);
    List<TruffleStackTraceElement> ctrace = TruffleStackTraceElement.getStackTrace(t);
    SulongStackTrace trace = new SulongStackTrace(message);
    for (int i = 0; i < ctrace.size(); i++) {
        TruffleStackTraceElement element = ctrace.get(i);
        // ignore this call
        if (element.getLocation() == this) {
            assert i == 0;
            continue;
        }
        fillStackTrace(trace, element.getLocation());
    }
    return trace;
}
Also used : TruffleStackTraceElement(com.oracle.truffle.api.TruffleStackTraceElement) SulongStackTrace(com.oracle.truffle.llvm.runtime.SulongStackTrace)

Aggregations

SulongStackTrace (com.oracle.truffle.llvm.runtime.SulongStackTrace)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 TruffleStackTraceElement (com.oracle.truffle.api.TruffleStackTraceElement)1 Specialization (com.oracle.truffle.api.dsl.Specialization)1