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

Side by Side Diff: chrome_elf/chrome_elf_main.cc

Issue 2428703002: Signal chrome_elf to initialize crash reporting, rather than doing it in DllMain (Closed)
Patch Set: . Created 4 years, 2 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
« no previous file with comments | « chrome_elf/chrome_elf_main.h ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome_elf/chrome_elf_main.h" 5 #include "chrome_elf/chrome_elf_main.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "chrome/install_static/install_util.h" 10 #include "chrome/install_static/install_util.h"
11 #include "chrome_elf/blacklist/blacklist.h" 11 #include "chrome_elf/blacklist/blacklist.h"
12 #include "chrome_elf/crash/crash_helper.h" 12 #include "chrome_elf/crash/crash_helper.h"
13 13
14 // This function is a temporary workaround for https://crbug.com/655788. We
15 // need to come up with a better way to initialize crash reporting that can
16 // happen inside DllMain().
17 void SignalInitializeCrashReporting() {
18 if (!elf_crash::InitializeCrashReporting()) {
19 #ifdef _DEBUG
20 assert(false);
21 #endif // _DEBUG
22 }
23 }
24
14 void SignalChromeElf() { 25 void SignalChromeElf() {
15 blacklist::ResetBeacon(); 26 blacklist::ResetBeacon();
16 } 27 }
17 28
18 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { 29 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) {
19 if (reason == DLL_PROCESS_ATTACH) { 30 if (reason == DLL_PROCESS_ATTACH) {
20 if (!elf_crash::InitializeCrashReporting()) {
21 #ifdef _DEBUG
22 assert(false);
23 #endif // _DEBUG
24 }
25 // CRT on initialization installs an exception filter which calls 31 // CRT on initialization installs an exception filter which calls
26 // TerminateProcess. We need to hook CRT's attempt to set an exception. 32 // TerminateProcess. We need to hook CRT's attempt to set an exception.
27 // NOTE: Do not hook if ASan is present, or ASan will fail to install 33 // NOTE: Do not hook if ASan is present, or ASan will fail to install
28 // its own unhandled exception filter. 34 // its own unhandled exception filter.
29 #if !defined(ADDRESS_SANITIZER) 35 #if !defined(ADDRESS_SANITIZER)
30 elf_crash::DisableSetUnhandledExceptionFilter(); 36 elf_crash::DisableSetUnhandledExceptionFilter();
31 #endif // !defined (ADDRESS_SANITIZER) 37 #endif // !defined (ADDRESS_SANITIZER)
32 38
33 install_static::InitializeProcessType(); 39 install_static::InitializeProcessType();
34 40
35 __try { 41 __try {
36 blacklist::Initialize(false); // Don't force, abort if beacon is present. 42 blacklist::Initialize(false); // Don't force, abort if beacon is present.
37 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { 43 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) {
38 } 44 }
39 } else if (reason == DLL_PROCESS_DETACH) { 45 } else if (reason == DLL_PROCESS_DETACH) {
40 elf_crash::ShutdownCrashReporting(); 46 elf_crash::ShutdownCrashReporting();
41 } 47 }
42 return TRUE; 48 return TRUE;
43 } 49 }
OLDNEW
« no previous file with comments | « chrome_elf/chrome_elf_main.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698