diff options
-rw-r--r-- | src/client/linux/minidump_writer/minidump_writer.cc | 24 | ||||
-rw-r--r-- | src/google_breakpad/common/minidump_format.h | 3 | ||||
-rw-r--r-- | src/processor/exploitability.cc | 1 | ||||
-rw-r--r-- | src/processor/minidump.cc | 5 | ||||
-rw-r--r-- | src/processor/minidump_processor.cc | 6 |
5 files changed, 38 insertions, 1 deletions
diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc index 35a291db..209e1720 100644 --- a/src/client/linux/minidump_writer/minidump_writer.cc +++ b/src/client/linux/minidump_writer/minidump_writer.cc @@ -53,6 +53,9 @@ #include <link.h> #endif #include <stdio.h> +#if defined(__ANDROID__) +#include <sys/system_properties.h> +#endif #if !defined(__ANDROID__) #include <sys/ucontext.h> #include <sys/user.h> @@ -1246,7 +1249,11 @@ class MinidumpWriter { } bool WriteOSInformation(MDRawSystemInfo* sys_info) { +#if defined(__ANDROID__) + sys_info->platform_id = MD_OS_ANDROID; +#else sys_info->platform_id = MD_OS_LINUX; +#endif struct utsname uts; if (uname(&uts)) @@ -1283,6 +1290,23 @@ class MinidumpWriter { space_left -= info_len; } +#ifdef __ANDROID__ + // On Android, try to get the build fingerprint and append it. + // Fail gracefully because there is no guarantee that the system + // property will always be available or accessible. + char fingerprint[PROP_VALUE_MAX]; + int fingerprint_len = __system_property_get("ro.build.fingerprint", + fingerprint); + // System property values shall always be zero-terminated. + // Be paranoid and don't trust the system. + if (fingerprint_len > 0 && fingerprint_len < PROP_VALUE_MAX) { + const char* separator = " "; + if (!first_item) + strlcat(buf, separator, buf_len); + strlcat(buf, fingerprint, buf_len); + } +#endif + MDLocationDescriptor location; if (!minidump_writer_.WriteString(buf, 0, &location)) return false; diff --git a/src/google_breakpad/common/minidump_format.h b/src/google_breakpad/common/minidump_format.h index a92007a5..a43e2292 100644 --- a/src/google_breakpad/common/minidump_format.h +++ b/src/google_breakpad/common/minidump_format.h @@ -611,7 +611,8 @@ typedef enum { MD_OS_MAC_OS_X = 0x8101, /* Mac OS X/Darwin */ MD_OS_IOS = 0x8102, /* iOS */ MD_OS_LINUX = 0x8201, /* Linux */ - MD_OS_SOLARIS = 0x8202 /* Solaris */ + MD_OS_SOLARIS = 0x8202, /* Solaris */ + MD_OS_ANDROID = 0x8203 /* Android */ } MDOSPlatform; diff --git a/src/processor/exploitability.cc b/src/processor/exploitability.cc index eb0b4d35..459e7ce1 100644 --- a/src/processor/exploitability.cc +++ b/src/processor/exploitability.cc @@ -79,6 +79,7 @@ Exploitability *Exploitability::ExploitabilityForPlatform( case MD_OS_LINUX: case MD_OS_UNIX: case MD_OS_SOLARIS: + case MD_OS_ANDROID: default: { platform_exploitability = NULL; break; diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc index dd7358c0..d88101f6 100644 --- a/src/processor/minidump.cc +++ b/src/processor/minidump.cc @@ -1760,6 +1760,7 @@ string MinidumpModule::code_identifier() const { case MD_OS_MAC_OS_X: case MD_OS_IOS: case MD_OS_SOLARIS: + case MD_OS_ANDROID: case MD_OS_LINUX: { // TODO(mmentovai): support uuid extension if present, otherwise fall // back to version (from LC_ID_DYLIB?), otherwise fall back to something @@ -3108,6 +3109,10 @@ string MinidumpSystemInfo::GetOS() { os = "solaris"; break; + case MD_OS_ANDROID: + os = "android"; + break; + default: BPLOG(ERROR) << "MinidumpSystemInfo unknown OS for platform " << HexString(system_info_.platform_id); diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc index 40b28735..6dbe81ec 100644 --- a/src/processor/minidump_processor.cc +++ b/src/processor/minidump_processor.cc @@ -401,6 +401,11 @@ bool MinidumpProcessor::GetOSInfo(Minidump *dump, SystemInfo *info) { break; } + case MD_OS_ANDROID: { + info->os = "Android"; + break; + } + default: { // Assign the numeric platform ID into the OS string. char os_string[11]; @@ -838,6 +843,7 @@ string MinidumpProcessor::GetCrashReason(Minidump *dump, u_int64_t *address) { break; } + case MD_OS_ANDROID: case MD_OS_LINUX: { switch (exception_code) { case MD_EXCEPTION_CODE_LIN_SIGHUP: |