Commit 11478276 authored by agrieve's avatar agrieve Committed by Commit bot

Add package field to Android crash reports

Required for crash server to de-obfuscate java stack traces.

BUG=620323

Review-Url: https://codereview.chromium.org/2556523002
Cr-Commit-Position: refs/heads/master@{#443305}
parent ab4e21b7
......@@ -553,6 +553,28 @@ void CrashReporterWriter::AddFileContents(const char* filename_msg,
}
#endif // defined(OS_CHROMEOS)
#if defined(OS_ANDROID)
// Writes the "package" field, which is in the format:
// $PACKAGE_NAME v$VERSION_CODE ($VERSION_NAME)
void WriteAndroidPackage(MimeWriter& writer,
base::android::BuildInfo* android_build_info) {
// The actual size limits on packageId and versionName are quite generous.
// Limit to a reasonable size rather than allocating theoretical limits.
const int kMaxSize = 1024;
char buf[kMaxSize];
// Not using sprintf to ensure no heap allocations.
my_strlcpy(buf, android_build_info->package_name(), kMaxSize);
my_strlcat(buf, " v", kMaxSize);
my_strlcat(buf, android_build_info->package_version_code(), kMaxSize);
my_strlcat(buf, " (", kMaxSize);
my_strlcat(buf, android_build_info->package_version_name(), kMaxSize);
my_strlcat(buf, ")", kMaxSize);
writer.AddPairString("package", buf);
}
#endif // defined(OS_ANDROID)
void DumpProcess() {
if (g_breakpad)
g_breakpad->WriteMinidump();
......@@ -1628,6 +1650,8 @@ void HandleCrashDump(const BreakpadInfo& info) {
writer.AddPairString(gms_core_version,
android_build_info->gms_version_code());
writer.AddBoundary();
WriteAndroidPackage(writer, android_build_info);
writer.AddBoundary();
if (android_build_info->java_exception_info() != nullptr) {
writer.AddPairString(exception_info,
android_build_info->java_exception_info());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment