Improved handling of debugger sending "<string>".

Tue, 12 Jul 2011 09:08:45 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 12 Jul 2011 09:08:45 +0200
changeset 1171
1ffefa5ca226
parent 1170
a3731e520b28
child 1172
a183f45d3553

Improved handling of debugger sending "<string>".

Debugger/DebuggerInterfacePython.py file | annotate | diff | comparison | revisions
Debugger/DebuggerInterfacePython3.py file | annotate | diff | comparison | revisions
diff -r a3731e520b28 -r 1ffefa5ca226 Debugger/DebuggerInterfacePython.py
--- a/Debugger/DebuggerInterfacePython.py	Sun Jul 10 19:01:08 2011 +0200
+++ b/Debugger/DebuggerInterfacePython.py	Tue Jul 12 09:08:45 2011 +0200
@@ -88,6 +88,9 @@
                 self.translate = self.__remoteTranslation
             else:
                 self.translate = self.__identityTranslation
+        
+        # attribute to remember the name of the executed script
+        self.__scriptName = ""
 
     def __identityTranslation(self, fn, remote2local=True):
         """
@@ -434,6 +437,7 @@
         @keyparam forkChild flag indicating to debug the child after forking (boolean)
         """
         self.__autoContinue = autoContinue
+        self.__scriptName = os.path.abspath(fn)
         
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
@@ -453,6 +457,8 @@
         @keyparam autoFork flag indicating the automatic fork mode (boolean)
         @keyparam forkChild flag indicating to debug the child after forking (boolean)
         """
+        self.__scriptName = os.path.abspath(fn)
+        
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}\n'.format(
@@ -470,6 +476,8 @@
         @keyparam erase flag indicating that coverage info should be
             cleared first (boolean)
         """
+        self.__scriptName = os.path.abspath(fn)
+        
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format(
@@ -485,6 +493,8 @@
         @param wd the working directory for the program (string)
         @keyparam erase flag indicating that timing info should be cleared first (boolean)
         """
+        self.__scriptName = os.path.abspath(fn)
+        
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format(
@@ -709,6 +719,8 @@
                 filename
         @param coverase flag indicating erasure of coverage data is requested
         """
+        self.__scriptName = os.path.abspath(fn)
+        
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}|{2}|{3}|{4:d}|{5}|{6:d}\n'.format(
             DebugProtocol.RequestUTPrepare, fn, tn, tfn, cov, covname, coverase))
@@ -835,7 +847,11 @@
                         excmessage = exclist[1]
                         stack = exclist[2:]
                         if stack and stack[0] and stack[0][0] == "<string>":
-                            stack = []
+                            for stackEntry in stack:
+                                if stackEntry[0] == "<string>":
+                                    stackEntry[0] = self.__scriptName
+                                else:
+                                    break
                     except (IndexError, ValueError, SyntaxError):
                         exctype = None
                         excmessage = ''
@@ -860,6 +876,7 @@
                     continue
                 
                 if resp == DebugProtocol.ResponseExit:
+                    self.__scriptName = ""
                     self.debugServer.signalClientExit(evalArg)
                     continue
                 
diff -r a3731e520b28 -r 1ffefa5ca226 Debugger/DebuggerInterfacePython3.py
--- a/Debugger/DebuggerInterfacePython3.py	Sun Jul 10 19:01:08 2011 +0200
+++ b/Debugger/DebuggerInterfacePython3.py	Tue Jul 12 09:08:45 2011 +0200
@@ -85,6 +85,9 @@
                 self.translate = self.__remoteTranslation
             else:
                 self.translate = self.__identityTranslation
+        
+        # attribute to remember the name of the executed script
+        self.__scriptName = ""
 
     def __identityTranslation(self, fn, remote2local=True):
         """
@@ -430,6 +433,7 @@
         @keyparam forkChild flag indicating to debug the child after forking (boolean)
         """
         self.__autoContinue = autoContinue
+        self.__scriptName = os.path.abspath(fn)
         
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
@@ -449,6 +453,8 @@
         @keyparam autoFork flag indicating the automatic fork mode (boolean)
         @keyparam forkChild flag indicating to debug the child after forking (boolean)
         """
+        self.__scriptName = os.path.abspath(fn)
+        
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}\n'.format(
@@ -466,6 +472,8 @@
         @keyparam erase flag indicating that coverage info should be
             cleared first (boolean)
         """
+        self.__scriptName = os.path.abspath(fn)
+        
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}@@{2}@@{3}@@{4:d}\n'.format(
@@ -481,6 +489,8 @@
         @param wd the working directory for the program (string)
         @keyparam erase flag indicating that timing info should be cleared first (boolean)
         """
+        self.__scriptName = os.path.abspath(fn)
+        
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format(
@@ -705,6 +715,8 @@
                 filename
         @param coverase flag indicating erasure of coverage data is requested
         """
+        self.__scriptName = os.path.abspath(fn)
+        
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}|{2}|{3}|{4:d}|{5}|{6:d}\n'.format(
             DebugProtocol.RequestUTPrepare, fn, tn, tfn, cov, covname, coverase))
@@ -831,7 +843,11 @@
                         excmessage = exclist[1]
                         stack = exclist[2:]
                         if stack and stack[0] and stack[0][0] == "<string>":
-                            stack = []
+                            for stackEntry in stack:
+                                if stackEntry[0] == "<string>":
+                                    stackEntry[0] = self.__scriptName
+                                else:
+                                    break
                     except (IndexError, ValueError, SyntaxError):
                         exctype = None
                         excmessage = ''
@@ -857,6 +873,7 @@
                     continue
                 
                 if resp == DebugProtocol.ResponseExit:
+                    self.__scriptName = ""
                     self.debugServer.signalClientExit(line[eoc:-1])
                     continue
                 

eric ide

mercurial