com.intellij.xdebugger.breakpoints.XLineBreakpoint Java Examples

The following examples show how to use com.intellij.xdebugger.breakpoints.XLineBreakpoint. 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: XDependentBreakpointsTest.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void testSerialize() throws Exception {
  XLineBreakpoint<?> master = createMaster();
  XLineBreakpoint<?> slave = createSlave();
  myDependentBreakpointManager.setMasterBreakpoint(slave, master, true);

  Element element = save();
  myDependentBreakpointManager.clearMasterBreakpoint(slave);
  //System.out.println(JDOMUtil.writeElement(element, SystemProperties.getLineSeparator()));
  load(element);

  List<XBreakpoint<?>> breakpoints = getAllBreakpoints();
  assertEquals(3, breakpoints.size());
  assertEquals("default", ((MyBreakpointProperties)breakpoints.get(0).getProperties()).myOption);
  XLineBreakpoint newMaster = (XLineBreakpoint)breakpoints.get(1);
  XLineBreakpoint newSlave = (XLineBreakpoint)breakpoints.get(2);
  assertEquals("file://master", newMaster.getFileUrl());
  assertEquals("file://slave", newSlave.getFileUrl());
  assertSame(newMaster, myDependentBreakpointManager.getMasterBreakpoint(newSlave));
  assertTrue(myDependentBreakpointManager.isLeaveEnabled(newSlave));
}
 
Example #2
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 #3
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 #4
Source File: XBreakpointFileGroupingRule.java    From consulo with Apache License 2.0 6 votes vote down vote up
public XBreakpointFileGroup getGroup(@Nonnull final B breakpoint, @Nonnull final Collection<XBreakpointFileGroup> groups) {
  if (!(breakpoint instanceof XLineBreakpoint)) {
    return null;
  }
  XSourcePosition position = ((XLineBreakpoint)breakpoint).getSourcePosition();

  if (position == null) return null;

  VirtualFile file = position.getFile();
  for (XBreakpointFileGroup group : groups) {
    if (group.getFile().equals(file)) {
      return group;
    }
  }

  return new XBreakpointFileGroup(file);
}
 
Example #5
Source File: XBreakpointActionsPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void init(Project project, XBreakpointManager breakpointManager, @Nonnull XBreakpointBase breakpoint, @Nullable XDebuggerEditorsProvider debuggerEditorsProvider) {
  init(project, breakpointManager, breakpoint);
  if (debuggerEditorsProvider != null) {
    ActionListener listener = new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        onCheckboxChanged();
      }
    };
    myLogExpressionComboBox = new XDebuggerExpressionComboBox(project, debuggerEditorsProvider, LOG_EXPRESSION_HISTORY_ID, myBreakpoint.getSourcePosition(), true);
    JComponent logExpressionComponent = myLogExpressionComboBox.getComponent();
    myLogExpressionPanel.add(logExpressionComponent, BorderLayout.CENTER);
    myLogExpressionComboBox.setEnabled(false);
    myTemporaryCheckBox.setVisible(breakpoint instanceof XLineBreakpoint);
    myLogExpressionCheckBox.addActionListener(listener);
    DebuggerUIUtil.focusEditorOnCheck(myLogExpressionCheckBox, myLogExpressionComboBox.getEditorComponent());
  }
  else {
    myExpressionPanel.getParent().remove(myExpressionPanel);
  }
}
 
