]> git.cworth.org Git - apitrace/blobdiff - retrace/retrace.py
d3dretrace: Dump d3d10 snapshots too.
[apitrace] / retrace / retrace.py
index 2dd8e2f12a2ae0d825c9c61f079946a91b1b4699..c4ad2d2bb494aceb861dcf163818bb702af58622 100644 (file)
@@ -242,7 +242,7 @@ class SwizzledValueRegistrator(stdapi.Visitor):
         pass
     
     def visitObjPointer(self, pointer, lvalue, rvalue):
-        print r'    retrace::addObj(%s, %s);' % (rvalue, lvalue)
+        print r'    retrace::addObj(call, %s, %s);' % (rvalue, lvalue)
     
     def visitLinearPointer(self, pointer, lvalue, rvalue):
         assert pointer.size is not None
@@ -434,6 +434,7 @@ class Retracer:
         if function.type is not stdapi.Void:
             print '    _result = %s(%s);' % (function.name, arg_names)
             print '    (void)_result;'
+            self.checkResult(function.type)
         else:
             print '    %s(%s);' % (function.name, arg_names)
 
@@ -450,9 +451,16 @@ class Retracer:
         if method.type is not stdapi.Void:
             print '    _result = _this->%s(%s);' % (method.name, arg_names)
             print '    (void)_result;'
+            self.checkResult(method.type)
         else:
             print '    _this->%s(%s);' % (method.name, arg_names)
 
+    def checkResult(self, resultType):
+        if str(resultType) == 'HRESULT':
+            print r'    if (FAILED(_result)) {'
+            print r'        retrace::warning(call) << "failed\n";'
+            print r'    }'
+
     def filterFunction(self, function):
         return True
 
@@ -479,7 +487,7 @@ class Retracer:
                 handle_names.add(handle.name)
         print
 
-        functions = filter(self.filterFunction, api.functions)
+        functions = filter(self.filterFunction, api.getAllFunctions())
         for function in functions:
             if function.sideeffects and not function.internal:
                 self.retraceFunction(function)