]> granicus.if.org Git - python/commitdiff
Set breakpoints on remote debugger
authorChui Tey <chui.tey@advdata.com.au>
Mon, 4 Nov 2002 23:39:45 +0000 (23:39 +0000)
committerChui Tey <chui.tey@advdata.com.au>
Mon, 4 Nov 2002 23:39:45 +0000 (23:39 +0000)
Lib/idlelib/Debugger.py
Lib/idlelib/PyShell.py

index 27e8c2b56c52cdef075b947ea65982e7e615ab28..a0b54a36a0142866c09aec4b57acb3d850b6a53a 100644 (file)
@@ -330,7 +330,7 @@ class Debugger:
         for editwin in pyshell_edit_windows:
             filename = editwin.io.filename
             try:
-                for lineno in editwin.breakpoints:
+                for lineno in editwin.get_current_breaks():
                     self.set_breakpoint_here(filename, lineno)
             except AttributeError:
                 continue
index 2b77ee30759909b445a6550718b92acd4fb40291..ffd8767fb5657922aade32bc0dd8b04d52dc122c 100644 (file)
@@ -84,7 +84,7 @@ class PyShellEditorWindow(EditorWindow):
 
         # whenever a file is changed, restore breakpoints
         if self.io.filename: self.restore_file_breaks()
-        def filename_changed_hook(self,old_hook=self.io.filename_change_hook):
+        def filename_changed_hook(old_hook=self.io.filename_change_hook,self=self):
             self.restore_file_breaks()
             old_hook()
         self.io.set_filename_change_hook(filename_changed_hook)
@@ -161,18 +161,19 @@ class PyShellEditorWindow(EditorWindow):
         for line in lines:
             if not line.startswith(filename+"="):
                 new_file.write(line)
-        new_file.write(filename+"="+`self.get_current_breaks()`)
+        new_file.write(filename+"="+`self.get_current_breaks()`+"\n")
         new_file.close()
 
     def restore_file_breaks(self):
         self.text.update()   # this enables setting "BREAK" tags to be visible
         filename=self.io.filename
-        lines=open(self.breakpointPath,"r").readlines()
-        for line in lines:
-            if line.startswith(filename+"="):
-                breakpoint_linenumbers=eval(line[len(filename)+1:]) 
-                for breakpoint_linenumber in breakpoint_linenumbers:
-                    self.set_breakpoint(breakpoint_linenumber)
+        if os.path.isfile(self.breakpointPath):
+            lines=open(self.breakpointPath,"r").readlines()
+            for line in lines:
+                if line.startswith(filename+"="):
+                    breakpoint_linenumbers=eval(line[len(filename)+1:]) 
+                    for breakpoint_linenumber in breakpoint_linenumbers:
+                        self.set_breakpoint(breakpoint_linenumber)
 
     def get_current_breaks(self):
         #