Chromium Code Reviews| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 | 554 |
| 555 AddString(filename_msg); | 555 AddString(filename_msg); |
| 556 AddString(g_sep); | 556 AddString(g_sep); |
| 557 AddItem(data, data_len); | 557 AddItem(data, data_len); |
| 558 AddString(g_sep); | 558 AddString(g_sep); |
| 559 AddItem(file_data, file_size); | 559 AddItem(file_data, file_size); |
| 560 Flush(); | 560 Flush(); |
| 561 } | 561 } |
| 562 #endif // defined(OS_CHROMEOS) | 562 #endif // defined(OS_CHROMEOS) |
| 563 | 563 |
| 564 #if defined(OS_ANDROID) | |
| 565 // Writes the "package" field, which is in the format: | |
| 566 // $PACKAGE_NAME v$VERSION_CODE ($VERSION_NAME) | |
| 567 void WriteAndroidPackage(MimeWriter& writer, | |
| 568 base::android::BuildInfo* android_build_info) { | |
| 569 static const char package[] = "package"; | |
| 570 // The actual size limits on packageId and versionName are quite generous. | |
| 571 // Limit to a reasonable size rather than allocating theoretical limits. | |
| 572 const int kMaxSize = 1024; | |
| 573 char buf[kMaxSize]; | |
| 574 | |
| 575 my_strlcpy(buf, android_build_info->package_name(), kMaxSize); | |
|
scottmg
2017/01/11 02:47:41
Comment here why it's not just using sprintf.
agrieve
2017/01/12 02:13:09
Done.
| |
| 576 my_strlcat(buf, " v", kMaxSize - my_strlen(buf)); | |
|
scottmg
2017/01/11 02:47:41
I believe strlcat and strlcpy normally take the fu
agrieve
2017/01/12 02:13:09
Aha, that's much nicer :)
| |
| 577 my_strlcat(buf, android_build_info->package_version_code(), | |
| 578 kMaxSize - my_strlen(buf)); | |
| 579 my_strlcat(buf, " (", kMaxSize - my_strlen(buf)); | |
| 580 my_strlcat(buf, android_build_info->package_version_name(), | |
| 581 kMaxSize - my_strlen(buf)); | |
| 582 my_strlcat(buf, ")", kMaxSize - my_strlen(buf)); | |
| 583 | |
| 584 writer.AddPairString(package, buf); | |
| 585 } | |
| 586 #endif // defined(OS_ANDROID) | |
| 587 | |
| 564 void DumpProcess() { | 588 void DumpProcess() { |
| 565 if (g_breakpad) | 589 if (g_breakpad) |
| 566 g_breakpad->WriteMinidump(); | 590 g_breakpad->WriteMinidump(); |
| 567 | 591 |
| 568 #if defined(OS_ANDROID) | 592 #if defined(OS_ANDROID) |
| 569 // If microdumps are enabled write also a microdump on the system log. | 593 // If microdumps are enabled write also a microdump on the system log. |
| 570 if (g_microdump) | 594 if (g_microdump) |
| 571 g_microdump->WriteMinidump(); | 595 g_microdump->WriteMinidump(); |
| 572 #endif | 596 #endif |
| 573 } | 597 } |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1650 writer.AddBoundary(); | 1674 writer.AddBoundary(); |
| 1651 writer.AddPairString(device, android_build_info->device()); | 1675 writer.AddPairString(device, android_build_info->device()); |
| 1652 writer.AddBoundary(); | 1676 writer.AddBoundary(); |
| 1653 writer.AddPairString(model, android_build_info->model()); | 1677 writer.AddPairString(model, android_build_info->model()); |
| 1654 writer.AddBoundary(); | 1678 writer.AddBoundary(); |
| 1655 writer.AddPairString(brand, android_build_info->brand()); | 1679 writer.AddPairString(brand, android_build_info->brand()); |
| 1656 writer.AddBoundary(); | 1680 writer.AddBoundary(); |
| 1657 writer.AddPairString(gms_core_version, | 1681 writer.AddPairString(gms_core_version, |
| 1658 android_build_info->gms_version_code()); | 1682 android_build_info->gms_version_code()); |
| 1659 writer.AddBoundary(); | 1683 writer.AddBoundary(); |
| 1684 WriteAndroidPackage(writer, android_build_info); | |
| 1685 writer.AddBoundary(); | |
| 1660 if (android_build_info->java_exception_info() != nullptr) { | 1686 if (android_build_info->java_exception_info() != nullptr) { |
| 1661 writer.AddPairString(exception_info, | 1687 writer.AddPairString(exception_info, |
| 1662 android_build_info->java_exception_info()); | 1688 android_build_info->java_exception_info()); |
| 1663 writer.AddBoundary(); | 1689 writer.AddBoundary(); |
| 1664 } | 1690 } |
| 1665 #endif | 1691 #endif |
| 1666 writer.Flush(); | 1692 writer.Flush(); |
| 1667 } | 1693 } |
| 1668 | 1694 |
| 1669 if (info.process_start_time > 0) { | 1695 if (info.process_start_time > 0) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1967 void SetNativeCodeTextAddrRange(uintptr_t start, uintptr_t end) { | 1993 void SetNativeCodeTextAddrRange(uintptr_t start, uintptr_t end) { |
| 1968 g_microdump_info.Get().SetMicrodumpInterestRange(start, end); | 1994 g_microdump_info.Get().SetMicrodumpInterestRange(start, end); |
| 1969 } | 1995 } |
| 1970 #endif // OS_ANDROID | 1996 #endif // OS_ANDROID |
| 1971 | 1997 |
| 1972 bool IsCrashReporterEnabled() { | 1998 bool IsCrashReporterEnabled() { |
| 1973 return g_is_crash_reporter_enabled; | 1999 return g_is_crash_reporter_enabled; |
| 1974 } | 2000 } |
| 1975 | 2001 |
| 1976 } // namespace breakpad | 2002 } // namespace breakpad |
| OLD | NEW |