Use libbacktrace instead of libcorkscrew.
Also, removed the ignore frames of 2, this was causing threads to chop
the lower two frames. The original code assumed that the calls to decode
the frame were in the unwind trace, but that's not the case.
Change-Id: Ifc0da0227f9114a5b462ef88e038439d58f951e9
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index 6451d5c..7802acc 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -16,7 +16,7 @@
#include "mem_map.h"
-#include <corkscrew/map_info.h>
+#include <backtrace/backtrace.h>
#include "base/stringprintf.h"
#include "ScopedFd.h"
@@ -32,8 +32,8 @@
#if !defined(NDEBUG)
-static std::ostream& operator<<(std::ostream& os, map_info_t* rhs) {
- for (map_info_t* m = rhs; m != NULL; m = m->next) {
+static std::ostream& operator<<(std::ostream& os, backtrace_map_info_t* rhs) {
+ for (backtrace_map_info_t* m = rhs; m != NULL; m = m->next) {
os << StringPrintf("0x%08x-0x%08x %c%c %s\n",
static_cast<uint32_t>(m->start),
static_cast<uint32_t>(m->end),
@@ -50,8 +50,8 @@
uint32_t base = reinterpret_cast<size_t>(addr);
uint32_t limit = base + byte_count;
- map_info_t* map_info_list = load_map_info_list(getpid());
- for (map_info_t* m = map_info_list; m != NULL; m = m->next) {
+ backtrace_map_info_t* map_info_list = backtrace_create_map_info_list(getpid());
+ for (backtrace_map_info_t* m = map_info_list; m != NULL; m = m->next) {
CHECK(!(base >= m->start && base < m->end) // start of new within old
&& !(limit > m->start && limit < m->end) // end of new within old
&& !(base <= m->start && limit > m->end)) // start/end of new includes all of old
@@ -60,7 +60,7 @@
static_cast<uint32_t>(m->start), static_cast<uint32_t>(m->end), m->name)
<< map_info_list;
}
- free_map_info_list(map_info_list);
+ backtrace_destroy_map_info_list(map_info_list);
}
#else