+ getProcAddressFunctionNames = []
+
+ def traceApi(self, api):
+ if self.getProcAddressFunctionNames:
+ # Generate a function to wrap proc addresses
+ getProcAddressFunction = api.getFunctionByName(self.getProcAddressFunctionNames[0])
+ argType = getProcAddressFunction.args[0].type
+ retType = getProcAddressFunction.type
+
+ print 'static %s _wrapProcAddress(%s procName, %s procPtr);' % (retType, argType, retType)
+ print
+
+ Tracer.traceApi(self, api)
+
+ print 'static %s _wrapProcAddress(%s procName, %s procPtr) {' % (retType, argType, retType)
+ print ' if (!procPtr) {'
+ print ' return procPtr;'
+ print ' }'
+ for function in api.functions:
+ ptype = function_pointer_type(function)
+ pvalue = function_pointer_value(function)
+ print ' if (strcmp("%s", (const char *)procName) == 0) {' % function.name
+ print ' %s = (%s)procPtr;' % (pvalue, ptype)
+ print ' return (%s)&%s;' % (retType, function.name,)
+ print ' }'
+ print ' os::log("apitrace: warning: unknown function \\"%s\\"\\n", (const char *)procName);'
+ print ' return procPtr;'
+ print '}'
+ print
+ else:
+ Tracer.traceApi(self, api)
+