mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-01-09 09:25:40 +00:00
add interface for WriteMinidump which allows the caller to supply file handles instead of paths where the minidumps should be written.
BUG=N/A TEST=N/A R=ivan.penkov@gmail.com, mark@chromium.org Review URL: https://breakpad.appspot.com/602002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1191 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
e10e9ac7ca
commit
8041deee0c
|
@ -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() {
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue