diff --git a/libutils/Android.mk b/libutils/Android.mk
index 720443e..1710d36 100644
--- a/libutils/Android.mk
+++ b/libutils/Android.mk
@@ -116,10 +116,12 @@
 	libcutils
 
 LOCAL_SHARED_LIBRARIES := \
-        libcorkscrew \
+        libbacktrace \
         liblog \
         libdl
 
+include external/stlport/libstlport.mk
+
 LOCAL_MODULE:= libutils
 include $(BUILD_STATIC_LIBRARY)
 
@@ -129,10 +131,12 @@
 LOCAL_MODULE:= libutils
 LOCAL_WHOLE_STATIC_LIBRARIES := libutils
 LOCAL_SHARED_LIBRARIES := \
-        liblog \
+        libbacktrace \
         libcutils \
         libdl \
-        libcorkscrew
+        liblog \
+
+include external/stlport/libstlport.mk
 
 include $(BUILD_SHARED_LIBRARY)
 
diff --git a/libutils/CallStack.cpp b/libutils/CallStack.cpp
index 4ceaa7c..0bfb520 100644
--- a/libutils/CallStack.cpp
+++ b/libutils/CallStack.cpp
@@ -20,93 +20,33 @@
 #include <utils/Printer.h>
 #include <utils/Errors.h>
 #include <utils/Log.h>
-#include <corkscrew/backtrace.h>
+#include <UniquePtr.h>
+
+#include <backtrace/Backtrace.h>
 
 namespace android {
 
-CallStack::CallStack() :
-        mCount(0) {
+CallStack::CallStack() {
 }
 
-CallStack::CallStack(const char* logtag, int32_t ignoreDepth, int32_t maxDepth) {
-    this->update(ignoreDepth+1, maxDepth, CURRENT_THREAD);
+CallStack::CallStack(const char* logtag, int32_t ignoreDepth) {
+    this->update(ignoreDepth+1);
     this->log(logtag);
 }
 
-CallStack::CallStack(const CallStack& rhs) :
-        mCount(rhs.mCount) {
-    if (mCount) {
-        memcpy(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t));
-    }
-}
-
 CallStack::~CallStack() {
 }
 
-CallStack& CallStack::operator = (const CallStack& rhs) {
-    mCount = rhs.mCount;
-    if (mCount) {
-        memcpy(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t));
+void CallStack::update(int32_t ignoreDepth, pid_t tid) {
+    mFrameLines.clear();
+
+    UniquePtr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, tid));
+    if (!backtrace->Unwind(ignoreDepth)) {
+        ALOGW("%s: Failed to unwind callstack.", __FUNCTION__);
     }
-    return *this;
-}
-
-bool CallStack::operator == (const CallStack& rhs) const {
-    if (mCount != rhs.mCount)
-        return false;
-    return !mCount || memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) == 0;
-}
-
-bool CallStack::operator != (const CallStack& rhs) const {
-    return !operator == (rhs);
-}
-
-bool CallStack::operator < (const CallStack& rhs) const {
-    if (mCount != rhs.mCount)
-        return mCount < rhs.mCount;
-    return memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) < 0;
-}
-
-bool CallStack::operator >= (const CallStack& rhs) const {
-    return !operator < (rhs);
-}
-
-bool CallStack::operator > (const CallStack& rhs) const {
-    if (mCount != rhs.mCount)
-        return mCount > rhs.mCount;
-    return memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) > 0;
-}
-
-bool CallStack::operator <= (const CallStack& rhs) const {
-    return !operator > (rhs);
-}
-
-const void* CallStack::operator [] (int index) const {
-    if (index >= int(mCount))
-        return 0;
-    return reinterpret_cast<const void*>(mStack[index].absolute_pc);
-}
-
-void CallStack::clear() {
-    mCount = 0;
-}
-
-void CallStack::update(int32_t ignoreDepth, int32_t maxDepth, pid_t tid) {
-    if (maxDepth > MAX_DEPTH) {
-        maxDepth = MAX_DEPTH;
+    for (size_t i = 0; i < backtrace->NumFrames(); i++) {
+      mFrameLines.push_back(String8(backtrace->FormatFrameData(i).c_str()));
     }
-    ssize_t count;
-
-    if (tid >= 0) {
-        count = unwind_backtrace_thread(tid, mStack, ignoreDepth + 1, maxDepth);
-    } else if (tid == CURRENT_THREAD) {
-        count = unwind_backtrace(mStack, ignoreDepth + 1, maxDepth);
-    } else {
-        ALOGE("%s: Invalid tid specified (%d)", __FUNCTION__, tid);
-        count = 0;
-    }
-
-    mCount = count > 0 ? count : 0;
 }
 
 void CallStack::log(const char* logtag, android_LogPriority priority, const char* prefix) const {
@@ -129,16 +69,9 @@
 }
 
 void CallStack::print(Printer& printer) const {
-    backtrace_symbol_t symbols[mCount];
-
-    get_backtrace_symbols(mStack, mCount, symbols);
-    for (size_t i = 0; i < mCount; i++) {
-        char line[MAX_BACKTRACE_LINE_LENGTH];
-        format_backtrace_line(i, &mStack[i], &symbols[i],
-                line, MAX_BACKTRACE_LINE_LENGTH);
-        printer.printLine(line);
+    for (size_t i = 0; i < mFrameLines.size(); i++) {
+        printer.printLine(mFrameLines[i]);
     }
-    free_backtrace_symbols(symbols, mCount);
 }
 
 }; // namespace android
diff --git a/libutils/Printer.cpp b/libutils/Printer.cpp
index ac729e0..263e740 100644
--- a/libutils/Printer.cpp
+++ b/libutils/Printer.cpp
@@ -145,6 +145,7 @@
         return;
     }
 
