[cig-commits] r6169 - cs/babel/trunk/spike/Spike/Compiler

leif at geodynamics.org leif at geodynamics.org
Fri Mar 2 19:57:07 PST 2007


Author: leif
Date: 2007-03-02 19:57:07 -0800 (Fri, 02 Mar 2007)
New Revision: 6169

Modified:
   cs/babel/trunk/spike/Spike/Compiler/Code.py
Log:
Generate #line directives which point to the user's original source
file (.spk/.pyx), so that crashes are easier to debug under GDB.


Modified: cs/babel/trunk/spike/Spike/Compiler/Code.py
===================================================================
--- cs/babel/trunk/spike/Spike/Compiler/Code.py	2007-03-03 03:53:53 UTC (rev 6168)
+++ cs/babel/trunk/spike/Spike/Compiler/Code.py	2007-03-03 03:57:07 UTC (rev 6169)
@@ -41,10 +41,16 @@
         self.bol = 1
     
     def emit_marker(self):
-        self.f.write("\n");
+        if False:
+            self.f.write("\n");
         self.indent()
-        self.f.write("/* %s */\n" % self.marker)
-        self.marker = None
+        if False:
+            self.f.write('/* "%s":%s */\n' % self.marker[0:2])
+            self.marker = None
+        else:
+            # For debugging under GDB.
+            self.f.write('# %s "%s"\n' % (self.marker[1], self.marker[0]))
+        return
 
     def put(self, code):
         dl = code.count("{") - code.count("}")
@@ -75,8 +81,7 @@
         self.f.write("  " * self.level)
     
     def mark_pos(self, pos):
-        file, line, col = pos
-        self.marker = '"%s":%s' % (file, line)
+        self.marker = pos
 
     def init_labels(self):
         self.label_counter = 0



More information about the cig-commits mailing list