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:
doshimun 2008-04-17 21:21:48 +00:00
parent 9609db8173
commit 9033edcd7b
5 changed files with 27 additions and 10 deletions

View File

@ -783,20 +783,23 @@ void CrashGenerationServer::HandleDumpRequest(const ClientInfo& client_info) {
// Generate the dump only if it's explicitly requested by the
// server application; otherwise the server might want to generate
// dump in the callback.
std::wstring dump_path;
if (generate_dumps_) {
if (!GenerateDump(client_info)) {
if (!GenerateDump(client_info, &dump_path)) {
return;
}
}
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());
}
bool CrashGenerationServer::GenerateDump(const ClientInfo& client) {
bool CrashGenerationServer::GenerateDump(const ClientInfo& client,
std::wstring* dump_path) {
assert(client.pid() != 0);
assert(client.process_handle());
@ -819,7 +822,8 @@ bool CrashGenerationServer::GenerateDump(const ClientInfo& client) {
client_ex_info,
client.assert_info(),
client.dump_type(),
true);
true,
dump_path);
}
} // namespace google_breakpad

View File

@ -53,7 +53,8 @@ class CrashGenerationServer {
const ClientInfo* client_info);
typedef void (*OnClientDumpRequestCallback)(void* context,
const ClientInfo* client_info);
const ClientInfo* client_info,
const std::wstring* file_path);
typedef void (*OnClientExitedCallback)(void* context,
const ClientInfo* client_info);
@ -189,7 +190,7 @@ class CrashGenerationServer {
bool AddClient(ClientInfo* client_info);
// 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.
CRITICAL_SECTION clients_sync_;

View File

@ -66,7 +66,8 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
EXCEPTION_POINTERS* exception_pointers,
MDRawAssertionInfo* assert_info,
MINIDUMP_TYPE dump_type,
bool is_client_pointers) {
bool is_client_pointers,
wstring* dump_path) {
MiniDumpWriteDumpType write_dump = GetWriteDump();
if (!write_dump) {
return false;
@ -163,6 +164,13 @@ bool MinidumpGenerator::WriteMinidump(HANDLE process_handle,
NULL) != FALSE;
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;
}

View File

@ -48,7 +48,9 @@ class 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,
DWORD process_id,
DWORD thread_id,
@ -56,7 +58,8 @@ class MinidumpGenerator {
EXCEPTION_POINTERS* exception_pointers,
MDRawAssertionInfo* assert_info,
MINIDUMP_TYPE dump_type,
bool is_client_pointers);
bool is_client_pointers,
std::wstring* dump_path);
private:
// Function pointer type for MiniDumpWriteDump, which is looked up

View File

@ -197,7 +197,8 @@ static void _cdecl ShowClientConnected(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];
int result = swprintf_s(line,
kMaximumLineLength,