use of com.oracle.truffle.api.instrumentation.InstrumentationHandler.InstrumentClientInstrumenter in project graal by oracle.
the class ProbeNode method exceptionEventForClientInstrument.
/**
* Handles exceptions from non-language instrumentation code that must not be allowed to alter
* guest language execution semantics. Normal response is to log and continue.
*/
@TruffleBoundary
static void exceptionEventForClientInstrument(EventBinding.Source<?> b, String eventName, Throwable t) {
assert !b.isLanguageBinding();
if (t instanceof ThreadDeath) {
// Terminates guest language execution immediately
throw (ThreadDeath) t;
}
// Exception is a failure in (non-language) instrumentation code; log and continue
InstrumentClientInstrumenter instrumenter = (InstrumentClientInstrumenter) b.getInstrumenter();
Class<?> instrumentClass = instrumenter.getInstrumentClass();
String message = //
String.format(//
"Event %s failed for instrument class %s and listener/factory %s.", eventName, instrumentClass.getName(), b.getElement());
Exception exception = new Exception(message, t);
PrintStream stream = new PrintStream(instrumenter.getEnv().err());
exception.printStackTrace(stream);
}
Aggregations