omap4xxx: now heaptracker can dump stack traces in-place
Change-Id: I98114b4b25049a7702448bb3dfffa74976cc7aa8
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/heaptracker.c b/heaptracker.c
index 6f2dcfe..84c2f49 100644
--- a/heaptracker.c
+++ b/heaptracker.c
@@ -96,10 +96,17 @@
static struct hdr *backlog_last;
static pthread_rwlock_t backlog_lock = PTHREAD_RWLOCK_INITIALIZER;
-static void print_backtrace(const intptr_t *bt, int depth)
+void print_backtrace(const intptr_t *bt, int depth)
{
mapinfo *mi;
int cnt, rel_pc;
+ intptr_t self_bt[MAX_BACKTRACE_DEPTH];
+
+ if (!bt) {
+ depth = heaptracker_stacktrace(self_bt, MAX_BACKTRACE_DEPTH);
+ bt = self_bt;
+ }
+
malloc_log("*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
for (cnt = 0; cnt < depth && cnt < MAX_BACKTRACE_DEPTH; cnt++) {
mi = pc_to_mapinfo(milist, bt[cnt], &rel_pc);