DebugClients/Python3/DebugClientBase.py

branch
6_0_x
changeset 4373
54d6d7c772ea
parent 4120
6f0d4d279aeb
equal deleted inserted replaced
4372:5ca53a23d584 4373:54d6d7c772ea
569 exec(code, self.debugMod.__dict__) 569 exec(code, self.debugMod.__dict__)
570 except SystemExit as exc: 570 except SystemExit as exc:
571 res = exc.code 571 res = exc.code
572 atexit._run_exitfuncs() 572 atexit._run_exitfuncs()
573 self.writestream.flush() 573 self.writestream.flush()
574 self.progTerminated(res) 574 self.progTerminated(res, exit=True)
575 return 575 return
576 576
577 if cmd == DebugProtocol.RequestProfile: 577 if cmd == DebugProtocol.RequestProfile:
578 sys.setprofile(None) 578 sys.setprofile(None)
579 import PyProfile 579 import PyProfile
614 except SystemExit as exc: 614 except SystemExit as exc:
615 res = exc.code 615 res = exc.code
616 atexit._run_exitfuncs() 616 atexit._run_exitfuncs()
617 self.prof.save() 617 self.prof.save()
618 self.writestream.flush() 618 self.writestream.flush()
619 self.progTerminated(res) 619 self.progTerminated(res, exit=True)
620 return 620 return
621 621
622 if cmd == DebugProtocol.RequestCoverage: 622 if cmd == DebugProtocol.RequestCoverage:
623 from coverage import coverage 623 from coverage import coverage
624 sys.argv = [] 624 sys.argv = []
665 res = exc.code 665 res = exc.code
666 atexit._run_exitfuncs() 666 atexit._run_exitfuncs()
667 self.cover.stop() 667 self.cover.stop()
668 self.cover.save() 668 self.cover.save()
669 self.writestream.flush() 669 self.writestream.flush()
670 self.progTerminated(res) 670 self.progTerminated(res, exit=True)
671 return 671 return
672 672
673 if cmd == DebugProtocol.RequestShutdown: 673 if cmd == DebugProtocol.RequestShutdown:
674 self.sessionClose() 674 self.sessionClose()
675 return 675 return
1252 1252
1253 @return flag indicating a running debug session (boolean) 1253 @return flag indicating a running debug session (boolean)
1254 """ 1254 """
1255 return self.running 1255 return self.running
1256 1256
1257 def progTerminated(self, status): 1257 def progTerminated(self, status, exit=False):
1258 """ 1258 """
1259 Public method to tell the debugger that the program has terminated. 1259 Public method to tell the debugger that the program has terminated.
1260 1260
1261 @param status the return status 1261 @param status return status
1262 @param exit flag indicating to perform a sys.exit()
1263 @type bool
1262 """ 1264 """
1263 if status is None: 1265 if status is None:
1264 status = 0 1266 status = 0
1265 else: 1267 else:
1266 try: 1268 try:
1270 1272
1271 if self.running: 1273 if self.running:
1272 self.set_quit() 1274 self.set_quit()
1273 self.running = None 1275 self.running = None
1274 self.write('{0}{1:d}\n'.format(DebugProtocol.ResponseExit, status)) 1276 self.write('{0}{1:d}\n'.format(DebugProtocol.ResponseExit, status))
1277 if exit:
1278 sys.exit(status)
1275 1279
1276 # reset coding 1280 # reset coding
1277 self.__coding = self.defaultCoding 1281 self.__coding = self.defaultCoding
1278 1282
1279 def __dumpVariables(self, frmnr, scope, filter): 1283 def __dumpVariables(self, frmnr, scope, filter):

eric ide

mercurial