DebugClients/Python3/DebugClientBase.py

Wed, 31 Aug 2016 18:31:57 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 31 Aug 2016 18:31:57 +0200
branch
jsonrpc
changeset 5119
80bd41498eef
parent 5115
ed2f37c1f6b6
child 5120
c5189d404cc7
permissions
-rw-r--r--

Started with the modernization of the debugger interface.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
4631
5c1a96925da4 Updated copyright for 2016.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4604
diff changeset
3 # Copyright (c) 2009 - 2016 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a debug client base class.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import sys
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import socket
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 import select
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 import codeop
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import traceback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import time
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import imp
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import re
2371
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
19 import atexit
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
20 import signal
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
23 import DebugProtocol
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 import DebugClientCapabilities
723
49ef401db2ce Changed syntax check to allow to ignore a syntax warning by ending the source line with "__IGNORE_WARNING__" and modified a few files accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 692
diff changeset
25 from DebugBase import setRecursionLimit, printerr # __IGNORE_WARNING__
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
26 from AsyncFile import AsyncFile, AsyncPendingWrite
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 from DebugConfig import ConfigVarTypeStrings
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 from FlexCompleter import Completer
4455
ca13a6f6c452 Prepared the Python3 debug client for some obsolescences of the inspect.py module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4370
diff changeset
29 from DebugUtilities import getargvalues, formatargvalues
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 DebugClientInstance = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
34 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
36
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
37 def DebugClientInput(prompt="", echo=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 Replacement for the standard input builtin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 This function works with the split debugger.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
43 @param prompt prompt to be shown (string)
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
44 @param echo flag indicating to echo the output (boolean)
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
45 @return result of the input() call
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 if DebugClientInstance is None or not DebugClientInstance.redirect:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 return DebugClientOrigInput(prompt)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
96
9624a110667d Started to clean up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 72
diff changeset
50 return DebugClientInstance.input(prompt, echo)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 # Use our own input().
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 DebugClientOrigInput = __builtins__.__dict__['input']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 __builtins__.__dict__['input'] = DebugClientInput
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 except (AttributeError, KeyError):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 import __main__
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 DebugClientOrigInput = __main__.__builtins__.__dict__['input']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 __main__.__builtins__.__dict__['input'] = DebugClientInput
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
61 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
63
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 def DebugClientFork():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 Replacement for the standard os.fork().
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
67
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
68 @return result of the fork() call
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 if DebugClientInstance is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 return DebugClientOrigFork()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 return DebugClientInstance.fork()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 # use our own fork().
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 if 'fork' in dir(os):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 DebugClientOrigFork = os.fork
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 os.fork = DebugClientFork
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
80 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
82
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 def DebugClientClose(fd):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 Replacement for the standard os.close(fd).
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 @param fd open file descriptor to be closed (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 if DebugClientInstance is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 DebugClientOrigClose(fd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 DebugClientInstance.close(fd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 # use our own close().
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 if 'close' in dir(os):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 DebugClientOrigClose = os.close
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 os.close = DebugClientClose
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
99 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
101
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 def DebugClientSetRecursionLimit(limit):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 Replacement for the standard sys.setrecursionlimit(limit).
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 @param limit recursion limit (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 rl = max(limit, 64)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 setRecursionLimit(rl)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 DebugClientOrigSetRecursionLimit(rl + 64)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 # use our own setrecursionlimit().
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 if 'setrecursionlimit' in dir(sys):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 DebugClientOrigSetRecursionLimit = sys.setrecursionlimit
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 sys.setrecursionlimit = DebugClientSetRecursionLimit
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 DebugClientSetRecursionLimit(sys.getrecursionlimit())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
118 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
120
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 class DebugClientBase(object):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 Class implementing the client side of the debugger.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
125 It provides access to the Python interpeter from a debugger running in
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
126 another process whether or not the Qt event loop is running.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 The protocol between the debugger and the client assumes that there will be
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 a single source of debugger commands and a single source of Python
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 statements. Commands and statement are always exactly one line and may be
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 interspersed.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 The protocol is as follows. First the client opens a connection to the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 debugger and then sends a series of one line commands. A command is either
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
135 &gt;Load&lt;, &gt;Step&lt;, &gt;StepInto&lt;, ... or a Python statement.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 See DebugProtocol.py for a listing of valid protocol tokens.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 A Python statement consists of the statement to execute, followed (in a
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
139 separate line) by &gt;OK?&lt;. If the statement was incomplete then the
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
140 response is &gt;Continue&lt;. If there was an exception then the response
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
141 is &gt;Exception&lt;. Otherwise the response is &gt;OK&lt;. The reason
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
142 for the &gt;OK?&lt; part is to provide a sentinal (ie. the responding
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
143 &gt;OK&lt;) after any possible output as a result of executing the command.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 The client may send any other lines at any other time which should be
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 interpreted as program output.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 If the debugger closes the session there is no response from the client.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 The client may close the session at any time as a result of the script
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 being debugged closing or crashing.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
152 <b>Note</b>: This class is meant to be subclassed by individual
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
153 DebugClient classes. Do not instantiate it directly.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 clientCapabilities = DebugClientCapabilities.HasAll
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 def __init__(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 self.breakpoints = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 self.redirect = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 # The next couple of members are needed for the threaded version.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 # For this base class they contain static values for the non threaded
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 # debugger
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 # dictionary of all threads running
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 self.threads = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
171 # the "current" thread, basically the thread we are at a breakpoint
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
172 # for.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 self.currentThread = self
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 # special objects representing the main scripts thread and frame
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 self.mainThread = self
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 self.mainFrame = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 self.framenr = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 # The context to run the debugged program in.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 self.debugMod = imp.new_module('__main__')
3729
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
182 self.debugMod.__dict__['__builtins__'] = __builtins__
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 # The list of complete lines to execute.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 self.buffer = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 # The list of regexp objects to filter variables against
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 self.globalsFilterObjects = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 self.localsFilterObjects = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
191 self.pendingResponse = DebugProtocol.ResponseOK
1706
d0871e278075 Fixed an issue uncovered by the recent change to the DebugClientBase classes (only on Windows).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1607
diff changeset
192 self._fncache = {}
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 self.dircache = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 self.inRawMode = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 self.mainProcStr = None # used for the passive mode
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 self.passive = False # used to indicate the passive mode
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 self.running = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 self.test = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 self.tracePython = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 self.debugging = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 self.fork_auto = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 self.fork_child = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 self.readstream = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 self.writestream = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 self.errorstream = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 self.pollingDisabled = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209
2170
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
210 self.callTraceEnabled = False
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
211 self.__newCallTraceEnabled = False
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
212
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 self.skipdirs = sys.path[:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 self.variant = 'You should not see this'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 # commandline completion stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 self.complete = Completer(self.debugMod.__dict__).complete
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 self.compile_command = codeop.CommandCompiler()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
43
2fdc635b106a Reverted the last change to the Python3 debugger backend.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 42
diff changeset
222 self.coding_re = re.compile(r"coding[:=]\s*([-\w_.]+)")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 self.defaultCoding = 'utf-8'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 self.__coding = self.defaultCoding
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 self.noencoding = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 def getCoding(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 Public method to return the current coding.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 @return codec name (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 return self.__coding
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 def __setCoding(self, filename):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 Private method to set the coding used by a python file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 @param filename name of the file to inspect (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 if self.noencoding:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 self.__coding = sys.getdefaultencoding()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 default = 'utf-8'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 f = open(filename, 'rb')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 # read the first and second line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 text = f.readline()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 text = "{0}{1}".format(text, f.readline())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 f.close()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 except IOError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 self.__coding = default
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 for l in text.splitlines():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 m = self.coding_re.search(l)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 if m:
43
2fdc635b106a Reverted the last change to the Python3 debugger backend.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 42
diff changeset
258 self.__coding = m.group(1)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 self.__coding = default
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
262 def attachThread(self, target=None, args=None, kwargs=None,
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
263 mainThread=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 Public method to setup a thread for DebugClient to debug.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
267 If mainThread is non-zero, then we are attaching to the already
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 started mainthread of the app and the rest of the args are ignored.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
270 @param target the start function of the target thread (i.e. the
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
271 user code)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 @param args arguments to pass to target
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 @param kwargs keyword arguments to pass to target
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
274 @param mainThread True, if we are attaching to the already
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 started mainthread of the app
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 if self.debugging:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 sys.setprofile(self.profile)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 def __dumpThreadList(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
282 Private method to send the list of threads.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 threadList = []
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
285 if self.threads and self.currentThread:
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
286 # indication for the threaded debugger
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 currentId = self.currentThread.get_ident()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 for t in self.threads.values():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 d = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 d["id"] = t.get_ident()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 d["name"] = t.get_name()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 d["broken"] = t.isBroken()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 threadList.append(d)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 currentId = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 d = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 d["id"] = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 d["name"] = "MainThread"
4063
b7269498aa95 Fixed a serious issue handling 'non-error' exceptions in the debugger. This bug was about 10 years old.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
299 if hasattr(self, "isBroken"):
b7269498aa95 Fixed a serious issue handling 'non-error' exceptions in the debugger. This bug was about 10 years old.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
300 d["broken"] = self.isBroken()
b7269498aa95 Fixed a serious issue handling 'non-error' exceptions in the debugger. This bug was about 10 years old.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
301 else:
b7269498aa95 Fixed a serious issue handling 'non-error' exceptions in the debugger. This bug was about 10 years old.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
302 d["broken"] = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 threadList.append(d)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
305 self.write("{0}{1!r}\n".format(DebugProtocol.ResponseThreadList,
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
306 (currentId, threadList)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
308 def input(self, prompt, echo=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 Public method to implement input() using the event loop.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 @param prompt the prompt to be shown (string)
96
9624a110667d Started to clean up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 72
diff changeset
313 @param echo Flag indicating echoing of the input (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 @return the entered string
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 """
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
316 self.write("{0}{1!r}\n".format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
317 DebugProtocol.ResponseRaw, (prompt, echo)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 self.inRawMode = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 self.eventLoop(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 return self.rawLine
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 def __exceptionRaised(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 """
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
324 Private method called in the case of an exception.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 It ensures that the debug server is informed of the raised exception.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 """
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
328 self.pendingResponse = DebugProtocol.ResponseException
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
330 def sessionClose(self, exit=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 """
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
332 Public method to close the session with the debugger and optionally
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
333 terminate.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 @param exit flag indicating to terminate (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 self.set_quit()
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
339 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 # clean up asyncio.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 self.disconnect()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 self.debugging = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 # make sure we close down our end of the socket
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 # might be overkill as normally stdin, stdout and stderr
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 # SHOULD be closed on exit, but it does not hurt to do it here
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 self.readstream.close(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 self.writestream.close(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 self.errorstream.close(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 if exit:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 # Ok, go away.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 sys.exit()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
357 def __compileFileSource(self, filename, mode='exec'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 Private method to compile source code read from a file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 @param filename name of the source file (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 @param mode kind of code to be generated (string, exec or eval)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 @return compiled code object (None in case of errors)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
365 with open(filename, encoding=self.__coding) as fp:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 statement = fp.read()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 code = compile(statement + '\n', filename, mode)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 except SyntaxError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 exctype, excval, exctb = sys.exc_info()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 try:
3085
4a0f54a64496 Fixed an issue in the Python3 debugger backend handling syntax errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3032
diff changeset
373 message = str(excval)
4a0f54a64496 Fixed an issue in the Python3 debugger backend handling syntax errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3032
diff changeset
374 filename = excval.filename
4a0f54a64496 Fixed an issue in the Python3 debugger backend handling syntax errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3032
diff changeset
375 linenr = excval.lineno
4a0f54a64496 Fixed an issue in the Python3 debugger backend handling syntax errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3032
diff changeset
376 charnr = excval.offset
4a0f54a64496 Fixed an issue in the Python3 debugger backend handling syntax errors.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3032
diff changeset
377 except (AttributeError, ValueError):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 exclist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 exclist = [message, [filename, linenr, charnr]]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
382 self.write("{0}{1}\n".format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
383 DebugProtocol.ResponseSyntax, str(exclist)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 return None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 return code
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
388 def handleLine(self, line):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 Public method to handle the receipt of a complete line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
392 It first looks for a valid protocol token at the start of the line.
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
393 Thereafter it trys to execute the lines accumulated so far.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 @param line the received line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 # Remove any newline.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 if line[-1] == '\n':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 line = line[:-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 ## printerr(line) ##debug
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
402
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
403 if "jsonrpc" in line:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
404 return self.__handleJsonCommand(line)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 eoc = line.find('<')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 if eoc >= 0 and line[0] == '>':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 # Get the command part and any argument.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 cmd = line[:eoc + 1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 arg = line[eoc + 1:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
413 if cmd == DebugProtocol.RequestVariables:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 frmnr, scope, filter = eval(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 self.__dumpVariables(int(frmnr), int(scope), filter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
418 if cmd == DebugProtocol.RequestVariable:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 var, frmnr, scope, filter = eval(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.__dumpVariable(var, int(frmnr), int(scope), filter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
423 if cmd == DebugProtocol.RequestThreadList:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 self.__dumpThreadList()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
427 if cmd == DebugProtocol.RequestThreadSet:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 tid = eval(arg)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 if tid in self.threads:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 self.setCurrentThread(tid)
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
431 self.write(DebugProtocol.ResponseThreadSet + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 stack = self.currentThread.getStack()
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
433 self.write('{0}{1!r}\n'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
434 DebugProtocol.ResponseStack, stack))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
437 if cmd == DebugProtocol.RequestStep:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 self.currentThread.step(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
442 if cmd == DebugProtocol.RequestStepOver:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 self.currentThread.step(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
447 if cmd == DebugProtocol.RequestStepOut:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 self.currentThread.stepOut()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
452 if cmd == DebugProtocol.RequestStepQuit:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 if self.passive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 self.progTerminated(42)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 self.set_quit()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
460 if cmd == DebugProtocol.RequestContinue:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 special = int(arg)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 self.currentThread.go(special)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
466 if cmd == DebugProtocol.RequestOK:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 self.write(self.pendingResponse + '\n')
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
468 self.pendingResponse = DebugProtocol.ResponseOK
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470
2170
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
471 if cmd == DebugProtocol.RequestCallTrace:
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
472 if arg.strip().lower() == "on":
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
473 callTraceEnabled = True
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
474 else:
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
475 callTraceEnabled = False
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
476 if self.debugging:
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
477 self.callTraceEnabled = callTraceEnabled
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
478 else:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
479 self.__newCallTraceEnabled = callTraceEnabled
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
480 # remember for later
2170
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
481 return
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
482
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
483 ## if cmd == DebugProtocol.RequestEnv:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
484 ## env = eval(arg.replace("u'", "'"))
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
485 ## for key, value in env.items():
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
486 ## if key.endswith("+"):
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
487 ## if key[:-1] in os.environ:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
488 ## os.environ[key[:-1]] += value
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
489 ## else:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
490 ## os.environ[key[:-1]] = value
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
491 ## else:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
492 ## os.environ[key] = value
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
493 ## return
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
494 ##
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
495 ## if cmd == DebugProtocol.RequestLoad:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
496 ## self._fncache = {}
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
497 ## self.dircache = []
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
498 ## sys.argv = []
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
499 ## wd, fn, args, tracePython = arg.split('|')
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
500 ## self.__setCoding(fn)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
501 ## sys.argv.append(fn)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
502 ## sys.argv.extend(eval(args))
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
503 ## sys.path = self.__getSysPath(os.path.dirname(sys.argv[0]))
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
504 ## if wd == '':
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
505 ## os.chdir(sys.path[1])
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
506 ## else:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
507 ## os.chdir(wd)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
508 ## tracePython = int(tracePython)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
509 ## self.running = sys.argv[0]
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
510 ## self.mainFrame = None
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
511 ## self.inRawMode = False
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
512 ## self.debugging = True
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
513 ##
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
514 ## self.threads.clear()
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
515 ## self.attachThread(mainThread=True)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
516 ##
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
517 ## # set the system exception handling function to ensure, that
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
518 ## # we report on all unhandled exceptions
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
519 ## sys.excepthook = self.__unhandled_exception
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
520 ## self.__interceptSignals()
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
521 ##
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
522 ## # clear all old breakpoints, they'll get set after we have
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
523 ## # started
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
524 ## self.mainThread.clear_all_breaks()
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
525 ##
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
526 ## self.mainThread.tracePython = tracePython
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
527 ##
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
528 ## # This will eventually enter a local event loop.
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
529 ## self.debugMod.__dict__['__file__'] = self.running
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
530 ## sys.modules['__main__'] = self.debugMod
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
531 ## code = self.__compileFileSource(self.running)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
532 ## if code:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
533 ## self.callTraceEnabled = self.__newCallTraceEnabled
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
534 ## res = self.mainThread.run(code, self.debugMod.__dict__)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
535 ## self.progTerminated(res)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
536 ## return
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
537 ##
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
538 if cmd == DebugProtocol.RequestRun:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 sys.argv = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 wd, fn, args = arg.split('|')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 self.__setCoding(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 sys.argv.append(fn)
5115
ed2f37c1f6b6 Fixed an issue in the debugger backend for Python3 causing a trailing u in a command line argument to be deleted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4944
diff changeset
543 sys.argv.extend(eval(args))
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
544 sys.path = self.__getSysPath(os.path.dirname(sys.argv[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 if wd == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 os.chdir(sys.path[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 os.chdir(wd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 self.running = sys.argv[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 self.mainFrame = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 self.botframe = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 self.inRawMode = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 self.threads.clear()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
556 self.attachThread(mainThread=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 sys.excepthook = self.__unhandled_exception
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
561 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 self.mainThread.tracePython = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 self.debugMod.__dict__['__file__'] = sys.argv[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 sys.modules['__main__'] = self.debugMod
2376
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
567 res = 0
3640
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
568 code = self.__compileFileSource(self.running)
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
569 if code:
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
570 try:
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
571 exec(code, self.debugMod.__dict__)
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
572 except SystemExit as exc:
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
573 res = exc.code
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
574 atexit._run_exitfuncs()
2bf828881e86 Fixed stop at sys.breakpoint() in run mode under Python3 and on first run (Py2 and 3).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3621
diff changeset
575 self.writestream.flush()
4943
e093b4e24e97 Gracefully exit the debugger clients, without loosing last lines.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4834
diff changeset
576 self.progTerminated(res)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
579 if cmd == DebugProtocol.RequestProfile:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 sys.setprofile(None)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 import PyProfile
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 sys.argv = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 wd, fn, args, erase = arg.split('|')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 self.__setCoding(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 sys.argv.append(fn)
5115
ed2f37c1f6b6 Fixed an issue in the debugger backend for Python3 causing a trailing u in a command line argument to be deleted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4944
diff changeset
586 sys.argv.extend(eval(args))
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
587 sys.path = self.__getSysPath(os.path.dirname(sys.argv[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 if wd == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 os.chdir(sys.path[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591 os.chdir(wd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 sys.excepthook = self.__unhandled_exception
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
596 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 # generate a profile object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 self.prof = PyProfile.PyProfile(sys.argv[0])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 if int(erase):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 self.prof.erase()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 self.debugMod.__dict__['__file__'] = sys.argv[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 sys.modules['__main__'] = self.debugMod
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
605 fp = open(sys.argv[0], encoding=self.__coding)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 script = fp.read()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 finally:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 fp.close()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 if script:
2376
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
611 if not script.endswith('\n'):
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
612 script += '\n'
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
613 self.running = sys.argv[0]
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
614 res = 0
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
615 try:
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
616 self.prof.run(script)
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
617 except SystemExit as exc:
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
618 res = exc.code
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
619 atexit._run_exitfuncs()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 self.prof.save()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 self.writestream.flush()
4943
e093b4e24e97 Gracefully exit the debugger clients, without loosing last lines.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4834
diff changeset
622 self.progTerminated(res)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
625 if cmd == DebugProtocol.RequestCoverage:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 from coverage import coverage
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 sys.argv = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 wd, fn, args, erase = arg.split('@@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 self.__setCoding(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 sys.argv.append(fn)
5115
ed2f37c1f6b6 Fixed an issue in the debugger backend for Python3 causing a trailing u in a command line argument to be deleted.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4944
diff changeset
631 sys.argv.extend(eval(args))
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
632 sys.path = self.__getSysPath(os.path.dirname(sys.argv[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 if wd == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 os.chdir(sys.path[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 os.chdir(wd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 sys.excepthook = self.__unhandled_exception
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
641 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 # generate a coverage object
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
644 self.cover = coverage(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
645 auto_data=True,
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
646 data_file="{0}.coverage".format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
647 os.path.splitext(sys.argv[0])[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 if int(erase):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650 self.cover.erase()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 sys.modules['__main__'] = self.debugMod
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 self.debugMod.__dict__['__file__'] = sys.argv[0]
2371
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
653 fp = open(sys.argv[0], encoding=self.__coding)
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
654 try:
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
655 script = fp.read()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
656 finally:
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
657 fp.close()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
658 if script:
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
659 if not script.endswith('\n'):
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
660 script += '\n'
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
661 code = compile(script, sys.argv[0], 'exec')
2376
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
662 self.running = sys.argv[0]
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
663 res = 0
2371
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
664 self.cover.start()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
665 try:
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
666 exec(code, self.debugMod.__dict__)
2376
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
667 except SystemExit as exc:
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
668 res = exc.code
2371
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
669 atexit._run_exitfuncs()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
670 self.cover.stop()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
671 self.cover.save()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
672 self.writestream.flush()
4943
e093b4e24e97 Gracefully exit the debugger clients, without loosing last lines.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4834
diff changeset
673 self.progTerminated(res)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
676 if cmd == DebugProtocol.RequestShutdown:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 self.sessionClose()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
680 if cmd == DebugProtocol.RequestBreak:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 fn, line, temporary, set, cond = arg.split('@@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682 line = int(line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 set = int(set)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 temporary = int(temporary)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686 if set:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687 if cond == 'None' or cond == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 cond = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 compile(cond, '<string>', 'eval')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 except SyntaxError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 self.write('{0}{1},{2:d}\n'.format(
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
694 DebugProtocol.ResponseBPConditionError,
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
695 fn, line))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 self.mainThread.set_break(fn, line, temporary, cond)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 self.mainThread.clear_break(fn, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
703 if cmd == DebugProtocol.RequestBreakEnable:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 fn, line, enable = arg.split(',')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 line = int(line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706 enable = int(enable)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 bp = self.mainThread.get_break(fn, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 if bp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 if enable:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 bp.enable()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 bp.disable()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
717 if cmd == DebugProtocol.RequestBreakIgnore:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 fn, line, count = arg.split(',')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 line = int(line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 count = int(count)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 bp = self.mainThread.get_break(fn, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723 if bp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 bp.ignore = count
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
728 if cmd == DebugProtocol.RequestWatch:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729 cond, temporary, set = arg.split('@@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 set = int(set)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 temporary = int(temporary)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 if set:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 if not cond.endswith('??created??') and \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 not cond.endswith('??changed??'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 compile(cond, '<string>', 'eval')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 except SyntaxError:
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
739 self.write('{0}{1}\n'.format(
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
740 DebugProtocol.ResponseWPConditionError, cond))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742 self.mainThread.set_watch(cond, temporary)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 self.mainThread.clear_watch(cond)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
748 if cmd == DebugProtocol.RequestWatchEnable:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 cond, enable = arg.split(',')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 enable = int(enable)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 bp = self.mainThread.get_watch(cond)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 if bp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 if enable:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 bp.enable()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 bp.disable()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
761 if cmd == DebugProtocol.RequestWatchIgnore:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 cond, count = arg.split(',')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 count = int(count)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 bp = self.mainThread.get_watch(cond)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 if bp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 bp.ignore = count
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
771 if cmd == DebugProtocol.RequestEval:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 try:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
773 value = eval(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
774 arg,
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
775 self.currentThread.getCurrentFrame().f_globals,
4642
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
776 self.currentThread.getFrameLocals(self.framenr))
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
777 self.currentThread.storeFrameLocals(self.framenr)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
778 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 # Report the exception and the traceback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 type, value, tb = sys.exc_info()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 sys.last_type = type
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 sys.last_value = value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 sys.last_traceback = tb
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 tblist = traceback.extract_tb(tb)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 del tblist[:1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 list = traceback.format_list(tblist)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 if list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 list.insert(0, "Traceback (innermost last):\n")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 list[len(list):] = \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 traceback.format_exception_only(type, value)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 finally:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 tblist = tb = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 for l in list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796 self.write(l)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
798 self.write(DebugProtocol.ResponseException + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 self.write(str(value) + '\n')
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
802 self.write(DebugProtocol.ResponseOK + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
806 if cmd == DebugProtocol.RequestExec:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 _globals = self.currentThread.getCurrentFrame().f_globals
4642
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
808 _locals = self.currentThread.getFrameLocals(self.framenr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 code = compile(arg + '\n', '<stdin>', 'single')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 exec(code, _globals, _locals)
4642
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
812 self.currentThread.storeFrameLocals(self.framenr)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
813 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 # Report the exception and the traceback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 type, value, tb = sys.exc_info()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 sys.last_type = type
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 sys.last_value = value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 sys.last_traceback = tb
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820 tblist = traceback.extract_tb(tb)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 del tblist[:1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
822 list = traceback.format_list(tblist)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 if list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824 list.insert(0, "Traceback (innermost last):\n")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825 list[len(list):] = \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826 traceback.format_exception_only(type, value)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 finally:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 tblist = tb = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 for l in list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 self.write(l)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
833 self.write(DebugProtocol.ResponseException + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
837 ## if cmd == DebugProtocol.RequestBanner:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
838 ## self.write('{0}{1}\n'.format(DebugProtocol.ResponseBanner,
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
839 ## str(("Python {0}".format(sys.version),
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
840 ## socket.gethostname(), self.variant))))
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
841 ## return
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
842 ##
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
843 ## if cmd == DebugProtocol.RequestCapabilities:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
844 ## self.write('{0}{1:d}, "Python3"\n'.format(
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
845 ## DebugProtocol.ResponseCapabilities,
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
846 ## self.__clientCapabilities()))
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
847 ## return
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
848 ##
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
849 if cmd == DebugProtocol.RequestCompletion:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850 self.__completionList(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
853 if cmd == DebugProtocol.RequestSetFilter:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 scope, filterString = eval(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 self.__generateFilterObjects(int(scope), filterString)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
858 if cmd == DebugProtocol.RequestUTPrepare:
1499
b4d0457afb15 Extended the unit test module to allow to rerun only failed tests of the last.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1474
diff changeset
859 fn, tn, tfn, failed, cov, covname, erase = arg.split('|')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860 sys.path.insert(0, os.path.dirname(os.path.abspath(fn)))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861 os.chdir(sys.path[0])
1499
b4d0457afb15 Extended the unit test module to allow to rerun only failed tests of the last.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1474
diff changeset
862 failed = eval(failed)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 sys.excepthook = self.__unhandled_exception
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
867 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
868
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870 import unittest
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 utModule = imp.load_source(tn, fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872 try:
1499
b4d0457afb15 Extended the unit test module to allow to rerun only failed tests of the last.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1474
diff changeset
873 if failed:
b4d0457afb15 Extended the unit test module to allow to rerun only failed tests of the last.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1474
diff changeset
874 self.test = unittest.defaultTestLoader\
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
875 .loadTestsFromNames(failed, utModule)
1499
b4d0457afb15 Extended the unit test module to allow to rerun only failed tests of the last.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1474
diff changeset
876 else:
b4d0457afb15 Extended the unit test module to allow to rerun only failed tests of the last.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1474
diff changeset
877 self.test = unittest.defaultTestLoader\
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
878 .loadTestsFromName(tfn, utModule)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879 except AttributeError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
880 self.test = unittest.defaultTestLoader\
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
881 .loadTestsFromModule(utModule)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
882 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
883 exc_type, exc_value, exc_tb = sys.exc_info()
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
884 self.write('{0}{1}\n'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
885 DebugProtocol.ResponseUTPrepared,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
886 str((0, str(exc_type), str(exc_value)))))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887 self.__exceptionRaised()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 # generate a coverage object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891 if int(cov):
33
597036b70646 Added a forgotten import statement.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
892 from coverage import coverage
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
893 self.cover = coverage(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
894 auto_data=True,
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
895 data_file="{0}.coverage".format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
896 os.path.splitext(covname)[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
897 if int(erase):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
898 self.cover.erase()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900 self.cover = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
902 self.write('{0}{1}\n'.format(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
903 DebugProtocol.ResponseUTPrepared,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 str((self.test.countTestCases(), "", ""))))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
907 if cmd == DebugProtocol.RequestUTRun:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 from DCTestResult import DCTestResult
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
909 self.testResult = DCTestResult(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910 if self.cover:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 self.cover.start()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 self.test.run(self.testResult)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 if self.cover:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914 self.cover.stop()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 self.cover.save()
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
916 self.write('{0}\n'.format(DebugProtocol.ResponseUTFinished))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
919 if cmd == DebugProtocol.RequestUTStop:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920 self.testResult.stop()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
923 if cmd == DebugProtocol.ResponseForkTo:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 # this results from a separate event loop
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925 self.fork_child = (arg == 'child')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
929 if cmd == DebugProtocol.RequestForkMode:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 self.fork_auto, self.fork_child = eval(arg)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
931 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 # If we are handling raw mode input then reset the mode and break out
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 # of the current event loop.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 if self.inRawMode:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 self.inRawMode = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 self.rawLine = line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 if self.buffer:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 self.buffer = self.buffer + '\n' + line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 self.buffer = line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 code = self.compile_command(self.buffer, self.readstream.name)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 except (OverflowError, SyntaxError, ValueError):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 # Report the exception
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 sys.last_type, sys.last_value, sys.last_traceback = sys.exc_info()
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
951 for l in traceback.format_exception_only(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
952 sys.last_type, sys.last_value):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 self.write(l)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 self.buffer = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 if code is None:
1112
8a7d1b9d18db Improved code quality by getting rid of star imports. That way pyflakes can do its job. A few bugs fixed found by flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1029
diff changeset
957 self.pendingResponse = DebugProtocol.ResponseContinue
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
958 else:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959 self.buffer = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 if self.running is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 exec(code, self.debugMod.__dict__)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965 if self.currentThread is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 # program has terminated
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967 self.running = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 _globals = self.debugMod.__dict__
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969 _locals = _globals
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 cf = self.currentThread.getCurrentFrame()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 # program has terminated
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
973 if cf is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
974 self.running = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 _globals = self.debugMod.__dict__
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
976 _locals = _globals
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
978 frmnr = self.framenr
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
979 while cf is not None and frmnr > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
980 cf = cf.f_back
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
981 frmnr -= 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
982 _globals = cf.f_globals
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
983 _locals = \
4309
cc9c62f55413 Changed the Python debugger backends to evaluate statements entered into the shell in the frame selected in the local variables viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4270
diff changeset
984 self.currentThread.getFrameLocals(
cc9c62f55413 Changed the Python debugger backends to evaluate statements entered into the shell in the frame selected in the local variables viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4270
diff changeset
985 self.framenr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
986 # reset sys.stdout to our redirector (unconditionally)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
987 if "sys" in _globals:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988 __stdout = _globals["sys"].stdout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
989 _globals["sys"].stdout = self.writestream
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 exec(code, _globals, _locals)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
991 _globals["sys"].stdout = __stdout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
992 elif "sys" in _locals:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
993 __stdout = _locals["sys"].stdout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
994 _locals["sys"].stdout = self.writestream
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
995 exec(code, _globals, _locals)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
996 _locals["sys"].stdout = __stdout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
998 exec(code, _globals, _locals)
4642
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
999
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
1000 self.currentThread.storeFrameLocals(self.framenr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1001 except SystemExit as exc:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1002 self.progTerminated(exc.code)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1003 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004 # Report the exception and the traceback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1005 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 exc_type, exc_value, exc_tb = sys.exc_info()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 sys.last_type = exc_type
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008 sys.last_value = exc_value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1009 sys.last_traceback = exc_tb
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1010 tblist = traceback.extract_tb(exc_tb)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1011 del tblist[:1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1012 list = traceback.format_list(tblist)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013 if list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 list.insert(0, "Traceback (innermost last):\n")
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1015 list[len(list):] = traceback.format_exception_only(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1016 exc_type, exc_value)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017 finally:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 tblist = exc_tb = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1020 for l in list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 self.write(l)
5119
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1022
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1023 def __handleJsonCommand(self, jsonStr):
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1024 """
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1025 Private method to handle a command serialized as a JSON string.
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1026 """
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1027 import json
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1028
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1029 try:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1030 commandDict = json.loads(jsonStr.strip())
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1031 except json.JSONDecodeError as err:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1032 printerr(str(err))
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1033 return
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1034
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1035 method = commandDict["method"]
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1036 params = commandDict["params"]
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1037
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1038 if method == "RequestCapabilities":
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1039 self.__sendJsonCommand("ResponseCapabilities", {
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1040 "capabilities": self.__clientCapabilities(),
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1041 "clientType": "Python3"
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1042 })
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1043 return
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1044
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1045 if method == "RequestBanner":
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1046 self.__sendJsonCommand("ResponseBanner", {
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1047 "version": "Python {0}".format(sys.version),
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1048 "platform": socket.gethostname(),
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1049 "dbgclient": self.variant,
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1050 })
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1051 return
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1052
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1053 if method == "RequestEnvironment":
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1054 for key, value in params["environment"].items():
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1055 if key.endswith("+"):
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1056 if key[:-1] in os.environ:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1057 os.environ[key[:-1]] += value
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1058 else:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1059 os.environ[key[:-1]] = value
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1060 else:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1061 os.environ[key] = value
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1062 return
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1063
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1064 if method == "RequestLoad":
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1065 printerr(method)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1066 self._fncache = {}
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1067 self.dircache = []
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1068 sys.argv = []
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1069 self.__setCoding(params["filename"])
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1070 sys.argv.append(params["filename"])
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1071 sys.argv.extend(params["argv"])
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1072 sys.path = self.__getSysPath(os.path.dirname(sys.argv[0]))
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1073 if params["workdir"] == '':
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1074 os.chdir(sys.path[1])
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1075 else:
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1076 os.chdir(params["workdir"])
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1077 self.running = sys.argv[0]
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1078 self.mainFrame = None
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1079 self.inRawMode = False
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1080 self.debugging = True
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1081
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1082 self.fork_auto = params["autofork"]
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1083 self.fork_child = params["forkChild"]
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1084
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1085 self.threads.clear()
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1086 self.attachThread(mainThread=True)
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1087
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1088 # set the system exception handling function to ensure, that
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1089 # we report on all unhandled exceptions
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1090 sys.excepthook = self.__unhandled_exception
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1091 self.__interceptSignals()
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1092
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115
diff changeset
1093 # clear all old breakpoints, they'll get set after we have
80bd41498eef Started with the modernization of the debugger interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5115