DebugClients/Python3/DebugClientBase.py

Fri, 08 Jan 2016 22:14:39 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Fri, 08 Jan 2016 22:14:39 +0100
changeset 4642
f18d5fb9a53b
parent 4631
5c1a96925da4
child 4830
f609a22f43bd
child 4833
803bf753032a
permissions
-rw-r--r--

Store values entered into the shell in selected frame.

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
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 eoc = line.find('<')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 if eoc >= 0 and line[0] == '>':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 # Get the command part and any argument.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 cmd = line[:eoc + 1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 arg = line[eoc + 1:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409
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
410 if cmd == DebugProtocol.RequestVariables:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 frmnr, scope, filter = eval(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 self.__dumpVariables(int(frmnr), int(scope), filter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414
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
415 if cmd == DebugProtocol.RequestVariable:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 var, frmnr, scope, filter = eval(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 self.__dumpVariable(var, int(frmnr), int(scope), filter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419
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
420 if cmd == DebugProtocol.RequestThreadList:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 self.__dumpThreadList()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423
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
424 if cmd == DebugProtocol.RequestThreadSet:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 tid = eval(arg)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 if tid in self.threads:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 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
428 self.write(DebugProtocol.ResponseThreadSet + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 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
430 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
431 DebugProtocol.ResponseStack, stack))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433
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
434 if cmd == DebugProtocol.RequestStep:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 self.currentThread.step(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438
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
439 if cmd == DebugProtocol.RequestStepOver:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 self.currentThread.step(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443
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
444 if cmd == DebugProtocol.RequestStepOut:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 self.currentThread.stepOut()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448
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
449 if cmd == DebugProtocol.RequestStepQuit:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 if self.passive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 self.progTerminated(42)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 self.set_quit()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456
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
457 if cmd == DebugProtocol.RequestContinue:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 special = int(arg)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 self.currentThread.go(special)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462
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
463 if cmd == DebugProtocol.RequestOK:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 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
465 self.pendingResponse = DebugProtocol.ResponseOK
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467
2170
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
468 if cmd == DebugProtocol.RequestCallTrace:
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
469 if arg.strip().lower() == "on":
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
470 callTraceEnabled = True
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
471 else:
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
472 callTraceEnabled = False
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
473 if self.debugging:
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
474 self.callTraceEnabled = callTraceEnabled
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
475 else:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
476 self.__newCallTraceEnabled = callTraceEnabled
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
477 # remember for later
2170
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
478 return
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
479
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
480 if cmd == DebugProtocol.RequestEnv:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 env = eval(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 for key, value in env.items():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 if key.endswith("+"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 if key[:-1] in os.environ:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 os.environ[key[:-1]] += value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 os.environ[key[:-1]] = value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 os.environ[key] = value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491
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
492 if cmd == DebugProtocol.RequestLoad:
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
493 self._fncache = {}
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 self.dircache = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 sys.argv = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 wd, fn, args, tracePython = arg.split('|')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 self.__setCoding(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 sys.argv.append(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 sys.argv.extend(eval(args.replace("u'", "'")))
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
500 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
501 if wd == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 os.chdir(sys.path[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 os.chdir(wd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 tracePython = int(tracePython)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 self.running = sys.argv[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 self.mainFrame = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 self.inRawMode = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 self.debugging = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 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
512 self.attachThread(mainThread=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 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
517 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
519 # clear all old breakpoints, they'll get set after we have
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
520 # started
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 self.mainThread.clear_all_breaks()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 self.mainThread.tracePython = tracePython
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 # This will eventually enter a local event loop.
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
526 # Note the use of backquotes to cause a repr of self.running.
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
527 # The need for this is on Windows os where backslash is the
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
528 # path separator. They will get inadvertantly stripped away
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
529 # during the eval causing IOErrors, if self.running is passed
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
530 # as a normal str.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 self.debugMod.__dict__['__file__'] = self.running
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 sys.modules['__main__'] = self.debugMod
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 code = self.__compileFileSource(self.running)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 if code:
2170
f4e0f6133ace Started implementing the call trace functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2157
diff changeset
535 self.callTraceEnabled = self.__newCallTraceEnabled
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536 res = self.mainThread.run(code, self.debugMod.__dict__)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 self.progTerminated(res)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539
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
540 if cmd == DebugProtocol.RequestRun:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 sys.argv = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 wd, fn, args = arg.split('|')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 self.__setCoding(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 sys.argv.append(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 sys.argv.extend(eval(args.replace("u'", "'")))
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
546 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
547 if wd == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 os.chdir(sys.path[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 os.chdir(wd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 self.running = sys.argv[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 self.mainFrame = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 self.botframe = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 self.inRawMode = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 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
558 self.attachThread(mainThread=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 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
563 self.__interceptSignals()
0
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.mainThread.tracePython = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 self.debugMod.__dict__['__file__'] = sys.argv[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 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
569 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
570 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
571 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
572 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
573 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
574 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
575 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
576 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
577 self.writestream.flush()
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
578 self.progTerminated(res, exit=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580
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
581 if cmd == DebugProtocol.RequestProfile:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 sys.setprofile(None)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 import PyProfile
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 sys.argv = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 wd, fn, args, erase = arg.split('|')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586 self.__setCoding(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 sys.argv.append(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 sys.argv.extend(eval(args.replace("u'", "'")))
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
589 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
590 if wd == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591 os.chdir(sys.path[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593 os.chdir(wd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 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
598 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 # generate a profile object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 self.prof = PyProfile.PyProfile(sys.argv[0])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 if int(erase):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 self.prof.erase()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 self.debugMod.__dict__['__file__'] = sys.argv[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 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
607 fp = open(sys.argv[0], encoding=self.__coding)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 script = fp.read()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 finally:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 fp.close()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 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
613 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
614 script += '\n'
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
615 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
616 res = 0
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
617 try:
a0409e65bd81 Fixed some more bugs in the Python2 and Python3 debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2371
diff changeset
618 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
619 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
620 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
621 atexit._run_exitfuncs()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 self.prof.save()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 self.writestream.flush()
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
624 self.progTerminated(res, exit=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626
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
627 if cmd == DebugProtocol.RequestCoverage:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 from coverage import coverage
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 sys.argv = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 wd, fn, args, erase = arg.split('@@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 self.__setCoding(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 sys.argv.append(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 sys.argv.extend(eval(args.replace("u'", "'")))
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
634 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
635 if wd == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 os.chdir(sys.path[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 os.chdir(wd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 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
643 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 # generate a coverage object
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
646 self.cover = coverage(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
647 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
648 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
649 os.path.splitext(sys.argv[0])[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 if int(erase):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 self.cover.erase()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 sys.modules['__main__'] = self.debugMod
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 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
655 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
656 try:
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
657 script = fp.read()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
658 finally:
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
659 fp.close()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
660 if script:
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
661 if not script.endswith('\n'):
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
662 script += '\n'
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
663 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
664 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
665 res = 0
2371
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
666 self.cover.start()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
667 try:
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
668 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
669 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
670 res = exc.code
2371
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
671 atexit._run_exitfuncs()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
672 self.cover.stop()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
673 self.cover.save()
72e2f353f34b Fixed severe bugs in the coverage integration.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
674 self.writestream.flush()
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
675 self.progTerminated(res, exit=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677
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
678 if cmd == DebugProtocol.RequestShutdown:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 self.sessionClose()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681
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
682 if cmd == DebugProtocol.RequestBreak:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 fn, line, temporary, set, cond = arg.split('@@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 line = int(line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 set = int(set)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686 temporary = int(temporary)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 if set:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 if cond == 'None' or cond == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 cond = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 compile(cond, '<string>', 'eval')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 except SyntaxError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 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
696 DebugProtocol.ResponseBPConditionError,
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
697 fn, line))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 self.mainThread.set_break(fn, line, temporary, cond)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 self.mainThread.clear_break(fn, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704
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
705 if cmd == DebugProtocol.RequestBreakEnable:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706 fn, line, enable = arg.split(',')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707 line = int(line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 enable = int(enable)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 bp = self.mainThread.get_break(fn, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 if bp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 if enable:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 bp.enable()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 bp.disable()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718
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
719 if cmd == DebugProtocol.RequestBreakIgnore:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 fn, line, count = arg.split(',')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 line = int(line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 count = int(count)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 bp = self.mainThread.get_break(fn, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 if bp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726 bp.ignore = count
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729
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
730 if cmd == DebugProtocol.RequestWatch:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 cond, temporary, set = arg.split('@@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732 set = int(set)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 temporary = int(temporary)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 if set:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 if not cond.endswith('??created??') and \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 not cond.endswith('??changed??'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 compile(cond, '<string>', 'eval')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 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
741 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
742 DebugProtocol.ResponseWPConditionError, cond))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 self.mainThread.set_watch(cond, temporary)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
745 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
746 self.mainThread.clear_watch(cond)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
747
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
748 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749
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
750 if cmd == DebugProtocol.RequestWatchEnable:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 cond, enable = arg.split(',')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 enable = int(enable)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 bp = self.mainThread.get_watch(cond)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 if bp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 if enable:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 bp.enable()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 bp.disable()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762
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
763 if cmd == DebugProtocol.RequestWatchIgnore:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 cond, count = arg.split(',')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 count = int(count)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 bp = self.mainThread.get_watch(cond)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 if bp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 bp.ignore = count
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772
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
773 if cmd == DebugProtocol.RequestEval:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 try:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
775 value = eval(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
776 arg,
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
777 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
778 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
779 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
780 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 # Report the exception and the traceback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 type, value, tb = sys.exc_info()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 sys.last_type = type
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 sys.last_value = value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 sys.last_traceback = tb
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 tblist = traceback.extract_tb(tb)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 del tblist[:1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 list = traceback.format_list(tblist)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 if list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 list.insert(0, "Traceback (innermost last):\n")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 list[len(list):] = \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 traceback.format_exception_only(type, value)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 finally:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 tblist = tb = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 for l in list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 self.write(l)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799
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
800 self.write(DebugProtocol.ResponseException + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 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
804 self.write(DebugProtocol.ResponseOK + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807
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
808 if cmd == DebugProtocol.RequestExec:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 _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
810 _locals = self.currentThread.getFrameLocals(self.framenr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812 code = compile(arg + '\n', '<stdin>', 'single')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 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
814 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
815 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 # Report the exception and the traceback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 type, value, tb = sys.exc_info()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 sys.last_type = type
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820 sys.last_value = value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 sys.last_traceback = tb
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
822 tblist = traceback.extract_tb(tb)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 del tblist[:1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824 list = traceback.format_list(tblist)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825 if list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826 list.insert(0, "Traceback (innermost last):\n")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 list[len(list):] = \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 traceback.format_exception_only(type, value)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829 finally:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 tblist = tb = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 for l in list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833 self.write(l)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834
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
835 self.write(DebugProtocol.ResponseException + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838
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
839 if cmd == DebugProtocol.RequestBanner:
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
840 self.write('{0}{1}\n'.format(DebugProtocol.ResponseBanner,
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
841 str(("Python {0}".format(sys.version),
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
842 socket.gethostname(), self.variant))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844
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
845 if cmd == DebugProtocol.RequestCapabilities:
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
846 self.write('{0}{1:d}, "Python3"\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
847 DebugProtocol.ResponseCapabilities,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 self.__clientCapabilities()))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850
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
851 if cmd == DebugProtocol.RequestCompletion:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 self.__completionList(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854
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
855 if cmd == DebugProtocol.RequestSetFilter:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 scope, filterString = eval(arg.replace("u'", "'"))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857 self.__generateFilterObjects(int(scope), filterString)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859
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
860 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
861 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
862 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
863 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
864 failed = eval(failed)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
868 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
869 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872 import unittest
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 utModule = imp.load_source(tn, fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
874 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
875 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
876 self.test = unittest.defaultTestLoader\
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
877 .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
878 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
879 self.test = unittest.defaultTestLoader\
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
880 .loadTestsFromName(tfn, utModule)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
881 except AttributeError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
882 self.test = unittest.defaultTestLoader\
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
883 .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
884 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
885 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
886 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
887 DebugProtocol.ResponseUTPrepared,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 str((0, str(exc_type), str(exc_value)))))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 self.__exceptionRaised()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 # generate a coverage object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 if int(cov):
33
597036b70646 Added a forgotten import statement.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 26
diff changeset
894 from coverage import coverage
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
895 self.cover = coverage(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
896 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
897 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
898 os.path.splitext(covname)[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899 if int(erase):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900 self.cover.erase()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902 self.cover = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
904 self.write('{0}{1}\n'.format(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
905 DebugProtocol.ResponseUTPrepared,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906 str((self.test.countTestCases(), "", ""))))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908
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
909 if cmd == DebugProtocol.RequestUTRun:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910 from DCTestResult import DCTestResult
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 self.testResult = DCTestResult(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 if self.cover:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 self.cover.start()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914 self.test.run(self.testResult)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 if self.cover:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916 self.cover.stop()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 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
918 self.write('{0}\n'.format(DebugProtocol.ResponseUTFinished))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920
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
921 if cmd == DebugProtocol.RequestUTStop:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 self.testResult.stop()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924
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
925 if cmd == DebugProtocol.ResponseForkTo:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926 # this results from a separate event loop
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 self.fork_child = (arg == 'child')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930
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
931 if cmd == DebugProtocol.RequestForkMode:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 self.fork_auto, self.fork_child = eval(arg)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 # 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
936 # of the current event loop.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 if self.inRawMode:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 self.inRawMode = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 self.rawLine = line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 self.eventExit = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 if self.buffer:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 self.buffer = self.buffer + '\n' + line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 self.buffer = line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 code = self.compile_command(self.buffer, self.readstream.name)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 except (OverflowError, SyntaxError, ValueError):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 # Report the exception
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 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
953 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
954 sys.last_type, sys.last_value):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 self.write(l)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 self.buffer = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 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
959 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
960 else:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 self.buffer = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 if self.running is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965 exec(code, self.debugMod.__dict__)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967 if self.currentThread is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 # program has terminated
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969 self.running = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970 _globals = self.debugMod.__dict__
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 _locals = _globals
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
973 cf = self.currentThread.getCurrentFrame()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
974 # program has terminated
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 if cf is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
976 self.running = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977 _globals = self.debugMod.__dict__
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
978 _locals = _globals
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
979 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
980 frmnr = self.framenr
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
981 while cf is not None and frmnr > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
982 cf = cf.f_back
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
983 frmnr -= 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
984 _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
985 _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
986 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
987 self.framenr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988 # reset sys.stdout to our redirector (unconditionally)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
989 if "sys" in _globals:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 __stdout = _globals["sys"].stdout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
991 _globals["sys"].stdout = self.writestream
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
992 exec(code, _globals, _locals)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
993 _globals["sys"].stdout = __stdout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
994 elif "sys" in _locals:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
995 __stdout = _locals["sys"].stdout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
996 _locals["sys"].stdout = self.writestream
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997 exec(code, _globals, _locals)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
998 _locals["sys"].stdout = __stdout
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
999 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000 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
1001
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
1002 self.currentThread.storeFrameLocals(self.framenr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1003 except SystemExit as exc:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004 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
1005 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 # Report the exception and the traceback
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008 exc_type, exc_value, exc_tb = sys.exc_info()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1009 sys.last_type = exc_type
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1010 sys.last_value = exc_value
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1011 sys.last_traceback = exc_tb
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1012 tblist = traceback.extract_tb(exc_tb)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013 del tblist[:1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 list = traceback.format_list(tblist)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 if list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1016 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
1017 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
1018 exc_type, exc_value)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019 finally:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1020 tblist = exc_tb = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 for l in list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023 self.write(l)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1024
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025 def __clientCapabilities(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027 Private method to determine the clients capabilities.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1028
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1029 @return client capabilities (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1030 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1031 try:
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
1032 import PyProfile # __IGNORE_WARNING__
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1033 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 del sys.modules['PyProfile']
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1036 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 return self.clientCapabilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1038 except ImportError:
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1039 return (self.clientCapabilities &
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1040 ~DebugClientCapabilities.HasProfiler)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1041
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1042 def write(self, s):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 Public method to write data to the output stream.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1046 @param s data to be written (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1047 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1048 self.writestream.write(s)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1049 self.writestream.flush()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1050
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1051 def __interact(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1052 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1053 Private method to Interact with the debugger.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1054 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1055 global DebugClientInstance
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1056
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1057 self.setDescriptors(self.readstream, self.writestream)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1058 DebugClientInstance = self
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1059
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1060 if not self.passive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1061 # At this point simulate an event loop.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1062 self.eventLoop()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1063
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1064 def eventLoop(self, disablePolling=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1065 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1066 Public method implementing our event loop.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1067
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1068 @param disablePolling flag indicating to enter an event loop with
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1069 polling disabled (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1070 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1071 self.eventExit = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1072 self.pollingDisabled = disablePolling
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1073
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1074 while self.eventExit is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1075 wrdy = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1076
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1077 if AsyncPendingWrite(self.writestream):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1078 wrdy.append(self.writestream)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1079
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1080 if AsyncPendingWrite(self.errorstream):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1081 wrdy.append(self.errorstream)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1082
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1083 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1084 rrdy, wrdy, xrdy = select.select([self.readstream], wrdy, [])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1085 except (select.error, KeyboardInterrupt, socket.error):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1086 # just carry on
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1087 continue
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1088
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1089 if self.readstream in rrdy:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1090 self.readReady(self.readstream.fileno())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1091
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1092 if self.writestream in wrdy:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1093 self.writeReady(self.writestream.fileno())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1094
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1095 if self.errorstream in wrdy:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1096 self.writeReady(self.errorstream.fileno())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1097
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1098 self.eventExit = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1099 self.pollingDisabled = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1100
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1101 def eventPoll(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1102 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1103 Public method to poll for events like 'set break point'.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1104 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1105 if self.pollingDisabled:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1106 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1107
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1108 # the choice of a ~0.5 second poll interval is arbitrary.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1109 lasteventpolltime = getattr(self, 'lasteventpolltime', time.time())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1110 now = time.time()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1111 if now - lasteventpolltime < 0.5:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1112 self.lasteventpolltime = lasteventpolltime
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1113 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1114 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1115 self.lasteventpolltime = now
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1116
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1117 wrdy = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1118 if AsyncPendingWrite(self.writestream):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1119 wrdy.append(self.writestream)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1120
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1121 if AsyncPendingWrite(self.errorstream):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1122 wrdy.append(self.errorstream)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1123
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1124 # immediate return if nothing is ready.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1125 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1126 rrdy, wrdy, xrdy = select.select([self.readstream], wrdy, [], 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1127 except (select.error, KeyboardInterrupt, socket.error):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1128 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1129
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1130 if self.readstream in rrdy:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1131 self.readReady(self.readstream.fileno())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1132
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1133 if self.writestream in wrdy:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1134 self.writeReady(self.writestream.fileno())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1135
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1136 if self.errorstream in wrdy:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1137 self.writeReady(self.errorstream.fileno())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1138
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1139 def connectDebugger(self, port, remoteAddress=None, redirect=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1140 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1141 Public method to establish a session with the debugger.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1142
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1143 It opens a network connection to the debugger, connects it to stdin,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1144 stdout and stderr and saves these file objects in case the application
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1145 being debugged redirects them itself.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1146
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1147 @param port the port number to connect to (int)
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1148 @param remoteAddress the network address of the debug server host
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1149 (string)
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1150 @param redirect flag indicating redirection of stdin, stdout and
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1151 stderr (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1152 """
4269
5ba44a2de31a Simplified the debugger backend connection code for the Python2 and Python3 debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4220
diff changeset
1153 if remoteAddress is None:
5ba44a2de31a Simplified the debugger backend connection code for the Python2 and Python3 debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4220
diff changeset
1154 remoteAddress = "127.0.0.1"
4270
fd51fbdfdd69 Fixed the last socket change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4269
diff changeset
1155 elif "@@i" in remoteAddress:
fd51fbdfdd69 Fixed the last socket change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4269
diff changeset
1156 remoteAddress = remoteAddress.split("@@i")[0]
4269
5ba44a2de31a Simplified the debugger backend connection code for the Python2 and Python3 debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4220
diff changeset
1157 sock = socket.create_connection((remoteAddress, port))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1158
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1159 self.readstream = AsyncFile(sock, sys.stdin.mode, sys.stdin.name)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1160 self.writestream = AsyncFile(sock, sys.stdout.mode, sys.stdout.name)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1161 self.errorstream = AsyncFile(sock, sys.stderr.mode, sys.stderr.name)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1162
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1163 if redirect:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1164 sys.stdin = self.readstream
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1165 sys.stdout = self.writestream
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1166 sys.stderr = self.errorstream
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1167 self.redirect = redirect
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1168
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1169 # attach to the main thread here
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1170 self.attachThread(mainThread=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1171
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1172 def __unhandled_exception(self, exctype, excval, exctb):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1173 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1174 Private method called to report an uncaught exception.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1175
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1176 @param exctype the type of the exception
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1177 @param excval data about the exception
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1178 @param exctb traceback for the exception
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1179 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1180 self.mainThread.user_exception(None, (exctype, excval, exctb), True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1181
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1182 def __interceptSignals(self):
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1183 """
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1184 Private method to intercept common signals.
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1185 """
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1186 for signum in [
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1187 signal.SIGABRT, # abnormal termination
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1188 signal.SIGFPE, # floating point exception
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1189 signal.SIGILL, # illegal instruction
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1190 signal.SIGSEGV, # segmentation violation
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1191 ]:
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1192 signal.signal(signum, self.__signalHandler)
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1193
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1194 def __signalHandler(self, signalNumber, stackFrame):
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1195 """
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1196 Private method to handle signals.
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1197
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1198 @param signalNumber number of the signal to be handled
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1199 @type int
4370
54dbb658f9e6 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4366
diff changeset
1200 @param stackFrame current stack frame
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1201 @type frame object
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1202 """
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1203 if signalNumber == signal.SIGABRT:
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1204 message = "Abnormal Termination"
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1205 elif signalNumber == signal.SIGFPE:
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1206 message = "Floating Point Exception"
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1207 elif signalNumber == signal.SIGILL:
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1208 message = "Illegal Instruction"
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1209 elif signalNumber == signal.SIGSEGV:
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1210 message = "Segmentation Violation"
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1211 else:
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1212 message = "Unknown Signal '{0}'".format(signalNumber)
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1213
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1214 filename = self.absPath(stackFrame)
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1215
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1216 linenr = stackFrame.f_lineno
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1217 ffunc = stackFrame.f_code.co_name
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1218
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1219 if ffunc == '?':
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1220 ffunc = ''
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1221
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1222 if ffunc and not ffunc.startswith("<"):
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
1223 argInfo = getargvalues(stackFrame)
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1224 try:
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
1225 fargs = formatargvalues(
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1226 argInfo.args, argInfo.varargs,
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1227 argInfo.keywords, argInfo.locals)
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1228 except Exception:
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1229 fargs = ""
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1230 else:
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1231 fargs = ""
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1232
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1233 siglist = [message, [filename, linenr, ffunc, fargs]]
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1234
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1235 self.write("{0}{1}".format(DebugProtocol.ResponseSignal, str(siglist)))
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1236
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1237 def absPath(self, fn):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1238 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1239 Public method to convert a filename to an absolute name.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1240
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1241 sys.path is used as a set of possible prefixes. The name stays
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1242 relative if a file could not be found.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1243
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1244 @param fn filename (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1245 @return the converted filename (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1246 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1247 if os.path.isabs(fn):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1248 return fn
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1249
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1250 # Check the cache.
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
1251 if fn in self._fncache:
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
1252 return self._fncache[fn]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1253
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1254 # Search sys.path.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1255 for p in sys.path:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1256 afn = os.path.abspath(os.path.join(p, fn))
1607
67c7ffaed401 Fixed an issue in the debugger backends for Python and Python3 that caused files in exceptions been converted to all lowercase on case insensitive filesystems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1257 nafn = os.path.normcase(afn)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1258
1607
67c7ffaed401 Fixed an issue in the debugger backends for Python and Python3 that caused files in exceptions been converted to all lowercase on case insensitive filesystems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1259 if os.path.exists(nafn):
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
1260 self._fncache[fn] = afn
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1261 d = os.path.dirname(afn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1262 if (d not in sys.path) and (d not in self.dircache):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1263 self.dircache.append(d)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1264 return afn
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1265
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1266 # Search the additional directory cache
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1267 for p in self.dircache:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1268 afn = os.path.abspath(os.path.join(p, fn))
1607
67c7ffaed401 Fixed an issue in the debugger backends for Python and Python3 that caused files in exceptions been converted to all lowercase on case insensitive filesystems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1269 nafn = os.path.normcase(afn)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1270
1607
67c7ffaed401 Fixed an issue in the debugger backends for Python and Python3 that caused files in exceptions been converted to all lowercase on case insensitive filesystems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1271 if os.path.exists(nafn):
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
1272 self._fncache[fn] = afn
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1273 return afn
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1274
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1275 # Nothing found.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1276 return fn
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1277
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1278 def shouldSkip(self, fn):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1279 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1280 Public method to check if a file should be skipped.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1281
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1282 @param fn filename to be checked
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1283 @return non-zero if fn represents a file we are 'skipping',
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1284 zero otherwise.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1285 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1286 if self.mainThread.tracePython: # trace into Python library
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1287 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1288
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1289 # Eliminate anything that is part of the Python installation.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1290 afn = self.absPath(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1291 for d in self.skipdirs:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1292 if afn.startswith(d):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1293 return True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1294
2761
bcc10ef7015d Added code to the Python debugger backends to skip over 'site-packages' and 'dist-packages' if Python tracing is disabled.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2636
diff changeset
1295 # special treatment for paths containing site-packages or dist-packages
bcc10ef7015d Added code to the Python debugger backends to skip over 'site-packages' and 'dist-packages' if Python tracing is disabled.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2636
diff changeset
1296 for part in ["site-packages", "dist-packages"]:
bcc10ef7015d Added code to the Python debugger backends to skip over 'site-packages' and 'dist-packages' if Python tracing is disabled.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2636
diff changeset
1297 if part in afn:
bcc10ef7015d Added code to the Python debugger backends to skip over 'site-packages' and 'dist-packages' if Python tracing is disabled.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2636
diff changeset
1298 return True
bcc10ef7015d Added code to the Python debugger backends to skip over 'site-packages' and 'dist-packages' if Python tracing is disabled.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2636
diff changeset
1299
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1300 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1301
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1302 def getRunning(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1303 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1304 Public method to return the main script we are currently running.
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
1305
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
1306 @return flag indicating a running debug session (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1307 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1308 return self.running
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1309
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1310 def progTerminated(self, status, exit=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1311 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1312 Public method to tell the debugger that the program has terminated.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1313
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1314 @param status return status
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1315 @param exit flag indicating to perform a sys.exit()
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1316 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1317 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1318 if status is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1319 status = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1320 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1321 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1322 int(status)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1323 except ValueError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1324 status = 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1325
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1326 if self.running:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1327 self.set_quit()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1328 self.running = 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
1329 self.write('{0}{1:d}\n'.format(DebugProtocol.ResponseExit, status))
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1330 if exit:
4604
623f95f1531b Incorporated two little fixes (one slightly changed) provided by Tobias Rzepka.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4566
diff changeset
1331 self.writestream.close(True)
4366
9445c7cb991f Implemented a signal handler for the Python debug clients.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4309
diff changeset
1332 sys.exit(status)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1333
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1334 # reset coding
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1335 self.__coding = self.defaultCoding
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1336
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1337 def __dumpVariables(self, frmnr, scope, filter):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1338 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1339 Private method to return the variables of a frame to the debug server.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1340
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1341 @param frmnr distance of frame reported on. 0 is the current frame
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1342 (int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1343 @param scope 1 to report global variables, 0 for local variables (int)
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1344 @param filter the indices of variable types to be filtered
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1345 (list of int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1346 """
2636
f3dd3c8d4aa4 Fixed an issue in the Python debug clients caused by the current thread being None.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2486
diff changeset
1347 if self.currentThread is None:
f3dd3c8d4aa4 Fixed an issue in the Python debug clients caused by the current thread being None.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2486
diff changeset
1348 return
f3dd3c8d4aa4 Fixed an issue in the Python debug clients caused by the current thread being None.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2486
diff changeset
1349
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1350 if scope == 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1351 self.framenr = frmnr
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1352
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1353 f = self.currentThread.getCurrentFrame()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1354
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1355 while f is not None and frmnr > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1356 f = f.f_back
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1357 frmnr -= 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1358
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1359 if f is None:
3729
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1360 if scope:
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1361 dict = self.debugMod.__dict__
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1362 else:
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1363 scope = -1
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1364 elif scope:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1365 dict = f.f_globals
4642
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
1366 elif f.f_globals is f.f_locals:
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
1367 scope = -1
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1368 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1369 dict = f.f_locals
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1370
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1371 varlist = [scope]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1372
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1373 if scope != -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1374 keylist = dict.keys()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1375
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1376 vlist = self.__formatVariablesList(keylist, dict, scope, filter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1377 varlist.extend(vlist)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1378
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1379 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
1380 DebugProtocol.ResponseVariables, str(varlist)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1381
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1382 def __dumpVariable(self, var, frmnr, scope, filter):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1383 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1384 Private method to return the variables of a frame to the debug server.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1385
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1386 @param var list encoded name of the requested variable
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1387 (list of strings)
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1388 @param frmnr distance of frame reported on. 0 is the current frame
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1389 (int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1390 @param scope 1 to report global variables, 0 for local variables (int)
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1391 @param filter the indices of variable types to be filtered
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1392 (list of int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1393 """
2636
f3dd3c8d4aa4 Fixed an issue in the Python debug clients caused by the current thread being None.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2486
diff changeset
1394 if self.currentThread is None:
f3dd3c8d4aa4 Fixed an issue in the Python debug clients caused by the current thread being None.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2486
diff changeset
1395 return
f3dd3c8d4aa4 Fixed an issue in the Python debug clients caused by the current thread being None.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2486
diff changeset
1396
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1397 f = self.currentThread.getCurrentFrame()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1398
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1399 while f is not None and frmnr > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1400 f = f.f_back
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1401 frmnr -= 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1402
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1403 if f is None:
3729
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1404 if scope:
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1405 dict = self.debugMod.__dict__
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1406 else:
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1407 scope = -1
b6eda7d63e4c Debug viewer always active.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3640
diff changeset
1408 elif scope:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1409 dict = f.f_globals
4642
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
1410 elif f.f_globals is f.f_locals:
f18d5fb9a53b Store values entered into the shell in selected frame.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4631
diff changeset
1411 scope = -1
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1412 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1413 dict = f.f_locals
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1414
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1415 varlist = [scope, var]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1416
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1417 if scope != -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1418 # search the correct dictionary
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1419 i = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1420 rvar = var[:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1421 dictkeys = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1422 obj = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1423 isDict = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1424 formatSequences = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1425 access = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1426 oaccess = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1427 odict = dict
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1428
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1429 qtVariable = False
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1430 qvar = None
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1431 qvtype = ""
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1432
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1433 while i < len(var):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1434 if len(dict):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1435 udict = dict
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1436 ndict = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1437 # this has to be in line with VariablesViewer.indicators
4543
2e6a880670e9 Fixed a few code style issues (forgotten future imports, copyrights,...).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4489
diff changeset
1438 if var[i][-2:] in ["[]", "()", "{}"]: # __IGNORE_WARNING__
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1439 if i + 1 == len(var):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1440 if var[i][:-2] == '...':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1441 dictkeys = [var[i - 1]]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1442 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1443 dictkeys = [var[i][:-2]]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1444 formatSequences = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1445 if not access and not oaccess:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1446 if var[i][:-2] == '...':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1447 access = '["{0!s}"]'.format(var[i - 1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1448 dict = odict
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1449 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1450 access = '["{0!s}"]'.format(var[i][:-2])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1451 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1452 if var[i][:-2] == '...':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1453 if oaccess:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1454 access = oaccess
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1455 else:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1456 access = '{0!s}[{1!s}]'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1457 access, var[i - 1])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1458 dict = odict
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1459 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1460 if oaccess:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1461 access = '{0!s}[{1!s}]'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1462 oaccess, var[i][:-2])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1463 oaccess = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1464 else:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1465 access = '{0!s}[{1!s}]'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1466 access, var[i][:-2])
4543
2e6a880670e9 Fixed a few code style issues (forgotten future imports, copyrights,...).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4489
diff changeset
1467 if var[i][-2:] == "{}": # __IGNORE_WARNING__
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1468 isDict = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1469 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1470 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1471 if not access:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1472 if var[i][:-2] == '...':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1473 access = '["{0!s}"]'.format(var[i - 1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1474 dict = odict
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1475 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1476 access = '["{0!s}"]'.format(var[i][:-2])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1477 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1478 if var[i][:-2] == '...':
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1479 access = '{0!s}[{1!s}]'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1480 access, var[i - 1])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1481 dict = odict
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1482 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1483 if oaccess:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1484 access = '{0!s}[{1!s}]'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1485 oaccess, var[i][:-2])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1486 oaccess = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1487 else:
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1488 access = '{0!s}[{1!s}]'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1489 access, var[i][:-2])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1490 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1491 if access:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1492 if oaccess:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1493 access = '{0!s}[{1!s}]'.format(oaccess, var[i])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1494 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1495 access = '{0!s}[{1!s}]'.format(access, var[i])
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1496 if var[i - 1][:-2] == '...':
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1497 oaccess = access
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1498 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1499 oaccess = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1500 try:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1501 loc = {"dict": dict}
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1502 exec('mdict = dict{0!s}.__dict__\nobj = dict{0!s}'
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1503 .format(access), globals(), loc)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1504 mdict = loc["mdict"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1505 obj = loc["obj"]
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1506 if "PyQt4." in str(type(obj)) or \
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1507 "PyQt5." in str(type(obj)):
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1508 qtVariable = True
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1509 qvar = obj
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1510 qvtype = str(type(qvar))[1:-1].split()[1][1:-1]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1511 ndict.update(mdict)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1512 except Exception:
1727
9355815a4403 Fixes for the debugger backends causing failures dumping variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1706
diff changeset
1513 pass
9355815a4403 Fixes for the debugger backends causing failures dumping variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1706
diff changeset
1514 try:
1305
14d63fe71d53 Fixed an issue in the debugger not showing class variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1179
diff changeset
1515 loc = {"dict": dict}
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1516 exec('mcdict = dict{0!s}.__class__.__dict__'
1305
14d63fe71d53 Fixed an issue in the debugger not showing class variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1179
diff changeset
1517 .format(access), globals(), loc)
14d63fe71d53 Fixed an issue in the debugger not showing class variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1179
diff changeset
1518 ndict.update(loc["mcdict"])
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
1519 if mdict and "sipThis" not in mdict.keys():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1520 del rvar[0:2]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1521 access = ""
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1522 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1523 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1524 try:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1525 loc = {"cdict": {}, "dict": dict}
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1526 exec('slv = dict{0!s}.__slots__'.format(access),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1527 globals(), loc)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1528 for v in loc["slv"]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1529 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1530 loc["v"] = v
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1531 exec('cdict[v] = dict{0!s}.{1!s}'.format(
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1532 access, v), globals, loc)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1533 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1534 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1535 ndict.update(loc["cdict"])
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1536 exec('obj = dict{0!s}'.format(access),
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1537 globals(), loc)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1538 obj = loc["obj"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1539 access = ""
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1540 if "PyQt4." in str(type(obj)) or \
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1541 "PyQt5." in str(type(obj)):
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1542 qtVariable = True
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1543 qvar = obj
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1544 qvtype = str(type(qvar))[1:-1].split()[1][1:-1]
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1545 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1546 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1547 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1548 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1549 ndict.update(dict[var[i]].__dict__)
1305
14d63fe71d53 Fixed an issue in the debugger not showing class variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1179
diff changeset
1550 ndict.update(dict[var[i]].__class__.__dict__)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1551 del rvar[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1552 obj = dict[var[i]]
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1553 if "PyQt4." in str(type(obj)) or \
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1554 "PyQt5." in str(type(obj)):
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1555 qtVariable = True
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1556 qvar = obj
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1557 qvtype = str(type(qvar))[1:-1].split()[1][1:-1]
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1558 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1559 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1560 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1561 slv = dict[var[i]].__slots__
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1562 loc = {"cdict": {}, "dict": dict,
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1563 "var": var, "i": i}
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1564 for v in slv:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1565 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1566 loc["v"] = v
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1567 exec('cdict[v] = dict[var[i]].{0!s}'
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1568 .format(v),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1569 globals(), loc)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1570 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1571 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1572 ndict.update(loc["cdict"])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1573 obj = dict[var[i]]
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1574 if "PyQt4." in str(type(obj)) or \
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1575 "PyQt5." in str(type(obj)):
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1576 qtVariable = True
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1577 qvar = obj
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1578 qvtype = str(type(qvar))[1:-1].split()[1][1:-1]
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1579 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1580 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1581 odict = dict
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1582 dict = ndict
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1583 i += 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1584
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1585 if qtVariable:
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1586 vlist = self.__formatQtVariable(qvar, qvtype)
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1587 elif ("sipThis" in dict.keys() and len(dict) == 1) or \
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1588 (len(dict) == 0 and len(udict) > 0):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1589 if access:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1590 loc = {"udict": udict}
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1591 exec('qvar = udict{0!s}'.format(access), globals(), loc)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1592 qvar = loc["qvar"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1593 # this has to be in line with VariablesViewer.indicators
4543
2e6a880670e9 Fixed a few code style issues (forgotten future imports, copyrights,...).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4489
diff changeset
1594 elif rvar and rvar[0][-2:] in ["[]", "()", "{}"]: # __IGNORE_WARNING__
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1595 loc = {"udict": udict}
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1596 exec('qvar = udict["{0!s}"][{1!s}]'.format(rvar[0][:-2],
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1597 rvar[1]),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1598 globals(), loc)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1599 qvar = loc["qvar"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1600 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1601 qvar = udict[var[-1]]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1602 qvtype = str(type(qvar))[1:-1].split()[1][1:-1]
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1603 if qvtype.startswith(("PyQt4", "PyQt5")):
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1604 vlist = self.__formatQtVariable(qvar, qvtype)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1605 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1606 vlist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1607 else:
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1608 qtVariable = False
1727
9355815a4403 Fixes for the debugger backends causing failures dumping variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1706
diff changeset
1609 if len(dict) == 0 and len(udict) > 0:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1610 if access:
1474
1eaec11a0078 Fixed a few PEP-8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1471
diff changeset
1611 loc = {"udict": udict}
2991
226481ff40d1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2987
diff changeset
1612 exec('qvar = udict{0!s}'.format(access),
226481ff40d1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2987
diff changeset
1613 globals(), loc)
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1614 qvar = loc["qvar"]
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1615 # this has to be in line with VariablesViewer.indicators
4543
2e6a880670e9 Fixed a few code style issues (forgotten future imports, copyrights,...).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4489
diff changeset
1616 elif rvar and rvar[0][-2:] in ["[]", "()", "{}"]: # __IGNORE_WARNING__
1474
1eaec11a0078 Fixed a few PEP-8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1471
diff changeset
1617 loc = {"udict": udict}
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1618 exec('qvar = udict["{0!s}"][{1!s}]'.format(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1619 rvar[0][:-2], rvar[1]), globals(), loc)
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1620 qvar = loc["qvar"]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1621 else:
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1622 qvar = udict[var[-1]]
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1623 qvtype = str(type(qvar))[1:-1].split()[1][1:-1]
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1624 if qvtype.startswith(("PyQt4", "PyQt5")):
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1625 qtVariable = True
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1626
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1627 if qtVariable:
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1628 vlist = self.__formatQtVariable(qvar, qvtype)
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1629 else:
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1630 # format the dictionary found
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1631 if dictkeys is None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1632 dictkeys = dict.keys()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1633 else:
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1634 # treatment for sequences and dictionaries
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1635 if access:
1474
1eaec11a0078 Fixed a few PEP-8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1471
diff changeset
1636 loc = {"dict": dict}
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1637 exec("dict = dict{0!s}".format(access), globals(),
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1638 loc)
1471
af9e4f5a34b5 Fixed the last change for the Python3 backend.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1470
diff changeset
1639 dict = loc["dict"]
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1640 else:
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1641 dict = dict[dictkeys[0]]
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1642 if isDict:
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1643 dictkeys = dict.keys()
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1644 else:
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1645 dictkeys = range(len(dict))
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1646 vlist = self.__formatVariablesList(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1647 dictkeys, dict, scope, filter, formatSequences)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1648 varlist.extend(vlist)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1649
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1650 if obj is not None and not formatSequences:
2486
e16c9ced6ae5 Fixed an issue that could cause the debugger backends to crash, if a class redefined __repr__.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2376
diff changeset
1651 try:
e16c9ced6ae5 Fixed an issue that could cause the debugger backends to crash, if a class redefined __repr__.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2376
diff changeset
1652 if repr(obj).startswith('{'):
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1653 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1654 ('...', 'dict', "{0:d}".format(len(obj.keys()))))
2486
e16c9ced6ae5 Fixed an issue that could cause the debugger backends to crash, if a class redefined __repr__.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2376
diff changeset
1655 elif repr(obj).startswith('['):
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1656 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1657 ('...', 'list', "{0:d}".format(len(obj))))
2486
e16c9ced6ae5 Fixed an issue that could cause the debugger backends to crash, if a class redefined __repr__.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2376
diff changeset
1658 elif repr(obj).startswith('('):
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1659 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1660 ('...', 'tuple', "{0:d}".format(len(obj))))
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1661 except Exception:
2486
e16c9ced6ae5 Fixed an issue that could cause the debugger backends to crash, if a class redefined __repr__.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2376
diff changeset
1662 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1663
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1664 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
1665 DebugProtocol.ResponseVariable, str(varlist)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1666
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1667 def __formatQtVariable(self, value, vtype):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1668 """
2297
e8a46f81517c Adjusted some display strings to be independant of the Qt version (Qt4/Qt5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2276
diff changeset
1669 Private method to produce a formatted output of a simple Qt4/Qt5 type.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1670
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1671 @param value variable to be formatted
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1672 @param vtype type of the variable to be formatted (string)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1673 @return A tuple consisting of a list of formatted variables. Each
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1674 variable entry is a tuple of three elements, the variable name,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1675 its type and value.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1676 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1677 qttype = vtype.split('.')[-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1678 varlist = []
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1679 if qttype == 'QChar':
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1680 varlist.append(("", "QChar", "{0}".format(chr(value.unicode()))))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1681 varlist.append(("", "int", "{0:d}".format(value.unicode())))
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1682 elif qttype == 'QByteArray':
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1683 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1684 ("bytes", "QByteArray", "{0}".format(bytes(value))[2:-1]))
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1685 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1686 ("hex", "QByteArray", "{0}".format(value.toHex())[2:-1]))
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1687 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1688 ("base64", "QByteArray", "{0}".format(value.toBase64())[2:-1]))
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1689 varlist.append(("percent encoding", "QByteArray",
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1690 "{0}".format(value.toPercentEncoding())[2:-1]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1691 elif qttype == 'QPoint':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1692 varlist.append(("x", "int", "{0:d}".format(value.x())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1693 varlist.append(("y", "int", "{0:d}".format(value.y())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1694 elif qttype == 'QPointF':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1695 varlist.append(("x", "float", "{0:g}".format(value.x())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1696 varlist.append(("y", "float", "{0:g}".format(value.y())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1697 elif qttype == 'QRect':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1698 varlist.append(("x", "int", "{0:d}".format(value.x())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1699 varlist.append(("y", "int", "{0:d}".format(value.y())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1700 varlist.append(("width", "int", "{0:d}".format(value.width())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1701 varlist.append(("height", "int", "{0:d}".format(value.height())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1702 elif qttype == 'QRectF':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1703 varlist.append(("x", "float", "{0:g}".format(value.x())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1704 varlist.append(("y", "float", "{0:g}".format(value.y())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1705 varlist.append(("width", "float", "{0:g}".format(value.width())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1706 varlist.append(("height", "float", "{0:g}".format(value.height())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1707 elif qttype == 'QSize':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1708 varlist.append(("width", "int", "{0:d}".format(value.width())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1709 varlist.append(("height", "int", "{0:d}".format(value.height())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1710 elif qttype == 'QSizeF':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1711 varlist.append(("width", "float", "{0:g}".format(value.width())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1712 varlist.append(("height", "float", "{0:g}".format(value.height())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1713 elif qttype == 'QColor':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1714 varlist.append(("name", "str", "{0}".format(value.name())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1715 r, g, b, a = value.getRgb()
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1716 varlist.append(
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1717 ("rgba", "int",
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1718 "{0:d}, {1:d}, {2:d}, {3:d}".format(r, g, b, a)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1719 h, s, v, a = value.getHsv()
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1720 varlist.append(
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1721 ("hsva", "int",
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1722 "{0:d}, {1:d}, {2:d}, {3:d}".format(h, s, v, a)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1723 c, m, y, k, a = value.getCmyk()
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1724 varlist.append(
4118
3c9fa4b8869d Fixed an issue in the Python debugger backends caused by forgotten check for PyQt5 type variables.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4063
diff changeset
1725 ("cmyka", "int",
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1726 "{0:d}, {1:d}, {2:d}, {3:d}, {4:d}".format(c, m, y, k, a)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1727 elif qttype == 'QDate':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1728 varlist.append(("", "QDate", "{0}".format(value.toString())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1729 elif qttype == 'QTime':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1730 varlist.append(("", "QTime", "{0}".format(value.toString())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1731 elif qttype == 'QDateTime':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1732 varlist.append(("", "QDateTime", "{0}".format(value.toString())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1733 elif qttype == 'QDir':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1734 varlist.append(("path", "str", "{0}".format(value.path())))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1735 varlist.append(("absolutePath", "str",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1736 "{0}".format(value.absolutePath())))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1737 varlist.append(("canonicalPath", "str",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1738 "{0}".format(value.canonicalPath())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1739 elif qttype == 'QFile':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1740 varlist.append(("fileName", "str", "{0}".format(value.fileName())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1741 elif qttype == 'QFont':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1742 varlist.append(("family", "str", "{0}".format(value.family())))
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1743 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1744 ("pointSize", "int", "{0:d}".format(value.pointSize())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1745 varlist.append(("weight", "int", "{0:d}".format(value.weight())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1746 varlist.append(("bold", "bool", "{0}".format(value.bold())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1747 varlist.append(("italic", "bool", "{0}".format(value.italic())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1748 elif qttype == 'QUrl':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1749 varlist.append(("url", "str", "{0}".format(value.toString())))
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1750 varlist.append(("scheme", "str", "{0}".format(value.scheme())))
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1751 varlist.append(("user", "str", "{0}".format(value.userName())))
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1752 varlist.append(("password", "str", "{0}".format(value.password())))
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1753 varlist.append(("host", "str", "{0}".format(value.host())))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 126
diff changeset
1754 varlist.append(("port", "int", "{0:d}".format(value.port())))
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1755 varlist.append(("path", "str", "{0}".format(value.path())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1756 elif qttype == 'QModelIndex':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1757 varlist.append(("valid", "bool", "{0}".format(value.isValid())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1758 if value.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1759 varlist.append(("row", "int", "{0}".format(value.row())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1760 varlist.append(("column", "int", "{0}".format(value.column())))
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1761 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1762 ("internalId", "int", "{0}".format(value.internalId())))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1763 varlist.append(("internalPointer", "void *",
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1764 "{0}".format(value.internalPointer())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1765 elif qttype == 'QRegExp':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1766 varlist.append(("pattern", "str", "{0}".format(value.pattern())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1767
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1768 # GUI stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1769 elif qttype == 'QAction':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1770 varlist.append(("name", "str", "{0}".format(value.objectName())))
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1771 varlist.append(("text", "str", "{0}".format(value.text())))
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1772 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1773 ("icon text", "str", "{0}".format(value.iconText())))
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1774 varlist.append(("tooltip", "str", "{0}".format(value.toolTip())))
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1775 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1776 ("whatsthis", "str", "{0}".format(value.whatsThis())))
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1777 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1778 ("shortcut", "str",
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1779 "{0}".format(value.shortcut().toString())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1780 elif qttype == 'QKeySequence':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1781 varlist.append(("value", "", "{0}".format(value.toString())))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1782
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1783 # XML stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1784 elif qttype == 'QDomAttr':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1785 varlist.append(("name", "str", "{0}".format(value.name())))
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1786 varlist.append(("value", "str", "{0}".format(value.value())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1787 elif qttype == 'QDomCharacterData':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1788 varlist.append(("data", "str", "{0}".format(value.data())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1789 elif qttype == 'QDomComment':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1790 varlist.append(("data", "str", "{0}".format(value.data())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1791 elif qttype == "QDomDocument":
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1792 varlist.append(("text", "str", "{0}".format(value.toString())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1793 elif qttype == 'QDomElement':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1794 varlist.append(("tagName", "str", "{0}".format(value.tagName())))
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1795 varlist.append(("text", "str", "{0}".format(value.text())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1796 elif qttype == 'QDomText':
5
fa319c01b604 Corrected some omissions for the QString v2 API conversion.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1797 varlist.append(("data", "str", "{0}".format(value.data())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1798
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1799 # Networking stuff
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1800 elif qttype == 'QHostAddress':
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1801 varlist.append(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1802 ("address", "QHostAddress", "{0}".format(value.toString())))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1803
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1804 return varlist
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1805
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1806 def __formatVariablesList(self, keylist, dict, scope, filter=[],
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1807 formatSequences=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1808 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1809 Private method to produce a formated variables list.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1810
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1811 The dictionary passed in to it is scanned. Variables are
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1812 only added to the list, if their type is not contained
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1813 in the filter list and their name doesn't match any of the filter
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1814 expressions. The formated variables list (a list of tuples of 3
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1815 values) is returned.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1816
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1817 @param keylist keys of the dictionary
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1818 @param dict the dictionary to be scanned
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1819 @param scope 1 to filter using the globals filter, 0 using the locals
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1820 filter (int).
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1821 Variables are only added to the list, if their name do not match
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1822 any of the filter expressions.
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1823 @param filter the indices of variable types to be filtered. Variables
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1824 are only added to the list, if their type is not contained in the
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1825 filter list.
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1826 @param formatSequences flag indicating, that sequence or dictionary
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1827 variables should be formatted. If it is 0 (or false), just the
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1828 number of items contained in these variables is returned. (boolean)
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1829 @return A tuple consisting of a list of formatted variables. Each
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1830 variable entry is a tuple of three elements, the variable name,
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1831 its type and value.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1832 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1833 varlist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1834 if scope:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1835 patternFilterObjects = self.globalsFilterObjects
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1836 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1837 patternFilterObjects = self.localsFilterObjects
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1838
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1839 for key in keylist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1840 # filter based on the filter pattern
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1841 matched = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1842 for pat in patternFilterObjects:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1843 if pat.match(str(key)):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1844 matched = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1845 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1846 if matched:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1847 continue
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1848
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1849 # filter hidden attributes (filter #0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1850 if 0 in filter and str(key)[:2] == '__':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1851 continue
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1852
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1853 # special handling for '__builtins__' (it's way too big)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1854 if key == '__builtins__':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1855 rvalue = '<module __builtin__ (built-in)>'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1856 valtype = 'module'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1857 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1858 value = dict[key]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1859 valtypestr = str(type(value))[1:-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1860
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1861 valtype = valtypestr[7:-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1862 if valtype not in ConfigVarTypeStrings:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1863 if ConfigVarTypeStrings.index('instance') in filter:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1864 continue
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1865 elif valtype == "sip.methoddescriptor":
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1866 if ConfigVarTypeStrings.index(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1867 'instance method') in filter:
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1868 continue
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1869 elif valtype == "sip.enumtype":
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1870 if ConfigVarTypeStrings.index('class') in filter:
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1871 continue
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1872 valtype = valtypestr
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1873 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1874 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1875 if ConfigVarTypeStrings.index(valtype) in filter:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1876 continue
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1877 except ValueError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1878 if valtype == "classobj":
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1879 if ConfigVarTypeStrings.index(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1880 'instance') in filter:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1881 continue
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1882 elif valtype == "sip.methoddescriptor":
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1883 if ConfigVarTypeStrings.index(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1884 'instance method') in filter:
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1885 continue
2157
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1886 elif valtype == "sip.enumtype":
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1887 if ConfigVarTypeStrings.index('class') in filter:
aa3bdc7cb686 Changed the Python debugger backends to cope with latest PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1727
diff changeset
1888 continue
1470
65af67c5b5c3 Modified the Python debuggers to better cope with later PyQt4 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1305
diff changeset
1889 elif not valtype.startswith("PySide") and \
3032
927a2f8b3669 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1890 ConfigVarTypeStrings.index('other') in filter:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1891 continue
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1892
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1893 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1894 if valtype not in ['list', 'tuple', 'dict']:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1895 rvalue = repr(value)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1896 if valtype.startswith('class') and \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1897 rvalue[0] in ['{', '(', '[']:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1898 rvalue = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1899 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1900 if valtype == 'dict':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1901 rvalue = "{0:d}".format(len(value.keys()))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1902 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1903 rvalue = "{0:d}".format(len(value))
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1904 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1905 rvalue = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1906
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1907 if formatSequences:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1908 if str(key) == key:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1909 key = "'{0!s}'".format(key)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1910 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1911 key = str(key)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1912 varlist.append((key, valtype, rvalue))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1913
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1914 return varlist
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1915
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1916 def __generateFilterObjects(self, scope, filterString):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1917 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1918 Private slot to convert a filter string to a list of filter objects.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1919
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1920 @param scope 1 to generate filter for global variables, 0 for local
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1921 variables (int)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1922 @param filterString string of filter patterns separated by ';'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1923 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1924 patternFilterObjects = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1925 for pattern in filterString.split(';'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1926 patternFilterObjects.append(re.compile('^{0}$'.format(pattern)))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1927 if scope:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1928 self.globalsFilterObjects = patternFilterObjects[:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1929 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1930 self.localsFilterObjects = patternFilterObjects[:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1931
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1932 def __completionList(self, text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1933 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1934 Private slot to handle the request for a commandline completion list.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1935
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1936 @param text the text to be completed (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1937 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1938 completerDelims = ' \t\n`~!@#$%^&*()-=+[{]}\\|;:\'",<>/?'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1939
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1940 completions = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1941 state = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1942 # find position of last delim character
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1943 pos = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1944 while pos >= -len(text):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1945 if text[pos] in completerDelims:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1946 if pos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1947 text = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1948 else:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1949 text = text[pos + 1:]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1950 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1951 pos -= 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1952
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1953 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1954 comp = self.complete(text, state)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1955 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1956 comp = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1957 while comp is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1958 completions.append(comp)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1959 state += 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1960 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1961 comp = self.complete(text, state)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
1962 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1963 comp = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1964
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
1965 self.write("{0}{1}||{2}\n".format(DebugProtocol.ResponseCompletion,
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
1966 str(completions), text))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1967
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
1968 def startDebugger(self, filename=None, host=None, port=None,
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
1969 enableTrace=True, exceptions=True, tracePython=False,
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
1970 redirect=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1971 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1972 Public method used to start the remote debugger.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1973
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1974 @param filename the program to be debugged (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1975 @param host hostname of the debug server (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1976 @param port portnumber of the debug server (int)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1977 @param enableTrace flag to enable the tracing function (boolean)
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1978 @param exceptions flag to enable exception reporting of the IDE
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1979 (boolean)
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1980 @param tracePython flag to enable tracing into the Python library
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1981 (boolean)
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1982 @param redirect flag indicating redirection of stdin, stdout and
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1983 stderr (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1984 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1985 global debugClient
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1986 if host is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1987 host = os.getenv('ERICHOST', 'localhost')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1988 if port is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1989 port = os.getenv('ERICPORT', 42424)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1990
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1991 remoteAddress = self.__resolveHost(host)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1992 self.connectDebugger(port, remoteAddress, redirect)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1993 if filename is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1994 self.running = os.path.abspath(filename)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1995 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1996 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1997 self.running = os.path.abspath(sys.argv[0])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1998 except IndexError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1999 self.running = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2000 if self.running:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2001 self.__setCoding(self.running)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2002 self.passive = True
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
2003 self.write("{0}{1}|{2:d}\n".format(DebugProtocol.PassiveStartup,
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
2004 self.running, exceptions))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2005 self.__interact()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2006
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2007 # setup the debugger variables
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
2008 self._fncache = {}
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2009 self.dircache = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2010 self.mainFrame = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2011 self.inRawMode = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2012 self.debugging = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2013
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2014 self.attachThread(mainThread=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2015 self.mainThread.tracePython = tracePython
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2016
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2017 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2018 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2019 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
2020 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2021
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2022 # now start debugging
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2023 if enableTrace:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2024 self.mainThread.set_trace()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2025
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2026 def startProgInDebugger(self, progargs, wd='', host=None,
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
2027 port=None, exceptions=True, tracePython=False,
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
2028 redirect=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2029 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2030 Public method used to start the remote debugger.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2031
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2032 @param progargs commandline for the program to be debugged
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2033 (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2034 @param wd working directory for the program execution (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2035 @param host hostname of the debug server (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2036 @param port portnumber of the debug server (int)
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2037 @param exceptions flag to enable exception reporting of the IDE
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2038 (boolean)
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2039 @param tracePython flag to enable tracing into the Python library
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2040 (boolean)
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2041 @param redirect flag indicating redirection of stdin, stdout and
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2042 stderr (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2043 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2044 if host is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2045 host = os.getenv('ERICHOST', 'localhost')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2046 if port is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2047 port = os.getenv('ERICPORT', 42424)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2048
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2049 remoteAddress = self.__resolveHost(host)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2050 self.connectDebugger(port, remoteAddress, redirect)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2051
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
2052 self._fncache = {}
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2053 self.dircache = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2054 sys.argv = progargs[:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2055 sys.argv[0] = os.path.abspath(sys.argv[0])
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2056 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
2057 if wd == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2058 os.chdir(sys.path[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2059 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2060 os.chdir(wd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2061 self.running = sys.argv[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2062 self.__setCoding(self.running)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2063 self.mainFrame = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2064 self.inRawMode = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2065 self.debugging = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2066
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2067 self.passive = True
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
2068 self.write("{0}{1}|{2:d}\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
2069 DebugProtocol.PassiveStartup, self.running, exceptions))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2070 self.__interact()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2071
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2072 self.attachThread(mainThread=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2073 self.mainThread.tracePython = tracePython
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2074
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2075 # set the system exception handling function to ensure, that
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2076 # we report on all unhandled exceptions
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2077 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
2078 self.__interceptSignals()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2079
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2080 # This will eventually enter a local event loop.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2081 # Note the use of backquotes to cause a repr of self.running. The
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2082 # need for this is on Windows os where backslash is the path separator.
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2083 # They will get inadvertantly stripped away during the eval causing
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2084 # IOErrors if self.running is passed as a normal str.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2085 self.debugMod.__dict__['__file__'] = self.running
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2086 sys.modules['__main__'] = self.debugMod
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2087 res = self.mainThread.run(
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2088 'exec(open(' + repr(self.running) + ').read())',
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2089 self.debugMod.__dict__)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2090 self.progTerminated(res)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2091
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2092 def run_call(self, scriptname, func, *args):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2093 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2094 Public method used to start the remote debugger and call a function.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2095
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2096 @param scriptname name of the script to be debugged (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2097 @param func function to be called
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2098 @param *args arguments being passed to func
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2099 @return result of the function call
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2100 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2101 self.startDebugger(scriptname, enableTrace=False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2102 res = self.mainThread.runcall(func, *args)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2103 self.progTerminated(res)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2104 return res
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2105
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2106 def __resolveHost(self, host):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2107 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2108 Private method to resolve a hostname to an IP address.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2109
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2110 @param host hostname of the debug server (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2111 @return IP address (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2112 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2113 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2114 host, version = host.split("@@")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2115 except ValueError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2116 version = 'v4'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2117 if version == 'v4':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2118 family = socket.AF_INET
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2119 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2120 family = socket.AF_INET6
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2121 return socket.getaddrinfo(host, None,
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2122 family, socket.SOCK_STREAM)[0][4][0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2123
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2124 def main(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2125 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2126 Public method implementing the main method.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2127 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2128 if '--' in sys.argv:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2129 args = sys.argv[1:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2130 host = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2131 port = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2132 wd = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2133 tracePython = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2134 exceptions = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2135 redirect = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2136 while args[0]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2137 if args[0] == '-h':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2138 host = args[1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2139 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2140 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2141 elif args[0] == '-p':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2142 port = int(args[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2143 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2144 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2145 elif args[0] == '-w':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2146 wd = args[1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2147 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2148 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2149 elif args[0] == '-t':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2150 tracePython = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2151 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2152 elif args[0] == '-e':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2153 exceptions = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2154 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2155 elif args[0] == '-n':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2156 redirect = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2157 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2158 elif args[0] == '--no-encoding':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2159 self.noencoding = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2160 del args[0]
1029
0fb3d1d26eab Added the autofork capability to the debug client commandline interface used for passive debugging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
2161 elif args[0] == '--fork-child':
0fb3d1d26eab Added the autofork capability to the debug client commandline interface used for passive debugging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
2162 self.fork_auto = True
0fb3d1d26eab Added the autofork capability to the debug client commandline interface used for passive debugging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
2163 self.fork_child = True
0fb3d1d26eab Added the autofork capability to the debug client commandline interface used for passive debugging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
2164 del args[0]
0fb3d1d26eab Added the autofork capability to the debug client commandline interface used for passive debugging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
2165 elif args[0] == '--fork-parent':
0fb3d1d26eab Added the autofork capability to the debug client commandline interface used for passive debugging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
2166 self.fork_auto = True
0fb3d1d26eab Added the autofork capability to the debug client commandline interface used for passive debugging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
2167 self.fork_child = False
0fb3d1d26eab Added the autofork capability to the debug client commandline interface used for passive debugging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
2168 del args[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2169 elif args[0] == '--':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2170 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2171 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2172 else: # unknown option
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2173 del args[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2174 if not args:
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
2175 print("No program given. Aborting!") # __IGNORE_WARNING__
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2176 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2177 if not self.noencoding:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2178 self.__coding = self.defaultCoding
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2179 self.startProgInDebugger(args, wd, host, port,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2180 exceptions=exceptions,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2181 tracePython=tracePython,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2182 redirect=redirect)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2183 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2184 if sys.argv[1] == '--no-encoding':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2185 self.noencoding = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2186 del sys.argv[1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2187 if sys.argv[1] == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2188 del sys.argv[1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2189 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2190 port = int(sys.argv[1])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2191 except (ValueError, IndexError):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2192 port = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2193 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2194 redirect = int(sys.argv[2])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2195 except (ValueError, IndexError):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2196 redirect = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2197 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2198 ipOrHost = sys.argv[3]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2199 if ':' in ipOrHost:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2200 remoteAddress = ipOrHost
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2201 elif ipOrHost[0] in '0123456789':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2202 remoteAddress = ipOrHost
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2203 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2204 remoteAddress = self.__resolveHost(ipOrHost)
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4543
diff changeset
2205 except Exception:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2206 remoteAddress = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2207 sys.argv = ['']
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
2208 if '' not in sys.path:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2209 sys.path.insert(0, '')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2210 if port >= 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2211 if not self.noencoding:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2212 self.__coding = self.defaultCoding
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2213 self.connectDebugger(port, remoteAddress, redirect)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2214 self.__interact()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2215 else:
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4563
diff changeset
2216 print("No network port given. Aborting...") # __IGNORE_WARNING__
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2217
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2218 def fork(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2219 """
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
2220 Public method implementing a fork routine deciding which branch
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
2221 to follow.
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
2222
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2761
diff changeset
2223 @return process ID (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2224 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2225 if not self.fork_auto:
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
2226 self.write(DebugProtocol.RequestForkTo + '\n')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2227 self.eventLoop(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2228 pid = DebugClientOrigFork()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2229 if pid == 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2230 # child
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2231 if not self.fork_child:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2232 sys.settrace(None)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2233 sys.setprofile(None)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2234 self.sessionClose(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2235 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2236 # parent
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2237 if self.fork_child:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2238 sys.settrace(None)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2239 sys.setprofile(None)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2240 self.sessionClose(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2241 return pid
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2242
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2243 def close(self, fd):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2244 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
2245 Public method implementing a close method as a replacement for
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2246 os.close().
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2247
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2248 It prevents the debugger connections from being closed.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2249
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2250 @param fd file descriptor to be closed (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2251 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2252 if fd in [self.readstream.fileno(), self.writestream.fileno(),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2253 self.errorstream.fileno()]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2254 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2255
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2256 DebugClientOrigClose(fd)
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2257
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2258 def __getSysPath(self, firstEntry):
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2259 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 935
diff changeset
2260 Private slot to calculate a path list including the PYTHONPATH
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2261 environment variable.
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2262
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2263 @param firstEntry entry to be put first in sys.path (string)
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2264 @return path list for use as sys.path (list of strings)
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2265 """
2987
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2266 sysPath = [path for path in os.environ.get("PYTHONPATH", "")
c99695c0f13a Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
2267 .split(os.pathsep)
72
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2268 if path not in sys.path] + sys.path[:]
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2269 if "" in sysPath:
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2270 sysPath.remove("")
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2271 sysPath.insert(0, firstEntry)
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2272 sysPath.insert(0, '')
015c7e35bd84 Added code to use the PYTHONPATH environment setting in the debuggers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 43
diff changeset
2273 return sysPath
4543
2e6a880670e9 Fixed a few code style issues (forgotten future imports, copyrights,...).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4489
diff changeset
2274
2e6a880670e9 Fixed a few code style issues (forgotten future imports, copyrights,...).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4489
diff changeset
2275 #
2e6a880670e9 Fixed a few code style issues (forgotten future imports, copyrights,...).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4489
diff changeset
2276 # eflag: noqa = M702

eric ide

mercurial