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

Unified Diff: syzygy/agent/asan/runtime.cc

Issue 2576003002: Add the ability to defer the initialization of the SyzyAsan crash reporter. (Closed)
Patch Set: Add an entry point to reinitialize the crash reporter. Created 4 years 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
Index: syzygy/agent/asan/runtime.cc
diff --git a/syzygy/agent/asan/runtime.cc b/syzygy/agent/asan/runtime.cc
index a35ea5c7772302e01c0290df649a511f1d89b449..0cee22141cdeb432e5d0802099d2edc785ff313b 100644
--- a/syzygy/agent/asan/runtime.cc
+++ b/syzygy/agent/asan/runtime.cc
@@ -501,13 +501,6 @@ bool AsanRuntime::SetUp(const std::wstring& flags_command_line) {
return false;
WindowsHeapAdapter::SetUp(heap_manager_.get());
- // Determine the preferred crash reporter type, as specified in the
- // environment. If this isn't present it defaults to
- // kDefaultCrashReporterType, in which case experiments or command-line flags
- // may specify the crash reporter to use.
- CrashReporterType crash_reporter_type =
- GetCrashReporterTypeFromEnvironment(logger());
-
if (params_.feature_randomization) {
AsanFeatureSet feature_set = GenerateRandomFeatureSet();
PropagateFeatureSet(feature_set);
@@ -516,27 +509,7 @@ bool AsanRuntime::SetUp(const std::wstring& flags_command_line) {
// Propagates the flags values to the different modules.
PropagateParams();
- // The name 'disable_breakpad_reporting' is legacy; this actually means to
- // disable all external crash reporting integration.
- if (!params_.disable_breakpad_reporting) {
- // This will create the crash reporter with a preference for creating a
- // reporter of the hinted type. If such a reporter isn't available, it will
- // fall back to trying to create the most 'modern' reporter available.
- crash_reporter_.reset(CreateCrashReporterWithTypeHint(
- logger(), crash_reporter_type).release());
- }
-
- // Set up the appropriate error handler depending on whether or not
- // we successfully initialized a crash reporter.
- if (crash_reporter_.get() != nullptr) {
- logger_->Write(base::StringPrintf(
- "SyzyASAN: Using %s for error reporting.",
- crash_reporter_->GetName()));
- SetErrorCallBack(base::Bind(&CrashReporterErrorHandler));
- } else {
- logger_->Write("SyzyASAN: Using default error reporting handler.");
- SetErrorCallBack(base::Bind(&DefaultErrorHandler));
- }
+ InitializeCrashReporter();
// Install the unhandled exception handler. This is only installed once
// across all runtime instances in a process so we check that it hasn't
@@ -1227,5 +1200,42 @@ AsanFeatureSet AsanRuntime::GetEnabledFeatureSet() {
return enabled_features;
}
+void AsanRuntime::InitializeCrashReporter() {
+ if (crash_reporter_.get() != nullptr) {
+ logger_->Write(base::StringPrintf(
+ "SyzyASAN: Reinitializing crash reporter.",
+ crash_reporter_->GetName()));
+ }
+
+ // Determine the preferred crash reporter type, as specified in the
+ // environment. If this isn't present it defaults to
+ // kDefaultCrashReporterType, in which case experiments or command-line flags
+ // may specify the crash reporter to use.
+ CrashReporterType crash_reporter_type =
+ GetCrashReporterTypeFromEnvironment(logger());
+
+ // The name 'disable_breakpad_reporting' is legacy; this actually means to
+ // disable all external crash reporting integration.
+ if (!params_.disable_breakpad_reporting) {
+ // This will create the crash reporter with a preference for creating a
+ // reporter of the hinted type. If such a reporter isn't available, it will
+ // fall back to trying to create the most 'modern' reporter available.
+ crash_reporter_.reset(CreateCrashReporterWithTypeHint(
+ logger(), crash_reporter_type).release());
+ }
+
+ // Set up the appropriate error handler depending on whether or not
+ // we successfully initialized a crash reporter.
+ if (crash_reporter_.get() != nullptr) {
+ logger_->Write(base::StringPrintf(
+ "SyzyASAN: Using %s for error reporting.",
+ crash_reporter_->GetName()));
+ SetErrorCallBack(base::Bind(&CrashReporterErrorHandler));
+ } else {
+ logger_->Write("SyzyASAN: Using default error reporting handler.");
+ SetErrorCallBack(base::Bind(&DefaultErrorHandler));
+ }
+}
+
} // namespace asan
} // namespace agent

Powered by Google App Engine
This is Rietveld 408576698