protected static void removeBreakpoint(IDbgpSession session, IScriptBreakpoint breakpoint) throws DbgpException, CoreException { final IDbgpBreakpointCommands commands = session.getCoreCommands(); final String id = breakpoint.removeId(session); if (id != null) { commands.removeBreakpoint(id); } if (breakpoint instanceof IScriptMethodEntryBreakpoint) { IScriptMethodEntryBreakpoint entryBreakpoint = (IScriptMethodEntryBreakpoint) breakpoint; final String entryId = entryBreakpoint.getEntryBreakpointId(); if (entryId != null) { commands.removeBreakpoint(entryId); } final String exitId = entryBreakpoint.getExitBreakpointId(); if (exitId != null) { commands.removeBreakpoint(exitId); } } }
protected void changeBreakpoint(final IDbgpSession session, IScriptBreakpoint breakpoint) throws DbgpException, CoreException { if (!target.supportsBreakpoint(breakpoint)) return; final IDbgpBreakpointCommands commands = session.getCoreCommands(); 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()); } if (breakpoint instanceof IScriptMethodEntryBreakpoint) { DbgpBreakpointConfig config = createBreakpointConfig(breakpoint); IScriptMethodEntryBreakpoint entryBreakpoint = (IScriptMethodEntryBreakpoint) breakpoint; String entryId = entryBreakpoint.getEntryBreakpointId(); if (entryBreakpoint.breakOnEntry()) { if (entryId == null) { // Create entry breakpoint entryId = commands.setCallBreakpoint(bpUri, entryBreakpoint.getMethodName(), config); entryBreakpoint.setEntryBreakpointId(entryId); } else { // Update entry breakpoint commands.updateBreakpoint(entryId, config); } } else { if (entryId != null) { // Remove existing entry breakpoint commands.removeBreakpoint(entryId); entryBreakpoint.setEntryBreakpointId(null); } } String exitId = entryBreakpoint.getExitBreakpointId(); if (entryBreakpoint.breakOnExit()) { if (exitId == null) { // Create exit breakpoint exitId = commands.setReturnBreakpoint(bpUri, entryBreakpoint.getMethodName(), config); entryBreakpoint.setExitBreakpointId(exitId); } else { // Update exit breakpoint commands.updateBreakpoint(exitId, config); } } else { if (exitId != null) { // Remove exit breakpoint commands.removeBreakpoint(exitId); entryBreakpoint.setExitBreakpointId(null); } } } else { // All other breakpoints final String id = breakpoint.getId(session); if (id != null) { final DbgpBreakpointConfig config = createBreakpointConfig(breakpoint); if (breakpoint instanceof IScriptWatchpoint) { config.setExpression(makeWatchpointExpression((IScriptWatchpoint) breakpoint)); } commands.updateBreakpoint(id, config); } } }