@Override public Object createInstrumentationHandler(Object vm, DispatchOutputStream out, DispatchOutputStream err, InputStream in, MessageTransport messageInterceptor) { return new InstrumentationHandler(vm, out, err, in, messageInterceptor); }
void initializeInstrument(Object vmObject, Class<?> instrumentClass) { Env env = new Env(vmObject, out, err, in); env.instrumenter = new InstrumentClientInstrumenter(env, instrumentClass); if (TRACE) { trace("Initialize instrument class %s %n", instrumentClass); } try { env.instrumenter.instrument = (TruffleInstrument) instrumentClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { failInstrumentInitialization(env, String.format("Failed to create new instrumenter class %s", instrumentClass.getName()), e); return; } if (TRACE) { trace("Initialized instrument %s class %s %n", env.instrumenter.instrument, instrumentClass); } addInstrumenter(vmObject, env.instrumenter); }
private <T extends ExecutionEventNodeFactory> EventBinding<T> attachFactory(AbstractInstrumenter instrumenter, SourceSectionFilter filter, SourceSectionFilter inputFilter, T factory) { return addExecutionBinding(new EventBinding.Source<>(instrumenter, filter, inputFilter, factory, true)); }
private <T extends ThreadsListener> EventBinding<T> attachThreadsListener(AbstractInstrumenter instrumenter, T listener, boolean includeStartedThreads) { assert listener != null; return addThreadsBinding(new EventBinding<>(instrumenter, listener), includeStartedThreads); }
private <T extends ContextsListener> EventBinding<T> attachContextsListener(AbstractInstrumenter instrumenter, T listener, boolean includeActiveContexts) { assert listener != null; return addContextsBinding(new EventBinding<>(instrumenter, listener), includeActiveContexts); }
private <T> EventBinding<T> attachSourceSectionListener(AbstractInstrumenter abstractInstrumenter, SourceSectionFilter filter, T listener, boolean notifyLoaded) { return addSourceSectionBinding(new EventBinding.Source<>(abstractInstrumenter, filter, null, listener, false), notifyLoaded); }
private <T> EventBinding<T> attachExecuteSourceListener(AbstractInstrumenter abstractInstrumenter, SourceSectionFilter filter, T listener, boolean notifyLoaded) { return addSourceExecutionBinding(new EventBinding.Source<>(abstractInstrumenter, filter, null, listener, false), notifyLoaded); }
private <T extends OutputStream> EventBinding<T> attachOutputConsumer(AbstractInstrumenter instrumenter, T stream, boolean errorOutput) { return addOutputBinding(new EventBinding<>(instrumenter, stream), errorOutput); }
private <T extends LoadSourceListener> EventBinding<T> attachSourceListener(AbstractInstrumenter abstractInstrumenter, SourceSectionFilter filter, T listener, boolean notifyLoaded) { return addSourceBinding(new EventBinding.Source<>(abstractInstrumenter, filter, null, listener, false), notifyLoaded); }
private <T extends AllocationListener> EventBinding<T> attachAllocationListener(AbstractInstrumenter instrumenter, AllocationEventFilter filter, T listener) { return addAllocationBinding(new EventBinding.Allocation<>(instrumenter, filter, listener)); }
private <T extends ExecutionEventListener> EventBinding<T> attachListener(AbstractInstrumenter instrumenter, SourceSectionFilter filter, SourceSectionFilter inputFilter, T listener) { return addExecutionBinding(new EventBinding.Source<>(instrumenter, filter, inputFilter, listener, true)); }
private <T extends ThreadsListener> EventBinding<T> attachThreadsListener(AbstractInstrumenter instrumenter, T listener, boolean includeStartedThreads) { assert listener != null; return addThreadsBinding(new EventBinding<>(instrumenter, listener), includeStartedThreads); }
private <T extends ContextsListener> EventBinding<T> attachContextsListener(AbstractInstrumenter instrumenter, T listener, boolean includeActiveContexts) { assert listener != null; return addContextsBinding(new EventBinding<>(instrumenter, listener), includeActiveContexts); }
private <T> EventBinding<T> attachSourceSectionListener(AbstractInstrumenter abstractInstrumenter, SourceSectionFilter filter, T listener, boolean notifyLoaded) { return addSourceSectionBinding(new EventBinding.Source<>(abstractInstrumenter, filter, null, listener, false), notifyLoaded); }
private <T> EventBinding<T> attachExecuteSourceListener(AbstractInstrumenter abstractInstrumenter, SourceSectionFilter filter, T listener, boolean notifyLoaded) { return addSourceExecutionBinding(new EventBinding.Source<>(abstractInstrumenter, filter, null, listener, false), notifyLoaded); }
private <T extends OutputStream> EventBinding<T> attachOutputConsumer(AbstractInstrumenter instrumenter, T stream, boolean errorOutput) { return addOutputBinding(new EventBinding<>(instrumenter, stream), errorOutput); }
private <T extends LoadSourceListener> EventBinding<T> attachSourceListener(AbstractInstrumenter abstractInstrumenter, SourceSectionFilter filter, T listener, boolean notifyLoaded) { return addSourceBinding(new EventBinding.Source<>(abstractInstrumenter, filter, null, listener, false), notifyLoaded); }
private <T extends AllocationListener> EventBinding<T> attachAllocationListener(AbstractInstrumenter instrumenter, AllocationEventFilter filter, T listener) { return addAllocationBinding(new EventBinding.Allocation<>(instrumenter, filter, listener)); }
void initializeInstrument(Object vmObject, Class<?> instrumentClass) { Env env = new Env(vmObject, out, err, in, messageInterceptor); env.instrumenter = new InstrumentClientInstrumenter(env, instrumentClass); if (TRACE) { trace("Initialize instrument class %s %n", instrumentClass); } try { env.instrumenter.instrument = (TruffleInstrument) instrumentClass.getDeclaredConstructor().newInstance(); } catch (Exception e) { failInstrumentInitialization(env, String.format("Failed to create new instrumenter class %s", instrumentClass.getName()), e); return; } if (TRACE) { trace("Initialized instrument %s class %s %n", env.instrumenter.instrument, instrumentClass); } addInstrumenter(vmObject, env.instrumenter); }
private <T extends ExecutionEventListener> EventBinding<T> attachListener(AbstractInstrumenter instrumenter, SourceSectionFilter filter, SourceSectionFilter inputFilter, T listener) { return addExecutionBinding(new EventBinding.Source<>(instrumenter, filter, inputFilter, listener, true)); }