120 class DebugClientBase(object): |
120 class DebugClientBase(object): |
121 """ |
121 """ |
122 Class implementing the client side of the debugger. |
122 Class implementing the client side of the debugger. |
123 |
123 |
124 It provides access to the Python interpeter from a debugger running in |
124 It provides access to the Python interpeter from a debugger running in |
125 another process whether or not the Qt event loop is running. |
125 another process. |
126 |
126 |
127 The protocol between the debugger and the client assumes that there will be |
127 The protocol between the debugger and the client is based on JSONRPC 2.0 |
128 a single source of debugger commands and a single source of Python |
128 PDUs. Each one is sent on a single line, i.e. commands or responses are |
129 statements. Commands and statement are always exactly one line and may be |
129 separated by a linefeed character. |
130 interspersed. |
|
131 |
|
132 The protocol is as follows. First the client opens a connection to the |
|
133 debugger and then sends a series of one line commands. A command is either |
|
134 >Load<, >Step<, >StepInto<, ... or a Python statement. |
|
135 See DebugProtocol.py for a listing of valid protocol tokens. |
|
136 |
|
137 A Python statement consists of the statement to execute, followed (in a |
|
138 separate line) by >OK?<. If the statement was incomplete then the |
|
139 response is >Continue<. If there was an exception then the response |
|
140 is >Exception<. Otherwise the response is >OK<. The reason |
|
141 for the >OK?< part is to provide a sentinal (ie. the responding |
|
142 >OK<) after any possible output as a result of executing the command. |
|
143 |
|
144 The client may send any other lines at any other time which should be |
|
145 interpreted as program output. |
|
146 |
130 |
147 If the debugger closes the session there is no response from the client. |
131 If the debugger closes the session there is no response from the client. |
148 The client may close the session at any time as a result of the script |
132 The client may close the session at any time as a result of the script |
149 being debugged closing or crashing. |
133 being debugged closing or crashing. |
150 |
134 |
188 self.globalsFilterObjects = [] |
172 self.globalsFilterObjects = [] |
189 self.localsFilterObjects = [] |
173 self.localsFilterObjects = [] |
190 |
174 |
191 self._fncache = {} |
175 self._fncache = {} |
192 self.dircache = [] |
176 self.dircache = [] |
193 self.mainProcStr = None # used for the passive mode |
|
194 self.passive = False # used to indicate the passive mode |
177 self.passive = False # used to indicate the passive mode |
195 self.running = None |
178 self.running = None |
196 self.test = None |
179 self.test = None |
197 self.tracePython = False |
180 self.tracePython = False |
198 self.debugging = False |
181 self.debugging = False |