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

Side by Side Diff: components/crash/app/breakpad_linux.cc

Issue 1019663003: Roll breakpad r1454:r1456 and add product info in microdumps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // For linux_syscall_support.h. This makes it safe to call embedded system 5 // For linux_syscall_support.h. This makes it safe to call embedded system
6 // calls when in seccomp mode. 6 // calls when in seccomp mode.
7 7
8 #include "components/crash/app/breakpad_linux.h" 8 #include "components/crash/app/breakpad_linux.h"
9 9
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 const char kUploadURL[] = "https://clients2.google.com/cr/report"; 82 const char kUploadURL[] = "https://clients2.google.com/cr/report";
83 #endif 83 #endif
84 84
85 bool g_is_crash_reporter_enabled = false; 85 bool g_is_crash_reporter_enabled = false;
86 uint64_t g_process_start_time = 0; 86 uint64_t g_process_start_time = 0;
87 pid_t g_pid = 0; 87 pid_t g_pid = 0;
88 char* g_crash_log_path = NULL; 88 char* g_crash_log_path = NULL;
89 ExceptionHandler* g_breakpad = NULL; 89 ExceptionHandler* g_breakpad = NULL;
90 ExceptionHandler* g_microdump = NULL; 90 ExceptionHandler* g_microdump = NULL;
91 91
92 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.
93 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
94
95 std::string g_microdump_product_info;
96 const char* g_c_microdump_product_info = NULL;
97
92 #if defined(ADDRESS_SANITIZER) 98 #if defined(ADDRESS_SANITIZER)
93 const char* g_asan_report_str = NULL; 99 const char* g_asan_report_str = NULL;
94 #endif 100 #endif
95 #if defined(OS_ANDROID) 101 #if defined(OS_ANDROID)
96 char* g_process_type = NULL; 102 char* g_process_type = NULL;
97 #endif 103 #endif
98 104
99 CrashKeyStorage* g_crash_keys = NULL; 105 CrashKeyStorage* g_crash_keys = NULL;
100 106
101 // Writes the value |v| as 16 hex characters to the memory pointed at by 107 // Writes the value |v| as 16 hex characters to the memory pointed at by
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 // TODO(primiano): For the moment microdumps are enabled only on arm (32/64). 728 // TODO(primiano): For the moment microdumps are enabled only on arm (32/64).
723 // Extend support to other architectures (requires some breakpad changes). 729 // Extend support to other architectures (requires some breakpad changes).
724 return; 730 return;
725 #endif 731 #endif
726 732
727 if (!GetCrashReporterClient()->ShouldEnableBreakpadMicrodumps()) 733 if (!GetCrashReporterClient()->ShouldEnableBreakpadMicrodumps())
728 return; 734 return;
729 735
730 VLOG(1) << "Enabling microdumps crash handler (process_type:" 736 VLOG(1) << "Enabling microdumps crash handler (process_type:"
731 << process_type << ")"; 737 << process_type << ")";
738
739 const char* product_name = NULL;
740 const char* product_version = NULL;
741 GetCrashReporterClient()->GetProductNameAndVersion(&product_name,
742 &product_version);
743 g_microdump_product_info = product_name + string(":") + product_version;
744 g_microdump_build_fingerprint =
745 base::android::BuildInfo::GetInstance()->android_build_fp();
746
747 // The exception handler runs in a compromised context and cannot use c_str()
748 // as that would require the heap. Therefore, we have to guarantee that the
749 // build fingerprint and product info pointers are always valid.
750 g_c_microdump_product_info = g_microdump_product_info.c_str();
751 g_c_microdump_build_fingerprint = g_microdump_build_fingerprint.c_str();
752
753 MinidumpDescriptor descriptor(MinidumpDescriptor::kMicrodumpOnConsole);
754 descriptor.SetMicrodumpProductInfo(g_c_microdump_product_info);
755 descriptor.SetMicrodumpBuildFingerprint(g_c_microdump_build_fingerprint);
756
732 DCHECK(!g_microdump); 757 DCHECK(!g_microdump);
733 bool is_browser_process = process_type.empty() || process_type == "webview"; 758 bool is_browser_process = process_type.empty() || process_type == "webview";
734 g_microdump = new ExceptionHandler( 759 g_microdump = new ExceptionHandler(
735 MinidumpDescriptor(MinidumpDescriptor::kMicrodumpOnConsole), 760 descriptor,
736 NULL, 761 NULL,
737 MicrodumpCrashDone, 762 MicrodumpCrashDone,
738 reinterpret_cast<void*>(is_browser_process), 763 reinterpret_cast<void*>(is_browser_process),
739 true, // Install handlers. 764 true, // Install handlers.
740 -1); // Server file descriptor. -1 for in-process. 765 -1); // Server file descriptor. -1 for in-process.
741 return; 766 return;
742 } 767 }
743 768
744 bool CrashDoneInProcessNoUpload( 769 bool CrashDoneInProcessNoUpload(
745 const google_breakpad::MinidumpDescriptor& descriptor, 770 const google_breakpad::MinidumpDescriptor& descriptor,
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 } 1733 }
1709 } 1734 }
1710 } 1735 }
1711 #endif // OS_ANDROID 1736 #endif // OS_ANDROID
1712 1737
1713 bool IsCrashReporterEnabled() { 1738 bool IsCrashReporterEnabled() {
1714 return g_is_crash_reporter_enabled; 1739 return g_is_crash_reporter_enabled;
1715 } 1740 }
1716 1741
1717 } // namespace breakpad 1742 } // namespace breakpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698