]> git.cworth.org Git - apitrace/blobdiff - retrace.py
Fix a crash when loading multiple frames at once.
[apitrace] / retrace.py
index 3b68d6018eee0ac19e4ce6138e8d198dff9ed9a4..9092f351366a2377231761c962e2c1daec382879 100644 (file)
@@ -26,9 +26,8 @@
 
 """Generic retracing code generator."""
 
-import stdapi
-import glapi
-from codegen import *
+import specs.stdapi as stdapi
+import specs.glapi as glapi
 
 
 class ConstRemover(stdapi.Rebuilder):
@@ -234,6 +233,9 @@ class Retracer:
 
     def extract_arg(self, function, arg, arg_type, lvalue, rvalue):
         ValueExtractor().visit(arg_type, lvalue, rvalue)
+    
+    def extract_opaque_arg(self, function, arg, arg_type, lvalue, rvalue):
+        OpaqueValueExtractor().visit(arg_type, lvalue, rvalue)
 
     def call_function(self, function):
         arg_names = ", ".join([arg.name for arg in function.args])
@@ -247,27 +249,19 @@ class Retracer:
     def filter_function(self, function):
         return True
 
+    table_name = 'retrace::callbacks'
+
     def retrace_functions(self, functions):
         functions = filter(self.filter_function, functions)
 
         for function in functions:
             self.retrace_function(function)
 
-        print 'void retrace::retrace_call(Trace::Call &call) {'
-        print '    const char *name = call.name().c_str();'
-        print
-
-        func_dict = dict([(function.name, function) for function in functions])
-
-        def handle_case(function_name):
-            function = func_dict[function_name]
-            print '        retrace_%s(call);' % function.name
-            print '        return;'
-    
-        string_switch('name', func_dict.keys(), handle_case)
-
-        print '    retrace_unknown(call);'
-        print '}'
+        print 'const retrace::Entry %s[] = {' % self.table_name
+        for function in functions:
+            print '    {"%s", &retrace_%s},' % (function.name, function.name)
+        print '    {NULL, NULL}'
+        print '};'
         print