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

Side by Side Diff: chrome/app/chrome_main.cc

Issue 2909623002: Change DumpProcessWithoutCrash to use load-time dynamic linking (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | chrome_elf/chrome_elf.def » ('j') | components/crash/content/app/crashpad_win.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/app/chrome_main_delegate.h" 10 #include "chrome/app/chrome_main_delegate.h"
(...skipping 11 matching lines...) Expand all
22 #if defined(OS_MACOSX) 22 #if defined(OS_MACOSX)
23 #include "chrome/app/chrome_main_mac.h" 23 #include "chrome/app/chrome_main_mac.h"
24 #endif 24 #endif
25 25
26 #if defined(OS_WIN) 26 #if defined(OS_WIN)
27 #include "base/debug/dump_without_crashing.h" 27 #include "base/debug/dump_without_crashing.h"
28 #include "base/win/win_util.h" 28 #include "base/win/win_util.h"
29 #include "chrome/common/chrome_constants.h" 29 #include "chrome/common/chrome_constants.h"
30 #include "chrome/install_static/initialize_from_primary_module.h" 30 #include "chrome/install_static/initialize_from_primary_module.h"
31 #include "chrome/install_static/install_details.h" 31 #include "chrome/install_static/install_details.h"
32 #include "chrome_elf/chrome_elf_main.h"
32 33
33 #define DLLEXPORT __declspec(dllexport) 34 #define DLLEXPORT __declspec(dllexport)
34 35
35 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. 36 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling.
36 extern "C" { 37 extern "C" {
37 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, 38 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance,
38 sandbox::SandboxInterfaceInfo* sandbox_info, 39 sandbox::SandboxInterfaceInfo* sandbox_info,
39 int64_t exe_entry_point_ticks); 40 int64_t exe_entry_point_ticks);
40 } 41 }
41 #elif defined(OS_POSIX) 42 #elif defined(OS_POSIX)
(...skipping 20 matching lines...) Expand all
62 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); 63 base::TimeTicks::FromInternalValue(exe_entry_point_ticks));
63 content::ContentMainParams params(&chrome_main_delegate); 64 content::ContentMainParams params(&chrome_main_delegate);
64 65
65 #if defined(OS_WIN) 66 #if defined(OS_WIN)
66 // The process should crash when going through abnormal termination. 67 // The process should crash when going through abnormal termination.
67 base::win::SetShouldCrashOnProcessDetach(true); 68 base::win::SetShouldCrashOnProcessDetach(true);
68 base::win::SetAbortBehaviorForCrashReporting(); 69 base::win::SetAbortBehaviorForCrashReporting();
69 params.instance = instance; 70 params.instance = instance;
70 params.sandbox_info = sandbox_info; 71 params.sandbox_info = sandbox_info;
71 72
72 // SetDumpWithoutCrashingFunction must be passed the DumpProcess function 73 base::debug::SetDumpWithoutCrashingFunction(GetDumpWithoutCrashingFunction());
Will Harris 2017/05/26 05:54:38 I'm not sure it's okay to call this function in ch
Will Harris 2017/05/26 06:03:34 so fwiw current chrome.dll already calls these fun
73 // from chrome_elf and not from the DLL in order for DumpWithoutCrashing to
74 // function correctly.
75 typedef void (__cdecl *DumpProcessFunction)();
76 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>(
77 ::GetProcAddress(::GetModuleHandle(chrome::kChromeElfDllName),
78 "DumpProcessWithoutCrash"));
79 CHECK(DumpProcess);
80 base::debug::SetDumpWithoutCrashingFunction(DumpProcess);
81 74
82 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) 75 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll)
83 // have the same version. 76 // have the same version.
84 if (install_static::InstallDetails::Get().VersionMismatch()) 77 if (install_static::InstallDetails::Get().VersionMismatch())
85 base::debug::DumpWithoutCrashing(); 78 base::debug::DumpWithoutCrashing();
86 #else 79 #else
87 params.argc = argc; 80 params.argc = argc;
88 params.argv = argv; 81 params.argv = argv;
89 base::CommandLine::Init(params.argc, params.argv); 82 base::CommandLine::Init(params.argc, params.argv);
90 #endif // defined(OS_WIN) 83 #endif // defined(OS_WIN)
(...skipping 16 matching lines...) Expand all
107 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) 100 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES)
108 101
109 int rv = content::ContentMain(params); 102 int rv = content::ContentMain(params);
110 103
111 #if defined(OS_WIN) 104 #if defined(OS_WIN)
112 base::win::SetShouldCrashOnProcessDetach(false); 105 base::win::SetShouldCrashOnProcessDetach(false);
113 #endif 106 #endif
114 107
115 return rv; 108 return rv;
116 } 109 }
OLDNEW
« no previous file with comments | « no previous file | chrome_elf/chrome_elf.def » ('j') | components/crash/content/app/crashpad_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698