]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/msw/debughlp.h
synchronize GTK2 minimum version in docs
[wxWidgets.git] / include / wx / msw / debughlp.h
index a4b945ee81eb83acbe807a8b91d94ea9009ecf44..cdfaae6250a20d7d84687d13ed5ee2acf7be5b4f 100644 (file)
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        wx/msw/wrapdbgh.h
+// Name:        wx/msw/debughlp.h
 // Purpose:     wraps dbghelp.h standard file
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -146,9 +146,9 @@ public:
                                        PGET_MODULE_BASE_ROUTINE,
                                        PTRANSLATE_ADDRESS_ROUTINE);
     typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO);
-    typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD);
-    typedef DWORD (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD);
-    typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD,
+    typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD_PTR);
+    typedef DWORD_PTR (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD_PTR);
+    typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD_PTR,
                                                 PDWORD, PIMAGEHLP_LINE);
     typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME,
                                            PIMAGEHLP_CONTEXT);
@@ -164,23 +164,44 @@ public:
                                                CONST PMINIDUMP_USER_STREAM_INFORMATION,
                                                CONST PMINIDUMP_CALLBACK_INFORMATION);
 
+    // The macro called by wxDO_FOR_ALL_SYM_FUNCS() below takes 2 arguments:
+    // the name of the function in the program code, which never has "64"
+    // suffix, and the name of the function in the DLL which can have "64"
+    // suffix in some cases. These 2 helper macros call the macro with the
+    // correct arguments in both cases.
+    #define wxSYM_CALL(what, name)  what(name, name)
+#if defined(_M_AMD64)
+    #define wxSYM_CALL_64(what, name)  what(name, name ## 64)
+
+    // Also undo all the "helpful" definitions done by imagehlp.h that map 32
+    // bit functions to 64 bit ones, we don't need this as we do it ourselves.
+    #undef StackWalk
+    #undef SymFunctionTableAccess
+    #undef SymGetModuleBase
+    #undef SymGetLineFromAddr
+    #undef EnumerateLoadedModules
+#else
+    #define wxSYM_CALL_64(what, name)  what(name, name)
+#endif
+
     #define wxDO_FOR_ALL_SYM_FUNCS(what)                                      \
-        what(SymGetOptions);                                                  \
-        what(SymSetOptions);                                                  \
-        what(SymInitialize);                                                  \
-        what(StackWalk);                                                      \
-        what(SymFromAddr);                                                    \
-        what(SymFunctionTableAccess);                                         \
-        what(SymGetModuleBase);                                               \
-        what(SymGetLineFromAddr);                                             \
-        what(SymSetContext);                                                  \
-        what(SymEnumSymbols);                                                 \
-        what(SymGetTypeInfo);                                                 \
-        what(SymCleanup);                                                     \
-        what(EnumerateLoadedModules);                                         \
-        what(MiniDumpWriteDump)
-
-    #define wxDECLARE_SYM_FUNCTION(func) static func ## _t func
+        wxSYM_CALL_64(what, StackWalk);                                       \
+        wxSYM_CALL_64(what, SymFunctionTableAccess);                          \
+        wxSYM_CALL_64(what, SymGetModuleBase);                                \
+        wxSYM_CALL_64(what, SymGetLineFromAddr);                              \
+        wxSYM_CALL_64(what, EnumerateLoadedModules);                          \
+                                                                              \
+        wxSYM_CALL(what, SymGetOptions);                                      \
+        wxSYM_CALL(what, SymSetOptions);                                      \
+        wxSYM_CALL(what, SymInitialize);                                      \
+        wxSYM_CALL(what, SymFromAddr);                                        \
+        wxSYM_CALL(what, SymSetContext);                                      \
+        wxSYM_CALL(what, SymEnumSymbols);                                     \
+        wxSYM_CALL(what, SymGetTypeInfo);                                     \
+        wxSYM_CALL(what, SymCleanup);                                         \
+        wxSYM_CALL(what, MiniDumpWriteDump)
+
+    #define wxDECLARE_SYM_FUNCTION(func, name) static func ## _t func
 
     wxDO_FOR_ALL_SYM_FUNCS(wxDECLARE_SYM_FUNCTION);