diff options
author | Yabin Cui <yabinc@google.com> | 2017-12-12 18:04:10 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2017-12-15 13:29:53 -0800 |
commit | f88082811a87e3e088b926d0e0fa90688e02d258 (patch) | |
tree | f338ee9f0e5e0c061fde9e3a39f2f27f9e457958 /libbacktrace/Backtrace.cpp | |
parent | 80bfeeef884e08b3a6aa593b1a35217b01e1b855 (diff) | |
download | system_core-f88082811a87e3e088b926d0e0fa90688e02d258.tar.gz system_core-f88082811a87e3e088b926d0e0fa90688e02d258.tar.bz2 system_core-f88082811a87e3e088b926d0e0fa90688e02d258.zip |
libbacktrace: export offline unwinding failures.
This is to help debugging different offline unwiding failures.
Bug: http://b/69383534
Test: run backtrace_test.
Change-Id: I5ed4837027a9f17d032925e97e9f5927161444b3
Diffstat (limited to 'libbacktrace/Backtrace.cpp')
-rw-r--r-- | libbacktrace/Backtrace.cpp | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/libbacktrace/Backtrace.cpp b/libbacktrace/Backtrace.cpp index e18dbf3db..5bb6edc8f 100644 --- a/libbacktrace/Backtrace.cpp +++ b/libbacktrace/Backtrace.cpp @@ -142,22 +142,33 @@ Backtrace* Backtrace::Create(pid_t pid, pid_t tid, BacktraceMap* map) { } std::string Backtrace::GetErrorString(BacktraceUnwindError error) { - switch (error) { - case BACKTRACE_UNWIND_NO_ERROR: - return "No error"; - case BACKTRACE_UNWIND_ERROR_SETUP_FAILED: - return "Setup failed"; - case BACKTRACE_UNWIND_ERROR_MAP_MISSING: - return "No map found"; - case BACKTRACE_UNWIND_ERROR_INTERNAL: - return "Internal libbacktrace error, please submit a bugreport"; - case BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST: - return "Thread doesn't exist"; - case BACKTRACE_UNWIND_ERROR_THREAD_TIMEOUT: - return "Thread has not responded to signal in time"; - case BACKTRACE_UNWIND_ERROR_UNSUPPORTED_OPERATION: - return "Attempt to use an unsupported feature"; - case BACKTRACE_UNWIND_ERROR_NO_CONTEXT: - return "Attempt to do an offline unwind without a context"; + switch (error.error_code) { + case BACKTRACE_UNWIND_NO_ERROR: + return "No error"; + case BACKTRACE_UNWIND_ERROR_SETUP_FAILED: + return "Setup failed"; + case BACKTRACE_UNWIND_ERROR_MAP_MISSING: + return "No map found"; + case BACKTRACE_UNWIND_ERROR_INTERNAL: + return "Internal libbacktrace error, please submit a bugreport"; + case BACKTRACE_UNWIND_ERROR_THREAD_DOESNT_EXIST: + return "Thread doesn't exist"; + case BACKTRACE_UNWIND_ERROR_THREAD_TIMEOUT: + return "Thread has not responded to signal in time"; + case BACKTRACE_UNWIND_ERROR_UNSUPPORTED_OPERATION: + return "Attempt to use an unsupported feature"; + case BACKTRACE_UNWIND_ERROR_NO_CONTEXT: + return "Attempt to do an offline unwind without a context"; + case BACKTRACE_UNWIND_ERROR_EXCEED_MAX_FRAMES_LIMIT: + return "Exceed MAX_BACKTRACE_FRAMES limit"; + case BACKTRACE_UNWIND_ERROR_ACCESS_MEM_FAILED: + return android::base::StringPrintf("Failed to read memory at addr 0x%" PRIx64, + error.error_info.addr); + case BACKTRACE_UNWIND_ERROR_ACCESS_REG_FAILED: + return android::base::StringPrintf("Failed to read register %" PRIu64, error.error_info.regno); + case BACKTRACE_UNWIND_ERROR_FIND_PROC_INFO_FAILED: + return "Failed to find a function in debug sections"; + case BACKTRACE_UNWIND_ERROR_EXECUTE_DWARF_INSTRUCTION_FAILED: + return "Failed to execute dwarf instructions in debug sections"; } } |