com.intellij.xdebugger.breakpoints.XBreakpointProperties Java Examples

The following examples show how to use com.intellij.xdebugger.breakpoints.XBreakpointProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MuleBreakpointType.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project)
{
    final XSourcePosition position = breakpoint.getSourcePosition();
    if (position == null)
    {
        return null;
    }

    final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
    if (file == null)
    {
        return null;
    }

    return new MuleDebuggerEditorsProvider();
}
 
Example #2
Source File: VmServiceWrapper.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void addBreakpointForIsolates(@NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint,
                                     @NotNull final Collection<IsolatesInfo.IsolateInfo> isolateInfos) {
  for (final IsolatesInfo.IsolateInfo isolateInfo : isolateInfos) {
    addBreakpoint(isolateInfo.getIsolateId(), xBreakpoint.getSourcePosition(), new VmServiceConsumers.BreakpointsConsumer() {
      @Override
      void sourcePositionNotApplicable() {
        myBreakpointHandler.breakpointFailed(xBreakpoint);
      }

      @Override
      void received(List<Breakpoint> breakpointResponses, List<RPCError> errorResponses) {
        for (Breakpoint breakpoint : breakpointResponses) {
          myBreakpointHandler.vmBreakpointAdded(xBreakpoint, isolateInfo.getIsolateId(), breakpoint);
        }
      }
    });
  }
}
 
Example #3
Source File: WeaveBreakpointType.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project)
{
    final XSourcePosition position = breakpoint.getSourcePosition();
    if (position == null)
    {
        return null;
    }

    final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
    if (file == null)
    {
        return null;
    }

    return new WeaveDebuggerEditorsProvider();
}
 
Example #4
Source File: HaxeDebugRunner.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
private void unregisterBreakpoint
  (@NotNull final XLineBreakpoint<XBreakpointProperties> breakpoint,
   final boolean temporary) {
  if (!mMap.containsKey(breakpoint)) {
    return;
  }

  int id = mMap.remove(breakpoint);
  DebugProcess.this.enqueueCommand
    (debugger.Command.DeleteBreakpointRange(id, id),
     new MessageListener() {
       public void handleMessage(int messageId,
                                 debugger.Message message) {
         // Could verify that the response was Deleted ...
       }
     });
}
 
Example #5
Source File: HaxeDebugRunner.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
private void registerBreakpoint
  (@NotNull final XLineBreakpoint<XBreakpointProperties> breakpoint) {
  final XSourcePosition position = breakpoint.getSourcePosition();
  if (position == null) {
    return;
  }

  String path = getRelativePath(mProject, position.getFile());

  DebugProcess.this.enqueueCommand
    (debugger.Command.AddFileLineBreakpoint
      (path, position.getLine() + 1), new MessageListener() {
      public void handleMessage(int messageId,
                                debugger.Message message) {
        if (messageId == JavaProtocol.IdFileLineBreakpointNumber) {
          mMap.put(breakpoint, (Integer)(message.params[0]));
        }
        else {
          getSession().updateBreakpointPresentation
            (breakpoint,
             AllIcons.Debugger.Db_invalid_breakpoint, null);
          DebugProcess.this.warn("Cannot set breakpoint");
        }
      }
    });
}
 
Example #6
Source File: HaxeDebugRunner.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
public DebugProcess(@NotNull XDebugSession session,
                    Project project, Module module,
                    int port) throws IOException {
  super(session);
  mClassesWithStatics = new Vector<String>();
  mProject = project;
  mModule = module;
  mDeferredQueue =
    new LinkedList<Pair<debugger.Command, MessageListener>>();
  mListenerQueue = new LinkedList<MessageListener>();
  mServerSocket = new java.net.ServerSocket(port);
  mBreakpointHandlers = this.createBreakpointHandlers();
  mMap =
    new HashMap<XLineBreakpoint<XBreakpointProperties>, Integer>();

  mWriteQueue = QueueProcessor.createRunnableQueueProcessor(QueueProcessor.ThreadToUse.POOLED);
}
 
