Index: components/crash/content/app/crashpad.cc |
diff --git a/components/crash/content/app/crashpad.cc b/components/crash/content/app/crashpad.cc |
index e3b4124affd8182b1d160d42f109363bab717612..345dced18decc078b70e0c57b2cc454b619bac18 100644 |
--- a/components/crash/content/app/crashpad.cc |
+++ b/components/crash/content/app/crashpad.cc |
@@ -19,6 +19,7 @@ |
#include "base/strings/string_piece.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/sys_string_conversions.h" |
+#include "base/strings/utf_string_conversions.h" |
#include "build/build_config.h" |
#include "components/crash/content/app/crash_reporter_client.h" |
#include "third_party/crashpad/crashpad/client/crash_report_database.h" |
@@ -143,8 +144,15 @@ void InitializeCrashpad(bool initial_client, const std::string& process_type) { |
g_simple_string_dictionary = new crashpad::SimpleStringDictionary(); |
crashpad_info->set_simple_annotations(g_simple_string_dictionary); |
+#if !defined(OS_WIN) || !defined(COMPONENT_BUILD) |
+ // chrome/common/child_process_logging_win.cc registers crash keys for |
+ // chrome.dll. In a component build, that is sufficient as chrome.dll and |
+ // chrome.exe share a copy of base (in base.dll). In a static build, the EXE |
+ // must separately initialize the crash keys configuration as it has its own |
+ // statically linked copy of base. |
base::debug::SetCrashKeyReportingFunctions(SetCrashKeyValue, ClearCrashKey); |
crash_reporter_client->RegisterCrashKeys(); |
+#endif |
SetCrashKeyValue("ptype", browser_process ? base::StringPiece("browser") |
: base::StringPiece(process_type)); |
@@ -234,3 +242,25 @@ void GetUploadedReports(std::vector<UploadedReport>* uploaded_reports) { |
} |
} // namespace crash_reporter |
+ |
+#if defined(OS_WIN) |
+ |
+extern "C" { |
+ |
+// NOTE: This function is used by SyzyASAN to annotate crash reports. If you |
+// change the name or signature of this function you will break SyzyASAN |
+// instrumented releases of Chrome. Please contact syzygy-team@chromium.org |
+// before doing so! See also http://crbug.com/567781. |
+void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, |
+ const wchar_t* value) { |
+ crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), |
+ base::UTF16ToUTF8(value)); |
+} |
+ |
+void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { |
+ crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); |
+} |
+ |
+} // extern "C" |
+ |
+#endif // OS_WIN |