コード例 #1
0
  protected static DbgpBreakpointConfig createBreakpointConfig(IScriptBreakpoint breakpoint)
      throws CoreException {
    // Enabled
    boolean enabled = breakpoint.isEnabled() && getBreakpointManager().isEnabled();

    DbgpBreakpointConfig config = new DbgpBreakpointConfig(enabled);

    // Hit value
    config.setHitValue(breakpoint.getHitValue());

    // Hit condition
    config.setHitCondition(breakpoint.getHitCondition());

    // Expression
    if (breakpoint.getExpressionState()) {
      config.setExpression(breakpoint.getExpression());
    }

    if (breakpoint instanceof IScriptLineBreakpoint
        && !(breakpoint instanceof IScriptMethodEntryBreakpoint)) {
      IScriptLineBreakpoint lineBreakpoint = (IScriptLineBreakpoint) breakpoint;
      config.setLineNo(lineBreakpoint.getLineNumber());
    }
    return config;
  }
コード例 #2
0
  // Adding, removing, updating
  protected void addBreakpoint(final IDbgpSession session, IScriptBreakpoint breakpoint)
      throws CoreException, DbgpException {
    if (!target.supportsBreakpoint(breakpoint)) return;
    final IDbgpCoreCommands commands = session.getCoreCommands();
    DbgpBreakpointConfig config = createBreakpointConfig(breakpoint);

    String id = null;
    URI bpUri = null;

    // map the outgoing uri if we're a line breakpoint
    if (breakpoint instanceof IScriptLineBreakpoint) {
      IScriptLineBreakpoint bp = (IScriptLineBreakpoint) breakpoint;
      bpUri = bpPathMapper.map(bp.getResourceURI());
    }

    // Type specific
    if (breakpoint instanceof IScriptWatchpoint) {
      IScriptWatchpoint watchpoint = (IScriptWatchpoint) breakpoint;
      config.setExpression(makeWatchpointExpression(watchpoint));
      config.setLineNo(watchpoint.getLineNumber());
      if (bpLineMapper != null) {
        bpLineMapper.toDebuggerBreakpoint(bpUri, config.getLineNo(), config);
      }
      id = commands.setWatchBreakpoint(bpUri, config.getLineNo(), config);
    } else if (breakpoint instanceof IScriptMethodEntryBreakpoint) {
      IScriptMethodEntryBreakpoint entryBreakpoint = (IScriptMethodEntryBreakpoint) breakpoint;

      if (entryBreakpoint.breakOnExit()) {
        final String exitId =
            commands.setReturnBreakpoint(bpUri, entryBreakpoint.getMethodName(), config);

        entryBreakpoint.setExitBreakpointId(exitId);
      }

      if (entryBreakpoint.breakOnEntry()) {
        final String entryId =
            commands.setCallBreakpoint(bpUri, entryBreakpoint.getMethodName(), config);

        entryBreakpoint.setEntryBreakpointId(entryId);
      }
    } else if (breakpoint instanceof IScriptLineBreakpoint) {
      IScriptLineBreakpoint lineBreakpoint = (IScriptLineBreakpoint) breakpoint;

      config.setLineNo(lineBreakpoint.getLineNumber());

      if (bpLineMapper != null) {
        bpLineMapper.toDebuggerBreakpoint(bpUri, config.getLineNo(), config);
      }

      if (ScriptBreakpointUtils.isConditional(lineBreakpoint)) {
        id = commands.setConditionalBreakpoint(bpUri, config.getLineNo(), config);
      } else {
        id = commands.setLineBreakpoint(bpUri, config.getLineNo(), config);
      }
    } else if (breakpoint instanceof IScriptExceptionBreakpoint) {
      IScriptExceptionBreakpoint lineBreakpoint = (IScriptExceptionBreakpoint) breakpoint;
      id = commands.setExceptionBreakpoint(lineBreakpoint.getTypeName(), config);
    }

    // Identifier
    breakpoint.setId(session, id);
  }