Example #6
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 #7
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 #8
Source File: XBreakpointActionsPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
void saveProperties() {
  myBreakpoint.setLogMessage(myLogMessageCheckBox.isSelected());

  if (myBreakpoint instanceof XLineBreakpoint) {
    ((XLineBreakpoint)myBreakpoint).setTemporary(myTemporaryCheckBox.isSelected());
  }

  if (myLogExpressionComboBox != null) {
    XExpression expression = myLogExpressionComboBox.getExpression();
    XExpression logExpression = !XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null;
    myBreakpoint.setLogExpressionEnabled(logExpression == null || myLogExpressionCheckBox.isSelected());
    myBreakpoint.setLogExpressionObject(logExpression);
    myLogExpressionComboBox.saveTextInHistory();
  }
}
 
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: XBreakpointManagerTest.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void testAddRemove() {
  XLineBreakpoint<MyBreakpointProperties> lineBreakpoint =
    myBreakpointManager.addLineBreakpoint(MY_LINE_BREAKPOINT_TYPE, "url", 239, new MyBreakpointProperties("123"));

  XBreakpoint<MyBreakpointProperties> breakpoint = myBreakpointManager.addBreakpoint(MY_SIMPLE_BREAKPOINT_TYPE, new MyBreakpointProperties("abc"));

  assertSameElements(getAllBreakpoints(), breakpoint, lineBreakpoint);
  assertSame(lineBreakpoint, assertOneElement(myBreakpointManager.getBreakpoints(MY_LINE_BREAKPOINT_TYPE)));
  assertSame(breakpoint, getSingleBreakpoint());

  myBreakpointManager.removeBreakpoint(lineBreakpoint);
  assertSame(breakpoint, assertOneElement(getAllBreakpoints()));
  assertTrue(myBreakpointManager.getBreakpoints(MY_LINE_BREAKPOINT_TYPE).isEmpty());
  assertSame(breakpoint, getSingleBreakpoint());

  myBreakpointManager.removeBreakpoint(breakpoint);
  assertEmpty(getAllBreakpoints());
  assertTrue(myBreakpointManager.getBreakpoints(MY_SIMPLE_BREAKPOINT_TYPE).isEmpty());
}
 
Example #11
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 #12
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 #13
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 #14
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 #15
Source File: UpdateBreakpointsAfterRenameTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void testRenameFile() throws Exception {
  final VirtualFile file = createFile("file.txt");
  XLineBreakpoint<?> b = putBreakpoint(file);
  file.rename(this, "file2.txt");
  assertTrue(b.getFileUrl().endsWith("file2.txt"));
  assertSame(b, getBreakpointManager().findBreakpointAtLine(XDebuggerTestCase.MY_LINE_BREAKPOINT_TYPE, file, 0));
}
 
Example #16
Source File: XBreakpointManagerTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void testSerialize() {
  XLineBreakpoint<MyBreakpointProperties> breakpoint =
    myBreakpointManager.addLineBreakpoint(MY_LINE_BREAKPOINT_TYPE, "myurl", 239, new MyBreakpointProperties("z1"));
  breakpoint.setCondition("cond");
  breakpoint.setLogExpression("log");
  breakpoint.setSuspendPolicy(SuspendPolicy.NONE);
  breakpoint.setLogMessage(true);
  myBreakpointManager.addBreakpoint(MY_SIMPLE_BREAKPOINT_TYPE, new MyBreakpointProperties("z2"));

  reload();
  List<XBreakpoint<?>> breakpoints = getAllBreakpoints();
  assertEquals("Expected 3 breakpoints, actual: " + breakpoints, 3, breakpoints.size());

  assertTrue(myBreakpointManager.isDefaultBreakpoint(breakpoints.get(0)));
  assertEquals("default", assertInstanceOf(breakpoints.get(0).getProperties(), MyBreakpointProperties.class).myOption);
  assertTrue(breakpoints.get(0).isEnabled());

  XLineBreakpoint lineBreakpoint = assertInstanceOf(breakpoints.get(1), XLineBreakpoint.class);
  assertEquals(239, lineBreakpoint.getLine());
  assertEquals("myurl", lineBreakpoint.getFileUrl());
  assertEquals("z1", assertInstanceOf(lineBreakpoint.getProperties(), MyBreakpointProperties.class).myOption);
  assertEquals("cond", lineBreakpoint.getCondition());
  assertEquals("log", lineBreakpoint.getLogExpression());
  assertTrue(lineBreakpoint.isLogMessage());
  assertEquals(SuspendPolicy.NONE, lineBreakpoint.getSuspendPolicy());

  assertEquals("z2", assertInstanceOf(breakpoints.get(2).getProperties(), MyBreakpointProperties.class).myOption);
  assertEquals(SuspendPolicy.ALL, breakpoints.get(2).getSuspendPolicy());
  assertFalse(breakpoints.get(2).isLogMessage());
}
 
