print '}'
print
+ def retraceInterfaceMethod(self, interface, method):
+ print 'static void retrace_%s__%s(trace::Call &call) {' % (interface.name, method.name)
+ self.retraceInterfaceMethodBody(interface, method)
+ print '}'
+ print
+
def retraceFunctionBody(self, function):
- if not function.sideeffects:
- print ' (void)call;'
- return
+ assert function.sideeffects
- if not method.sideeffects:
- print ' (void)call;'
- return
+ self.deserializeArgs(function)
+
+ self.invokeFunction(function)
+
+ self.swizzleValues(function)
+
+ def retraceInterfaceMethodBody(self, interface, method):
++ assert method.sideeffects
+
+ self.deserializeThisPointer(interface)
+
+ self.deserializeArgs(method)
+
+ self.invokeInterfaceMethod(interface, method)
+
+ self.swizzleValues(method)
+
+ def deserializeThisPointer(self, interface):
+ print r' %s *_this;' % (interface.name,)
+ print r' _this = static_cast<%s *>(_obj_map[call.arg(0).toUIntPtr()]);' % (interface.name,)
+ print r' if (!_this) {'
+ print r' retrace::warning(call) << "NULL this pointer\n";'
+ print r' return;'
+ print r' }'
+
+ def deserializeArgs(self, function):
print ' retrace::ScopedAllocator _allocator;'
print ' (void)_allocator;'
success = True
handle_names.add(handle.name)
print
- self.retraceFunctions(api.functions)
+ print 'static std::map<unsigned long long, void *> _obj_map;'
+ print
+
+ functions = filter(self.filterFunction, api.functions)
+ for function in functions:
- self.retraceFunction(function)
++ if function.sideeffects:
++ self.retraceFunction(function)
+ interfaces = api.getAllInterfaces()
+ for interface in interfaces:
+ for method in interface.iterMethods():
- self.retraceInterfaceMethod(interface, method)
++ if method.sideeffects:
++ self.retraceInterfaceMethod(interface, method)
+
+ print 'const retrace::Entry %s[] = {' % self.table_name
+ for function in functions:
- print ' {"%s", &retrace_%s},' % (function.name, function.name)
++ if function.sideeffects:
++ print ' {"%s", &retrace_%s},' % (function.name, function.name)
++ else:
++ print ' {"%s", &retrace::ignore},' % (function.name,)
+ for interface in interfaces:
- for method in interface.iterMethods():
- print ' {"%s::%s", &retrace_%s__%s},' % (interface.name, method.name, interface.name, method.name)
++ for method in interface.iterMethods():
++ if method.sideeffects:
++ print ' {"%s::%s", &retrace_%s__%s},' % (interface.name, method.name, interface.name, method.name)
++ else:
++ print ' {"%s::%s", &retrace::ignore},' % (interface.name, method.name)
+ print ' {NULL, NULL}'
+ print '};'
+ print