diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/windows/crash_generation/minidump_generator.cc | 70 | ||||
-rwxr-xr-x | src/client/windows/crash_generation/minidump_generator.h | 15 |
2 files changed, 64 insertions, 21 deletions
diff --git a/src/client/windows/crash_generation/minidump_generator.cc b/src/client/windows/crash_generation/minidump_generator.cc index 96d7e81b..00a50012 100644 --- a/src/client/windows/crash_generation/minidump_generator.cc +++ b/src/client/windows/crash_generation/minidump_generator.cc @@ -291,11 +291,6 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle, bool is_client_pointers, wstring* dump_path, wstring* full_dump_path) { - MiniDumpWriteDumpType write_dump = GetWriteDump(); - if (!write_dump) { - return false; - } - wstring dump_file_path; if (!GenerateDumpFilePath(&dump_file_path)) { return false; @@ -340,6 +335,54 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle, } } + bool result = WriteMinidump(process_handle, + process_id, + thread_id, + requesting_thread_id, + exception_pointers, + assert_info, + dump_type, + is_client_pointers, + dump_file, + full_dump_file); + + // Store the path of the dump file in the out parameter if dump generation + // succeeded. + if (result && dump_path) { + *dump_path = dump_file_path; + } + if (result && full_memory_dump && full_dump_path) { + *full_dump_path = full_dump_file_path; + } + + CloseHandle(dump_file); + if (full_dump_file != INVALID_HANDLE_VALUE) + CloseHandle(full_dump_file); + + return result; +} + +bool MinidumpGenerator::WriteMinidump(HANDLE process_handle, + DWORD process_id, + DWORD thread_id, + DWORD requesting_thread_id, + EXCEPTION_POINTERS* exception_pointers, + MDRawAssertionInfo* assert_info, + MINIDUMP_TYPE dump_type, + bool is_client_pointers, + HANDLE dump_file, + HANDLE full_dump_file) { + bool full_memory_dump = (dump_type & MiniDumpWithFullMemory) != 0; + if (dump_file == INVALID_HANDLE_VALUE || + (full_memory_dump && full_dump_file == INVALID_HANDLE_VALUE)) { + return false; + } + + MiniDumpWriteDumpType write_dump = GetWriteDump(); + if (!write_dump) { + return false; + } + MINIDUMP_EXCEPTION_INFORMATION* dump_exception_pointers = NULL; MINIDUMP_EXCEPTION_INFORMATION dump_exception_info; @@ -457,22 +500,7 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle, &user_streams, NULL) != FALSE; - bool result = result_minidump && result_full_memory; - - CloseHandle(dump_file); - if (full_dump_file != INVALID_HANDLE_VALUE) - CloseHandle(full_dump_file); - - // Store the path of the dump file in the out parameter if dump generation - // succeeded. - if (result && dump_path) { - *dump_path = dump_file_path; - } - if (result && full_memory_dump && full_dump_path) { - *full_dump_path = full_dump_file_path; - } - - return result; + return result_minidump && result_full_memory; } HMODULE MinidumpGenerator::GetDbghelpModule() { diff --git a/src/client/windows/crash_generation/minidump_generator.h b/src/client/windows/crash_generation/minidump_generator.h index 5a1aea0d..a72db285 100755 --- a/src/client/windows/crash_generation/minidump_generator.h +++ b/src/client/windows/crash_generation/minidump_generator.h @@ -76,6 +76,21 @@ class MinidumpGenerator { std::wstring* dump_path, std::wstring* full_dump_path); + // Writes the minidump with the given parameters. Writes the minidump and + // full dump to the file handles supplied. This allows the caller to handle + // the creation of the files for the dump. The file handles are not closed + // by this function. + bool WriteMinidump(HANDLE process_handle, + DWORD process_id, + DWORD thread_id, + DWORD requesting_thread_id, + EXCEPTION_POINTERS* exception_pointers, + MDRawAssertionInfo* assert_info, + MINIDUMP_TYPE dump_type, + bool is_client_pointers, + HANDLE dump_file, + HANDLE full_dump_file); + private: // Function pointer type for MiniDumpWriteDump, which is looked up // dynamically. |