Example #7
Source File: VmServiceWrapper.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void addBreakpointForIsolates(@NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint,
                                     @NotNull final Collection<IsolatesInfo.IsolateInfo> isolateInfos) {
  for (final IsolatesInfo.IsolateInfo isolateInfo : isolateInfos) {
    addBreakpoint(isolateInfo.getIsolateId(), xBreakpoint.getSourcePosition(), new VmServiceConsumers.BreakpointsConsumer() {
      @Override
      void sourcePositionNotApplicable() {
        myBreakpointHandler.breakpointFailed(xBreakpoint);
      }

      @Override
      void received(List<Breakpoint> breakpointResponses, List<RPCError> errorResponses) {
        for (Breakpoint breakpoint : breakpointResponses) {
          myBreakpointHandler.vmBreakpointAdded(xBreakpoint, isolateInfo.getIsolateId(), breakpoint);
        }
      }
    });
  }
}
 
Example #8
Source File: SkylarkDebugProcess.java    From intellij with Apache License 2.0 6 votes vote down vote up
private void handleThreadPausedEvent(PausedThread thread) {
  // ignore threads paused during initialization
  if (!debuggingStarted && thread.getPauseReason() == PauseReason.ALL_THREADS_PAUSED) {
    // Temporary backwards-compatibility code. TODO(brendandouglas): remove in v2018.10+
    return;
  }
  if (thread.getPauseReason() == PauseReason.INITIALIZING) {
    return;
  }

  if (thread.getPauseReason() != PauseReason.CONDITIONAL_BREAKPOINT_ERROR) {
    notifyThreadPaused(thread);
    return;
  }
  XLineBreakpoint<XBreakpointProperties> breakpoint =
      lineBreakpoints.get(thread.getLocation().toBuilder().setColumnNumber(0).build());
  if (breakpoint == null) {
    notifyThreadPaused(thread);
  } else {
    handleConditionalBreakpointError(breakpoint, thread);
  }
}
 
Example #9
Source File: SkylarkDebugProcess.java    From intellij with Apache License 2.0 6 votes vote down vote up
private void notifyThreadPaused(PausedThreadState threadState, boolean alwaysNotify) {
  pausedThreads.put(threadState.thread.getId(), threadState);
  XLineBreakpoint<XBreakpointProperties> breakpoint =
      lineBreakpoints.get(
          threadState.thread.getLocation().toBuilder().setColumnNumber(0).build());

  boolean isSuspended = getSession().isSuspended();
  if (!alwaysNotify && isSuspended && breakpoint != null) {
    // don't notify for subsequent breakpoint hits when we're already suspended. Otherwise we can
    // get 100s of threads stopping at a single breakpoint, kicking off a listFrames for each
    return;
  }

  SkylarkSuspendContext suspendContext = new SkylarkSuspendContext(this, threadState);
  if (breakpoint != null) {
    getSession().breakpointReached(breakpoint, null, suspendContext);
  } else if (alwaysNotify
      || threadState.thread.getId() == currentlySteppingThreadId
      || !isSuspended
      || individualThreadPausedByUser(threadState.thread.getPauseReason())) {
    getSession().positionReached(suspendContext);
  }
}
 
Example #10
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void vmBreakpointAdded(@NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint,
                              @NotNull final String isolateId,
                              @NotNull final Breakpoint vmBreakpoint) {
  myVmBreakpointIdToXBreakpointMap.put(vmBreakpoint.getId(), xBreakpoint);

  final IsolateBreakpointInfo info = getIsolateInfo(isolateId);
  info.vmBreakpointAdded(xBreakpoint, vmBreakpoint);

  if (vmBreakpoint.getResolved()) {
    breakpointResolved(vmBreakpoint);
  }
}
 
Example #11
Source File: XQueryBreakpointType.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project) {
    final XSourcePosition position = breakpoint.getSourcePosition();
    if (position == null) {
        return null;
    }
    final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
    if (file == null) {
        return null;
    }
    return new XQueryEditorsProvider();
}
 
Example #12
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void unregisterBreakpoint(@NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint, boolean temporary) {
  myXBreakpoints.remove(xBreakpoint);

  for (IsolateBreakpointInfo info : myIsolateInfo.values()) {
    info.unregisterBreakpoint(xBreakpoint);
  }
}
 
Example #13
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void registerBreakpoint(@NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint) {
  myXBreakpoints.add(xBreakpoint);

  final VmServiceWrapper vmServiceWrapper = myDebugProcess.getVmServiceWrapper();
  if (vmServiceWrapper != null) {
    vmServiceWrapper.addBreakpointForIsolates(xBreakpoint, myDebugProcess.getIsolateInfos());
  }
}
 
Example #14
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void registerBreakpoint(@NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint) {
  myXBreakpoints.add(xBreakpoint);

  final VmServiceWrapper vmServiceWrapper = myDebugProcess.getVmServiceWrapper();
  if (vmServiceWrapper != null) {
    vmServiceWrapper.addBreakpointForIsolates(xBreakpoint, myDebugProcess.getIsolateInfos());
  }
}
 
