summaryrefslogtreecommitdiffstats
path: root/libbacktrace
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-01-31 22:38:29 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-01-31 22:38:29 +0000
commit9361b583309d4f382df7067fcc1ed9f8f54aa1e5 (patch)
treed5e8164b7339e1582d4da20580492a0ca0904442 /libbacktrace
parent28d1d3bad09e5a57c96cbd44648675f231b0a614 (diff)
parentfe0d5d42e4ca8b77d6a0657be1b8b6343c21d689 (diff)
downloadsystem_core-9361b583309d4f382df7067fcc1ed9f8f54aa1e5.zip
system_core-9361b583309d4f382df7067fcc1ed9f8f54aa1e5.tar.gz
system_core-9361b583309d4f382df7067fcc1ed9f8f54aa1e5.tar.bz2
am fe0d5d42: am 5434bf66: Merge "LP64: Enable debuggerd/libbacktrace/libunwind."
* commit 'fe0d5d42e4ca8b77d6a0657be1b8b6343c21d689': LP64: Enable debuggerd/libbacktrace/libunwind.
Diffstat (limited to 'libbacktrace')
-rwxr-xr-x[-rw-r--r--]libbacktrace/Android.mk2
-rw-r--r--libbacktrace/BacktraceImpl.cpp18
-rwxr-xr-x[-rw-r--r--]libbacktrace/BacktraceImpl.h4
-rwxr-xr-x[-rw-r--r--]libbacktrace/UnwindCurrent.cpp3
4 files changed, 12 insertions, 15 deletions
diff --git a/libbacktrace/Android.mk b/libbacktrace/Android.mk
index 17a807d..ee90f28 100644..100755
--- a/libbacktrace/Android.mk
+++ b/libbacktrace/Android.mk
@@ -23,7 +23,7 @@ common_shared_libs := \
liblog \
# To enable using libunwind on each arch, add it to this list.
-libunwind_architectures := arm arm64 x86
+libunwind_architectures := arm arm64 x86 x86_64
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),$(libunwind_architectures)))
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;
diff --git a/libbacktrace/BacktraceImpl.h b/libbacktrace/BacktraceImpl.h
index af014d5..48dd11c 100644..100755
--- a/libbacktrace/BacktraceImpl.h
+++ b/libbacktrace/BacktraceImpl.h
@@ -61,7 +61,7 @@ public:
BacktraceCurrent(BacktraceImpl* impl, BacktraceMap* map);
virtual ~BacktraceCurrent();
- bool ReadWord(uintptr_t ptr, uint32_t* out_value);
+ bool ReadWord(uintptr_t ptr, word_t* out_value);
};
class BacktracePtrace : public Backtrace {
@@ -69,7 +69,7 @@ public:
BacktracePtrace(BacktraceImpl* impl, pid_t pid, pid_t tid, BacktraceMap* map);
virtual ~BacktracePtrace();
- bool ReadWord(uintptr_t ptr, uint32_t* out_value);
+ bool ReadWord(uintptr_t ptr, word_t* out_value);
};
Backtrace* CreateCurrentObj(BacktraceMap* map);
diff --git a/libbacktrace/UnwindCurrent.cpp b/libbacktrace/UnwindCurrent.cpp
index 461ed02..81e69bb 100644..100755
--- a/libbacktrace/UnwindCurrent.cpp
+++ b/libbacktrace/UnwindCurrent.cpp
@@ -16,6 +16,7 @@
#define LOG_TAG "libbacktrace"
+#include <sys/ucontext.h>
#include <sys/types.h>
#include <backtrace/Backtrace.h>
@@ -27,8 +28,6 @@
#include "UnwindCurrent.h"
#include "UnwindMap.h"
-#include <ucontext.h>
-
//-------------------------------------------------------------------------
// UnwindCurrent functions.
//-------------------------------------------------------------------------