eric6/DebugClients/Python/ThreadExtension.py

branch
multi_processing
changeset 7376
21df384d6150
parent 7364
bcf6b40e7790
child 7390
052ce4cf06c6
equal deleted inserted replaced
7375:af2500ced7e0 7376:21df384d6150
5 5
6 """ 6 """
7 Module implementing an import hook patching thread modules to get debugged too. 7 Module implementing an import hook patching thread modules to get debugged too.
8 """ 8 """
9 9
10 import os.path 10 import os
11 import sys 11 import sys
12 import importlib 12 import importlib
13 13
14 if sys.version_info[0] == 2: 14 if sys.version_info[0] == 2:
15 import thread as _thread 15 import thread as _thread
174 for threadId, thd in self.threads.items(): 174 for threadId, thd in self.threads.items():
175 d = {"id": threadId} 175 d = {"id": threadId}
176 try: 176 try:
177 d["name"] = threadNames.get(threadId, thd.name) 177 d["name"] = threadNames.get(threadId, thd.name)
178 d["broken"] = thd.isBroken 178 d["broken"] = thd.isBroken
179 d["except"] = thd.isException
179 except Exception: 180 except Exception:
180 d["name"] = 'UnknownThread' 181 d["name"] = 'UnknownThread'
181 d["broken"] = False 182 d["broken"] = False
183 d["except"] = False
182 184
183 threadList.append(d) 185 threadList.append(d)
184 else: 186 else:
185 currentId = -1 187 currentId = -1
186 d = {"id": -1} 188 d = {"id": -1}
187 d["name"] = "MainThread" 189 d["name"] = "MainThread"
188 d["broken"] = self.isBroken 190 d["broken"] = self.isBroken
191 d["except"] = self.isException
189 threadList.append(d) 192 threadList.append(d)
190 193
191 self.sendJsonCommand("ResponseThreadList", { 194 self.sendJsonCommand("ResponseThreadList", {
192 "currentID": currentId, 195 "currentID": currentId,
193 "threadList": threadList, 196 "threadList": threadList,

eric ide

mercurial