Index: components/crash/app/breakpad_linux.cc |
diff --git a/components/crash/app/breakpad_linux.cc b/components/crash/app/breakpad_linux.cc |
index 03ce34b1089d0baf441b940ed65a8212ee20b7d6..702d0b48ee50438898dad8a51e652b22817a8776 100644 |
--- a/components/crash/app/breakpad_linux.cc |
+++ b/components/crash/app/breakpad_linux.cc |
@@ -89,6 +89,12 @@ char* g_crash_log_path = NULL; |
ExceptionHandler* g_breakpad = NULL; |
ExceptionHandler* g_microdump = NULL; |
+std::string g_microdump_build_fingerprint; |
Lei Zhang
2015/05/14 19:14:26
Mark these Android only?
Lei Zhang
2015/05/14 19:14:27
Won't this and |g_microdump_product_info| add stat
Primiano Tucci (use gerrit)
2015/05/15 10:20:28
Facepalm, right. switched to lazy_instance with no
Primiano Tucci (use gerrit)
2015/05/15 10:20:28
Done.
|
+const char* g_c_microdump_build_fingerprint = NULL; |
Lei Zhang
2015/05/14 19:14:27
Let's start using nullptr in new code.
Primiano Tucci (use gerrit)
2015/05/15 10:20:27
If you are fine with that, I did mass s/NULL/nullp
|
+ |
+std::string g_microdump_product_info; |
+const char* g_c_microdump_product_info = NULL; |
+ |
#if defined(ADDRESS_SANITIZER) |
const char* g_asan_report_str = NULL; |
#endif |
@@ -729,10 +735,29 @@ void InitMicrodumpCrashHandlerIfNecessary(const std::string& process_type) { |
VLOG(1) << "Enabling microdumps crash handler (process_type:" |
<< process_type << ")"; |
+ |
+ const char* product_name = NULL; |
+ const char* product_version = NULL; |
+ GetCrashReporterClient()->GetProductNameAndVersion(&product_name, |
+ &product_version); |
+ g_microdump_product_info = product_name + string(":") + product_version; |
+ g_microdump_build_fingerprint = |
+ base::android::BuildInfo::GetInstance()->android_build_fp(); |
+ |
+ // The exception handler runs in a compromised context and cannot use c_str() |
+ // as that would require the heap. Therefore, we have to guarantee that the |
+ // build fingerprint and product info pointers are always valid. |
+ g_c_microdump_product_info = g_microdump_product_info.c_str(); |
+ g_c_microdump_build_fingerprint = g_microdump_build_fingerprint.c_str(); |
+ |
+ MinidumpDescriptor descriptor(MinidumpDescriptor::kMicrodumpOnConsole); |
+ descriptor.SetMicrodumpProductInfo(g_c_microdump_product_info); |
+ descriptor.SetMicrodumpBuildFingerprint(g_c_microdump_build_fingerprint); |
+ |
DCHECK(!g_microdump); |
bool is_browser_process = process_type.empty() || process_type == "webview"; |
g_microdump = new ExceptionHandler( |
- MinidumpDescriptor(MinidumpDescriptor::kMicrodumpOnConsole), |
+ descriptor, |
NULL, |
MicrodumpCrashDone, |
reinterpret_cast<void*>(is_browser_process), |