Example #15
Source File: MuleBreakpointHandler.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void registerBreakpoint(@NotNull XLineBreakpoint<XBreakpointProperties> xBreakpoint)
{
    //TODO Here get map from the debuggerManager and pass to the toMuleBreakpoint
    final Breakpoint breakpoint = MuleConfigUtils.toMuleBreakpoint(debuggerManager.getProject(), xBreakpoint, modulesToAppsMap);
    System.out.println("breakpoint added = " + breakpoint.getApplicationName() + "  , path  " + breakpoint.getPath());
    debuggerManager.addBreakpoint(breakpoint);
}
 
Example #16
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void vmBreakpointAdded(@NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint,
                              @NotNull final String isolateId,
                              @NotNull final Breakpoint vmBreakpoint) {
  myVmBreakpointIdToXBreakpointMap.put(vmBreakpoint.getId(), xBreakpoint);

  final IsolateBreakpointInfo info = getIsolateInfo(isolateId);
  info.vmBreakpointAdded(xBreakpoint, vmBreakpoint);

  if (vmBreakpoint.getResolved()) {
    breakpointResolved(vmBreakpoint);
  }
}
 
Example #17
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void unregisterBreakpoint(@NotNull final XLineBreakpoint<XBreakpointProperties> xBreakpoint, boolean temporary) {
  myXBreakpoints.remove(xBreakpoint);

  for (IsolateBreakpointInfo info : myIsolateInfo.values()) {
    info.unregisterBreakpoint(xBreakpoint);
  }
}
 
Example #18
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void unregisterBreakpoint(XLineBreakpoint<XBreakpointProperties> xBreakpoint) {
  if (myDebugProcess.isIsolateAlive(myIsolateId)) {
    for (String vmBreakpointId : getVmBreakpoints(xBreakpoint)) {
      myDebugProcess.getVmServiceWrapper().removeBreakpoint(myIsolateId, vmBreakpointId);
    }
  }

  myXBreakpointToVmBreakpointIdsMap.remove(xBreakpoint);
}
 
Example #19
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void breakpointResolved(@NotNull final Breakpoint vmBreakpoint) {
  final XLineBreakpoint<XBreakpointProperties> xBreakpoint = myVmBreakpointIdToXBreakpointMap.get(vmBreakpoint.getId());

  // This can be null when the breakpoint has been set by another debugger client.
  if (xBreakpoint != null) {
    myDebugProcess.getSession().updateBreakpointPresentation(xBreakpoint, null, null);
  }
}
 
Example #20
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void breakpointResolved(@NotNull final Breakpoint vmBreakpoint) {
  final XLineBreakpoint<XBreakpointProperties> xBreakpoint = myVmBreakpointIdToXBreakpointMap.get(vmBreakpoint.getId());

  // This can be null when the breakpoint has been set by another debugger client.
  if (xBreakpoint != null) {
    myDebugProcess.getSession().updateBreakpointPresentation(xBreakpoint, null, null);
  }
}
 
Example #21
Source File: DartVmServiceBreakpointHandler.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void unregisterBreakpoint(XLineBreakpoint<XBreakpointProperties> xBreakpoint) {
  if (myDebugProcess.isIsolateAlive(myIsolateId)) {
    for (String vmBreakpointId : getVmBreakpoints(xBreakpoint)) {
      myDebugProcess.getVmServiceWrapper().removeBreakpoint(myIsolateId, vmBreakpointId);
    }
  }

  myXBreakpointToVmBreakpointIdsMap.remove(xBreakpoint);
}
 
Example #22
Source File: SkylarkDebugProcess.java    From intellij with Apache License 2.0 5 votes vote down vote up
private static StarlarkDebuggingProtos.Breakpoint getBreakpointProto(
    Location location, XLineBreakpoint<XBreakpointProperties> breakpoint) {
  StarlarkDebuggingProtos.Breakpoint.Builder builder =
      StarlarkDebuggingProtos.Breakpoint.newBuilder().setLocation(location);
  String condition = getConditionExpression(breakpoint);
  if (condition != null) {
    builder.setExpression(condition);
  }
  return builder.build();
}
 
