From 80f596984e3a941353a7d179efdf86ff0181d412 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Fri, 20 Jun 2014 16:19:58 -0700 Subject: [PATCH] Print ABI in backtraces. This lets the stack tool figure out which toolchain to use automatically. Change-Id: Ia235d6904622423fe6fbc7b0315a1861e52a41ad --- debuggerd/backtrace.cpp | 3 ++- debuggerd/tombstone.cpp | 15 --------------- debuggerd/utility.h | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/debuggerd/backtrace.cpp b/debuggerd/backtrace.cpp index 50bc16702..c4a2143cf 100644 --- a/debuggerd/backtrace.cpp +++ b/debuggerd/backtrace.cpp @@ -49,8 +49,9 @@ static void dump_process_header(log_t* log, pid_t pid) { struct tm tm; localtime_r(&t, &tm); char timestr[64]; + _LOG(log, logtype::BACKTRACE, "\n\nABI: '%s'\n", ABI_STRING); strftime(timestr, sizeof(timestr), "%F %T", &tm); - _LOG(log, logtype::BACKTRACE, "\n\n----- pid %d at %s -----\n", pid, timestr); + _LOG(log, logtype::BACKTRACE, "\n----- pid %d at %s -----\n", pid, timestr); if (procname) { _LOG(log, logtype::BACKTRACE, "Cmd line: %s\n", procname); diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp index 74828868a..a58d9e588 100755 --- a/debuggerd/tombstone.cpp +++ b/debuggerd/tombstone.cpp @@ -58,21 +58,6 @@ // Must match the path defined in NativeCrashListener.java #define NCRASH_SOCKET_PATH "/data/system/ndebugsocket" -// Figure out the abi based on defined macros. -#if defined(__arm__) -#define ABI_STRING "arm" -#elif defined(__aarch64__) -#define ABI_STRING "arm64" -#elif defined(__mips__) -#define ABI_STRING "mips" -#elif defined(__i386__) -#define ABI_STRING "x86" -#elif defined(__x86_64__) -#define ABI_STRING "x86_64" -#else -#error "Unsupported ABI" -#endif - static bool signal_has_si_addr(int sig) { switch (sig) { case SIGBUS: diff --git a/debuggerd/utility.h b/debuggerd/utility.h index ee4f03536..f2e2d2959 100644 --- a/debuggerd/utility.h +++ b/debuggerd/utility.h @@ -21,6 +21,22 @@ #include #include +// Figure out the abi based on defined macros. +#if defined(__arm__) +#define ABI_STRING "arm" +#elif defined(__aarch64__) +#define ABI_STRING "arm64" +#elif defined(__mips__) +#define ABI_STRING "mips" +#elif defined(__i386__) +#define ABI_STRING "x86" +#elif defined(__x86_64__) +#define ABI_STRING "x86_64" +#else +#error "Unsupported ABI" +#endif + + typedef struct { /* tombstone file descriptor */ int tfd;