freemyipod r568 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r567‎ | r568 | r569 >
Date:23:47, 7 February 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Improve the default heap walker even more
Modified paths:
  • /emcore/trunk/libc/tlsf/tlsf.c (modified) (history)

Diff [purge]

Index: emcore/trunk/libc/tlsf/tlsf.c
@@ -6,6 +6,7 @@
77 #include "../include/stdlib.h"
88 #include "../include/string.h"
99 #include "../../console.h"
 10+#include "../../thread.h"
1011
1112 #include "tlsf.h"
1213 #include "tlsfbits.h"
@@ -714,8 +715,12 @@
715716
716717 static void default_walker(void* ptr, size_t size, int used, void* user)
717718 {
718 - if (used) cprintf((int)user, "%08X: %08X+8 bytes owned by %08X\n", ptr,
719 - size - 4, *((uint32_t*)(ptr + size - 4)));
 719+ if (used)
 720+ {
 721+ struct scheduler_thread* owner = *((struct scheduler_thread**)(ptr + size - 4));
 722+ cprintf((int)user, "%08X: %08X+8 bytes owned by %08X%s\n", ptr,
 723+ size - 4, owner, owner == current_thread ? " (self)" : "");
 724+ }
720725 else cprintf((int)user, "%08X: %08X bytes free\n", ptr, size + 4);
721726 }
722727