void resetReportedException() { if (haveReportedExceptions.get()) { doResetReportedException(); } }
@Override public void onEnter(VirtualFrame frame) { getBreakpoint().exceptionFilter.resetReportedException(); }
private void install(Debugger d) { assert Thread.holdsLock(this); if (this.debugger != null && this.debugger != d) { throw new IllegalStateException("Breakpoint is already installed in a different Debugger instance."); } this.debugger = d; if (exceptionFilter != null) { exceptionFilter.setDebugger(d); } }
Match matchException(Node throwNode, Throwable exception) { if (wasReported(exception)) { return Match.UNMATCHED; } if (caught && uncaught) { return Match.MATCHED; } else { return testExceptionCaught(throwNode, exception); } }
@TruffleBoundary private Match testExceptionCaught(Node throwNode, Throwable exception) { if (!(exception instanceof TruffleException)) { return uncaught ? Match.MATCHED : Match.UNMATCHED; } CatchLocation catchLocation = getCatchNode(debugger, throwNode, exception); boolean exceptionCaught = catchLocation != null; return new Match(caught && exceptionCaught || uncaught && !exceptionCaught, catchLocation); }
Throwable throwable = exception.getRawException(); assert throwable != null; BreakpointExceptionFilter.Match matched = exceptionFilter.matchException(node, throwable); if (!matched.isMatched) { return false;
/** * @return a new breakpoint instance of {@link Kind#EXCEPTION EXCEPTION} kind. * * @since 1.0 */ public Breakpoint build() { if (sourceElements == null) { sourceElements = new SourceElement[]{SourceElement.STATEMENT}; } BreakpointLocation location = BreakpointLocation.create(sourceElements, suspensionFilter); BreakpointExceptionFilter efilter = new BreakpointExceptionFilter(caught, uncaught); return new Breakpoint(location, SuspendAnchor.AFTER, false, efilter, null); } }
/** * Get source code location where this exception is to be caught. In case this exception is * going to be caught by guest language code, the catch location is provided. <code>null</code> * is returned for uncaught exceptions. * * @return the catch location, or <code>null</code> in case of uncaught exceptions. * @since 1.0 */ public CatchLocation getCatchLocation() { if (!isCatchNodeComputed) { synchronized (this) { if (!isCatchNodeComputed) { if (exception instanceof TruffleException) { catchLocation = BreakpointExceptionFilter.getCatchNode(session.getDebugger(), throwLocation, exception); if (catchLocation != null) { catchLocation.setSuspendedEvent(suspendedEvent); catchLocation = catchLocation.cloneFor(session); } } isCatchNodeComputed = true; } } } return catchLocation; }
BreakpointExceptionFilter.Match matched = getBreakpoint().exceptionFilter.matchException(this, exception); if (matched.isMatched) { BreakpointConditionFailure conditionError = null;
return getCatchNode(msgNodes, parent, exception);
@Override public void onReturnValue(VirtualFrame frame, Object result) { getBreakpoint().exceptionFilter.resetReportedException(); }