21 |
21 |
22 Provides simple wrapper methods around bdb for the 'owning' client to |
22 Provides simple wrapper methods around bdb for the 'owning' client to |
23 call to step etc. |
23 call to step etc. |
24 """ |
24 """ |
25 def __init__(self, dbgClient, targ=None, args=None, kwargs=None, |
25 def __init__(self, dbgClient, targ=None, args=None, kwargs=None, |
26 mainThread=0): |
26 mainThread=False): |
27 """ |
27 """ |
28 Constructor |
28 Constructor |
29 |
29 |
30 @param dbgClient the owning client |
30 @param dbgClient the owning client |
31 @param targ the target method in the run thread |
31 @param targ the target method in the run thread |
32 @param args arguments to be passed to the thread |
32 @param args arguments to be passed to the thread |
33 @param kwargs arguments to be passed to the thread |
33 @param kwargs arguments to be passed to the thread |
34 @param mainThread 0 if this thread is not the mainscripts thread |
34 @param mainThread False if this thread is not the main script's thread |
35 """ |
35 """ |
36 DebugBase.__init__(self, dbgClient) |
36 DebugBase.__init__(self, dbgClient) |
37 |
37 |
38 self._target = targ |
38 self._target = targ |
39 self._args = args |
39 self._args = args |
40 self._kwargs = kwargs |
40 self._kwargs = kwargs |
41 self._mainThread = mainThread |
41 self._mainThread = mainThread |
42 # thread running tracks execution state of client code |
42 # thread running tracks execution state of client code |
43 # it will always be 0 for main thread as that is tracked |
43 # it will always be 0 for main thread as that is tracked |
44 # by DebugClientThreads and Bdb... |
44 # by DebugClientThreads and Bdb... |
45 self._threadRunning = 0 |
45 self._threadRunning = False |
46 |
46 |
47 self.__ident = None # id of this thread. |
47 self.__ident = None # id of this thread. |
48 self.__name = "" |
48 self.__name = "" |
49 self.tracePython = False |
49 self.tracePython = False |
50 |
50 |
87 It wraps the call to the user function to enable tracing |
87 It wraps the call to the user function to enable tracing |
88 before hand. |
88 before hand. |
89 """ |
89 """ |
90 try: |
90 try: |
91 try: |
91 try: |
92 self._threadRunning = 1 |
92 self._threadRunning = True |
93 self.traceThread() |
93 self.traceThread() |
94 self._target(*self._args, **self._kwargs) |
94 self._target(*self._args, **self._kwargs) |
95 except bdb.BdbQuit: |
95 except bdb.BdbQuit: |
96 pass |
96 pass |
97 finally: |
97 finally: |
98 self._threadRunning = 0 |
98 self._threadRunning = False |
99 self.quitting = 1 |
99 self.quitting = True |
100 self._dbgClient.threadTerminated(self) |
100 self._dbgClient.threadTerminated(self) |
101 sys.settrace(None) |
101 sys.settrace(None) |
102 sys.setprofile(None) |
102 sys.setprofile(None) |
103 |
103 |
104 def trace_dispatch(self, frame, event, arg): |
104 def trace_dispatch(self, frame, event, arg): |