mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-01 04:04:32 +01:00
Allow option for efficient and safe opt out of in-proc dump generation for Windows breakpad clients.
https://breakpad.appspot.com/549002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1157 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
697da828dc
commit
40c9de4d8d
4 changed files with 143 additions and 41 deletions
|
|
@ -73,7 +73,8 @@ ExceptionHandler::ExceptionHandler(const wstring& dump_path,
|
|||
handler_types,
|
||||
dump_type,
|
||||
pipe_name,
|
||||
NULL,
|
||||
NULL, // pipe_handle
|
||||
NULL, // crash_generation_client
|
||||
custom_info);
|
||||
}
|
||||
|
||||
|
|
@ -91,11 +92,33 @@ ExceptionHandler::ExceptionHandler(const wstring& dump_path,
|
|||
callback_context,
|
||||
handler_types,
|
||||
dump_type,
|
||||
NULL,
|
||||
NULL, // pipe_name
|
||||
pipe_handle,
|
||||
NULL, // crash_generation_client
|
||||
custom_info);
|
||||
}
|
||||
|
||||
ExceptionHandler::ExceptionHandler(
|
||||
const wstring& dump_path,
|
||||
FilterCallback filter,
|
||||
MinidumpCallback callback,
|
||||
void* callback_context,
|
||||
int handler_types,
|
||||
MINIDUMP_TYPE dump_type,
|
||||
CrashGenerationClient* crash_generation_client,
|
||||
const CustomClientInfo* custom_info) {
|
||||
Initialize(dump_path,
|
||||
filter,
|
||||
callback,
|
||||
callback_context,
|
||||
handler_types,
|
||||
MiniDumpNormal,
|
||||
NULL, // pipe_name
|
||||
NULL, // pipe_handle
|
||||
crash_generation_client,
|
||||
custom_info);
|
||||
}
|
||||
|
||||
ExceptionHandler::ExceptionHandler(const wstring &dump_path,
|
||||
FilterCallback filter,
|
||||
MinidumpCallback callback,
|
||||
|
|
@ -107,20 +130,23 @@ ExceptionHandler::ExceptionHandler(const wstring &dump_path,
|
|||
callback_context,
|
||||
handler_types,
|
||||
MiniDumpNormal,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
NULL, // pipe_name
|
||||
NULL, // pipe_handle
|
||||
NULL, // crash_generation_client
|
||||
NULL); // custom_info
|
||||
}
|
||||
|
||||
void ExceptionHandler::Initialize(const wstring& dump_path,
|
||||
FilterCallback filter,
|
||||
MinidumpCallback callback,
|
||||
void* callback_context,
|
||||
int handler_types,
|
||||
MINIDUMP_TYPE dump_type,
|
||||
const wchar_t* pipe_name,
|
||||
HANDLE pipe_handle,
|
||||
const CustomClientInfo* custom_info) {
|
||||
void ExceptionHandler::Initialize(
|
||||
const wstring& dump_path,
|
||||
FilterCallback filter,
|
||||
MinidumpCallback callback,
|
||||
void* callback_context,
|
||||
int handler_types,
|
||||
MINIDUMP_TYPE dump_type,
|
||||
const wchar_t* pipe_name,
|
||||
HANDLE pipe_handle,
|
||||
CrashGenerationClient* crash_generation_client,
|
||||
const CustomClientInfo* custom_info) {
|
||||
LONG instance_count = InterlockedIncrement(&instance_count_);
|
||||
filter_ = filter;
|
||||
callback_ = callback;
|
||||
|
|
@ -149,23 +175,20 @@ void ExceptionHandler::Initialize(const wstring& dump_path,
|
|||
handler_return_value_ = false;
|
||||
handle_debug_exceptions_ = false;
|
||||
|
||||
// Attempt to use out-of-process if user has specified a pipe.
|
||||
if (pipe_name != NULL || pipe_handle != NULL) {
|
||||
assert(!(pipe_name && pipe_handle));
|
||||
|
||||
scoped_ptr<CrashGenerationClient> client;
|
||||
if (pipe_name) {
|
||||
client.reset(
|
||||
new CrashGenerationClient(pipe_name,
|
||||
dump_type_,
|
||||
custom_info));
|
||||
} else {
|
||||
client.reset(
|
||||
new CrashGenerationClient(pipe_handle,
|
||||
dump_type_,
|
||||
custom_info));
|
||||
}
|
||||
// Attempt to use out-of-process if user has specified a pipe or a
|
||||
// crash generation client.
|
||||
scoped_ptr<CrashGenerationClient> client;
|
||||
if (crash_generation_client) {
|
||||
client.reset(crash_generation_client);
|
||||
} else if (pipe_name) {
|
||||
client.reset(
|
||||
new CrashGenerationClient(pipe_name, dump_type_, custom_info));
|
||||
} else if (pipe_handle) {
|
||||
client.reset(
|
||||
new CrashGenerationClient(pipe_handle, dump_type_, custom_info));
|
||||
}
|
||||
|
||||
if (client.get() != NULL) {
|
||||
// If successful in registering with the monitoring process,
|
||||
// there is no need to setup in-process crash generation.
|
||||
if (client->Register()) {
|
||||
|
|
|
|||
|
|
@ -195,6 +195,27 @@ class ExceptionHandler {
|
|||
HANDLE pipe_handle,
|
||||
const CustomClientInfo* custom_info);
|
||||
|
||||
// ExceptionHandler that ENSURES out-of-process dump generation. Expects a
|
||||
// crash generation client that is already registered with a crash generation
|
||||
// server. Takes ownership of the passed-in crash_generation_client.
|
||||
//
|
||||
// Usage example:
|
||||
// crash_generation_client = new CrashGenerationClient(..);
|
||||
// if (crash_generation_client->Register()) {
|
||||
// // Registration with the crash generation server succeeded.
|
||||
// // Out-of-process dump generation is guaranteed.
|
||||
// g_handler = new ExceptionHandler(.., crash_generation_client, ..);
|
||||
// return true;
|
||||
// }
|
||||
ExceptionHandler(const wstring& dump_path,
|
||||
FilterCallback filter,
|
||||
MinidumpCallback callback,
|
||||
void* callback_context,
|
||||
int handler_types,
|
||||
MINIDUMP_TYPE dump_type,
|
||||
CrashGenerationClient* crash_generation_client,
|
||||
const CustomClientInfo* custom_info);
|
||||
|
||||
~ExceptionHandler();
|
||||
|
||||
// Get and set the minidump path.
|
||||
|
|
@ -264,6 +285,7 @@ class ExceptionHandler {
|
|||
MINIDUMP_TYPE dump_type,
|
||||
const wchar_t* pipe_name,
|
||||
HANDLE pipe_handle,
|
||||
CrashGenerationClient* crash_generation_client,
|
||||
const CustomClientInfo* custom_info);
|
||||
|
||||
// Function pointer type for MiniDumpWriteDump, which is looked up
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue