diff options
-rw-r--r-- | heaptracker.c | 9 |
1 files changed, 8 insertions, 1 deletions
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_first; 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); |