Example #23
Source File: SkylarkDebugProcess.java    From intellij with Apache License 2.0 5 votes vote down vote up
private Location convertLocation(XLineBreakpoint<XBreakpointProperties> breakpoint) {
  // TODO(brendandouglas): handle local changes?
  return Location.newBuilder()
      .setLineNumber(breakpoint.getLine() + 1)
      .setPath(breakpoint.getPresentableFilePath())
      .build();
}
 
Example #24
Source File: SkylarkDebugProcess.java    From intellij with Apache License 2.0 5 votes vote down vote up
private void handleConditionalBreakpointError(
    XLineBreakpoint<XBreakpointProperties> breakpoint, PausedThread thread) {
  // TODO(brendandouglas): also navigate to the problematic breakpoint
  String error = Preconditions.checkNotNull(thread.getConditionalBreakpointError().getMessage());
  String title = "Breakpoint Condition Error";
  String message =
      String.format(
          "Breakpoint: %s\nError: %s\nWould you like to stop at the breakpoint?",
          breakpoint.getType().getDisplayText(breakpoint), error);
  Ref<Boolean> stop = new Ref<>(true);
  ApplicationManager.getApplication()
      .invokeAndWait(
          () ->
              stop.set(
                  Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon())
                      == Messages.YES));
  if (stop.get()) {
    notifyThreadPaused(thread);
    return;
  }
  // else resume the thread
  transport.sendRequest(
      DebugRequest.newBuilder()
          .setContinueExecution(
              ContinueExecutionRequest.newBuilder()
                  .setThreadId(thread.getId())
                  .setStepping(Stepping.NONE)
                  .build()));
}
 
Example #25
Source File: HaxeBreakpointType.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@Override
public List<XBreakpointGroupingRule<XLineBreakpoint<XBreakpointProperties>, ?>> getGroupingRules() {
  XBreakpointGroupingRule<XLineBreakpoint<XBreakpointProperties>, ?> byFile = XDebuggerUtil.getInstance().getGroupingByFileRule();
  List<XBreakpointGroupingRule<XLineBreakpoint<XBreakpointProperties>, ?>> rules =
    new ArrayList<XBreakpointGroupingRule<XLineBreakpoint<XBreakpointProperties>, ?>>();
  rules.add(byFile);
  return rules;
}
 
Example #26
Source File: XQueryBreakpointHandler.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
@Override
public void registerBreakpoint(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint) {
    final XSourcePosition sourcePosition = breakpoint.getSourcePosition();
    if (isSourcePositionInvalid(sourcePosition)) return;

    final int lineNumber = getActualLineNumber(breakpoint.getLine());
    if (handleInvalidLine(breakpoint, lineNumber)) return;
    debugProcess.setBreakpoint(getFileUrl(sourcePosition), lineNumber, breakpoint.getConditionExpression());
}
 
Example #27
Source File: XQueryBreakpointHandler.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
@Override
public void unregisterBreakpoint(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, boolean temporary) {
    final XSourcePosition sourcePosition = breakpoint.getSourcePosition();
    if (isSourcePositionInvalid(sourcePosition)) return;

    final int lineNumber = getActualLineNumber(breakpoint.getLine());
    if (handleInvalidLine(breakpoint, lineNumber)) return;
    debugProcess.removeBreakpoint(getFileUrl(sourcePosition), lineNumber);
}
 
Example #28
Source File: XQueryBreakpointHandler.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private boolean handleInvalidLine(XLineBreakpoint<XBreakpointProperties> breakpoint, int lineNumber) {
    if (lineNumber == -1) {
        final XDebugSession session = debugProcess.getSession();
        session.updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint,
                "Unsupported breakpoint position");
        return true;
    }
    return false;
}
 
Example #29
Source File: MuleBreakpointHandler.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void unregisterBreakpoint(@NotNull XLineBreakpoint<XBreakpointProperties> xBreakpoint, boolean temporary)
{
    final Breakpoint breakpoint = MuleConfigUtils.toMuleBreakpoint(debuggerManager.getProject(), xBreakpoint, modulesToAppsMap);
    System.out.println("breakpoint removed = " + breakpoint.getApplicationName() + "  , path  " + breakpoint.getPath());
    debuggerManager.removeBreakpoint(breakpoint);
}
 
Example #30
Source File: WeaveBreakpointHandler.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
@Nullable
private String getExpression(@NotNull XLineBreakpoint<XBreakpointProperties> lineBreakpoint)
{
    final XExpression conditionExpression = lineBreakpoint.getConditionExpression();
    return conditionExpression != null ? conditionExpression.getExpression() : null;
}