Add one more parameter to the ClientDumpRequestCallback in crash generation server
to pass in the path of the dump file if the dump was generated successfully. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@262 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
9609db8173
commit
9033edcd7b
5 changed files with 27 additions and 10 deletions
|
@ -783,20 +783,23 @@ void CrashGenerationServer::HandleDumpRequest(const ClientInfo& client_info) {
|
||||||
// Generate the dump only if it's explicitly requested by the
|
// Generate the dump only if it's explicitly requested by the
|
||||||
// server application; otherwise the server might want to generate
|
// server application; otherwise the server might want to generate
|
||||||
// dump in the callback.
|
// dump in the callback.
|
||||||
|
std::wstring dump_path;
|
||||||
if (generate_dumps_) {
|
if (generate_dumps_) {
|
||||||
if (!GenerateDump(client_info)) {
|
if (!GenerateDump(client_info, &dump_path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dump_callback_) {
|
if (dump_callback_) {
|
||||||
dump_callback_(dump_context_, &client_info);
|
std::wstring* ptr_dump_path = (dump_path == L"") ? NULL : &dump_path;
|
||||||
|
dump_callback_(dump_context_, &client_info, ptr_dump_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEvent(client_info.dump_generated_handle());
|
SetEvent(client_info.dump_generated_handle());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CrashGenerationServer::GenerateDump(const ClientInfo& client) {
|
bool CrashGenerationServer::GenerateDump(const ClientInfo& client,
|
||||||
|
std::wstring* dump_path) {
|
||||||
assert(client.pid() != 0);
|
assert(client.pid() != 0);
|
||||||
assert(client.process_handle());
|
assert(client.process_handle());
|
||||||
|
|
||||||
|
@ -819,7 +822,8 @@ bool CrashGenerationServer::GenerateDump(const ClientInfo& client) {
|
||||||
client_ex_info,
|
client_ex_info,
|
||||||
client.assert_info(),
|
client.assert_info(),
|
||||||
client.dump_type(),
|
client.dump_type(),
|
||||||
true);
|
true,
|
||||||
|
dump_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace google_breakpad
|
} // namespace google_breakpad
|
||||||
|
|
|
@ -53,7 +53,8 @@ class CrashGenerationServer {
|
||||||
const ClientInfo* client_info);
|
const ClientInfo* client_info);
|
||||||
|
|
||||||
typedef void (*OnClientDumpRequestCallback)(void* context,
|
typedef void (*OnClientDumpRequestCallback)(void* context,
|
||||||
const ClientInfo* client_info);
|
const ClientInfo* client_info,
|
||||||
|
const std::wstring* file_path);
|
||||||
|
|
||||||
typedef void (*OnClientExitedCallback)(void* context,
|
typedef void (*OnClientExitedCallback)(void* context,
|
||||||
const ClientInfo* client_info);
|
const ClientInfo* client_info);
|
||||||
|
@ -189,7 +190,7 @@ class CrashGenerationServer {
|
||||||
bool AddClient(ClientInfo* client_info);
|
bool AddClient(ClientInfo* client_info);
|
||||||
|
|
||||||
// Generates dump for the given client.
|
// Generates dump for the given client.
|
||||||
bool GenerateDump(const ClientInfo& client);
|
bool GenerateDump(const ClientInfo& client, std::wstring* dump_path);
|
||||||
|
|
||||||
// Sync object for thread-safe access to the shared list of clients.
|
// Sync object for thread-safe access to the shared list of clients.
|
||||||
CRITICAL_SECTION clients_sync_;
|
CRITICAL_SECTION clients_sync_;
|
||||||
|
|
|
@ -66,7 +66,8 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
|
||||||
EXCEPTION_POINTERS* exception_pointers,
|
EXCEPTION_POINTERS* exception_pointers,
|
||||||
MDRawAssertionInfo* assert_info,
|
MDRawAssertionInfo* assert_info,
|
||||||
MINIDUMP_TYPE dump_type,
|
MINIDUMP_TYPE dump_type,
|
||||||
bool is_client_pointers) {
|
bool is_client_pointers,
|
||||||
|
wstring* dump_path) {
|
||||||
MiniDumpWriteDumpType write_dump = GetWriteDump();
|
MiniDumpWriteDumpType write_dump = GetWriteDump();
|
||||||
if (!write_dump) {
|
if (!write_dump) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -163,6 +164,13 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
|
||||||
NULL) != FALSE;
|
NULL) != FALSE;
|
||||||
|
|
||||||
CloseHandle(dump_file);
|
CloseHandle(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;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,9 @@ class MinidumpGenerator {
|
||||||
|
|
||||||
~MinidumpGenerator();
|
~MinidumpGenerator();
|
||||||
|
|
||||||
// Writes the minidump with the given parameters.
|
// Writes the minidump with the given parameters. Stores the
|
||||||
|
// dump file path in the dump_path parameter if dump generation
|
||||||
|
// succeeds.
|
||||||
bool WriteMinidump(HANDLE process_handle,
|
bool WriteMinidump(HANDLE process_handle,
|
||||||
DWORD process_id,
|
DWORD process_id,
|
||||||
DWORD thread_id,
|
DWORD thread_id,
|
||||||
|
@ -56,7 +58,8 @@ class MinidumpGenerator {
|
||||||
EXCEPTION_POINTERS* exception_pointers,
|
EXCEPTION_POINTERS* exception_pointers,
|
||||||
MDRawAssertionInfo* assert_info,
|
MDRawAssertionInfo* assert_info,
|
||||||
MINIDUMP_TYPE dump_type,
|
MINIDUMP_TYPE dump_type,
|
||||||
bool is_client_pointers);
|
bool is_client_pointers,
|
||||||
|
std::wstring* dump_path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Function pointer type for MiniDumpWriteDump, which is looked up
|
// Function pointer type for MiniDumpWriteDump, which is looked up
|
||||||
|
|
|
@ -197,7 +197,8 @@ static void _cdecl ShowClientConnected(void* context,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _cdecl ShowClientCrashed(void* context,
|
static void _cdecl ShowClientCrashed(void* context,
|
||||||
const ClientInfo* client_info) {
|
const ClientInfo* client_info,
|
||||||
|
const wstring* dump_path) {
|
||||||
TCHAR* line = new TCHAR[kMaximumLineLength];
|
TCHAR* line = new TCHAR[kMaximumLineLength];
|
||||||
int result = swprintf_s(line,
|
int result = swprintf_s(line,
|
||||||
kMaximumLineLength,
|
kMaximumLineLength,
|
||||||
|
|
Loading…
Reference in a new issue