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

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

Issue 2556523002: Add package field to Android crash reports (Closed)
Patch Set: Created 4 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 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/content/app/breakpad_linux.h" 8 #include "components/crash/content/app/breakpad_linux.h"
9 9
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "components/crash/core/common/crash_keys.h" 51 #include "components/crash/core/common/crash_keys.h"
52 #include "content/public/common/content_descriptors.h" 52 #include "content/public/common/content_descriptors.h"
53 53
54 #if defined(OS_ANDROID) 54 #if defined(OS_ANDROID)
55 #include <android/log.h> 55 #include <android/log.h>
56 #include <sys/stat.h> 56 #include <sys/stat.h>
57 57
58 #include "base/android/build_info.h" 58 #include "base/android/build_info.h"
59 #include "base/android/path_utils.h" 59 #include "base/android/path_utils.h"
60 #include "base/debug/leak_annotations.h" 60 #include "base/debug/leak_annotations.h"
61 #include "base/strings/stringprintf.h"
61 #endif 62 #endif
62 #include "third_party/lss/linux_syscall_support.h" 63 #include "third_party/lss/linux_syscall_support.h"
63 64
64 #if defined(ADDRESS_SANITIZER) 65 #if defined(ADDRESS_SANITIZER)
65 #include <ucontext.h> // for getcontext(). 66 #include <ucontext.h> // for getcontext().
66 #endif 67 #endif
67 68
68 #if defined(OS_ANDROID) 69 #if defined(OS_ANDROID)
69 #define STAT_STRUCT struct stat 70 #define STAT_STRUCT struct stat
70 #define FSTAT_FUNC fstat 71 #define FSTAT_FUNC fstat
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 base::ThreadChecker thread_checker_; 136 base::ThreadChecker thread_checker_;
136 const char* microdump_build_fingerprint_; 137 const char* microdump_build_fingerprint_;
137 const char* microdump_product_info_; 138 const char* microdump_product_info_;
138 const char* microdump_gpu_fingerprint_; 139 const char* microdump_gpu_fingerprint_;
139 const char* microdump_process_type_; 140 const char* microdump_process_type_;
140 }; 141 };
141 142
142 base::LazyInstance<MicrodumpInfo> g_microdump_info = 143 base::LazyInstance<MicrodumpInfo> g_microdump_info =
143 LAZY_INSTANCE_INITIALIZER; 144 LAZY_INSTANCE_INITIALIZER;
144 145
146 // Creates the value for the "package" field, which is in the format:
147 // $PACKAGE_NAME v$VERSION_CODE ($VERSION_NAME)
148 std::string format_android_package(
Lei Zhang 2016/12/08 06:53:50 nit: FormatAndroidPackage() ?
agrieve 2016/12/13 18:47:45 Done.
149 base::android::BuildInfo* android_build_info) {
150 return base::StringPrintf("%s v%s (%s)",
Lei Zhang 2016/12/08 06:53:50 This file has "WARNING: this code runs in a compro
agrieve 2016/12/13 18:47:45 Aha, great info! Put it on the stack.
151 android_build_info->package_name(),
152 android_build_info->package_version_code(),
153 android_build_info->package_version_name());
154 }
145 #endif 155 #endif
146 156
147 CrashKeyStorage* g_crash_keys = nullptr; 157 CrashKeyStorage* g_crash_keys = nullptr;
148 158
149 // Writes the value |v| as 16 hex characters to the memory pointed at by 159 // Writes the value |v| as 16 hex characters to the memory pointed at by
150 // |output|. 160 // |output|.
151 void write_uint64_hex(char* output, uint64_t v) { 161 void write_uint64_hex(char* output, uint64_t v) {
152 static const char hextable[] = "0123456789abcdef"; 162 static const char hextable[] = "0123456789abcdef";
153 163
154 for (int i = 15; i >= 0; --i) { 164 for (int i = 15; i >= 0; --i) {
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 } 1613 }
1604 #if defined(OS_ANDROID) 1614 #if defined(OS_ANDROID)
1605 // Addtional MIME blocks are added for logging on Android devices. 1615 // Addtional MIME blocks are added for logging on Android devices.
1606 static const char android_build_id[] = "android_build_id"; 1616 static const char android_build_id[] = "android_build_id";
1607 static const char android_build_fp[] = "android_build_fp"; 1617 static const char android_build_fp[] = "android_build_fp";
1608 static const char device[] = "device"; 1618 static const char device[] = "device";
1609 static const char gms_core_version[] = "gms_core_version"; 1619 static const char gms_core_version[] = "gms_core_version";
1610 static const char model[] = "model"; 1620 static const char model[] = "model";
1611 static const char brand[] = "brand"; 1621 static const char brand[] = "brand";
1612 static const char exception_info[] = "exception_info"; 1622 static const char exception_info[] = "exception_info";
1623 static const char package[] = "package";
1613 1624
1614 base::android::BuildInfo* android_build_info = 1625 base::android::BuildInfo* android_build_info =
1615 base::android::BuildInfo::GetInstance(); 1626 base::android::BuildInfo::GetInstance();
1616 writer.AddPairString( 1627 writer.AddPairString(
1617 android_build_id, android_build_info->android_build_id()); 1628 android_build_id, android_build_info->android_build_id());
1618 writer.AddBoundary(); 1629 writer.AddBoundary();
1619 writer.AddPairString( 1630 writer.AddPairString(
1620 android_build_fp, android_build_info->android_build_fp()); 1631 android_build_fp, android_build_info->android_build_fp());
1621 writer.AddBoundary(); 1632 writer.AddBoundary();
1622 writer.AddPairString(device, android_build_info->device()); 1633 writer.AddPairString(device, android_build_info->device());
1623 writer.AddBoundary(); 1634 writer.AddBoundary();
1624 writer.AddPairString(model, android_build_info->model()); 1635 writer.AddPairString(model, android_build_info->model());
1625 writer.AddBoundary(); 1636 writer.AddBoundary();
1626 writer.AddPairString(brand, android_build_info->brand()); 1637 writer.AddPairString(brand, android_build_info->brand());
1627 writer.AddBoundary(); 1638 writer.AddBoundary();
1628 writer.AddPairString(gms_core_version, 1639 writer.AddPairString(gms_core_version,
1629 android_build_info->gms_version_code()); 1640 android_build_info->gms_version_code());
1630 writer.AddBoundary(); 1641 writer.AddBoundary();
1642 std::string android_package = format_android_package(android_build_info);
1643 writer.AddPairString(package, android_package.c_str());
1644 writer.AddBoundary();
1631 if (android_build_info->java_exception_info() != nullptr) { 1645 if (android_build_info->java_exception_info() != nullptr) {
1632 writer.AddPairString(exception_info, 1646 writer.AddPairString(exception_info,
1633 android_build_info->java_exception_info()); 1647 android_build_info->java_exception_info());
1634 writer.AddBoundary(); 1648 writer.AddBoundary();
1635 } 1649 }
1636 #endif 1650 #endif
1637 writer.Flush(); 1651 writer.Flush();
1638 } 1652 }
1639 1653
1640 if (info.process_start_time > 0) { 1654 if (info.process_start_time > 0) {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 const std::string& gpu_fingerprint) { 1948 const std::string& gpu_fingerprint) {
1935 g_microdump_info.Get().SetGpuFingerprint(gpu_fingerprint); 1949 g_microdump_info.Get().SetGpuFingerprint(gpu_fingerprint);
1936 } 1950 }
1937 #endif // OS_ANDROID 1951 #endif // OS_ANDROID
1938 1952
1939 bool IsCrashReporterEnabled() { 1953 bool IsCrashReporterEnabled() {
1940 return g_is_crash_reporter_enabled; 1954 return g_is_crash_reporter_enabled;
1941 } 1955 }
1942 1956
1943 } // namespace breakpad 1957 } // 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