DebugClients/Python/DebugClientBase.py

changeset 2953
703452a2876f
parent 2761
bcc10ef7015d
child 2987
c99695c0f13a
equal deleted inserted replaced
2952:94fc661a54a2 2953:703452a2876f
36 """ 36 """
37 Replacement for the standard raw_input builtin. 37 Replacement for the standard raw_input builtin.
38 38
39 This function works with the split debugger. 39 This function works with the split debugger.
40 40
41 @param prompt The prompt to be shown. (string) 41 @param prompt prompt to be shown. (string)
42 @param echo Flag indicating echoing of the input (boolean) 42 @param echo flag indicating echoing of the input (boolean)
43 @return result of the raw_input() call
43 """ 44 """
44 if DebugClientInstance is None or DebugClientInstance.redirect == 0: 45 if DebugClientInstance is None or DebugClientInstance.redirect == 0:
45 return DebugClientOrigRawInput(prompt) 46 return DebugClientOrigRawInput(prompt)
46 47
47 return DebugClientInstance.raw_input(prompt, echo) 48 return DebugClientInstance.raw_input(prompt, echo)
62 """ 63 """
63 Replacement for the standard input builtin. 64 Replacement for the standard input builtin.
64 65
65 This function works with the split debugger. 66 This function works with the split debugger.
66 67
67 @param prompt The prompt to be shown. (string) 68 @param prompt prompt to be shown (string)
69 @return result of the input() call
68 """ 70 """
69 if DebugClientInstance is None or DebugClientInstance.redirect == 0: 71 if DebugClientInstance is None or DebugClientInstance.redirect == 0:
70 return DebugClientOrigInput(prompt) 72 return DebugClientOrigInput(prompt)
71 73
72 return DebugClientInstance.input(prompt) 74 return DebugClientInstance.input(prompt)
84 86
85 87
86 def DebugClientFork(): 88 def DebugClientFork():
87 """ 89 """
88 Replacement for the standard os.fork(). 90 Replacement for the standard os.fork().
91
92 @return result of the fork() call
89 """ 93 """
90 if DebugClientInstance is None: 94 if DebugClientInstance is None:
91 return DebugClientOrigFork() 95 return DebugClientOrigFork()
92 96
93 return DebugClientInstance.fork() 97 return DebugClientInstance.fork()
294 @param target the start function of the target thread (i.e. the user code) 298 @param target the start function of the target thread (i.e. the user code)
295 @param args arguments to pass to target 299 @param args arguments to pass to target
296 @param kwargs keyword arguments to pass to target 300 @param kwargs keyword arguments to pass to target
297 @param mainThread non-zero, if we are attaching to the already 301 @param mainThread non-zero, if we are attaching to the already
298 started mainthread of the app 302 started mainthread of the app
299 @return The identifier of the created thread
300 """ 303 """
301 if self.debugging: 304 if self.debugging:
302 sys.setprofile(self.profile) 305 sys.setprofile(self.profile)
303 306
304 def __dumpThreadList(self): 307 def __dumpThreadList(self):
347 """ 350 """
348 return eval(self.raw_input(prompt, 1)) 351 return eval(self.raw_input(prompt, 1))
349 352
350 def __exceptionRaised(self): 353 def __exceptionRaised(self):
351 """ 354 """
352 Private method called in the case of an exception 355 Private method called in the case of an exception.
353 356
354 It ensures that the debug server is informed of the raised exception. 357 It ensures that the debug server is informed of the raised exception.
355 """ 358 """
356 self.pendingResponse = DebugProtocol.ResponseException 359 self.pendingResponse = DebugProtocol.ResponseException
357 360
1201 return 0 1204 return 0
1202 1205
1203 def getRunning(self): 1206 def getRunning(self):
1204 """ 1207 """
1205 Public method to return the main script we are currently running. 1208 Public method to return the main script we are currently running.
1209
1210 @return flag indicating a running debug session (boolean)
1206 """ 1211 """
1207 return self.running 1212 return self.running
1208 1213
1209 def progTerminated(self, status): 1214 def progTerminated(self, status):
1210 """ 1215 """
2020 else: 2025 else:
2021 print "No network port given. Aborting..." 2026 print "No network port given. Aborting..."
2022 2027
2023 def fork(self): 2028 def fork(self):
2024 """ 2029 """
2025 Public method implementing a fork routine deciding which branch to follow. 2030 Public method implementing a fork routine deciding which branch to
2031 follow.
2032
2033 @return process ID (integer)
2026 """ 2034 """
2027 if not self.fork_auto: 2035 if not self.fork_auto:
2028 self.write(DebugProtocol.RequestForkTo + '\n') 2036 self.write(DebugProtocol.RequestForkTo + '\n')
2029 self.eventLoop(True) 2037 self.eventLoop(True)
2030 pid = DebugClientOrigFork() 2038 pid = DebugClientOrigFork()

eric ide

mercurial