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

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

Issue 2556523002: Add package field to Android crash reports (Closed)
Patch Set: scottmg comments Created 3 years, 11 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/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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 AddString(filename_msg); 547 AddString(filename_msg);
548 AddString(g_sep); 548 AddString(g_sep);
549 AddItem(data, data_len); 549 AddItem(data, data_len);
550 AddString(g_sep); 550 AddString(g_sep);
551 AddItem(file_data, file_size); 551 AddItem(file_data, file_size);
552 Flush(); 552 Flush();
553 } 553 }
554 #endif // defined(OS_CHROMEOS) 554 #endif // defined(OS_CHROMEOS)
555 555
556 #if defined(OS_ANDROID)
557 // Writes the "package" field, which is in the format:
558 // $PACKAGE_NAME v$VERSION_CODE ($VERSION_NAME)
559 void WriteAndroidPackage(MimeWriter& writer,
560 base::android::BuildInfo* android_build_info) {
561 static const char package[] = "package";
scottmg 2017/01/12 03:30:38 Since this is only used once, just put it into the
agrieve 2017/01/12 17:41:45 Done.
562 // The actual size limits on packageId and versionName are quite generous.
563 // Limit to a reasonable size rather than allocating theoretical limits.
564 const int kMaxSize = 1024;
565 char buf[kMaxSize];
566
567 // Not using sprintf to ensure no heap allocations.
568 my_strlcpy(buf, android_build_info->package_name(), kMaxSize);
569 my_strlcat(buf, " v", kMaxSize);
570 my_strlcat(buf, android_build_info->package_version_code(), kMaxSize);
571 my_strlcat(buf, " (", kMaxSize);
572 my_strlcat(buf, android_build_info->package_version_name(), kMaxSize);
573 my_strlcat(buf, ")", kMaxSize);
574
575 writer.AddPairString(package, buf);
576 }
577 #endif // defined(OS_ANDROID)
578
556 void DumpProcess() { 579 void DumpProcess() {
557 if (g_breakpad) 580 if (g_breakpad)
558 g_breakpad->WriteMinidump(); 581 g_breakpad->WriteMinidump();
559 582
560 #if defined(OS_ANDROID) 583 #if defined(OS_ANDROID)
561 // If microdumps are enabled write also a microdump on the system log. 584 // If microdumps are enabled write also a microdump on the system log.
562 if (g_microdump) 585 if (g_microdump)
563 g_microdump->WriteMinidump(); 586 g_microdump->WriteMinidump();
564 #endif 587 #endif
565 } 588 }
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 writer.AddBoundary(); 1644 writer.AddBoundary();
1622 writer.AddPairString(device, android_build_info->device()); 1645 writer.AddPairString(device, android_build_info->device());
1623 writer.AddBoundary(); 1646 writer.AddBoundary();
1624 writer.AddPairString(model, android_build_info->model()); 1647 writer.AddPairString(model, android_build_info->model());
1625 writer.AddBoundary(); 1648 writer.AddBoundary();
1626 writer.AddPairString(brand, android_build_info->brand()); 1649 writer.AddPairString(brand, android_build_info->brand());
1627 writer.AddBoundary(); 1650 writer.AddBoundary();
1628 writer.AddPairString(gms_core_version, 1651 writer.AddPairString(gms_core_version,
1629 android_build_info->gms_version_code()); 1652 android_build_info->gms_version_code());
1630 writer.AddBoundary(); 1653 writer.AddBoundary();
1654 WriteAndroidPackage(writer, android_build_info);
1655 writer.AddBoundary();
1631 if (android_build_info->java_exception_info() != nullptr) { 1656 if (android_build_info->java_exception_info() != nullptr) {
1632 writer.AddPairString(exception_info, 1657 writer.AddPairString(exception_info,
1633 android_build_info->java_exception_info()); 1658 android_build_info->java_exception_info());
1634 writer.AddBoundary(); 1659 writer.AddBoundary();
1635 } 1660 }
1636 #endif 1661 #endif
1637 writer.Flush(); 1662 writer.Flush();
1638 } 1663 }
1639 1664
1640 if (info.process_start_time > 0) { 1665 if (info.process_start_time > 0) {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 const std::string& gpu_fingerprint) { 1959 const std::string& gpu_fingerprint) {
1935 g_microdump_info.Get().SetGpuFingerprint(gpu_fingerprint); 1960 g_microdump_info.Get().SetGpuFingerprint(gpu_fingerprint);
1936 } 1961 }
1937 #endif // OS_ANDROID 1962 #endif // OS_ANDROID
1938 1963
1939 bool IsCrashReporterEnabled() { 1964 bool IsCrashReporterEnabled() {
1940 return g_is_crash_reporter_enabled; 1965 return g_is_crash_reporter_enabled;
1941 } 1966 }
1942 1967
1943 } // namespace breakpad 1968 } // 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