diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-06-30 10:37:19 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-06-30 10:37:19 +0100 |
commit | 3615c3435decb91d746f952435e4d60b50c304ae (patch) | |
tree | 6b9bbbd7a94593922487ef0b0a0203589cc5cb7e /wrappers | |
parent | dad8f1e68d5aed52f5041923b50919dce9ee6505 (diff) |
trace: Add more COM debugging.
To try to diagnose regression introduced by ealier commits, whereby
map_buffer randomly fail, but only on special circunstances.
Diffstat (limited to 'wrappers')
-rw-r--r-- | wrappers/trace.py | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/wrappers/trace.py b/wrappers/trace.py index 6773f7e2..41a99cfc 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -676,8 +676,6 @@ class Tracer: print r'#include "guids.hpp"' print - map(self.declareWrapperInterface, interfaces) - # Helper functions to wrap/unwrap interface pointers print r'static inline bool' print r'hasChildInterface(REFIID riid, IUnknown *pUnknown) {' @@ -696,6 +694,27 @@ class Tracer: print r' return pvObj ? *(const void **)pvObj : NULL;' print r'}' print + print r'static void' + print r'warnVtbl(const void *pVtbl) {' + print r' HMODULE hModule = 0;' + print r' BOOL bRet = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |' + print r' GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,' + print r' (LPCTSTR)pVtbl,' + print r' &hModule);' + print r' assert(bRet);' + print r' if (bRet) {' + print r' char szModule[MAX_PATH];' + print r' DWORD dwRet = GetModuleFileNameA(hModule, szModule, sizeof szModule);' + print r' assert(dwRet);' + print r' if (dwRet) {' + print r' DWORD dwOffset = (UINT_PTR)pVtbl - (UINT_PTR)hModule;' + print r' os::log("apitrace: warning: pVtbl = %p (%s!+0x%0lx)\n", pVtbl, szModule, dwOffset);' + print r' }' + print r' }' + print r'}' + print + + map(self.declareWrapperInterface, interfaces) self.implementIidWrapper(api) @@ -727,6 +746,8 @@ class Tracer: print r'private:' print r' void _dummy(unsigned i) const {' print r' os::log("error: %%s: unexpected virtual method %%i of instance pWrapper=%%p pvObj=%%p pVtbl=%%p\n", "%s", i, this, m_pInstance, m_pVtbl);' % interface.name + print r' warnVtbl(m_pVtbl);' + print r' warnVtbl(getVtbl(m_pInstance));' print r' trace::localWriter.flush();' print r' os::abort();' print r' }' @@ -920,22 +941,8 @@ class Tracer: print r' os::log("apitrace: warning: %s: %s IID %s\n",' print r' entryName, reason,' print r' getGuidName(riid));' - print r' void * pVtbl = *(void **)pvObj;' - print r' HMODULE hModule = 0;' - print r' BOOL bRet = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |' - print r' GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,' - print r' (LPCTSTR)pVtbl,' - print r' &hModule);' - print r' assert(bRet);' - print r' if (bRet) {' - print r' char szModule[MAX_PATH];' - print r' DWORD dwRet = GetModuleFileNameA(hModule, szModule, sizeof szModule);' - print r' assert(dwRet);' - print r' if (dwRet) {' - print r' DWORD dwOffset = (UINT_PTR)pVtbl - (UINT_PTR)hModule;' - print r' os::log("apitrace: warning: pVtbl = %p (%s!+0x%0lx)\n", pVtbl, szModule, dwOffset);' - print r' }' - print r' }' + print r' const void * pVtbl = getVtbl(pvObj);' + print r' warnVtbl(pVtbl);' print r'}' print print r'static void' |