mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-02-19 16:49:40 +00:00
Add a way for the client apps to specify custom information in case of out-of-process
scenarios that the OOP server can use in whatever way it wants to. Fix a bug in CrashGenerationserver where CreateNamedPipe failure was not checked correctly. TODO in near future: Add a custom stream to minidump files for the custom information. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@267 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
namespace google_breakpad {
|
||||
|
||||
const int kMaxLoadString = 100;
|
||||
const wchar_t kPipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\S-1-5-21-39260824-743453154-142223018-195347";
|
||||
const wchar_t kPipeName[] = L"\\\\.\\pipe\\GoogleCrashServices-Testing";
|
||||
|
||||
const DWORD kEditBoxStyles = WS_CHILD |
|
||||
WS_VISIBLE |
|
||||
@@ -63,6 +63,13 @@ BOOL InitInstance(HINSTANCE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
static int k_custom_info_count = 2;
|
||||
static CustomInfoEntry k_custom_info_entries[] =
|
||||
{
|
||||
CustomInfoEntry(L"prod", L"CrashTestApp"),
|
||||
CustomInfoEntry(L"ver", L"1.0"),
|
||||
};
|
||||
|
||||
static ExceptionHandler* handler = NULL;
|
||||
static CrashGenerationServer* crash_server = NULL;
|
||||
|
||||
@@ -211,6 +218,33 @@ static void _cdecl ShowClientCrashed(void* context,
|
||||
}
|
||||
|
||||
QueueUserWorkItem(AppendTextWorker, line, WT_EXECUTEDEFAULT);
|
||||
|
||||
const CustomInfoEntry* custom_info = NULL;
|
||||
int custom_info_count = client_info->GetCustomInfo(&custom_info);
|
||||
if (custom_info_count <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
wstring str_line;
|
||||
for (int i = 0; i < custom_info_count; ++i) {
|
||||
if (i > 0) {
|
||||
str_line += L", ";
|
||||
}
|
||||
str_line += custom_info[i].name;
|
||||
str_line += L": ";
|
||||
str_line += custom_info[i].value;
|
||||
}
|
||||
|
||||
line = new TCHAR[kMaximumLineLength];
|
||||
result = swprintf_s(line,
|
||||
kMaximumLineLength,
|
||||
L"%s\n",
|
||||
str_line.c_str());
|
||||
if (result == -1) {
|
||||
delete[] line;
|
||||
return;
|
||||
}
|
||||
QueueUserWorkItem(AppendTextWorker, line, WT_EXECUTEDEFAULT);
|
||||
}
|
||||
|
||||
static void _cdecl ShowClientExited(void* context,
|
||||
@@ -276,6 +310,7 @@ void RequestDump() {
|
||||
if (!handler->WriteMinidump()) {
|
||||
MessageBoxW(NULL, L"Dump request failed", L"Dumper", MB_OK);
|
||||
}
|
||||
k_custom_info_entries[1].set_value(L"1.1");
|
||||
}
|
||||
|
||||
void CleanUp() {
|
||||
@@ -427,6 +462,8 @@ int APIENTRY _tWinMain(HINSTANCE instance,
|
||||
cs_edit = new CRITICAL_SECTION();
|
||||
InitializeCriticalSection(cs_edit);
|
||||
|
||||
CustomClientInfo custom_info = {k_custom_info_entries, k_custom_info_count};
|
||||
|
||||
// This is needed for CRT to not show dialog for invalid param
|
||||
// failures and instead let the code handle it.
|
||||
_CrtSetReportMode(_CRT_ASSERT, 0);
|
||||
@@ -436,7 +473,8 @@ int APIENTRY _tWinMain(HINSTANCE instance,
|
||||
NULL,
|
||||
ExceptionHandler::HANDLER_ALL,
|
||||
MiniDumpNormal,
|
||||
kPipeName);
|
||||
kPipeName,
|
||||
&custom_info);
|
||||
|
||||
// Initialize global strings.
|
||||
LoadString(instance, IDS_APP_TITLE, title, kMaxLoadString);
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
#include <cassert>
|
||||
#include <list>
|
||||
|
||||
#include "client/windows/common/ipc_protocol.h"
|
||||
#include "client/windows/crash_generation/client_info.h"
|
||||
#include "client/windows/crash_generation/crash_generation_client.h"
|
||||
#include "client/windows/crash_generation/crash_generation_server.h"
|
||||
|
||||
Reference in New Issue
Block a user