[syslinux:pathbased] core/mem: better dprintf()
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Wed Feb 24 18:30:09 PST 2010
Commit-ID: 9ce07efd0b1b2cc2493dc0c022d8d8b984160d6d
Gitweb: http://syslinux.zytor.com/commit/9ce07efd0b1b2cc2493dc0c022d8d8b984160d6d
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 24 Feb 2010 18:25:58 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 24 Feb 2010 18:25:58 -0800
core/mem: better dprintf()
Add a few dprintf() statements to the core malloc/free which makes it
easier to track down bugs.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
core/mem/free.c | 4 ++--
core/mem/malloc.c | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/core/mem/free.c b/core/mem/free.c
index 79ab58f..0becb9e 100644
--- a/core/mem/free.c
+++ b/core/mem/free.c
@@ -15,8 +15,6 @@ __free_block(struct free_arena_header *ah)
struct free_arena_header *head =
&__malloc_head[ARENA_HEAP_GET(ah->a.attrs)];
- dprintf("free(%p)\n", (struct arena_header *)ah + 1);
-
pah = ah->a.prev;
nah = ah->a.next;
if ( ARENA_TYPE_GET(pah->a.attrs) == ARENA_TYPE_FREE &&
@@ -70,6 +68,8 @@ void free(void *ptr)
{
struct free_arena_header *ah;
+ dprintf("free(%p) @ %p\n", ptr, __builtin_return_address(0));
+
if ( !ptr )
return;
diff --git a/core/mem/malloc.c b/core/mem/malloc.c
index 20d5dfc..78f7b41 100644
--- a/core/mem/malloc.c
+++ b/core/mem/malloc.c
@@ -63,7 +63,8 @@ static void *_malloc(size_t size, enum heap heap, malloc_tag_t tag)
struct free_arena_header *head = &__malloc_head[heap];
void *p = NULL;
- dprintf("_malloc(%zu, %u, %u) = ", size, heap, tag);
+ dprintf("_malloc(%zu, %u, %u) @ %p = ",
+ size, heap, tag, __builtin_return_address(0));
if (size) {
/* Add the obligatory arena header, and round up */
More information about the Syslinux-commits
mailing list