mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-28 03:04:28 +01:00
Add MD_OS_ANDROID definition.
In order to better distinguish Android and Linux minidumps, introduce a new MD_OS_ANDROID definition, and modify related source code accordingly. Also append the build-fingerprint to the minidump location descriptor. This gives more information about the system image the device runs on. Review URL: https://breakpad.appspot.com/405002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@981 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
7db2fb7b93
commit
8d96707553
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user