Loading debuggerd/Android.bp +6 −0 Original line number Diff line number Diff line Loading @@ -183,6 +183,12 @@ cc_library_static { ], }, }, product_variables: { debuggable: { cflags: ["-DROOT_POSSIBLE"], }, }, } cc_test { Loading debuggerd/libdebuggerd/backtrace.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -74,10 +74,7 @@ void dump_backtrace_thread(int output_fd, unwindstack::Unwinder* unwinder, return; } unwinder->SetDisplayBuildID(true); for (size_t i = 0; i < unwinder->NumFrames(); i++) { _LOG(&log, logtype::BACKTRACE, " %s\n", unwinder->FormatFrame(i).c_str()); } log_backtrace(&log, unwinder, " "); } void dump_backtrace(android::base::unique_fd output_fd, unwindstack::Unwinder* unwinder, Loading debuggerd/libdebuggerd/include/libdebuggerd/utility.h +3 −0 Original line number Diff line number Diff line Loading @@ -73,9 +73,12 @@ typedef uint32_t word_t; void _LOG(log_t* log, logtype ltype, const char* fmt, ...) __attribute__((format(printf, 3, 4))); namespace unwindstack { class Unwinder; class Memory; } void log_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* prefix); void dump_memory(log_t* log, unwindstack::Memory* backtrace, uint64_t addr, const std::string&); void read_with_default(const char* path, char* buf, size_t len, const char* default_value); Loading debuggerd/libdebuggerd/tombstone.cpp +1 −8 Original line number Diff line number Diff line Loading @@ -371,13 +371,6 @@ static void dump_all_maps(log_t* log, unwindstack::Unwinder* unwinder, uint64_t } } void dump_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* prefix) { unwinder->SetDisplayBuildID(true); for (size_t i = 0; i < unwinder->NumFrames(); i++) { _LOG(log, logtype::BACKTRACE, "%s%s\n", prefix, unwinder->FormatFrame(i).c_str()); } } static void print_register_row(log_t* log, const std::vector<std::pair<std::string, uint64_t>>& registers) { std::string output; Loading Loading @@ -470,7 +463,7 @@ static bool dump_thread(log_t* log, unwindstack::Unwinder* unwinder, const Threa _LOG(log, logtype::THREAD, "Failed to unwind"); } else { _LOG(log, logtype::BACKTRACE, "\nbacktrace:\n"); dump_backtrace(log, unwinder, " "); log_backtrace(log, unwinder, " "); _LOG(log, logtype::STACK, "\nstack:\n"); dump_stack(log, unwinder->frames(), unwinder->GetMaps(), unwinder->GetProcessMemory().get()); Loading debuggerd/libdebuggerd/utility.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #include <debuggerd/handler.h> #include <log/log.h> #include <unwindstack/Memory.h> #include <unwindstack/Unwinder.h> using android::base::unique_fd; Loading Loading @@ -422,3 +423,22 @@ const char* get_sigcode(const siginfo_t* si) { // Then give up... return "?"; } void log_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* prefix) { if (unwinder->elf_from_memory_not_file()) { _LOG(log, logtype::BACKTRACE, "%sNOTE: Function names and BuildId information is missing for some frames due\n", prefix); _LOG(log, logtype::BACKTRACE, "%sNOTE: to unreadable libraries. For unwinds of apps, only shared libraries\n", prefix); _LOG(log, logtype::BACKTRACE, "%sNOTE: found under the lib/ directory are readable.\n", prefix); #if defined(ROOT_POSSIBLE) _LOG(log, logtype::BACKTRACE, "%sNOTE: On this device, run setenforce 0 to make the libraries readable.\n", prefix); #endif } unwinder->SetDisplayBuildID(true); for (size_t i = 0; i < unwinder->NumFrames(); i++) { _LOG(log, logtype::BACKTRACE, "%s%s\n", prefix, unwinder->FormatFrame(i).c_str()); } } Loading
debuggerd/Android.bp +6 −0 Original line number Diff line number Diff line Loading @@ -183,6 +183,12 @@ cc_library_static { ], }, }, product_variables: { debuggable: { cflags: ["-DROOT_POSSIBLE"], }, }, } cc_test { Loading
debuggerd/libdebuggerd/backtrace.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -74,10 +74,7 @@ void dump_backtrace_thread(int output_fd, unwindstack::Unwinder* unwinder, return; } unwinder->SetDisplayBuildID(true); for (size_t i = 0; i < unwinder->NumFrames(); i++) { _LOG(&log, logtype::BACKTRACE, " %s\n", unwinder->FormatFrame(i).c_str()); } log_backtrace(&log, unwinder, " "); } void dump_backtrace(android::base::unique_fd output_fd, unwindstack::Unwinder* unwinder, Loading
debuggerd/libdebuggerd/include/libdebuggerd/utility.h +3 −0 Original line number Diff line number Diff line Loading @@ -73,9 +73,12 @@ typedef uint32_t word_t; void _LOG(log_t* log, logtype ltype, const char* fmt, ...) __attribute__((format(printf, 3, 4))); namespace unwindstack { class Unwinder; class Memory; } void log_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* prefix); void dump_memory(log_t* log, unwindstack::Memory* backtrace, uint64_t addr, const std::string&); void read_with_default(const char* path, char* buf, size_t len, const char* default_value); Loading
debuggerd/libdebuggerd/tombstone.cpp +1 −8 Original line number Diff line number Diff line Loading @@ -371,13 +371,6 @@ static void dump_all_maps(log_t* log, unwindstack::Unwinder* unwinder, uint64_t } } void dump_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* prefix) { unwinder->SetDisplayBuildID(true); for (size_t i = 0; i < unwinder->NumFrames(); i++) { _LOG(log, logtype::BACKTRACE, "%s%s\n", prefix, unwinder->FormatFrame(i).c_str()); } } static void print_register_row(log_t* log, const std::vector<std::pair<std::string, uint64_t>>& registers) { std::string output; Loading Loading @@ -470,7 +463,7 @@ static bool dump_thread(log_t* log, unwindstack::Unwinder* unwinder, const Threa _LOG(log, logtype::THREAD, "Failed to unwind"); } else { _LOG(log, logtype::BACKTRACE, "\nbacktrace:\n"); dump_backtrace(log, unwinder, " "); log_backtrace(log, unwinder, " "); _LOG(log, logtype::STACK, "\nstack:\n"); dump_stack(log, unwinder->frames(), unwinder->GetMaps(), unwinder->GetProcessMemory().get()); Loading
debuggerd/libdebuggerd/utility.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #include <debuggerd/handler.h> #include <log/log.h> #include <unwindstack/Memory.h> #include <unwindstack/Unwinder.h> using android::base::unique_fd; Loading Loading @@ -422,3 +423,22 @@ const char* get_sigcode(const siginfo_t* si) { // Then give up... return "?"; } void log_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* prefix) { if (unwinder->elf_from_memory_not_file()) { _LOG(log, logtype::BACKTRACE, "%sNOTE: Function names and BuildId information is missing for some frames due\n", prefix); _LOG(log, logtype::BACKTRACE, "%sNOTE: to unreadable libraries. For unwinds of apps, only shared libraries\n", prefix); _LOG(log, logtype::BACKTRACE, "%sNOTE: found under the lib/ directory are readable.\n", prefix); #if defined(ROOT_POSSIBLE) _LOG(log, logtype::BACKTRACE, "%sNOTE: On this device, run setenforce 0 to make the libraries readable.\n", prefix); #endif } unwinder->SetDisplayBuildID(true); for (size_t i = 0; i < unwinder->NumFrames(); i++) { _LOG(log, logtype::BACKTRACE, "%s%s\n", prefix, unwinder->FormatFrame(i).c_str()); } }