56 #ifndef CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__ 57 #define CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__ 66 #pragma warning(disable:4530) 89 return ptr == other.ptr;
93 return ptr ==
reinterpret_cast<ULONG64
>(other);
111 typedef bool (*FilterCallback)(
void* context, EXCEPTION_POINTERS* exinfo,
138 typedef bool (*MinidumpCallback)(
const wchar_t* dump_path,
139 const wchar_t* minidump_id,
141 EXCEPTION_POINTERS* exinfo,
153 HANDLER_EXCEPTION = 1 << 0,
154 HANDLER_INVALID_PARAMETER = 1 << 1,
155 HANDLER_PURECALL = 1 << 2,
156 HANDLER_ALL = HANDLER_EXCEPTION |
157 HANDLER_INVALID_PARAMETER |
168 FilterCallback filter,
169 MinidumpCallback callback,
170 void* callback_context,
179 FilterCallback filter,
180 MinidumpCallback callback,
181 void* callback_context,
183 MINIDUMP_TYPE dump_type,
184 const wchar_t* pipe_name,
190 FilterCallback filter,
191 MinidumpCallback callback,
192 void* callback_context,
194 MINIDUMP_TYPE dump_type,
211 FilterCallback filter,
212 MinidumpCallback callback,
213 void* callback_context,
222 dump_path_ = dump_path;
223 dump_path_c_ = dump_path_.c_str();
228 bool RequestUpload(DWORD crash_id);
236 bool WriteMinidumpForException(EXCEPTION_POINTERS* exinfo);
241 MinidumpCallback callback,
void* callback_context);
248 static bool WriteMinidumpForChild(HANDLE child,
249 DWORD child_blamed_thread,
250 const wstring& dump_path,
251 MinidumpCallback callback,
252 void* callback_context);
263 handle_debug_exceptions_ = handle_debug_exceptions;
271 void RegisterAppMemory(
void*
ptr,
size_t length);
272 void UnregisterAppMemory(
void* ptr);
275 friend class AutoExceptionHandler;
279 FilterCallback filter,
280 MinidumpCallback callback,
281 void* callback_context,
283 MINIDUMP_TYPE dump_type,
284 const wchar_t* pipe_name,
291 typedef BOOL (WINAPI *MiniDumpWriteDump_type)(
295 MINIDUMP_TYPE DumpType,
296 CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
297 CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
298 CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
301 typedef RPC_STATUS (RPC_ENTRY *UuidCreate_type)(UUID* Uuid);
304 static DWORD WINAPI ExceptionHandlerThreadMain(
void* lpParameter);
308 static LONG WINAPI HandleException(EXCEPTION_POINTERS* exinfo);
310 #if _MSC_VER >= 1400 // MSVC 2005/8 316 static void HandleInvalidParameter(
const wchar_t* expression,
317 const wchar_t*
function,
321 #endif // _MSC_VER >= 1400 325 static void HandlePureVirtualCall();
336 bool WriteMinidumpOnHandlerThread(EXCEPTION_POINTERS* exinfo,
345 bool WriteMinidumpWithException(DWORD requesting_thread_id,
346 EXCEPTION_POINTERS* exinfo,
351 static BOOL CALLBACK MinidumpWriteDumpCallback(
353 const PMINIDUMP_CALLBACK_INPUT callback_input,
354 PMINIDUMP_CALLBACK_OUTPUT callback_output);
364 bool WriteMinidumpWithExceptionForProcess(DWORD requesting_thread_id,
365 EXCEPTION_POINTERS* exinfo,
368 bool write_requester_stream);
374 FilterCallback filter_;
375 MinidumpCallback callback_;
376 void* callback_context_;
385 wstring next_minidump_id_;
389 wstring next_minidump_path_;
397 const wchar_t* dump_path_c_;
398 const wchar_t* next_minidump_id_c_;
399 const wchar_t* next_minidump_path_c_;
401 HMODULE dbghelp_module_;
402 MiniDumpWriteDump_type minidump_write_dump_;
403 MINIDUMP_TYPE dump_type_;
405 HMODULE rpcrt4_module_;
406 UuidCreate_type uuid_create_;
416 LPTOP_LEVEL_EXCEPTION_FILTER previous_filter_;
418 #if _MSC_VER >= 1400 // MSVC 2005/8 423 _invalid_parameter_handler previous_iph_;
424 #endif // _MSC_VER >= 1400 428 _purecall_handler previous_pch_;
431 HANDLE handler_thread_;
437 volatile bool is_shutdown_;
441 CRITICAL_SECTION handler_critical_section_;
448 HANDLE handler_start_semaphore_;
449 HANDLE handler_finish_semaphore_;
456 DWORD requesting_thread_id_;
460 EXCEPTION_POINTERS* exception_info_;
468 bool handler_return_value_;
473 bool handle_debug_exceptions_;
477 AppMemoryList app_memory_info_;
484 static vector<ExceptionHandler*>* handler_stack_;
490 static LONG handler_stack_index_;
495 static CRITICAL_SECTION handler_stack_critical_section_;
498 static volatile LONG instance_count_;
509 #endif // CLIENT_WINDOWS_HANDLER_EXCEPTION_HANDLER_H__ bool operator==(const void *other) const
DWORD get_requesting_thread_id() const
bool get_handle_debug_exceptions() const
bool IsOutOfProcess() const
bool operator==(const struct AppMemory &other) const
void void Initialize(iObjectRegistry *object_reg)
void set_dump_path(const wstring &dump_path)
void set_handle_debug_exceptions(bool handle_debug_exceptions)
bool WriteMinidump(const char *minidump_path, pid_t crashing_process, const void *blob, size_t blob_size)
wstring dump_path() const
std::list< AppMemory > AppMemoryList