OLD | NEW |
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 Loading... |
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 // The actual size limits on packageId and versionName are quite generous. |
| 562 // Limit to a reasonable size rather than allocating theoretical limits. |
| 563 const int kMaxSize = 1024; |
| 564 char buf[kMaxSize]; |
| 565 |
| 566 // Not using sprintf to ensure no heap allocations. |
| 567 my_strlcpy(buf, android_build_info->package_name(), kMaxSize); |
| 568 my_strlcat(buf, " v", kMaxSize); |
| 569 my_strlcat(buf, android_build_info->package_version_code(), kMaxSize); |
| 570 my_strlcat(buf, " (", kMaxSize); |
| 571 my_strlcat(buf, android_build_info->package_version_name(), kMaxSize); |
| 572 my_strlcat(buf, ")", kMaxSize); |
| 573 |
| 574 writer.AddPairString("package", buf); |
| 575 } |
| 576 #endif // defined(OS_ANDROID) |
| 577 |
556 void DumpProcess() { | 578 void DumpProcess() { |
557 if (g_breakpad) | 579 if (g_breakpad) |
558 g_breakpad->WriteMinidump(); | 580 g_breakpad->WriteMinidump(); |
559 | 581 |
560 #if defined(OS_ANDROID) | 582 #if defined(OS_ANDROID) |
561 // If microdumps are enabled write also a microdump on the system log. | 583 // If microdumps are enabled write also a microdump on the system log. |
562 if (g_microdump) | 584 if (g_microdump) |
563 g_microdump->WriteMinidump(); | 585 g_microdump->WriteMinidump(); |
564 #endif | 586 #endif |
565 } | 587 } |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 writer.AddBoundary(); | 1643 writer.AddBoundary(); |
1622 writer.AddPairString(device, android_build_info->device()); | 1644 writer.AddPairString(device, android_build_info->device()); |
1623 writer.AddBoundary(); | 1645 writer.AddBoundary(); |
1624 writer.AddPairString(model, android_build_info->model()); | 1646 writer.AddPairString(model, android_build_info->model()); |
1625 writer.AddBoundary(); | 1647 writer.AddBoundary(); |
1626 writer.AddPairString(brand, android_build_info->brand()); | 1648 writer.AddPairString(brand, android_build_info->brand()); |
1627 writer.AddBoundary(); | 1649 writer.AddBoundary(); |
1628 writer.AddPairString(gms_core_version, | 1650 writer.AddPairString(gms_core_version, |
1629 android_build_info->gms_version_code()); | 1651 android_build_info->gms_version_code()); |
1630 writer.AddBoundary(); | 1652 writer.AddBoundary(); |
| 1653 WriteAndroidPackage(writer, android_build_info); |
| 1654 writer.AddBoundary(); |
1631 if (android_build_info->java_exception_info() != nullptr) { | 1655 if (android_build_info->java_exception_info() != nullptr) { |
1632 writer.AddPairString(exception_info, | 1656 writer.AddPairString(exception_info, |
1633 android_build_info->java_exception_info()); | 1657 android_build_info->java_exception_info()); |
1634 writer.AddBoundary(); | 1658 writer.AddBoundary(); |
1635 } | 1659 } |
1636 #endif | 1660 #endif |
1637 writer.Flush(); | 1661 writer.Flush(); |
1638 } | 1662 } |
1639 | 1663 |
1640 if (info.process_start_time > 0) { | 1664 if (info.process_start_time > 0) { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 const std::string& gpu_fingerprint) { | 1958 const std::string& gpu_fingerprint) { |
1935 g_microdump_info.Get().SetGpuFingerprint(gpu_fingerprint); | 1959 g_microdump_info.Get().SetGpuFingerprint(gpu_fingerprint); |
1936 } | 1960 } |
1937 #endif // OS_ANDROID | 1961 #endif // OS_ANDROID |
1938 | 1962 |
1939 bool IsCrashReporterEnabled() { | 1963 bool IsCrashReporterEnabled() { |
1940 return g_is_crash_reporter_enabled; | 1964 return g_is_crash_reporter_enabled; |
1941 } | 1965 } |
1942 | 1966 |
1943 } // namespace breakpad | 1967 } // namespace breakpad |
OLD | NEW |