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

Unified Diff: syzygy/agent/asan/rtl_impl.h

Issue 2576003002: Add the ability to defer the initialization of the SyzyAsan crash reporter. (Closed)
Patch Set: Fix comments. Created 3 years, 11 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 | « syzygy/agent/asan/gen/system_interceptors.def ('k') | syzygy/agent/asan/rtl_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: syzygy/agent/asan/rtl_impl.h
diff --git a/syzygy/agent/asan/rtl_impl.h b/syzygy/agent/asan/rtl_impl.h
index c9290bcb9c62f76417e62a61e7ec958287f9e00e..6db32b3245884b45387d45e1019f8796634d1906 100644
--- a/syzygy/agent/asan/rtl_impl.h
+++ b/syzygy/agent/asan/rtl_impl.h
@@ -105,7 +105,7 @@ void WINAPI asan_SetOnExceptionCallback(OnExceptionCallback callback);
// experiement.
typedef void(WINAPI* AsanExperimentCallback)(const char* experiment_name,
const char* experiment_group);
-// Calls @p callback once for each experiement this runtime is performing.
+// Calls @p callback once for each experiment this runtime is performing.
// @param callback a function that will be invoked recursively zero or more
// times to enumerate the experiments and their state.
void WINAPI asan_EnumExperiments(AsanExperimentCallback callback);
@@ -113,6 +113,29 @@ void WINAPI asan_EnumExperiments(AsanExperimentCallback callback);
int asan_CrashForException(EXCEPTION_POINTERS* exception);
+// This functions allows manually initializing the crash reporter used by the
+// runtime.
+//
+// It should only be used if the deferred initialization flag has been used by
+// the instrumented image (via the corresponding environment variable or at
+// instrumentation time) and should only be called once. Trying to initialize
+// the crash reporter a second time will result in undefined behavior.
+//
+// Manually controlling the initialization of the crash reporter is useful when
+// there's no crash reporter available at initialization time (i.e. the
+// instrumented process hasn't been initialized it yet). In addition to
+// instrumenting with the deferred initialization flag, the instrumented image
+// should do something like the following:
+//
+// InitializeCrashReporter();
+// typedef VOID(WINAPI* SyzyAsanInitializeCrashReporterFn)();
+// HMODULE handle = ::GetModuleHandle(L"syzyasan_rtl.dll");
+// SyzyAsanInitializeCrashReporterFn syzyasan_init_crash_reporter =
+// reinterpret_cast<SyzyAsanInitializeCrashReporterFn>(
+// ::GetProcAddress(handle, "asan_InitializeCrashReporter"));
+// syzyasan_init_crash_reporter();
+void WINAPI asan_InitializeCrashReporter();
+
} // extern "C"
#endif // SYZYGY_AGENT_ASAN_RTL_IMPL_H_
« no previous file with comments | « syzygy/agent/asan/gen/system_interceptors.def ('k') | syzygy/agent/asan/rtl_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698