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

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

Issue 2909623002: Change DumpProcessWithoutCrash to use load-time dynamic linking (Closed)
Patch Set: forgot to update def file Created 3 years, 5 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 | « base/debug/dump_without_crashing.cc ('k') | chrome_elf/chrome_elf.def » ('j') | no next file with comments »
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 16 matching lines...) Expand all
27 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
28 #include "chrome/app/chrome_main_mac.h" 28 #include "chrome/app/chrome_main_mac.h"
29 #endif 29 #endif
30 30
31 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 #include "base/debug/dump_without_crashing.h" 32 #include "base/debug/dump_without_crashing.h"
33 #include "base/win/win_util.h" 33 #include "base/win/win_util.h"
34 #include "chrome/common/chrome_constants.h" 34 #include "chrome/common/chrome_constants.h"
35 #include "chrome/install_static/initialize_from_primary_module.h" 35 #include "chrome/install_static/initialize_from_primary_module.h"
36 #include "chrome/install_static/install_details.h" 36 #include "chrome/install_static/install_details.h"
37 #include "chrome_elf/chrome_elf_main.h"
37 38
38 #define DLLEXPORT __declspec(dllexport) 39 #define DLLEXPORT __declspec(dllexport)
39 40
40 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. 41 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling.
41 extern "C" { 42 extern "C" {
42 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, 43 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance,
43 sandbox::SandboxInterfaceInfo* sandbox_info, 44 sandbox::SandboxInterfaceInfo* sandbox_info,
44 int64_t exe_entry_point_ticks); 45 int64_t exe_entry_point_ticks);
45 } 46 }
46 #elif defined(OS_POSIX) 47 #elif defined(OS_POSIX)
(...skipping 20 matching lines...) Expand all
67 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); 68 base::TimeTicks::FromInternalValue(exe_entry_point_ticks));
68 content::ContentMainParams params(&chrome_main_delegate); 69 content::ContentMainParams params(&chrome_main_delegate);
69 70
70 #if defined(OS_WIN) 71 #if defined(OS_WIN)
71 // The process should crash when going through abnormal termination. 72 // The process should crash when going through abnormal termination.
72 base::win::SetShouldCrashOnProcessDetach(true); 73 base::win::SetShouldCrashOnProcessDetach(true);
73 base::win::SetAbortBehaviorForCrashReporting(); 74 base::win::SetAbortBehaviorForCrashReporting();
74 params.instance = instance; 75 params.instance = instance;
75 params.sandbox_info = sandbox_info; 76 params.sandbox_info = sandbox_info;
76 77
77 // SetDumpWithoutCrashingFunction must be passed the DumpProcess function 78 // Pass chrome_elf's copy of DumpProcessWithoutCrash resolved via load-time
78 // from chrome_elf and not from the DLL in order for DumpWithoutCrashing to 79 // dynamic linking.
79 // function correctly. 80 base::debug::SetDumpWithoutCrashingFunction(&DumpProcessWithoutCrash);
80 typedef void (__cdecl *DumpProcessFunction)();
81 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>(
82 ::GetProcAddress(::GetModuleHandle(chrome::kChromeElfDllName),
83 "DumpProcessWithoutCrash"));
84 CHECK(DumpProcess);
85 base::debug::SetDumpWithoutCrashingFunction(DumpProcess);
86 81
87 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) 82 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll)
88 // have the same version. 83 // have the same version.
89 if (install_static::InstallDetails::Get().VersionMismatch()) 84 if (install_static::InstallDetails::Get().VersionMismatch())
90 base::debug::DumpWithoutCrashing(); 85 base::debug::DumpWithoutCrashing();
91 #else 86 #else
92 params.argc = argc; 87 params.argc = argc;
93 params.argv = argv; 88 params.argv = argv;
94 base::CommandLine::Init(params.argc, params.argv); 89 base::CommandLine::Init(params.argc, params.argv);
95 #endif // defined(OS_WIN) 90 #endif // defined(OS_WIN)
(...skipping 27 matching lines...) Expand all
123 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) 118 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES)
124 119
125 int rv = content::ContentMain(params); 120 int rv = content::ContentMain(params);
126 121
127 #if defined(OS_WIN) 122 #if defined(OS_WIN)
128 base::win::SetShouldCrashOnProcessDetach(false); 123 base::win::SetShouldCrashOnProcessDetach(false);
129 #endif 124 #endif
130 125
131 return rv; 126 return rv;
132 } 127 }
OLDNEW
« no previous file with comments | « base/debug/dump_without_crashing.cc ('k') | chrome_elf/chrome_elf.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698