use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class AceEditorWidget method removeBreakpoint.
public void removeBreakpoint(Breakpoint breakpoint) {
int idx = getBreakpointIdxById(breakpoint.getBreakpointId());
if (idx >= 0) {
removeBreakpointMarker(breakpoint);
breakpoints_.remove(idx);
}
}
use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method activateTopLevelBreakpoints.
private void activateTopLevelBreakpoints(String path) {
for (Breakpoint breakpoint : breakpoints_) {
ArrayList<Breakpoint> activatedBreakpoints = new ArrayList<Breakpoint>();
if (breakpoint.isPendingDebugCompletion() && breakpoint.getState() == Breakpoint.STATE_INACTIVE && breakpoint.getType() == Breakpoint.TYPE_TOPLEVEL && breakpoint.getPath().equals(path)) {
// If this is a top-level breakpoint in the file that we
// just finished sourcing, activate the breakpoint.
breakpoint.setPendingDebugCompletion(false);
breakpoint.setState(Breakpoint.STATE_ACTIVE);
activatedBreakpoints.add(breakpoint);
}
if (activatedBreakpoints.size() > 0)
notifyBreakpointsSaved(activatedBreakpoints, true);
}
}
use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method onContextDepthChanged.
@Override
public void onContextDepthChanged(ContextDepthChangedEvent event) {
// When we move around in debug context and hit a breakpoint, the initial
// evaluation state is a temporary construction that needs to be stepped
// past to begin actually evaluating the function. Step past it
// immediately.
JsArray<CallFrame> frames = event.getCallFrames();
Set<FileFunction> activeFunctions = new TreeSet<FileFunction>();
boolean hasSourceEquiv = false;
for (int idx = 0; idx < frames.length(); idx++) {
CallFrame frame = frames.get(idx);
String functionName = frame.getFunctionName();
String fileName = frame.getFileName();
if (functionName.equals(".doTrace") && event.isServerInitiated()) {
events_.fireEvent(new SendToConsoleEvent(DebugCommander.NEXT_COMMAND, true));
}
activeFunctions.add(new FileFunction(functionName, fileName, "", false));
if (frame.isSourceEquiv()) {
activeSource_ = fileName;
hasSourceEquiv = true;
}
}
// For any functions that were previously active in the callstack but
// are no longer active, enable any pending breakpoints for those
// functions.
Set<FileFunction> enableFunctions = new TreeSet<FileFunction>();
for (FileFunction function : activeFunctions_) {
if (!activeFunctions.contains(function)) {
for (Breakpoint breakpoint : breakpoints_) {
if (breakpoint.isPendingDebugCompletion() && breakpoint.getState() == Breakpoint.STATE_INACTIVE && function.containsBreakpoint(breakpoint)) {
enableFunctions.add(function);
}
}
}
}
for (FileFunction function : enableFunctions) {
prepareAndSetFunctionBreakpoints(function);
}
// Record the new frame list.
activeFunctions_ = activeFunctions;
// breakpoints in the file we were sourcing.
if (!hasSourceEquiv && activeSource_ != null) {
activateTopLevelBreakpoints(activeSource_);
activeSource_ = null;
}
}
use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method onRestartStatus.
@Override
public void onRestartStatus(RestartStatusEvent event) {
if (event.getStatus() == RestartStatusEvent.RESTART_INITIATED) {
// Restarting R unloads all the packages, so mark all active package
// breakpoints as inactive when this happens.
ArrayList<Breakpoint> breakpoints = new ArrayList<Breakpoint>();
for (Breakpoint breakpoint : breakpoints_) {
if (breakpoint.isPackageBreakpoint()) {
breakpoint.setState(Breakpoint.STATE_INACTIVE);
breakpoints.add(breakpoint);
}
}
notifyBreakpointsSaved(breakpoints, true);
}
}
use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method updatePackageBreakpoints.
private void updatePackageBreakpoints(String packageName, boolean enable) {
Set<FileFunction> functionsToBreak = new TreeSet<FileFunction>();
ArrayList<Breakpoint> breakpointsToDisable = new ArrayList<Breakpoint>();
for (Breakpoint breakpoint : breakpoints_) {
if (breakpoint.isPackageBreakpoint() && breakpoint.getPackageName().equals(packageName)) {
if (enable) {
functionsToBreak.add(new FileFunction(breakpoint));
} else {
breakpoint.setState(Breakpoint.STATE_INACTIVE);
breakpointsToDisable.add(breakpoint);
}
}
}
if (enable) {
for (FileFunction function : functionsToBreak) {
prepareAndSetFunctionBreakpoints(function);
}
} else {
notifyBreakpointsSaved(breakpointsToDisable, true);
}
}
Aggregations