aboutsummaryrefslogtreecommitdiff
path: root/src/client/windows
diff options
context:
space:
mode:
authorcdn@chromium.org <cdn@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-06-06 17:20:34 +0000
committercdn@chromium.org <cdn@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-06-06 17:20:34 +0000
commit8041deee0c85c984bd43c67694acfe06327c36ba (patch)
tree3ecb05fc841e738984ea03a303b66c2454a41d83 /src/client/windows
parentMake all linux ptrace dumper tests use a subprocess (diff)
downloadbreakpad-8041deee0c85c984bd43c67694acfe06327c36ba.tar.xz
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
Diffstat (limited to 'src/client/windows')
-rw-r--r--src/client/windows/crash_generation/minidump_generator.cc70
-rwxr-xr-xsrc/client/windows/crash_generation/minidump_generator.h15
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.