Add a way to disable backtracing in malloc debug.

The property libc.debug.malloc.nobacktrace set to non-zero disables
getting backtracing when using mode 1 or mode 10.

Bug: 16874447

(cherry picked from 49de01a5be)

Change-Id: I6bbefe5420b14991fe84c2f849222dcd7cb592bf
This commit is contained in:
Christopher Ferris
2014-08-07 16:21:21 -07:00
parent f2d8c357ee
commit 88a1f520d2
3 changed files with 98 additions and 35 deletions

View File

@@ -47,6 +47,7 @@
#include <unwind.h>
#include "debug_stacktrace.h"
#include "malloc_debug_backtrace.h"
#include "malloc_debug_common.h"
#include "malloc_debug_disable.h"
@@ -311,7 +312,7 @@ extern "C" void* leak_malloc(size_t bytes) {
ScopedPthreadMutexLocker locker(&g_hash_table->lock);
uintptr_t backtrace[BACKTRACE_SIZE];
size_t numEntries = get_backtrace(backtrace, BACKTRACE_SIZE);
size_t numEntries = GET_BACKTRACE(backtrace, BACKTRACE_SIZE);
AllocationEntry* header = reinterpret_cast<AllocationEntry*>(base);
header->entry = record_backtrace(backtrace, numEntries, bytes);