Kaynağa Gözat

Added debug symbol readout in MvK

Yentl Van Tendeloo 9 yıl önce
ebeveyn
işleme
b9a60fd509
2 değiştirilmiş dosya ile 9 ekleme ve 7 silme
  1. 8 6
      kernel/modelverse_kernel/main.py
  2. 1 1
      make_parallel.sh

+ 8 - 6
kernel/modelverse_kernel/main.py

@@ -14,6 +14,7 @@ class ModelverseKernel(object):
         self.returnvalue = None
         self.success = True
         self.generators = {}
+        self.debug = "(init):0"
 
     def execute_yields(self, username, operation, params, reply):
         try:
@@ -39,6 +40,7 @@ class ModelverseKernel(object):
         inst, phase =   yield [("RD", [user_frame, "IP"]),
                                ("RD", [user_frame, "phase"]),
                               ]
+        self.debug_info=yield [("RD", [inst, "__debug"])]
         phase_v, inst_v=yield [("RV", [phase]),
                                ("RV", [inst]),
                               ]
@@ -53,12 +55,12 @@ class ModelverseKernel(object):
                 #print("%-30s(%s)" % (inst_v["value"], phase_v))
                 gen = getattr(self, "%s_%s" % (inst_v["value"], phase_v))(user_root)
         elif inst_v is None:
-            raise Exception("Could not understand instruction/phase combination: %s -- %s" % (inst_v, phase_v))
+            raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
         elif inst_v["value"] == "call":
             #print("%-30s(%s)" % ("call", "param"))
             gen = self.call_param(user_root)
         else:
-            raise Exception("Could not understand instruction/phase combination: %s -- %s" % (inst_v, phase_v))
+            raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
 
         try:
             inp = None
@@ -117,7 +119,7 @@ class ModelverseKernel(object):
                 inp = yield prim.send(inp)
         except StopIteration:
             # Execution has ended without return value, so we have no idea what to do
-            raise Exception("Primitive finished without returning a value!")
+            raise Exception("%s: primitive finished without returning a value!" % (self.debug_info))
         except primitive_functions.PrimitiveFinished as e:
             # Execution has ended with a returnvalue, so read it out from the exception being thrown
             result = e.result
@@ -413,7 +415,7 @@ class ModelverseKernel(object):
                                    ("CNV", ["finish"]),
                                   ]
             if variable is None:
-                raise Exception("Not found as global: %s" % var_name)
+                raise Exception("%s: not found as global: %s" % (self.debug_info, var_name))
         else:
             phase_link, returnvalue_link, new_phase = \
                             yield [("RDE", [user_frame, "phase"]),
@@ -709,9 +711,9 @@ class ModelverseKernel(object):
         if len(matches) == 1:
             return matches[0]
         elif len(matches) > 1:
-            raise Exception("Multiple overlapping elements")
+            raise Exception("%s: error: multiple overlapping elements" % self.debug_info)
         else:
-            raise Exception("Could not find any overlap")
+            raise Exception("%s: error: could not find any overlap" % self.debug_info)
 
     def call_param(self, user_root):
         #TODO this code is likely very buggy!

+ 1 - 1
make_parallel.sh

@@ -6,7 +6,7 @@ shift
 
 for f in "$@"
 do
-    ./compile.sh $f $RANDOM $f PO &
+    ./compile.sh $f $RANDOM $f PO --debug &
 done
 
 for job in `jobs -p`