use of com.oracle.truffle.api.instrumentation.ExecuteSourceListener in project graal by oracle.
the class BreakpointSnippets method install.
private void install() {
assert Thread.holdsLock(this);
if (sourceBinding == null) {
SourceFilter filter = locationKey.createSourceFilter();
final boolean[] sourceResolved = new boolean[] { false };
sourceBinding = debugger.getInstrumenter().attachExecuteSourceListener(filter, new ExecuteSourceListener() {
@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);
if (sourceResolved[0]) {
sourceBinding.dispose();
}
} else if (breakpointBinding == null && sourceBinding.isDisposed()) {
// re-installing breakpoint
SourceSectionFilter locationFilter = locationKey.createLocationFilter(null, suspendAnchor);
breakpointBinding = createBinding(locationFilter);
}
}
Aggregations