2011/2/11 Joel Dice <[email protected]>:
> Hi all,
>
> My application uses AddVectoredExceptionHandler to register an exception
> handler which, if it can't handle the exception, tries to create a mini
> dump file for later analysis.  This involves using MiniDumpWriteDump from
> dbghelp.dll, which accepts a pointer to a MINIDUMP_EXCEPTION_INFORMATION
> instance which wraps the LPEXCEPTION_POINTERS instance provided to the
> exception handler by the OS.
>
> All this works great on 32-bit systems, but crashes on 64-bit ones.  To
> find out why, I ran my app in WinDbg and found that code in
> MiniDumpWriteDump was triggering an EXCEPTION_ACCESS_VIOLATION.  Tracing
> through the disassembled code revealed that MiniDumpWriteDump is looking
> for the ExceptionPointers field at a four byte offset from the beginning
> of the MINIDUMP_EXCEPTION_INFORMATION instance I passed as a parameter.
> However, the natural alignment of that field is 8 bytes, so GCC added
> padding after the first field (ThreadId) to achieve that alignment.
>
> Once I realized what was happening, I defined my own version of
> MINIDUMP_EXCEPTION_INFORMATION with __attribute__ ((__packed__)) to
> eliminate the padding, and this fixed the crash.
>
> Should MINIDUMP_EXCEPTION_INFORMATION be declared with __attribute__
> ((__packed__)) in dbghelp.h?  Are there other structures in that header
> that should be similarly declared?
>
> Thanks.

Joel,

thanks for the report. Feel free to provide a patch for this
adjustment. Nevertheless I am a bit curious, as those structures in
dbghelp.h have a packing of 4 bytes (see pshpack4.h).

Thanks,
Kai

PS: Please sign-up to ML before posting to it.

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to