print 'static const char * _%s_args[%u] = {%s};' % (function.name, len(function.args), ', '.join(['"%s"' % arg.name for arg in function.args]))
else:
print 'static const char ** _%s_args = NULL;' % (function.name,)
- print 'static trace::FunctionSig _%s_sig = {%u, "%s", %u, _%s_args};' % (function.name, self.getFunctionSigId(), function.name, len(function.args), function.name)
+ print 'static const trace::FunctionSig _%s_sig = {%u, "%s", %u, _%s_args};' % (function.name, self.getFunctionSigId(), function.name, len(function.args), function.name)
print
def getFunctionSigId(self):
# No-op if tracing is disabled
print ' if (!trace::isTracingEnabled()) {'
- Tracer.invokeFunction(self, function)
+ self.doInvokeFunction(function)
if function.type is not stdapi.Void:
print ' return _result;'
else:
self.wrapRet(function, "_result")
print ' trace::localWriter.endLeave();'
- def invokeFunction(self, function, prefix='_', suffix=''):
+ def invokeFunction(self, function):
+ self.doInvokeFunction(function)
+
+ def doInvokeFunction(self, function, prefix='_', suffix=''):
+ # Same as invokeFunction() but called both when trace is enabled or disabled.
if function.type is stdapi.Void:
result = ''
else:
# Private constructor
print '%s::%s(%s * pInstance) {' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface), interface.name)
for type, name, value in self.enumWrapperInterfaceVariables(interface):
- print ' %s = %s;' % (name, value)
+ if value is not None:
+ print ' %s = %s;' % (name, value)
print '}'
print
assert not method.internal
print ' static const char * _args[%u] = {%s};' % (len(method.args) + 1, ', '.join(['"this"'] + ['"%s"' % arg.name for arg in method.args]))
- print ' static trace::FunctionSig _sig = {%u, "%s", %u, _args};' % (self.getFunctionSigId(), interface.name + '::' + method.name, len(method.args) + 1)
+ print ' static const trace::FunctionSig _sig = {%u, "%s", %u, _args};' % (self.getFunctionSigId(), interface.name + '::' + method.name, len(method.args) + 1)
print ' %s *_this = static_cast<%s *>(m_pInstance);' % (base, base)
print ' %s_this->%s(%s);' % (result, method.name, ', '.join([str(arg.name) for arg in method.args]))
def emit_memcpy(self, dest, src, length):
- print ' unsigned _call = trace::localWriter.beginEnter(&trace::memcpy_sig);'
+ print ' unsigned _call = trace::localWriter.beginEnter(&trace::memcpy_sig, true);'
print ' trace::localWriter.beginArg(0);'
print ' trace::localWriter.writePointer((uintptr_t)%s);' % dest
print ' trace::localWriter.endArg();'