summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/malloc_debug.h
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2016-01-28 18:35:05 -0800
committerChristopher Ferris <cferris@google.com>2016-01-29 15:19:22 -0800
commit7993b80f894db20af4d1d154221c42fea6171a3d (patch)
treefc99d36000a8f0853224d75296d96509a730ee05 /libc/malloc_debug/malloc_debug.h
parent50647711ebaf2360aca05cc94a2fdf431c1a153e (diff)
Add better free tracking.
Included in this change: - Change the tag when a pointer is freed so it's easy to detect if an already freed pointer is being used. - Move the free backtrace out of the header. This backtrace is only used under only some circumstances, so no need to allocate space in all headers for it. - Add new option free_track_backtrace_num_frames to specify how many frames to record when the free occurs. This removes the dependency on the backtrace option to get backtraces. Bug: 26739265 Change-Id: I76f5209507dcf46af67ada162a7cb2bf282116f2
Diffstat (limited to 'libc/malloc_debug/malloc_debug.h')
-rw-r--r--libc/malloc_debug/malloc_debug.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/malloc_debug/malloc_debug.h b/libc/malloc_debug/malloc_debug.h
index 4a15f77bf..cd025a786 100644
--- a/libc/malloc_debug/malloc_debug.h
+++ b/libc/malloc_debug/malloc_debug.h
@@ -39,7 +39,6 @@
// will still be in this order.
// Header (Required)
// BacktraceHeader (Optional: For the allocation backtrace)
-// BacktraceHeader (Optional: For the free backtrace)
// uint8_t data (Optional: Front guard, will be a multiple of sizeof(uintptr_t))
// allocation data
// uint8_t data (Optional: End guard)
@@ -70,6 +69,7 @@ struct BacktraceHeader {
} __attribute__((packed));
constexpr uint32_t DEBUG_TAG = 0x1ee7d00d;
+constexpr uint32_t DEBUG_FREE_TAG = 0x1cc7dccd;
constexpr char LOG_DIVIDER[] = "*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***";
constexpr size_t FREE_TRACK_MEM_BUFFER_SIZE = 4096;