Example #17
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 #18
Source File: XDependentBreakpointsTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void testDelete() throws Exception {
  XLineBreakpoint<?> master = createMaster();
  XLineBreakpoint<?> slave = createSlave();
  myDependentBreakpointManager.setMasterBreakpoint(slave, master, true);
  assertSame(master, myDependentBreakpointManager.getMasterBreakpoint(slave));
  assertTrue(myDependentBreakpointManager.isLeaveEnabled(slave));
  assertSame(slave, assertOneElement(myDependentBreakpointManager.getSlaveBreakpoints(master)));
  assertSame(slave, assertOneElement(myDependentBreakpointManager.getAllSlaveBreakpoints()));
  
  myBreakpointManager.removeBreakpoint(master);
  assertNull(myDependentBreakpointManager.getMasterBreakpoint(slave));
  assertEmpty(myDependentBreakpointManager.getAllSlaveBreakpoints());
}
 
Example #19
Source File: CppBreakpointManager.java    From CppTools with Apache License 2.0 5 votes vote down vote up
public boolean processResponseLine(String token, CppDebuggerContext context) {
  final String prefix = BREAKPOINT_MARKER;

  if (token.startsWith(prefix)) {
    // Breakpoint 1 at 0x401308: file src/untitled.c, line 3.
    int atPos = token.indexOf(AT_MARKER, prefix.length());
    if (atPos == -1) atPos = Integer.MAX_VALUE;

    //Breakpoint 1, main (argc=1, argv=0x3d3fd8 "y$=") at src/untitled.c:3
    int commaPos = token.indexOf(", ", prefix.length());
    if (commaPos == -1) commaPos = Integer.MAX_VALUE;
    // Breakpoint 1 (untitled2.c:3) pending.
    int spacePos = token.indexOf(' ', prefix.length());
    if (spacePos == -1) spacePos = Integer.MAX_VALUE;
    final int index = Math.min(Math.min(atPos, commaPos), spacePos);
    int breakpointNumber = index != Integer.MAX_VALUE ? Integer.parseInt(token.substring(prefix.length(), index)):-1;

    XLineBreakpoint lineBreakpoint = getBreakpointByIndex(breakpointNumber);

    if (lineBreakpoint != null) {
      if (atPos == index) {
        context.getSession().updateBreakpointPresentation(lineBreakpoint, AllIcons.Debugger.Db_verified_breakpoint, null);
      } else if (commaPos == index) {
        context.getSession().breakpointReached(
          lineBreakpoint,
          new CppSuspendContext(
            new CppStackFrame(token.substring(index + 2, atPos != Integer.MAX_VALUE ? atPos:token.length()), lineBreakpoint.getSourcePosition(), context, 0),
            context
          )
        );
      }
    }

    return true;
  }
  return false;
}
 
Example #20
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 #21
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 #22
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 #23
Source File: UpdateBreakpointsAfterRenameTest.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void testMoveFile() throws Exception {
  final VirtualFile file = createFile("dir/a.txt");
  final VirtualFile targetDir = createFile("dir2/b.txt").getParent();
  final XLineBreakpoint<?> b = putBreakpoint(file);
  file.move(this, targetDir);
  assertTrue(b.getFileUrl().endsWith("dir2/a.txt"));
}
 
Example #24
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 #25
Source File: XBreakpointActionsPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
void loadProperties() {
  myLogMessageCheckBox.setSelected(myBreakpoint.isLogMessage());

  if (myBreakpoint instanceof XLineBreakpoint) {
    myTemporaryCheckBox.setSelected(((XLineBreakpoint)myBreakpoint).isTemporary());
  }

  if (myLogExpressionComboBox != null) {
    XExpression logExpression = myBreakpoint.getLogExpressionObjectInt();
    myLogExpressionComboBox.setExpression(logExpression);
    myLogExpressionCheckBox.setSelected(myBreakpoint.isLogExpressionEnabled() && logExpression != null);
  }
  onCheckboxChanged();
}
 
Example #26
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 #27
Source File: SkylarkLineBreakpointType.java    From intellij with Apache License 2.0 5 votes vote down vote up
/**
 * Tries to resolve a workspace-relative path, falling back to returning the full absolute path.
 */
private static String getPath(XLineBreakpoint<?> breakpoint) {
  String absolutePath = breakpoint.getPresentableFilePath();
  Project project = getProject(breakpoint);
  if (project == null) {
    return absolutePath;
  }
  WorkspacePathResolver pathResolver =
      WorkspacePathResolverProvider.getInstance(project).getPathResolver();
  if (pathResolver == null) {
    return absolutePath;
  }
  WorkspacePath path = pathResolver.getWorkspacePath(new File(absolutePath));
  return path != null ? path.relativePath() : absolutePath;
}
 
Example #28
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 #29
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 #30
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();
}