use of com.intellij.xdebugger.breakpoints.XBreakpointProperties in project intellij-plugins by JetBrains.
the class FlexBreakpointsHandler method updateBreakpointStatusToVerified.
void updateBreakpointStatusToVerified(String breakPointNumber) {
int spacePos = breakPointNumber.indexOf(' ');
// "24 at 0xf3103"
if (spacePos != -1)
breakPointNumber = breakPointNumber.substring(0, spacePos);
final int index = Integer.parseInt(breakPointNumber);
final XLineBreakpoint<XBreakpointProperties> breakpoint = myIndexToBreakpointMap.get(index);
if (breakpoint != null) {
myDebugProcess.getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_verified_breakpoint, null);
} else {
// run to cursor
}
}
use of com.intellij.xdebugger.breakpoints.XBreakpointProperties in project intellij-plugins by JetBrains.
the class FlexDebugProcess method processOneCommandLoop.
private void processOneCommandLoop() throws IOException, InterruptedException {
assert Thread.currentThread() == myDebuggerManagerThread;
final DebuggerCommand command = postCommand();
if (command == null)
return;
boolean explicitlyContinueRead = false;
do {
final CommandOutputProcessingType outputProcessingType = command.getOutputProcessingMode();
if (outputProcessingType == CommandOutputProcessingType.NO_PROCESSING || (outputProcessingType == CommandOutputProcessingType.DEFAULT_PROCESSING && !reader.hasSomeDataPending())) {
return;
}
if (myCheckForUnexpectedStartupStop && !(command instanceof DumpOutputCommand)) {
myCheckForUnexpectedStartupStop = false;
}
@NonNls String commandOutput = null;
try {
commandOutput = command.read(this);
} catch (IOException e) {
if (!(command instanceof QuitCommand)) {
throw e;
}
}
if (command instanceof QuitCommand) {
// request to finish
Thread.currentThread().interrupt();
}
if (commandOutput == null)
break;
if (commandOutput.contains("Player session terminated") && !(command instanceof SuspendResumeDebuggerCommand)) {
handleProbablyUnexpectedStop(commandOutput);
break;
}
commandOutput = commandOutput.trim();
log(commandOutput);
if (outputProcessingType == CommandOutputProcessingType.SPECIAL_PROCESSING) {
log("Processed by " + command);
if (command.onTextAvailable(commandOutput) == CommandOutputProcessingMode.DONE)
break;
explicitlyContinueRead = true;
continue;
}
ResponseLineIterator iterator = new ResponseLineIterator(commandOutput);
boolean toInsertContinue = false;
boolean encounteredNonsuspendableBreakpoint = false;
int index;
while (iterator.hasNext()) {
final String line = iterator.next();
if (line.startsWith("Active worker has changed to worker ")) {
try {
final String workerText = line.substring("Active worker has changed to worker ".length());
if ("Main Thread".equals(workerText)) {
myCurrentWorker = 0;
} else {
myCurrentWorker = Integer.parseInt(workerText);
}
} catch (NumberFormatException e) {
log("Unexpected worker number");
}
} else if (line.contains("Additional ActionScript code has been loaded")) {
if (!suspended)
reader.readLine(false);
myKnownFilesInfo.setUpToDate(false);
} else if ((index = line.indexOf(BREAKPOINT_MARKER)) != -1 && !line.contains(" created")) {
// Breakpoint 1, aaa() at A.mxml:14
try {
final int from = index + BREAKPOINT_MARKER.length();
// Breakpoint 1, aaa() at A.mxml:14
// Breakpoint 2: file ConfigurationService.as
// Breakpoint 3 at 0xFFF
int endOfBreakpointIndexPosition = line.indexOf(',', from);
final int colonIndex = line.indexOf(':', from);
final int spaceIndex = line.indexOf(' ', from);
if (endOfBreakpointIndexPosition != -1) {
if (colonIndex != -1) {
endOfBreakpointIndexPosition = Math.min(colonIndex, endOfBreakpointIndexPosition);
}
if (spaceIndex != -1) {
endOfBreakpointIndexPosition = Math.min(spaceIndex, endOfBreakpointIndexPosition);
}
index = Integer.parseInt(line.substring(from, endOfBreakpointIndexPosition));
final XLineBreakpoint<XBreakpointProperties> breakpoint = myBreakpointsHandler.getBreakpointByIndex(index);
if (breakpoint != null) {
FlexStackFrame frame = new FlexStackFrame(this, breakpoint.getSourcePosition());
boolean suspend = false;
if (evaluateCondition(breakpoint.getConditionExpression(), frame)) {
String message = evaluateMessage(breakpoint.getLogExpressionObject(), frame);
suspend = getSession().breakpointReached(breakpoint, message, new FlexSuspendContext(frame));
}
if (!suspend) {
encounteredNonsuspendableBreakpoint = true;
toInsertContinue = true;
}
} else {
// run to cursor break point
insertCommand(myBreakpointsHandler.new RemoveBreakpointCommand(index, breakpoint));
}
}
} catch (NumberFormatException ex) {
log(ex);
}
} else if (line.length() > 0 && Character.isDigit(line.charAt(0))) {
// we are on new location: e.g. " 119 trace('\x30 \123')"
if (!encounteredNonsuspendableBreakpoint)
insertCommand(new DumpSourceLocationCommand(this));
} else if (handleStdResponse(line, iterator)) {
} else if (line.startsWith(RESOLVED_BREAKPOINT_MARKER)) {
// TODO: move to break point handler
// Resolved breakpoint 1 to aaa() at A.mxml:14
final String breakPointNumber = line.substring(RESOLVED_BREAKPOINT_MARKER.length(), line.indexOf(' ', RESOLVED_BREAKPOINT_MARKER.length()));
myBreakpointsHandler.updateBreakpointStatusToVerified(breakPointNumber);
} else if (line.startsWith(ATTEMPTING_TO_RESOLVE_BREAKPOINT_MARKER)) {
// TODO: move to break point handler
int breakpointId = Integer.parseInt(line.substring(ATTEMPTING_TO_RESOLVE_BREAKPOINT_MARKER.length(), line.indexOf(',')));
final XLineBreakpoint<XBreakpointProperties> breakpoint = myBreakpointsHandler.getBreakpointByIndex(breakpointId);
if (iterator.hasNext() && iterator.getNext().contains("no executable code")) {
iterator.next();
myBreakpointsHandler.updateBreakpointStatusToInvalid(breakpoint);
toInsertContinue = true;
} else if (iterator.hasNext() && iterator.getNext().contains(AMBIGUOUS_MATCHING_FILE_NAMES)) {
iterator.next();
iterator.next();
while (iterator.hasNext() && iterator.getNext().contains("#")) {
iterator.next();
}
if (getFileId(breakpoint.getSourcePosition().getFile().getPath()) != null) {
final XBreakpointHandler handler = getBreakpointHandlers()[0];
handler.unregisterBreakpoint(breakpoint, false);
handler.registerBreakpoint(breakpoint);
}
toInsertContinue = true;
}
} else if (line.startsWith("Set additional breakpoints")) {
//Set additional breakpoints as desired, and then type 'continue'.
// TODO: move to break point handler
toInsertContinue = true;
} else if (line.contains("Execution halted")) {
if (!getSession().isPaused()) {
getSession().pause();
}
}
}
if (toInsertContinue)
insertCommand(new ContinueCommand());
} while (explicitlyContinueRead || reader.hasSomeDataPending());
}
use of com.intellij.xdebugger.breakpoints.XBreakpointProperties in project intellij-plugins by JetBrains.
the class DartVmServiceListener method onIsolatePaused.
void onIsolatePaused(@NotNull final IsolateRef isolateRef, @Nullable final ElementList<Breakpoint> vmBreakpoints, @Nullable final InstanceRef exception, @Nullable final Frame vmTopFrame, boolean atAsyncSuspension) {
if (vmTopFrame == null) {
myDebugProcess.getSession().positionReached(new XSuspendContext() {
});
return;
}
final DartVmServiceSuspendContext suspendContext = new DartVmServiceSuspendContext(myDebugProcess, isolateRef, vmTopFrame, exception, atAsyncSuspension);
final XStackFrame xTopFrame = suspendContext.getActiveExecutionStack().getTopFrame();
final XSourcePosition sourcePosition = xTopFrame == null ? null : xTopFrame.getSourcePosition();
if (vmBreakpoints == null || vmBreakpoints.isEmpty()) {
final StepOption latestStep = myDebugProcess.getVmServiceWrapper().getLatestStep();
if (latestStep == StepOption.Over && equalSourcePositions(myLatestSourcePosition, sourcePosition)) {
// continue stepping to change current line
myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), latestStep);
} else {
myLatestSourcePosition = sourcePosition;
myDebugProcess.getSession().positionReached(suspendContext);
}
} else {
if (vmBreakpoints.size() > 1) {
// Shouldn't happen. IDE doesn't allow to set 2 breakpoints on one line.
LOG.error(vmBreakpoints.size() + " breakpoints hit in one shot.");
}
// Remove any temporary (run to cursor) breakpoints.
myBreakpointHandler.removeTemporaryBreakpoints(isolateRef.getId());
final XLineBreakpoint<XBreakpointProperties> xBreakpoint = myBreakpointHandler.getXBreakpoint(vmBreakpoints.get(0));
if (xBreakpoint == null) {
// breakpoint could be set in the Observatory
myLatestSourcePosition = sourcePosition;
myDebugProcess.getSession().positionReached(suspendContext);
return;
}
if ("false".equals(evaluateExpression(isolateRef.getId(), vmTopFrame, xBreakpoint.getConditionExpression()))) {
myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), null);
return;
}
myLatestSourcePosition = sourcePosition;
final String logExpression = evaluateExpression(isolateRef.getId(), vmTopFrame, xBreakpoint.getLogExpressionObject());
final boolean suspend = myDebugProcess.getSession().breakpointReached(xBreakpoint, logExpression, suspendContext);
if (!suspend) {
myDebugProcess.getVmServiceWrapper().resumeIsolate(isolateRef.getId(), null);
}
}
}
use of com.intellij.xdebugger.breakpoints.XBreakpointProperties in project intellij-community by JetBrains.
the class ContextTest method testXDebugger.
public void testXDebugger() throws Exception {
final WorkingContextManager manager = getContextManager();
final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(getProject()).getBreakpointManager();
final XsltBreakpointType type = XBreakpointType.EXTENSION_POINT_NAME.findExtension(XsltBreakpointType.class);
ApplicationManager.getApplication().runWriteAction(() -> {
XLineBreakpointImpl<XBreakpointProperties> breakpoint = (XLineBreakpointImpl<XBreakpointProperties>) breakpointManager.addLineBreakpoint(type, "foo", 0, null);
final String name = "foo";
manager.saveContext(name, null);
breakpointManager.removeBreakpoint(breakpoint);
});
manager.loadContext("foo");
Collection<? extends XLineBreakpoint<XBreakpointProperties>> breakpoints = breakpointManager.getBreakpoints(type);
assertEquals(1, breakpoints.size());
manager.clearContext();
}
Aggregations