Revision: 1191
Author:
c...@chromium.org
Date: Thu Jun 6 10:20:34 2013
Log: 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....@gmail.com,
ma...@chromium.org
Review URL:
https://breakpad.appspot.com/602002
http://code.google.com/p/google-breakpad/source/detail?r=1191
Modified:
/trunk/src/client/windows/crash_generation/minidump_generator.cc
/trunk/src/client/windows/crash_generation/minidump_generator.h
=======================================
--- /trunk/src/client/windows/crash_generation/minidump_generator.cc Thu
Aug 16 18:41:05 2012
+++ /trunk/src/client/windows/crash_generation/minidump_generator.cc Thu
Jun 6 10:20:34 2013
@@ -291,11 +291,6 @@
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;
@@ -339,6 +334,54 @@
return false;
}
}
+
+ 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 @@
&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() {
=======================================
--- /trunk/src/client/windows/crash_generation/minidump_generator.h Wed
Mar 6 06:04:42 2013
+++ /trunk/src/client/windows/crash_generation/minidump_generator.h Thu
Jun 6 10:20:34 2013
@@ -76,6 +76,21 @@
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.