DebugClients/Python/DebugClientBase.py

branch
6_1_x
changeset 4643
705ee8ad484f
parent 4632
ca310db386ed
child 4644
99699903c454
equal deleted inserted replaced
4641:9fcce00f9714 4643:705ee8ad484f
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 except: 775 self.currentThread.storeFrameLocals(self.framenr)
776 # Report the exception and the traceback 776 # Report the exception and the traceback
777 try: 777 try:
778 type, value, tb = sys.exc_info() 778 type, value, tb = sys.exc_info()
779 sys.last_type = type 779 sys.last_type = type
780 sys.last_value = value 780 sys.last_value = value
799 799
800 return 800 return
801 801
802 if cmd == DebugProtocol.RequestExec: 802 if cmd == DebugProtocol.RequestExec:
803 _globals = self.currentThread.getCurrentFrame().f_globals 803 _globals = self.currentThread.getCurrentFrame().f_globals
804 _locals = self.currentThread.getFrameLocals(0) 804 _locals = self.currentThread.getFrameLocals(self.framenr)
805 try: 805 try:
806 code = compile(arg + '\n', '<stdin>', 'single') 806 code = compile(arg + '\n', '<stdin>', 'single')
807 exec code in _globals, _locals 807 exec code in _globals, _locals
808 except: 808 self.currentThread.storeFrameLocals(self.framenr)
809 # Report the exception and the traceback 809 # Report the exception and the traceback
810 try: 810 try:
811 type, value, tb = sys.exc_info() 811 type, value, tb = sys.exc_info()
812 sys.last_type = type 812 sys.last_type = type
813 sys.last_value = value 813 sys.last_value = value
992 _locals["sys"].stdout = self.writestream 992 _locals["sys"].stdout = self.writestream
993 exec code in _globals, _locals 993 exec code in _globals, _locals
994 _locals["sys"].stdout = __stdout 994 _locals["sys"].stdout = __stdout
995 else: 995 else:
996 exec code in _globals, _locals 996 exec code in _globals, _locals
997
998 self.currentThread.storeFrameLocals(self.framenr)
997 except SystemExit, exc: 999 except SystemExit, exc:
998 self.progTerminated(exc.code) 1000 self.progTerminated(exc.code)
999 except: 1001 except:
1000 # Report the exception and the traceback 1002 # Report the exception and the traceback
1001 try: 1003 try:
1354 dict = self.debugMod.__dict__ 1356 dict = self.debugMod.__dict__
1355 else: 1357 else:
1356 scope = -1 1358 scope = -1
1357 elif scope: 1359 elif scope:
1358 dict = f.f_globals 1360 dict = f.f_globals
1361 elif f.f_globals is f.f_locals:
1362 scope = -1
1359 else: 1363 else:
1360 dict = f.f_locals 1364 dict = f.f_locals
1361 1365
1362 if f.f_globals is f.f_locals:
1363 scope = -1
1364
1365 varlist = [scope] 1366 varlist = [scope]
1366 1367
1367 if scope != -1: 1368 if scope != -1:
1368 keylist = dict.keys() 1369 keylist = dict.keys()
1369 1370
1399 dict = self.debugMod.__dict__ 1400 dict = self.debugMod.__dict__
1400 else: 1401 else:
1401 scope = -1 1402 scope = -1
1402 elif scope: 1403 elif scope:
1403 dict = f.f_globals 1404 dict = f.f_globals
1405 elif f.f_globals is f.f_locals:
1406 scope = -1
1404 else: 1407 else:
1405 dict = f.f_locals 1408 dict = f.f_locals
1406 1409
1407 if f.f_globals is f.f_locals:
1408 scope = -1
1409
1410 varlist = [scope, var] 1410 varlist = [scope, var]
1411 1411
1412 if scope != -1: 1412 if scope != -1:
1413 # search the correct dictionary 1413 # search the correct dictionary
1414 i = 0 1414 i = 0

eric ide

mercurial