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

Unified Diff: services/service_manager/embedder/main.cc

Issue 2851653002: Make sanitizer signal handlers work again. (Closed)
Patch Set: Move commandline init to before SetupSignalHandlers(). Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/common/content_switches.cc ('k') | services/service_manager/embedder/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/service_manager/embedder/main.cc
diff --git a/services/service_manager/embedder/main.cc b/services/service_manager/embedder/main.cc
index c636bd2cef8d2abd36cb635130c4adfbe2e732d1..9635dc2c514bdd43a2ca02535d06d901dfe11f31 100644
--- a/services/service_manager/embedder/main.cc
+++ b/services/service_manager/embedder/main.cc
@@ -108,6 +108,12 @@ class ServiceProcessLauncherDelegateImpl
// Setup signal-handling state: resanitize most signals, ignore SIGPIPE.
void SetupSignalHandlers() {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableInProcessStackTraces)) {
+ // Don't interfere with sanitizer signal handlers.
+ return;
+ }
+
// Sanitise our signal handling state. Signals that were ignored by our
// parent will also be ignored by us. We also inherit our parent's sigmask.
sigset_t empty_signal_set;
@@ -337,16 +343,6 @@ int Main(const MainParams& params) {
ui::win::CreateATLModuleIfNeeded();
#endif // defined(OS_WIN)
-// On Android setlocale() is not supported, and we don't override the signal
-// handlers so we can get a stack trace when crashing.
-#if defined(OS_POSIX) && !defined(OS_ANDROID)
- // Set C library locale to make sure CommandLine can parse argument values in
- // the correct encoding.
- setlocale(LC_ALL, "");
-
- SetupSignalHandlers();
-#endif
-
#if !defined(OS_ANDROID)
// On Android, the command line is initialized when library is loaded.
int argc = 0;
@@ -369,6 +365,16 @@ int Main(const MainParams& params) {
SetProcessTitleFromCommandLine(argv);
#endif // !defined(OS_ANDROID)
+// On Android setlocale() is not supported, and we don't override the signal
+// handlers so we can get a stack trace when crashing.
+#if defined(OS_POSIX) && !defined(OS_ANDROID)
+ // Set C library locale to make sure CommandLine can parse argument values in
+ // the correct encoding.
+ setlocale(LC_ALL, "");
+
+ SetupSignalHandlers();
+#endif
+
const auto& command_line = *base::CommandLine::ForCurrentProcess();
#if defined(OS_WIN)
« no previous file with comments | « content/public/common/content_switches.cc ('k') | services/service_manager/embedder/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698