75 76 #ifdef _DEBUG 77 #include <crtdbg.h> 78 #endif 79 80 81 #include <windows.h> 82 #include <sys/types.h> 83 #include <sys/stat.h> 84 #include <sys/timeb.h> 85 #include <objidl.h> 86 #include <shlobj.h> 87 88 #include <malloc.h> 89 #include <signal.h> 90 #include <direct.h> 91 #include <errno.h> 92 #include <fcntl.h> 93 #include <io.h> 94 #include <process.h> // For _beginthreadex(), _endthreadex() 95 #include <imagehlp.h> // For os::dll_address_to_function_name 96 // for enumerating dll libraries 97 #include <vdmdbg.h> 98 99 // for timer info max values which include all bits 100 #define ALL_64_BITS CONST64(-1) 101 102 // For DLL loading/load error detection 103 // Values of PE COFF 104 #define IMAGE_FILE_PTR_TO_SIGNATURE 0x3c 105 #define IMAGE_FILE_SIGNATURE_LENGTH 4 106 107 static HANDLE main_process; 108 static HANDLE main_thread; 109 static int main_thread_id; 110 111 static FILETIME process_creation_time; 112 static FILETIME process_exit_time; 113 static FILETIME process_user_time; 114 static FILETIME process_kernel_time; 2194 // According to Windows API documentation, an illegal instruction sequence should generate 2195 // the 0xC000001C exception code. However, real world experience shows that occasionnaly 2196 // the execution of an illegal instruction can generate the exception code 0xC000001E. This 2197 // seems to be an undocumented feature of Win NT 4.0 (and probably other Windows systems). 2198 2199 #define EXCEPTION_ILLEGAL_INSTRUCTION_2 0xC000001E 2200 2201 // From "Execution Protection in the Windows Operating System" draft 0.35 2202 // Once a system header becomes available, the "real" define should be 2203 // included or copied here. 2204 #define EXCEPTION_INFO_EXEC_VIOLATION 0x08 2205 2206 // Handle NAT Bit consumption on IA64. 2207 #ifdef _M_IA64 2208 #define EXCEPTION_REG_NAT_CONSUMPTION STATUS_REG_NAT_CONSUMPTION 2209 #endif 2210 2211 // Windows Vista/2008 heap corruption check 2212 #define EXCEPTION_HEAP_CORRUPTION 0xC0000374 2213 2214 #define def_excpt(val) #val, val 2215 2216 struct siglabel { 2217 char *name; 2218 int number; 2219 }; 2220 2221 // All Visual C++ exceptions thrown from code generated by the Microsoft Visual 2222 // C++ compiler contain this error code. Because this is a compiler-generated 2223 // error, the code is not listed in the Win32 API header files. 2224 // The code is actually a cryptic mnemonic device, with the initial "E" 2225 // standing for "exception" and the final 3 bytes (0x6D7363) representing the 2226 // ASCII values of "msc". 2227 2228 #define EXCEPTION_UNCAUGHT_CXX_EXCEPTION 0xE06D7363 2229 2230 2231 struct siglabel exceptlabels[] = { 2232 def_excpt(EXCEPTION_ACCESS_VIOLATION), 2233 def_excpt(EXCEPTION_DATATYPE_MISALIGNMENT), 2234 def_excpt(EXCEPTION_BREAKPOINT), | 75 76 #ifdef _DEBUG 77 #include <crtdbg.h> 78 #endif 79 80 81 #include <windows.h> 82 #include <sys/types.h> 83 #include <sys/stat.h> 84 #include <sys/timeb.h> 85 #include <objidl.h> 86 #include <shlobj.h> 87 88 #include <malloc.h> 89 #include <signal.h> 90 #include <direct.h> 91 #include <errno.h> 92 #include <fcntl.h> 93 #include <io.h> 94 #include <process.h> // For _beginthreadex(), _endthreadex() 95 #if _MSC_VER >= 1900 96 #pragma warning( disable : 4091 ) // typedef ignored on left when no variable is declared 97 #endif 98 #include <imagehlp.h> // For os::dll_address_to_function_name 99 // for enumerating dll libraries 100 #include <vdmdbg.h> 101 102 // for timer info max values which include all bits 103 #define ALL_64_BITS CONST64(-1) 104 105 // For DLL loading/load error detection 106 // Values of PE COFF 107 #define IMAGE_FILE_PTR_TO_SIGNATURE 0x3c 108 #define IMAGE_FILE_SIGNATURE_LENGTH 4 109 110 static HANDLE main_process; 111 static HANDLE main_thread; 112 static int main_thread_id; 113 114 static FILETIME process_creation_time; 115 static FILETIME process_exit_time; 116 static FILETIME process_user_time; 117 static FILETIME process_kernel_time; 2197 // According to Windows API documentation, an illegal instruction sequence should generate 2198 // the 0xC000001C exception code. However, real world experience shows that occasionnaly 2199 // the execution of an illegal instruction can generate the exception code 0xC000001E. This 2200 // seems to be an undocumented feature of Win NT 4.0 (and probably other Windows systems). 2201 2202 #define EXCEPTION_ILLEGAL_INSTRUCTION_2 0xC000001E 2203 2204 // From "Execution Protection in the Windows Operating System" draft 0.35 2205 // Once a system header becomes available, the "real" define should be 2206 // included or copied here. 2207 #define EXCEPTION_INFO_EXEC_VIOLATION 0x08 2208 2209 // Handle NAT Bit consumption on IA64. 2210 #ifdef _M_IA64 2211 #define EXCEPTION_REG_NAT_CONSUMPTION STATUS_REG_NAT_CONSUMPTION 2212 #endif 2213 2214 // Windows Vista/2008 heap corruption check 2215 #define EXCEPTION_HEAP_CORRUPTION 0xC0000374 2216 2217 #if _MSC_VER >= 1900 2218 #define def_excpt(val) #val, (int) val 2219 #else 2220 #define def_excpt(val) #val, val 2221 #endif 2222 2223 struct siglabel { 2224 char *name; 2225 int number; 2226 }; 2227 2228 // All Visual C++ exceptions thrown from code generated by the Microsoft Visual 2229 // C++ compiler contain this error code. Because this is a compiler-generated 2230 // error, the code is not listed in the Win32 API header files. 2231 // The code is actually a cryptic mnemonic device, with the initial "E" 2232 // standing for "exception" and the final 3 bytes (0x6D7363) representing the 2233 // ASCII values of "msc". 2234 2235 #define EXCEPTION_UNCAUGHT_CXX_EXCEPTION 0xE06D7363 2236 2237 2238 struct siglabel exceptlabels[] = { 2239 def_excpt(EXCEPTION_ACCESS_VIOLATION), 2240 def_excpt(EXCEPTION_DATATYPE_MISALIGNMENT), 2241 def_excpt(EXCEPTION_BREAKPOINT), |