summaryrefslogtreecommitdiffstats
path: root/libbacktrace/BacktraceImpl.cpp
diff options
context:
space:
mode:
authorPavel Chupin <pavel.v.chupin@intel.com>2013-11-21 23:17:20 +0400
committerElliott Hughes <enh@google.com>2014-01-30 17:15:24 -0800
commitc6c194ced095df5e777b8fa24527ebd29c8fef54 (patch)
treee8c2872d11d30743d38f915b90ce394d2773ccf2 /libbacktrace/BacktraceImpl.cpp
parente97dad0d95ae1305686bf4294029da947fc2dcf2 (diff)
downloadsystem_core-c6c194ced095df5e777b8fa24527ebd29c8fef54.zip
system_core-c6c194ced095df5e777b8fa24527ebd29c8fef54.tar.gz
system_core-c6c194ced095df5e777b8fa24527ebd29c8fef54.tar.bz2
LP64: Enable debuggerd/libbacktrace/libunwind.
Change-Id: I2e432839f86c33c2adbaac8cc12ca8961956044b Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Diffstat (limited to 'libbacktrace/BacktraceImpl.cpp')
-rw-r--r--libbacktrace/BacktraceImpl.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/libbacktrace/BacktraceImpl.cpp b/libbacktrace/BacktraceImpl.cpp
index 8027d86..855810e 100644
--- a/libbacktrace/BacktraceImpl.cpp
+++ b/libbacktrace/BacktraceImpl.cpp
@@ -21,8 +21,6 @@
#include <sys/types.h>
#include <unistd.h>
-#include <inttypes.h>
-
#include <string>
#include <backtrace/Backtrace.h>
@@ -81,10 +79,10 @@ std::string Backtrace::GetFunctionName(uintptr_t pc, uintptr_t* offset) {
return func_name;
}
-bool Backtrace::VerifyReadWordArgs(uintptr_t ptr, uint32_t* out_value) {
- if (ptr & 3) {
+bool Backtrace::VerifyReadWordArgs(uintptr_t ptr, word_t* out_value) {
+ if (ptr & (sizeof(word_t)-1)) {
BACK_LOGW("invalid pointer %p", (void*)ptr);
- *out_value = (uint32_t)-1;
+ *out_value = (word_t)-1;
return false;
}
return true;
@@ -142,18 +140,18 @@ BacktraceCurrent::BacktraceCurrent(
BacktraceCurrent::~BacktraceCurrent() {
}
-bool BacktraceCurrent::ReadWord(uintptr_t ptr, uint32_t* out_value) {
+bool BacktraceCurrent::ReadWord(uintptr_t ptr, word_t* out_value) {
if (!VerifyReadWordArgs(ptr, out_value)) {
return false;
}
const backtrace_map_t* map = FindMap(ptr);
if (map && map->flags & PROT_READ) {
- *out_value = *reinterpret_cast<uint32_t*>(ptr);
+ *out_value = *reinterpret_cast<word_t*>(ptr);
return true;
} else {
BACK_LOGW("pointer %p not in a readable map", reinterpret_cast<void*>(ptr));
- *out_value = static_cast<uint32_t>(-1);
+ *out_value = static_cast<word_t>(-1);
return false;
}
}
@@ -170,7 +168,7 @@ BacktracePtrace::BacktracePtrace(
BacktracePtrace::~BacktracePtrace() {
}
-bool BacktracePtrace::ReadWord(uintptr_t ptr, uint32_t* out_value) {
+bool BacktracePtrace::ReadWord(uintptr_t ptr, word_t* out_value) {
if (!VerifyReadWordArgs(ptr, out_value)) {
return false;
}
@@ -183,7 +181,7 @@ bool BacktracePtrace::ReadWord(uintptr_t ptr, uint32_t* out_value) {
// To disambiguate -1 from a valid result, we clear errno beforehand.
errno = 0;
*out_value = ptrace(PTRACE_PEEKTEXT, Tid(), reinterpret_cast<void*>(ptr), NULL);
- if (*out_value == static_cast<uint32_t>(-1) && errno) {
+ if (*out_value == static_cast<word_t>(-1) && errno) {
BACK_LOGW("invalid pointer %p reading from tid %d, ptrace() strerror(errno)=%s",
reinterpret_cast<void*>(ptr), Tid(), strerror(errno));
return false;