Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome_elf/breakpad.cc

Issue 434143002: Add more detail to Chrome ELF crash reports (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove blank lines Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This module contains the necessary code to register the Breakpad exception 5 // This module contains the necessary code to register the Breakpad exception
6 // handler. This implementation is based on Chrome's crash reporting code. 6 // handler. This implementation is based on Chrome's crash reporting code.
7 7
8 #include "chrome_elf/breakpad.h" 8 #include "chrome_elf/breakpad.h"
9 9
10 #include <sddl.h> 10 #include <sddl.h>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "breakpad/src/client/windows/handler/exception_handler.h" 13 #include "breakpad/src/client/windows/handler/exception_handler.h"
14 #include "chrome_elf/chrome_elf_util.h" 14 #include "chrome_elf/chrome_elf_util.h"
15 #include "version.h" // NOLINT 15 #include "version.h" // NOLINT
16 16
17 google_breakpad::ExceptionHandler* g_elf_breakpad = NULL; 17 google_breakpad::ExceptionHandler* g_elf_breakpad = NULL;
18 18
19 namespace { 19 namespace {
20 20
21 const wchar_t kBreakpadProductName[] = L"Chrome"; 21 const wchar_t kBreakpadProductName[] = L"Chrome";
22 const wchar_t kBreakpadVersionEntry[] = L"ver"; 22 const wchar_t kBreakpadVersionEntry[] = L"ver";
23 const wchar_t kBreakpadProdEntry[] = L"prod"; 23 const wchar_t kBreakpadProdEntry[] = L"prod";
24 const wchar_t kBreakpadPlatformEntry[] = L"plat"; 24 const wchar_t kBreakpadPlatformEntry[] = L"plat";
25 const wchar_t kBreakpadPlatformWin32[] = L"Win32"; 25 const wchar_t kBreakpadPlatformWin32[] = L"Win32";
26 const wchar_t kBreakpadProcessEntry[] = L"ptype";
27 const wchar_t kBreakpadChannelEntry[] = L"channel";
26 28
27 // The protocol for connecting to the out-of-process Breakpad crash 29 // The protocol for connecting to the out-of-process Breakpad crash
28 // reporter is different for x86-32 and x86-64: the message sizes 30 // reporter is different for x86-32 and x86-64: the message sizes
29 // are different because the message struct contains a pointer. As 31 // are different because the message struct contains a pointer. As
30 // a result, there are two different named pipes to connect to. The 32 // a result, there are two different named pipes to connect to. The
31 // 64-bit one is distinguished with an "-x64" suffix. 33 // 64-bit one is distinguished with an "-x64" suffix.
32 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices\\"; 34 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices\\";
33 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; 35 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\";
34 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; 36 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18";
35 37
36 const wchar_t kNoErrorDialogs[] = L"noerrdialogs"; 38 const wchar_t kNoErrorDialogs[] = L"noerrdialogs";
37 const wchar_t kChromeHeadless[] = L"CHROME_HEADLESS"; 39 const wchar_t kChromeHeadless[] = L"CHROME_HEADLESS";
38 40
39 google_breakpad::CustomClientInfo* GetCustomInfo() { 41 google_breakpad::CustomClientInfo* GetCustomInfo() {
42 base::string16 process = IsNonBrowserProcess() ? L"renderer" : L"browser";
43
44 wchar_t exe_path[MAX_PATH] = {};
45 base::string16 channel;
46 if (GetModuleFileName(NULL, exe_path, arraysize(exe_path)) &&
47 IsCanary(exe_path)) {
48 channel = L"canary";
49 }
50
40 static google_breakpad::CustomInfoEntry ver_entry( 51 static google_breakpad::CustomInfoEntry ver_entry(
41 kBreakpadVersionEntry, TEXT(CHROME_VERSION_STRING)); 52 kBreakpadVersionEntry, TEXT(CHROME_VERSION_STRING));
42 static google_breakpad::CustomInfoEntry prod_entry( 53 static google_breakpad::CustomInfoEntry prod_entry(
43 kBreakpadProdEntry, kBreakpadProductName); 54 kBreakpadProdEntry, kBreakpadProductName);
44 static google_breakpad::CustomInfoEntry plat_entry( 55 static google_breakpad::CustomInfoEntry plat_entry(
45 kBreakpadPlatformEntry, kBreakpadPlatformWin32); 56 kBreakpadPlatformEntry, kBreakpadPlatformWin32);
57 static google_breakpad::CustomInfoEntry proc_entry(
58 kBreakpadProcessEntry, process.c_str());
59 static google_breakpad::CustomInfoEntry channel_entry(
60 kBreakpadChannelEntry, channel.c_str());
46 static google_breakpad::CustomInfoEntry entries[] = { 61 static google_breakpad::CustomInfoEntry entries[] = {
47 ver_entry, prod_entry, plat_entry }; 62 ver_entry, prod_entry, plat_entry, proc_entry, channel_entry};
48 static google_breakpad::CustomClientInfo custom_info = { 63 static google_breakpad::CustomClientInfo custom_info = {
49 entries, arraysize(entries) }; 64 entries, arraysize(entries) };
50 return &custom_info; 65 return &custom_info;
51 } 66 }
52 67
53 base::string16 GetUserSidString() { 68 base::string16 GetUserSidString() {
54 // Get the current token. 69 // Get the current token.
55 HANDLE token = NULL; 70 HANDLE token = NULL;
56 base::string16 user_sid; 71 base::string16 user_sid;
57 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) 72 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 google_breakpad::ExceptionHandler::HANDLER_ALL, 184 google_breakpad::ExceptionHandler::HANDLER_ALL,
170 dump_type, 185 dump_type,
171 pipe_name.c_str(), 186 pipe_name.c_str(),
172 GetCustomInfo()); 187 GetCustomInfo());
173 188
174 if (g_elf_breakpad->IsOutOfProcess()) { 189 if (g_elf_breakpad->IsOutOfProcess()) {
175 // Tells breakpad to handle breakpoint and single step exceptions. 190 // Tells breakpad to handle breakpoint and single step exceptions.
176 g_elf_breakpad->set_handle_debug_exceptions(true); 191 g_elf_breakpad->set_handle_debug_exceptions(true);
177 } 192 }
178 } 193 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698