From 8e57639ff51deaa905d7b54793172cb0b49fad3e Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 10 Feb 2011 11:54:00 -0700 Subject: [PATCH] use packed version of MINIDUMP_EXCEPTION_INFORMATION dbghelp.dll expects that MINIDUMP_EXCEPTION_INFORMATION has a packed layout and will crash if it doesn't (at least on 64-bit systems), but as of this writing mingw-w64's version is not declared to be so. Hence this workaround. --- src/windows.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/windows.cpp b/src/windows.cpp index 0079121d2f..d230e1eb3d 100644 --- a/src/windows.cpp +++ b/src/windows.cpp @@ -856,6 +856,16 @@ typedef BOOL (*MiniDumpWriteDumpType) const MINIDUMP_USER_STREAM_INFORMATION* userStream, const MINIDUMP_CALLBACK_INFORMATION* callback); +// dbghelp.dll expects that MINIDUMP_EXCEPTION_INFORMATION has a +// packed layout and will crash if it doesn't (at least on 64-bit +// systems), but as of this writing mingw-w64's version is not +// declared to be so. Hence this workaround: +struct __attribute__ ((__packed__)) My_MINIDUMP_EXCEPTION_INFORMATION { + DWORD ThreadId; + PEXCEPTION_POINTERS ExceptionPointers; + WINBOOL ClientPointers; +}; + void dump(LPEXCEPTION_POINTERS e, const char* directory) { @@ -877,7 +887,7 @@ dump(LPEXCEPTION_POINTERS e, const char* directory) (name, FILE_WRITE_DATA, 0, 0, CREATE_ALWAYS, 0, 0); if (file != INVALID_HANDLE_VALUE) { - MINIDUMP_EXCEPTION_INFORMATION exception + My_MINIDUMP_EXCEPTION_INFORMATION exception = { GetCurrentThreadId(), e, true }; MiniDumpWriteDump @@ -885,7 +895,7 @@ dump(LPEXCEPTION_POINTERS e, const char* directory) GetCurrentProcessId(), file, MiniDumpWithFullMemory, - &exception, + reinterpret_cast(&exception), 0, 0);