aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordoshimun <doshimun@4c0a9323-5329-0410-9bdc-e9ce6186880e>2008-05-07 21:54:12 +0000
committerdoshimun <doshimun@4c0a9323-5329-0410-9bdc-e9ce6186880e>2008-05-07 21:54:12 +0000
commit8602aa71ecba32d26985bdbbddc8e618ca203ff9 (patch)
treef48d6367dc8c520a762cf4ee541de68e13758613
parentBug fix for issue 263: mach_vm_region_recurse calls have invalid parameter sp... (diff)
downloadbreakpad-8602aa71ecba32d26985bdbbddc8e618ca203ff9.tar.xz
Some style guide compliance changes and changed the prototype of the method to get custom client info in ClientInfo class.
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@270 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r--src/client/windows/crash_generation/client_info.cc5
-rw-r--r--src/client/windows/crash_generation/client_info.h4
-rw-r--r--src/client/windows/handler/exception_handler.cc6
-rw-r--r--src/client/windows/tests/crash_generation_app/crash_generation_app.cc31
4 files changed, 25 insertions, 21 deletions
diff --git a/src/client/windows/crash_generation/client_info.cc b/src/client/windows/crash_generation/client_info.cc
index 48886d2a..0da031c9 100644
--- a/src/client/windows/crash_generation/client_info.cc
+++ b/src/client/windows/crash_generation/client_info.cc
@@ -169,9 +169,8 @@ bool ClientInfo::PopulateCustomInfo() {
return bytes_count == read_count;
}
-int ClientInfo::GetCustomInfo(CustomInfoEntry const** custom_info) const {
- *custom_info = custom_info_entries_.get();
- return custom_client_info_.count;
+const CustomClientInfo& ClientInfo::GetCustomInfo() const {
+ return custom_client_info_;
}
} // namespace google_breakpad
diff --git a/src/client/windows/crash_generation/client_info.h b/src/client/windows/crash_generation/client_info.h
index db3f05e9..f203b83d 100644
--- a/src/client/windows/crash_generation/client_info.h
+++ b/src/client/windows/crash_generation/client_info.h
@@ -88,10 +88,12 @@ class ClientInfo {
bool Initialize();
bool GetClientExceptionInfo(EXCEPTION_POINTERS** ex_info) const;
bool GetClientThreadId(DWORD* thread_id) const;
+
// Reads the custom information from the client process address space.
bool PopulateCustomInfo();
+
// Returns the client custom information.
- int GetCustomInfo(CustomInfoEntry const** custom_info) const;
+ const CustomClientInfo& GetCustomInfo() const;
private:
// Crash generation server.
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc
index f6469d78..8594d1bf 100644
--- a/src/client/windows/handler/exception_handler.cc
+++ b/src/client/windows/handler/exception_handler.cc
@@ -117,9 +117,9 @@ void ExceptionHandler::Initialize(const wstring& dump_path,
// Attempt to use out-of-process if user has specified pipe name.
if (pipe_name != NULL) {
scoped_ptr<CrashGenerationClient> client(
- new CrashGenerationClient(pipe_name,
- dump_type_,
- custom_info));
+ new CrashGenerationClient(pipe_name,
+ dump_type_,
+ custom_info));
// If successful in registering with the monitoring process,
// there is no need to setup in-process crash generation.
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 13d86216..e0cd2f04 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
@@ -63,12 +63,11 @@ 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 int kCustomInfoCount = 2;
+static CustomInfoEntry kCustomInfoEntries[] = {
+ CustomInfoEntry(L"prod", L"CrashTestApp"),
+ CustomInfoEntry(L"ver", L"1.0"),
+};
static ExceptionHandler* handler = NULL;
static CrashGenerationServer* crash_server = NULL;
@@ -175,6 +174,7 @@ bool ShowDumpResults(const wchar_t* dump_path,
MDRawAssertionInfo* assertion,
bool succeeded) {
TCHAR* text = new TCHAR[kMaximumLineLength];
+ text[0] = _T('\0');
int result = swprintf_s(text,
kMaximumLineLength,
TEXT("Dump generation request %s\r\n"),
@@ -190,6 +190,7 @@ bool ShowDumpResults(const wchar_t* dump_path,
static void _cdecl ShowClientConnected(void* context,
const ClientInfo* client_info) {
TCHAR* line = new TCHAR[kMaximumLineLength];
+ line[0] = _T('\0');
int result = swprintf_s(line,
kMaximumLineLength,
L"Client connected:\t\t%d\r\n",
@@ -207,6 +208,7 @@ static void _cdecl ShowClientCrashed(void* context,
const ClientInfo* client_info,
const wstring* dump_path) {
TCHAR* line = new TCHAR[kMaximumLineLength];
+ line[0] = _T('\0');
int result = swprintf_s(line,
kMaximumLineLength,
TEXT("Client requested dump:\t%d\r\n"),
@@ -219,23 +221,23 @@ 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) {
+ const CustomClientInfo& custom_info = client_info->GetCustomInfo();
+ if (custom_info.count <= 0) {
return;
}
wstring str_line;
- for (int i = 0; i < custom_info_count; ++i) {
+ for (int i = 0; i < custom_info.count; ++i) {
if (i > 0) {
str_line += L", ";
}
- str_line += custom_info[i].name;
+ str_line += custom_info.entries[i].name;
str_line += L": ";
- str_line += custom_info[i].value;
+ str_line += custom_info.entries[i].value;
}
line = new TCHAR[kMaximumLineLength];
+ line[0] = _T('\0');
result = swprintf_s(line,
kMaximumLineLength,
L"%s\n",
@@ -250,6 +252,7 @@ static void _cdecl ShowClientCrashed(void* context,
static void _cdecl ShowClientExited(void* context,
const ClientInfo* client_info) {
TCHAR* line = new TCHAR[kMaximumLineLength];
+ line[0] = _T('\0');
int result = swprintf_s(line,
kMaximumLineLength,
TEXT("Client exited:\t\t%d\r\n"),
@@ -310,7 +313,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");
+ kCustomInfoEntries[1].set_value(L"1.1");
}
void CleanUp() {
@@ -462,7 +465,7 @@ int APIENTRY _tWinMain(HINSTANCE instance,
cs_edit = new CRITICAL_SECTION();
InitializeCriticalSection(cs_edit);
- CustomClientInfo custom_info = {k_custom_info_entries, k_custom_info_count};
+ CustomClientInfo custom_info = {kCustomInfoEntries, kCustomInfoCount};
// This is needed for CRT to not show dialog for invalid param
// failures and instead let the code handle it.