diff options
| author | Peter Collingbourne <pcc@google.com> | 2021-11-05 18:40:52 -0700 |
|---|---|---|
| committer | Peter Collingbourne <pcc@google.com> | 2021-11-05 18:59:26 -0700 |
| commit | a6ceb010f19429312ce882d38ab6172e7f526447 (patch) | |
| tree | 0736c074c014637e0603c633419face7050944bf /debuggerd/libdebuggerd/utility.cpp | |
| parent | 25392487556b9468963883c7410707e3eb360dfa (diff) | |
Add a human readable description of the tagged_addr_ctrl value to tombstones.
Change-Id: Ib9860b282cf749891e0f6ef7697669b94235c236
Diffstat (limited to 'debuggerd/libdebuggerd/utility.cpp')
| -rw-r--r-- | debuggerd/libdebuggerd/utility.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/debuggerd/libdebuggerd/utility.cpp b/debuggerd/libdebuggerd/utility.cpp index a7506b7608..3c4c271495 100644 --- a/debuggerd/libdebuggerd/utility.cpp +++ b/debuggerd/libdebuggerd/utility.cpp @@ -41,6 +41,7 @@ #include <unwindstack/Memory.h> #include <unwindstack/Unwinder.h> +using android::base::StringPrintf; using android::base::unique_fd; bool is_allowed_in_logcat(enum logtype ltype) { @@ -444,6 +445,33 @@ const char* get_sigcode(const siginfo_t* si) { return "?"; } +std::string describe_tagged_addr_ctrl(long ctrl) { + std::string desc; + if (ctrl & PR_TAGGED_ADDR_ENABLE) { + desc += ", PR_TAGGED_ADDR_ENABLE"; + ctrl &= ~PR_TAGGED_ADDR_ENABLE; + } + if (ctrl & PR_MTE_TCF_SYNC) { + desc += ", PR_MTE_TCF_SYNC"; + ctrl &= ~PR_MTE_TCF_SYNC; + } + if (ctrl & PR_MTE_TCF_ASYNC) { + desc += ", PR_MTE_TCF_ASYNC"; + ctrl &= ~PR_MTE_TCF_ASYNC; + } + if (ctrl & PR_MTE_TAG_MASK) { + desc += StringPrintf(", mask 0x%04lx", (ctrl & PR_MTE_TAG_MASK) >> PR_MTE_TAG_SHIFT); + ctrl &= ~PR_MTE_TAG_MASK; + } + if (ctrl) { + desc += StringPrintf(", unknown 0x%lx", ctrl); + } + if (desc.empty()) { + return ""; + } + return " (" + desc.substr(2) + ")"; +} + void log_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* prefix) { if (unwinder->elf_from_memory_not_file()) { _LOG(log, logtype::BACKTRACE, |
