X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wrappers%2Ftrace.py;h=31087e92b722c9ef4b6991078172a67551d1500f;hb=2e0f3ce8e89e94aca25d80d5f1645b06244ee65d;hp=61a2cb95fcf8249c13719464a36bee5891f8f76a;hpb=d7c738e13decf8a8a891008c51b437ccbe3434fb;p=apitrace diff --git a/wrappers/trace.py b/wrappers/trace.py index 61a2cb9..31087e9 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -138,7 +138,7 @@ class ComplexValueSerializer(stdapi.OnceVisitor): def visitPolymorphic(self, polymorphic): if not polymorphic.contextLess: return - print 'static void _write__%s(int selector, const %s & value) {' % (polymorphic.tag, polymorphic.expr) + print 'static void _write__%s(int selector, %s const & value) {' % (polymorphic.tag, polymorphic.expr) print ' switch (selector) {' for cases, type in polymorphic.iterSwitch(): for case in cases: @@ -474,7 +474,7 @@ class Tracer: # 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: @@ -512,7 +512,11 @@ class Tracer: 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: @@ -627,7 +631,8 @@ class Tracer: # 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 @@ -782,7 +787,7 @@ class Tracer: 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();'