[Pydev-cvs] org.python.pydev.debug/src/org/python/pydev/debug/model AbstractDebugTarget.java, 1.14,
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-05-09 22:00:53
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31028/src/org/python/pydev/debug/model Modified Files: AbstractDebugTarget.java Log Message: Disable all breakpoints is working. patch from Oldrich Jedlicka: http://sourceforge.net/tracker/index.php?func=detail&aid=1960983&group_id=85796&atid=577329 Index: AbstractDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/AbstractDebugTarget.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AbstractDebugTarget.java 10 Apr 2008 16:16:00 -0000 1.14 --- AbstractDebugTarget.java 9 May 2008 22:00:58 -0000 1.15 *************** *** 47,58 **** --- 47,87 ---- import org.python.pydev.debug.model.remote.ThreadListCommand; import org.python.pydev.debug.model.remote.VersionCommand; + import org.python.pydev.plugin.PydevPlugin; + /** + * This is the target for the debug ( + * + * @author Fabio + */ public abstract class AbstractDebugTarget extends PlatformObject implements IDebugTarget, ILaunchListener { + /** + * Path pointing to the file that started the debug (e.g.: file with __name__ == '__main__') + */ protected IPath file; + + /** + * The threads found in the debugger. + */ protected PyThread[] threads; + + /** + * Indicates whether we've already disconnected from the debugger. + */ protected boolean disconnected = false; + + /** + * This is the instance used to pass messages to the debugger. + */ protected AbstractRemoteDebugger debugger; + + /** + * Launch that triggered the debug session. + */ protected ILaunch launch; + + /** + * Class used to check for modifications in the values already found. + */ private ValueModificationChecker modificationChecker; *************** *** 154,173 **** //Breakpoints ------------------------------------------------------------------------------------------------------ public boolean supportsBreakpoint(IBreakpoint breakpoint) { return breakpoint instanceof PyBreakpoint; } public void breakpointAdded(IBreakpoint breakpoint) { try { ! if (breakpoint instanceof PyBreakpoint && ((PyBreakpoint)breakpoint).isEnabled()) { PyBreakpoint b = (PyBreakpoint)breakpoint; ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, b.getFile(), b.getLine(), b.getCondition(), b.getFunctionName()); ! debugger.postCommand(cmd); } } catch (CoreException e) { ! e.printStackTrace(); } } public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { if (breakpoint instanceof PyBreakpoint) { --- 183,222 ---- //Breakpoints ------------------------------------------------------------------------------------------------------ + /** + * @return true if the given breakpoint is supported by this target + */ public boolean supportsBreakpoint(IBreakpoint breakpoint) { return breakpoint instanceof PyBreakpoint; } + /** + * @return true if all the breakpoints should be skipped. Patch from bug: + * http://sourceforge.net/tracker/index.php?func=detail&aid=1960983&group_id=85796&atid=577329 + */ + private boolean shouldSkipBreakpoints() { + DebugPlugin manager= DebugPlugin.getDefault(); + return manager != null && !manager.getBreakpointManager().isEnabled(); + } + + /** + * Adds a breakpoint if it's enabled. + */ public void breakpointAdded(IBreakpoint breakpoint) { try { ! if (breakpoint instanceof PyBreakpoint) { PyBreakpoint b = (PyBreakpoint)breakpoint; ! if (b.isEnabled() && !shouldSkipBreakpoints()) { ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, b.getFile(), b.getLine(), b.getCondition(), b.getFunctionName()); ! debugger.postCommand(cmd); ! } } } catch (CoreException e) { ! PydevPlugin.log(e); } } + /** + * Removes an existing breakpoint from the debug target. + */ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { if (breakpoint instanceof PyBreakpoint) { *************** *** 178,181 **** --- 227,237 ---- } + /** + * Called when a breakpoint is changed. + * E.g.: + * - When line numbers change in the file + * - When the manager decides to enable/disable all existing markers + * - When the breakpoint properties (hit condition) are edited + */ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { if (breakpoint instanceof PyBreakpoint) { *************** *** 184,187 **** --- 240,245 ---- } } + + //End Breakpoints -------------------------------------------------------------------------------------------------- *************** *** 447,463 **** for (IMarker marker : markers) { PyBreakpoint brk = (PyBreakpoint) breakpointManager.getBreakpoint(marker); ! ! if (brk.isEnabled()) { ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, brk.getFile(), brk.getLine(), brk.getCondition(), brk.getFunctionName()); ! debugger.postCommand(cmd); ! } } for (IMarker marker: condMarkers) { PyBreakpoint brk = (PyBreakpoint) breakpointManager.getBreakpoint(marker); ! if (brk.isEnabled()) { ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, brk.getFile(), brk.getLine(), brk.getCondition(), brk.getFunctionName()); ! debugger.postCommand(cmd); ! } } } catch (Throwable t) { --- 505,514 ---- for (IMarker marker : markers) { PyBreakpoint brk = (PyBreakpoint) breakpointManager.getBreakpoint(marker); ! breakpointAdded(brk); } for (IMarker marker: condMarkers) { PyBreakpoint brk = (PyBreakpoint) breakpointManager.getBreakpoint(marker); ! breakpointAdded(brk); } } catch (Throwable t) { |