diff options
author | doshimun <doshimun@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2008-05-05 20:03:56 +0000 |
---|---|---|
committer | doshimun <doshimun@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2008-05-05 20:03:56 +0000 |
commit | 0ded3d718f4b090d106014bb0ea9dbb7af4e1d81 (patch) | |
tree | c17841e1e075b5d449ed8b63b2a339d6856d20b7 /src/client/windows/tests | |
parent | Issue 261/262: 64-bit bug fix when iterating through load commands of a 64-bi... (diff) | |
download | breakpad-0ded3d718f4b090d106014bb0ea9dbb7af4e1d81.tar.xz |
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
Diffstat (limited to 'src/client/windows/tests')
-rw-r--r-- | src/client/windows/tests/crash_generation_app/crash_generation_app.cc | 42 | ||||
-rw-r--r-- | src/client/windows/tests/crash_generation_app/precompile.h | 1 |
2 files changed, 41 insertions, 2 deletions
diff --git a/src/client/windows/tests/crash_generation_app/crash_generation_app.cc b/src/client/windows/tests/crash_generation_app/crash_generation_app.cc index 924d734a..13d86216 100644 --- a/src/client/windows/tests/crash_generation_app/crash_generation_app.cc +++ b/src/client/windows/tests/crash_generation_app/crash_generation_app.cc @@ -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); diff --git a/src/client/windows/tests/crash_generation_app/precompile.h b/src/client/windows/tests/crash_generation_app/precompile.h index 7dab1281..1ade4451 100644 --- a/src/client/windows/tests/crash_generation_app/precompile.h +++ b/src/client/windows/tests/crash_generation_app/precompile.h @@ -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" |