shithub: pokecrystal

Download patch

ref: 9e92ebd40b6880ac41c639824aaa389592297dab
parent: 7ed1bebc01b9c5e31713f5bc65dec45c66b2c31d
author: Bryan Bishop <[email protected]>
date: Fri Apr 27 09:58:02 EDT 2012

better debugging for a max recursion depth error

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -4390,12 +4390,21 @@
     then you're losing out on the main value of having asm in the
     first place.
     """
-    if isinstance(some_object, int):
-        some_object = script_parse_table[some_object]
-    if some_object.dependencies != None and not recompute:
-        return list(flatten(some_object.dependencies))
-    deps = some_object.get_dependencies(recompute=recompute)
-    return list(flatten(deps))
+    try:
+        if isinstance(some_object, int):
+            some_object = script_parse_table[some_object]
+        if some_object.dependencies != None and not recompute:
+            return list(flatten(some_object.dependencies))
+        deps = some_object.get_dependencies(recompute=recompute)
+        return list(flatten(deps))
+    except RuntimeError, e:
+        #1552, 1291, 2075, 1552, 1291...
+        print "some_object is: " + str(some_object)
+        print "class type: " + str(some_object.__class__)
+        print "label name: " + str(some_object.label.name)
+        print "address: " + str(some_object.address)
+        print "asm is: \n\n" + to_asm(some_object)
+        raise e
 
 def isolate_incbins():
     "find each incbin line"
@@ -4771,8 +4780,11 @@
         start_address = new_object.address
         end_address = new_object.last_address
         if self.debug:
-            print "object is type="+str(new_object.__class__)+" new_object="+str(new_object)
-            print "start_address="+hex(start_address)+" end_address="+hex(end_address)
+            debugmsg  = "object is " + new_object.label.name + " type="+str(new_object.__class__)+" new_object="+str(new_object)
+            debugmsg += " start_address="+hex(start_address)+" end_address="+hex(end_address)
+            debugmsg += " label = " + new_object.label.name
+            print debugmsg
+            del debugmsg
         if (end_address < start_address) or ((end_address - start_address) < 0):
             if not self.debug:
                 print "object is type="+str(new_object.__class__)+" new_object="+str(new_object)