aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2015-08-14 07:35:21 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2015-09-02 21:30:35 +0200
commit8f17572be0a5a572f94bd476811087f634c26de6 (patch)
tree6299e81627d407c244009561dc97e28c2f68778e
parent73bb3701a19a9eeb30b6f77ff7612ca2a9cd3f38 (diff)
downloadsyslinux-8f17572be0a5a572f94bd476811087f634c26de6.tar.gz
syslinux-8f17572be0a5a572f94bd476811087f634c26de6.tar.xz
syslinux-8f17572be0a5a572f94bd476811087f634c26de6.zip
core: dprintf on malloc/free if -DDEBUG_MALLOC
When dynamic debug is engaged, the output is pretty flooded by malloc/free messages while you are looking at other traces. As devel.mk have a DEBUG_MALLOC option, it seems pretty logical to enable the malloc/free dprintf() only if this option is engaged. That patch make the dynamic debug output less floody while letting the choice to get the malloc/free dprintf() messages.
-rw-r--r--core/mem/free.c2
-rw-r--r--core/mem/malloc.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/core/mem/free.c b/core/mem/free.c
index 2d16cd1c..21f9b59f 100644
--- a/core/mem/free.c
+++ b/core/mem/free.c
@@ -87,7 +87,9 @@ void bios_free(void *ptr)
__export void free(void *ptr)
{
+#ifdef DEBUG_MALLOC
dprintf("free(%p) @ %p\n", ptr, __builtin_return_address(0));
+#endif
if ( !ptr )
return;
diff --git a/core/mem/malloc.c b/core/mem/malloc.c
index b40c2f21..836c2fe3 100644
--- a/core/mem/malloc.c
+++ b/core/mem/malloc.c
@@ -93,14 +93,18 @@ static void *_malloc(size_t size, enum heap heap, malloc_tag_t tag)
{
void *p;
+#ifdef DEBUG_MALLOC
dprintf("_malloc(%zu, %u, %u) @ %p = ",
size, heap, tag, __builtin_return_address(0));
+#endif
sem_down(&__malloc_semaphore, 0);
p = firmware->mem->malloc(size, heap, tag);
sem_up(&__malloc_semaphore);
+#ifdef DEBUG_MALLOC
dprintf("%p\n", p);
+#endif
return p;
}