+    mTarget->append(mPrefix);
     mTarget->append(string);
     mTarget->append("\n");
 }
diff --git a/libutils/ProcessCallStack.cpp b/libutils/ProcessCallStack.cpp
index f9340c5..f837bcb 100644
--- a/libutils/ProcessCallStack.cpp
+++ b/libutils/ProcessCallStack.cpp
@@ -123,7 +123,7 @@
     mTimeUpdated = tm();
 }
 
-void ProcessCallStack::update(int32_t maxDepth) {
+void ProcessCallStack::update() {
     DIR *dp;
     struct dirent *ep;
     struct dirent entry;
@@ -181,14 +181,13 @@
         int ignoreDepth = (selfPid == tid) ? IGNORE_DEPTH_CURRENT_THREAD : 0;
 
         // Update thread's call stacks
-        CallStack& cs = threadInfo.callStack;
-        cs.update(ignoreDepth, maxDepth, tid);
+        threadInfo.callStack.update(ignoreDepth, tid);
 
         // Read/save thread name
         threadInfo.threadName = getThreadName(tid);
 
         ALOGV("%s: Got call stack for tid %d (size %zu)",
-              __FUNCTION__, tid, cs.size());
+              __FUNCTION__, tid, threadInfo.callStack.size());
     }
     if (code != 0) { // returns positive error value on error
         ALOGE("%s: Failed to readdir from %s (errno = %d, '%s')",
@@ -221,13 +220,12 @@
     for (size_t i = 0; i < mThreadMap.size(); ++i) {
         pid_t tid = mThreadMap.keyAt(i);
         const ThreadInfo& threadInfo = mThreadMap.valueAt(i);
-        const CallStack& cs = threadInfo.callStack;
         const String8& threadName = threadInfo.threadName;
 
         printer.printLine("");
         printer.printFormatLine("\"%s\" sysTid=%d", threadName.string(), tid);
 
-        cs.print(csPrinter);
+        threadInfo.callStack.print(csPrinter);
     }
 
     dumpProcessFooter(printer, getpid());
