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

Unified Diff: components/crash/content/app/crashpad.cc

Issue 1517503004: win: Fix not setting crash keys in non-component build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't initialize in tests Created 5 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
« no previous file with comments | « chrome/test/base/chrome_test_launcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/test/base/chrome_test_launcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698