private synchronized void disableCancel() { int usersLeft = --cancellationUsers; if (usersLeft <= 0) { EventBinding<?> b = cancellationBinding; if (b != null) { b.dispose(); } cancellationBinding = null; } } }
private synchronized void disableCancel() { int usersLeft = --cancellationUsers; if (usersLeft <= 0) { EventBinding<?> b = cancellationBinding; if (b != null) { b.dispose(); } cancellationBinding = null; } } }
private void invalidateStack() { ShadowStack localShadowStack = this.shadowStack; if (localShadowStack != null) { synchronized (this) { localShadowStack = this.shadowStack; if (localShadowStack != null) { if (stacksBinding != null) { stacksBinding.dispose(); stacksBinding = null; } shadowStack = null; } else { assert stacksBinding == null; } } } }
private void uninstall() { assert Thread.holdsLock(this); EventBinding<?> binding = breakpointBinding; breakpointBinding = null; if (binding != null) { binding.dispose(); } resolved = false; }
private void uninstall() { assert Thread.holdsLock(this); EventBinding<?> binding = breakpointBinding; breakpointBinding = null; for (DebuggerSession s : sessions) { s.allBindings.remove(binding); } if (binding != null) { binding.dispose(); } resolved = false; }
/** * Closes the tracer for fuhrer use, deleting all the gathered data. * * @since 0.30 */ @Override public synchronized void close() { assert Thread.holdsLock(this); if (stacksBinding != null) { stacksBinding.dispose(); stacksBinding = null; } if (shadowStack != null) { shadowStack = null; } }
private void removeBindings() { assert Thread.holdsLock(this); if (syntaxElementsBinding != null) { callBinding.dispose(); syntaxElementsBinding.dispose(); callBinding = null; rootBinding.dispose(); rootBinding = null; syntaxElementsBinding = null; if (Debugger.TRACE) { trace("disabled stepping"); } } }
private void removeBindings() { assert Thread.holdsLock(this); if (syntaxElementsBinding != null) { allBindings.remove(syntaxElementsBinding); syntaxElementsBinding.dispose(); syntaxElementsBinding = null; if (Debugger.TRACE) { trace("disabled stepping"); } } }
@Override public void closeExecutionListener(Object impl) { try { ((ListenerImpl) impl).closing = true; ((ListenerImpl) impl).binding.dispose(); } catch (Throwable t) { throw wrapException(((ListenerImpl) impl).engine, t); } }
synchronized void setThreadsListener(DebugThreadsListener listener, boolean includeExistingThreads) { if (threadsBinding != null) { threadsBinding.dispose(); } this.threadsListener = listener; if (listener != null) { threadsBinding = lifecycleInstrumenter.attachThreadsListener(this, includeExistingThreads); } else { threadsBinding = null; if (contextsBinding == null) { contextMap.clear(); } } }
synchronized void setContextsListener(DebugContextsListener listener, boolean includeExistingContexts) { if (contextsBinding != null) { contextsBinding.dispose(); } contextsListener = listener; if (listener != null) { contextsBinding = lifecycleInstrumenter.attachContextsListener(this, includeExistingContexts); } else { contextsBinding = null; if (threadsBinding == null) { contextMap.clear(); } } }
synchronized void setContextsListener(DebugContextsListener listener, boolean includeExistingContexts) { if (contextsBinding != null) { contextsBinding.dispose(); } contextsListener = listener; if (listener != null) { contextsBinding = lifecycleInstrumenter.attachContextsListener(this, includeExistingContexts); } else { contextsBinding = null; if (threadsBinding == null) { contextMap.clear(); } } }
synchronized void setThreadsListener(DebugThreadsListener listener, boolean includeExistingThreads) { if (threadsBinding != null) { threadsBinding.dispose(); } this.threadsListener = listener; if (listener != null) { threadsBinding = lifecycleInstrumenter.attachThreadsListener(this, includeExistingThreads); } else { threadsBinding = null; if (contextsBinding == null) { contextMap.clear(); } } }
/** * Returns a filtered list of loaded {@link SourceSection} instances. * * @param filter criterion for inclusion * @return unmodifiable list of instances that pass the filter * * @since 0.18 */ public final List<SourceSection> querySourceSections(SourceSectionFilter filter) { final List<SourceSection> sourceSectionList = new ArrayList<>(); EventBinding<?> binding = attachLoadSourceSectionListener(filter, new LoadSourceSectionListener() { public void onLoad(LoadSourceSectionEvent event) { sourceSectionList.add(event.getSourceSection()); } }, true); binding.dispose(); return Collections.unmodifiableList(sourceSectionList); }
/** * Returns a list of all loaded sources. The sources are returned in the order as they have been * loaded by the languages. * * @return an unmodifiable list of sources * @since 0.17 * @deprecated not very flexible, polls all sources without any notification about changes. */ @Deprecated public List<Source> getLoadedSources() { final List<Source> sources = new ArrayList<>(); EventBinding<?> binding = env.getInstrumenter().attachLoadSourceListener(SourceFilter.ANY, new LoadSourceListener() { public void onLoad(LoadSourceEvent event) { sources.add(event.getSource()); } }, true); binding.dispose(); return Collections.unmodifiableList(sources); }
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)); } }); }
@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 = createBinding(locationFilter); } }, true);
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.shadowStack = new ShadowStack(stackLimit, f, env.getInstrumenter(), TruffleLogger.getLogger(CPUTracerInstrument.ID)); this.stacksBinding = this.shadowStack.install(env.getInstrumenter(), f, false); this.activeBinding = env.getInstrumenter().attachAllocationListener(AllocationEventFilter.ANY, new Listener()); }
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);