From: John Hodge Date: Fri, 25 Sep 2009 06:12:31 +0000 (+0800) Subject: Added return address to malloc's debug X-Git-Tag: rel0.06~516 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=097c2758fc7353c4b31f7794c6b6fff49a4e78e5;p=tpg%2Facess2.git Added return address to malloc's debug --- diff --git a/Kernel/heap.c b/Kernel/heap.c index 68239187..30c812e4 100644 --- a/Kernel/heap.c +++ b/Kernel/heap.c @@ -175,7 +175,7 @@ void *malloc(size_t Bytes) if(head->Size == Bytes) { head->Magic = MAGIC_USED; RELEASE(&giHeapSpinlock); // Release spinlock - LOG("RETURN %p", best->Data); + LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0)); return best->Data; } @@ -205,7 +205,7 @@ void *malloc(size_t Bytes) // Check size if(best->Size == Bytes) { RELEASE(&giHeapSpinlock); // Release spinlock - LOG("RETURN %p", best->Data); + LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0)); return best->Data; } } @@ -224,7 +224,7 @@ void *malloc(size_t Bytes) best->Magic = MAGIC_USED; // Mark block as used RELEASE(&giHeapSpinlock); // Release spinlock - LOG("RETURN %p", best->Data); + LOG("RETURN %p, to %p", best->Data, __builtin_return_address(0)); return best->Data; }