diff --git a/src/client/windows/crash_generation/crash_generation_client.cc b/src/client/windows/crash_generation/crash_generation_client.cc index 749223f1..20f7177a 100644 --- a/src/client/windows/crash_generation/crash_generation_client.cc +++ b/src/client/windows/crash_generation/crash_generation_client.cc @@ -167,6 +167,23 @@ bool CrashGenerationClient::Register() { return success; } +bool CrashGenerationClient::RequestUpload(DWORD crash_id) { + HANDLE pipe = ConnectToServer(); + if (!pipe) { + return false; + } + + CustomClientInfo custom_info; + ProtocolMessage msg(MESSAGE_TAG_UPLOAD_REQUEST, crash_id, + static_cast(NULL), NULL, NULL, NULL, + custom_info, NULL, NULL, NULL); + DWORD bytes_count = 0; + bool success = WriteFile(pipe, &msg, sizeof(msg), &bytes_count, NULL); + + CloseHandle(pipe); + return success; +} + HANDLE CrashGenerationClient::ConnectToServer() { HANDLE pipe = ConnectToPipe(pipe_name_.c_str(), kPipeDesiredAccess, diff --git a/src/client/windows/crash_generation/crash_generation_client.h b/src/client/windows/crash_generation/crash_generation_client.h index 01d13dde..85a0456c 100644 --- a/src/client/windows/crash_generation/crash_generation_client.h +++ b/src/client/windows/crash_generation/crash_generation_client.h @@ -73,6 +73,10 @@ class CrashGenerationClient { // Returns true if the registration is successful; false otherwise. bool Register(); + // Requests the crash server to upload a previous dump with the + // given crash id. + bool RequestUpload(DWORD crash_id); + bool RequestDump(EXCEPTION_POINTERS* ex_info, MDRawAssertionInfo* assert_info); diff --git a/src/client/windows/crash_generation/crash_generation_server.cc b/src/client/windows/crash_generation/crash_generation_server.cc index d9769ae8..794742db 100644 --- a/src/client/windows/crash_generation/crash_generation_server.cc +++ b/src/client/windows/crash_generation/crash_generation_server.cc @@ -424,9 +424,10 @@ void CrashGenerationServer::HandleReadDoneState() { if (msg_.tag == MESSAGE_TAG_UPLOAD_REQUEST) { if (upload_request_callback_) upload_request_callback_(upload_context_, msg_.id); + EnterStateImmediately(IPC_SERVER_STATE_DISCONNECTING); return; } - + scoped_ptr client_info( new ClientInfo(this, msg_.id, diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index 7ce2ca93..08c5fb5f 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -312,6 +312,10 @@ ExceptionHandler::~ExceptionHandler() { } } +bool ExceptionHandler::RequestUpload(DWORD crash_id) { + return crash_generation_client_->RequestUpload(crash_id); +} + // static DWORD ExceptionHandler::ExceptionHandlerThreadMain(void* lpParameter) { ExceptionHandler* self = reinterpret_cast(lpParameter); diff --git a/src/client/windows/handler/exception_handler.h b/src/client/windows/handler/exception_handler.h index 2c2e7b76..6c5ee76a 100644 --- a/src/client/windows/handler/exception_handler.h +++ b/src/client/windows/handler/exception_handler.h @@ -88,9 +88,9 @@ class ExceptionHandler { // if any. // // If a FilterCallback returns true, Breakpad will continue processing, - // attempting to write a minidump. If a FilterCallback returns false, Breakpad - // will immediately report the exception as unhandled without writing a - // minidump, allowing another handler the opportunity to handle it. + // attempting to write a minidump. If a FilterCallback returns false, + // Breakpad will immediately report the exception as unhandled without + // writing a minidump, allowing another handler the opportunity to handle it. typedef bool (*FilterCallback)(void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion); @@ -177,6 +177,9 @@ class ExceptionHandler { UpdateNextID(); // Necessary to put dump_path_ in next_minidump_path_. } + // Requests that a previously reported crash be uploaded. + bool RequestUpload(DWORD crash_id); + // Writes a minidump immediately. This can be used to capture the // execution state independently of a crash. Returns true on success. bool WriteMinidump();