summaryrefslogtreecommitdiff
path: root/debuggerd/libdebuggerd/utility.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-04-03 09:27:12 -0700
committerChristopher Ferris <cferris@google.com>2019-04-18 15:37:52 -0700
commitb914f04abb666493256946ce310b387ee4ff59dc (patch)
tree8bff2bcc0625cd0ee8f3667f170ac6a8779842f3 /debuggerd/libdebuggerd/utility.cpp
parent1e3961007845ef5631339abfb5d59dc0892f419a (diff)
Add indicator that an elf is memory backed.
Modify the unwinder library to indicate that at least one of the stack frames contains an elf file that is unreadable. Modify debuggerd to display a note about the unreadable frame and a possible way to fix it. Bug: 129769339 Test: New unit tests pass. Test: Ran an app that crashes and has an unreadable file and verified the Test: message is displayed. Then setenforce 0 and verify the message is Test: not displayed. Change-Id: Ibc4fe1d117e9b5840290454e90914ddc698d3cc2
Diffstat (limited to 'debuggerd/libdebuggerd/utility.cpp')
-rw-r--r--debuggerd/libdebuggerd/utility.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/debuggerd/libdebuggerd/utility.cpp b/debuggerd/libdebuggerd/utility.cpp
index 7aebea8fed..9b2779a9e4 100644
--- a/debuggerd/libdebuggerd/utility.cpp
+++ b/debuggerd/libdebuggerd/utility.cpp
@@ -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;
@@ -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());
+ }
+}