EventBinding<?> install(Instrumenter instrumenter, SourceSectionFilter filter, boolean compiledOnly) { return instrumenter.attachExecutionEventFactory(filter, new ExecutionEventNodeFactory() { public ExecutionEventNode create(EventContext context) { Node instrumentedNode = context.getInstrumentedNode(); if (instrumentedNode.getSourceSection() == null) { logger.warning("Instrumented node " + instrumentedNode + " has null SourceSection."); return null; } return new StackPushPopNode(ShadowStack.this, instrumenter, context, compiledOnly); } }); }
/** * Starts execution event notification for a given {@link SourceSectionFilter event filter} and * {@link ExecutionEventNodeFactory factory}. Events are delivered to the * {@link ExecutionEventNode} instances created by the factory. * <p> * Returns a {@link EventBinding binding} which allows to dispose the attached execution event * binding. Disposing the binding removes all probes and wrappers from the AST that were created * for this instrument. The removal of probes and wrappers is performed lazily on the next * execution of the AST. * <p> * By default no * {@link ExecutionEventNode#onInputValue(com.oracle.truffle.api.frame.VirtualFrame, EventContext, int, Object) * input value events} are delivered to the created execution event nodes. To deliver inputs * events use * {@link #attachExecutionEventFactory(SourceSectionFilter, SourceSectionFilter, ExecutionEventNodeFactory)} * instead. * * @param eventFilter filters the events that are reported to the {@link ExecutionEventNode * execution event nodes} created by the factory. * @param factory the factory that creates {@link ExecutionEventNode execution event nodes}. * @see ExecutionEventNodeFactory * @see #attachExecutionEventFactory(SourceSectionFilter, SourceSectionFilter, * ExecutionEventNodeFactory) * @since 0.33 */ public final <T extends ExecutionEventNodeFactory> EventBinding<T> attachExecutionEventFactory(SourceSectionFilter eventFilter, T factory) { return attachExecutionEventFactory(eventFilter, null, factory); }
/** * @since 0.12 * @deprecated in 0.32 use * {@link #attachExecutionEventFactory(SourceSectionFilter, ExecutionEventNodeFactory) * instead (rename only) */ @Deprecated public final <T extends ExecutionEventNodeFactory> EventBinding<T> attachFactory(SourceSectionFilter eventFilter, T factory) { return attachExecutionEventFactory(eventFilter, null, factory); }
/** * @since 0.12 * @deprecated in 0.32 use * {@link #attachExecutionEventFactory(SourceSectionFilter, ExecutionEventNodeFactory) * instead (rename only) */ @Deprecated public final <T extends ExecutionEventNodeFactory> EventBinding<T> attachFactory(SourceSectionFilter eventFilter, T factory) { return attachExecutionEventFactory(eventFilter, null, factory); }
/** * Starts execution event notification for a given {@link SourceSectionFilter event filter} and * {@link ExecutionEventNodeFactory factory}. Events are delivered to the * {@link ExecutionEventNode} instances created by the factory. * <p> * Returns a {@link EventBinding binding} which allows to dispose the attached execution event * binding. Disposing the binding removes all probes and wrappers from the AST that were created * for this instrument. The removal of probes and wrappers is performed lazily on the next * execution of the AST. * <p> * By default no * {@link ExecutionEventNode#onInputValue(com.oracle.truffle.api.frame.VirtualFrame, EventContext, int, Object) * input value events} are delivered to the created execution event nodes. To deliver inputs * events use * {@link #attachExecutionEventFactory(SourceSectionFilter, SourceSectionFilter, ExecutionEventNodeFactory)} * instead. * * @param eventFilter filters the events that are reported to the {@link ExecutionEventNode * execution event nodes} created by the factory. * @param factory the factory that creates {@link ExecutionEventNode execution event nodes}. * @see ExecutionEventNodeFactory * @see #attachExecutionEventFactory(SourceSectionFilter, SourceSectionFilter, * ExecutionEventNodeFactory) * @since 0.33 */ public final <T extends ExecutionEventNodeFactory> EventBinding<T> attachExecutionEventFactory(SourceSectionFilter eventFilter, T factory) { return attachExecutionEventFactory(eventFilter, null, factory); }
private EventBinding<? extends ExecutionEventNodeFactory> createBinding(SourceSectionFilter locationFilter) { EventBinding<BreakpointNodeFactory> binding = debugger.getInstrumenter().attachExecutionEventFactory(locationFilter, new BreakpointNodeFactory()); synchronized (this) { for (DebuggerSession s : sessions) { s.allBindings.add(binding); } } return binding; }
private synchronized void resetTracer() { assert Thread.holdsLock(this); if (activeBinding != null) { activeBinding.dispose(); activeBinding = null; } if (!collecting || closed) { return; } SourceSectionFilter f = this.filter; if (f == null) { f = DEFAULT_FILTER; } this.activeBinding = env.getInstrumenter().attachExecutionEventFactory(f, new ExecutionEventNodeFactory() { @Override public ExecutionEventNode create(EventContext context) { return new CounterNode(getCounter(context)); } }); }
private EventBinding<? extends ExecutionEventNodeFactory> createBinding(boolean includeInternalCode, Predicate<Source> sFilter, ExecutionEventNodeFactory factory, boolean onInput, Class<?>... tags) { Builder builder = SourceSectionFilter.newBuilder().tagIs(tags); builder.includeInternal(includeInternalCode); if (sFilter != null) { builder.sourceIs(new SourceSectionFilter.SourcePredicate() { @Override public boolean test(Source source) { return sFilter.test(source); } }); } SourceSectionFilter ssf = builder.build(); if (onInput) { return debugger.getInstrumenter().attachExecutionEventFactory(ssf, ssf, factory); } else { return debugger.getInstrumenter().attachExecutionEventFactory(ssf, factory); } }
private EventBinding<? extends ExecutionEventNodeFactory> createBinding(boolean includeInternalCode, Predicate<Source> sFilter, ExecutionEventNodeFactory factory, boolean onInput, Class<?>... tags) { Builder builder = SourceSectionFilter.newBuilder().tagIs(tags); builder.includeInternal(includeInternalCode); if (sFilter != null) { builder.sourceIs(new SourceSectionFilter.SourcePredicate() { @Override public boolean test(Source source) { return sFilter.test(source); } }); } SourceSectionFilter ssf = builder.build(); if (onInput) { return debugger.getInstrumenter().attachExecutionEventFactory(ssf, ssf, factory); } else { return debugger.getInstrumenter().attachExecutionEventFactory(ssf, factory); } }
binding = instrumenter.attachExecutionEventFactory(filter, mayNeedInputValues ? filter : null, new ExecutionEventNodeFactory() { public ExecutionEventNode create(EventContext context) { return new ProfilingNode(config, context); } else { binding = instrumenter.attachExecutionEventFactory(filter, null, new ExecutionEventNodeFactory() { public ExecutionEventNode create(EventContext context) { return new DefaultNode(config, context);
private void reset() { if (binding != null) { binding.dispose(); binding = null; } if (isCollecting) { final Builder filterBuilder = SourceSectionFilter.newBuilder(); if (mimeTypes != null) { filterBuilder.mimeTypeIs(mimeTypes); } final SourceSectionFilter filter = filterBuilder.tagIs(StandardTags.RootTag.class).sourceIs(notInternal).build(); binding = instrumenter.attachExecutionEventFactory(filter, new ExecutionEventNodeFactory() { public ExecutionEventNode create(EventContext context) { return createCountingNode(context); } }); } }
@Override public void onExecute(ExecuteSourceEvent event) { if (sourceResolved[0]) { return; } sourceResolved[0] = true; synchronized (Breakpoint.this) { if (sourceBinding != null) { sourceBinding.dispose(); } } Source source = event.getSource(); SourceSection location = locationKey.adjustLocation(source, debugger.getEnv(), suspendAnchor); if (location != null) { resolveBreakpoint(location); } SourceSectionFilter locationFilter = locationKey.createLocationFilter(source, suspendAnchor); breakpointBinding = debugger.getInstrumenter().attachExecutionEventFactory(locationFilter, new BreakpointNodeFactory()); } }, true);
breakpointBinding = debugger.getInstrumenter().attachExecutionEventFactory(locationFilter, new BreakpointNodeFactory());