DebugClients/Python/DebugClientBase.py

changeset 4642
f18d5fb9a53b
parent 4631
5c1a96925da4
child 4830
f609a22f43bd
child 4833
803bf753032a
equal deleted inserted replaced
4640:0b502e1bc0b9 4642:f18d5fb9a53b
769 769
770 if cmd == DebugProtocol.RequestEval: 770 if cmd == DebugProtocol.RequestEval:
771 try: 771 try:
772 value = eval( 772 value = eval(
773 arg, self.currentThread.getCurrentFrame().f_globals, 773 arg, self.currentThread.getCurrentFrame().f_globals,
774 self.currentThread.getFrameLocals(0)) 774 self.currentThread.getFrameLocals(self.framenr))
775 self.currentThread.storeFrameLocals(self.framenr)
775 except Exception: 776 except Exception:
776 # Report the exception and the traceback 777 # Report the exception and the traceback
777 try: 778 try:
778 type, value, tb = sys.exc_info() 779 type, value, tb = sys.exc_info()
779 sys.last_type = type 780 sys.last_type = type
799 800
800 return 801 return
801 802
802 if cmd == DebugProtocol.RequestExec: 803 if cmd == DebugProtocol.RequestExec:
803 _globals = self.currentThread.getCurrentFrame().f_globals 804 _globals = self.currentThread.getCurrentFrame().f_globals
804 _locals = self.currentThread.getFrameLocals(0) 805 _locals = self.currentThread.getFrameLocals(self.framenr)
805 try: 806 try:
806 code = compile(arg + '\n', '<stdin>', 'single') 807 code = compile(arg + '\n', '<stdin>', 'single')
807 exec code in _globals, _locals 808 exec code in _globals, _locals
809 self.currentThread.storeFrameLocals(self.framenr)
808 except Exception: 810 except Exception:
809 # Report the exception and the traceback 811 # Report the exception and the traceback
810 try: 812 try:
811 type, value, tb = sys.exc_info() 813 type, value, tb = sys.exc_info()
812 sys.last_type = type 814 sys.last_type = type
992 _locals["sys"].stdout = self.writestream 994 _locals["sys"].stdout = self.writestream
993 exec code in _globals, _locals 995 exec code in _globals, _locals
994 _locals["sys"].stdout = __stdout 996 _locals["sys"].stdout = __stdout
995 else: 997 else:
996 exec code in _globals, _locals 998 exec code in _globals, _locals
999
1000 self.currentThread.storeFrameLocals(self.framenr)
997 except SystemExit, exc: 1001 except SystemExit, exc:
998 self.progTerminated(exc.code) 1002 self.progTerminated(exc.code)
999 except Exception: 1003 except Exception:
1000 # Report the exception and the traceback 1004 # Report the exception and the traceback
1001 try: 1005 try:
1354 dict = self.debugMod.__dict__ 1358 dict = self.debugMod.__dict__
1355 else: 1359 else:
1356 scope = -1 1360 scope = -1
1357 elif scope: 1361 elif scope:
1358 dict = f.f_globals 1362 dict = f.f_globals
1363 elif f.f_globals is f.f_locals:
1364 scope = -1
1359 else: 1365 else:
1360 dict = f.f_locals 1366 dict = f.f_locals
1361 1367
1362 if f.f_globals is f.f_locals:
1363 scope = -1
1364
1365 varlist = [scope] 1368 varlist = [scope]
1366 1369
1367 if scope != -1: 1370 if scope != -1:
1368 keylist = dict.keys() 1371 keylist = dict.keys()
1369 1372
1399 dict = self.debugMod.__dict__ 1402 dict = self.debugMod.__dict__
1400 else: 1403 else:
1401 scope = -1 1404 scope = -1
1402 elif scope: 1405 elif scope:
1403 dict = f.f_globals 1406 dict = f.f_globals
1407 elif f.f_globals is f.f_locals:
1408 scope = -1
1404 else: 1409 else:
1405 dict = f.f_locals 1410 dict = f.f_locals
1406 1411
1407 if f.f_globals is f.f_locals:
1408 scope = -1
1409
1410 varlist = [scope, var] 1412 varlist = [scope, var]
1411 1413
1412 if scope != -1: 1414 if scope != -1:
1413 # search the correct dictionary 1415 # search the correct dictionary
1414 i = 0 1416 i = 0

eric ide

mercurial