On 10/23/2012 01:20 PM, Tom Lane wrote:
Here's a typical Windows exception: 2012-10-04 14:29:08 CEST LOG: server process (PID 1416) was terminated by exception 0xC0000005 2012-10-04 14:29:08 CEST HINT: See C include file "ntstatus.h" for a description of the hexadecimal value. These codes can be translated with FormatMessage: http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx http://support.microsoft.com/kb/259693 FormatMessage may not be safe to perform in the context of a munged heap or some other failure conditions, so you probably don't want to do it from a crash handler. It is safe for the postmaster to do it based on the exception code it gets from the dying backend, though. I'd say the best option is for the postmaster to print the FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_FROM_HMODULE, ...) output when it sees the exception code from the dying backend. RtlNtStatusToDosError may also be of interest: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680600(v=vs.85).aspx ... but it's in Winternl.h so it's not guaranteed to exist / be compatible between versions and can only be accessed via runtime dynamic linking. Not ideal. -- Craig Ringer |