summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/Debugger.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2002-10-23 04:48:08 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2002-10-23 04:48:08 (GMT)
commit45186c4ce08093d5f0d2f141f6e557e9726aedb4 (patch)
treec0372b3d6da9fd10493365df9f589d9b7e9996c5 /Lib/idlelib/Debugger.py
parent88f015dc8890960108e98a3114213ab258fda0c9 (diff)
downloadcpython-45186c4ce08093d5f0d2f141f6e557e9726aedb4.zip
cpython-45186c4ce08093d5f0d2f141f6e557e9726aedb4.tar.gz
cpython-45186c4ce08093d5f0d2f141f6e557e9726aedb4.tar.bz2
Implement Restoring Breakpoints in Subprocess Debugger
M Debugger.py M EditorWindow.py M PyShell.py 0. Polish PyShell.linecache_checkcache() 1. Move break clearing code to PyShell.PyShellEditorWindow from EditorWindow. 2. Add PyShellEditorWindow.breakpoints attribute to __init__, a list of line numbers which are breakpoints for that edit window. 3. Remove the code in Debugger which removes all module breakpoints when debugger is closed. Want to be able to reload into debugger when restarted. 4. Moved the code which sets EditorWindow.text breakpoints from Debugger to PyShell.PyShellEditorWindow and refactored. 5. Implement reloading subprocess debugger with breakpoints from all open PyShellEditorWindows when debugger is opened or subprocess restarted. 6. Eliminate the break_set attribute, use the breakpoint list instead.
Diffstat (limited to 'Lib/idlelib/Debugger.py')
-rw-r--r--Lib/idlelib/Debugger.py47
1 files changed, 14 insertions, 33 deletions
diff --git a/Lib/idlelib/Debugger.py b/Lib/idlelib/Debugger.py
index 0419623..27e8c2b 100644
--- a/Lib/idlelib/Debugger.py
+++ b/Lib/idlelib/Debugger.py
@@ -77,11 +77,6 @@ class Debugger:
return
if self.stackviewer:
self.stackviewer.close(); self.stackviewer = None
- # Remove all EditWindow BREAK tags when closing debugger:
- edit_windows = self.pyshell.flist.inversedict.keys()
- for window in edit_windows:
- window.text.tag_remove("BREAK", 1.0, END)
- window.break_set = False
# Clean up pyshell if user clicked debugger control close widget.
# (Causes a harmless extra cycle through close_debugger() if user
# toggled debugger from pyshell Debug menu)
@@ -311,48 +306,34 @@ class Debugger:
if gv:
gv.load_dict(gdict, force, self.pyshell.interp.rpcclt)
- def set_breakpoint_here(self, edit):
- text = edit.text
- filename = edit.io.filename
- if not filename:
- text.bell()
- return
- lineno = int(float(text.index("insert")))
+ def set_breakpoint_here(self, filename, lineno):
msg = self.idb.set_break(filename, lineno)
if msg:
text.bell()
return
- text.tag_add("BREAK", "insert linestart", "insert lineend +1char")
- edit.break_set = True
- def clear_breakpoint_here(self, edit):
- text = edit.text
- filename = edit.io.filename
- if not filename:
- text.bell()
- return
- lineno = int(float(text.index("insert")))
+ def clear_breakpoint_here(self, filename, lineno):
msg = self.idb.clear_break(filename, lineno)
if msg:
text.bell()
return
- text.tag_remove("BREAK", "insert linestart",\
- "insert lineend +1char")
- # Don't bother to track break_set status
-
- def clear_file_breaks(self, edit):
- text = edit.text
- filename = edit.io.filename
- if not filename:
- text.bell()
- return
+
+ def clear_file_breaks(self, filename):
msg = self.idb.clear_all_file_breaks(filename)
if msg:
text.bell()
return
- text.tag_remove("BREAK", "1.0", END)
- edit.break_set = False
+ def load_breakpoints(self):
+ "Load PyShellEditorWindow breakpoints into subprocess debugger"
+ pyshell_edit_windows = self.pyshell.flist.inversedict.keys()
+ for editwin in pyshell_edit_windows:
+ filename = editwin.io.filename
+ try:
+ for lineno in editwin.breakpoints:
+ self.set_breakpoint_here(filename, lineno)
+ except AttributeError:
+ continue
class StackViewer(ScrolledList):