fix (kernel): improved heap dump

This commit is contained in:
antifallobst 2023-02-18 21:46:24 +01:00
parent ab055a4d66
commit 1f342ccea6
1 changed files with 20 additions and 18 deletions

View File

@ -158,31 +158,33 @@ void* heap_memory_allocate(heap_T* heap, uint64_t size) {
void heap_dump_segments(heap_T* heap) { void heap_dump_segments(heap_T* heap) {
log(LOG_DEBUG, "<=====[ Dumping Heap Segments ]=====>"); log(LOG_DEBUG, "<=====[ Dumping Heap Segments ]=====>");
log(LOG_NONE, " |---------------------|"); log(LOG_NONE, " |-------------------------|");
log(LOG_NONE, " | START |"); log(LOG_NONE, " | START |");
log(LOG_NONE, " | 0x%x |", heap->start); log(LOG_NONE, " | 0x%x |", heap->start);
log(LOG_NONE, " |----------v----------|"); log(LOG_NONE, " |------------v------------|");
heap_segment_T* segment = heap->start; heap_segment_T* segment = heap->start;
while (segment != NULL) { while (segment != NULL) {
log(LOG_NONE, " |"); log(LOG_NONE, " |");
log(LOG_NONE, " |"); log(LOG_NONE, " |");
log(LOG_NONE, " |----------^----------|"); log(LOG_NONE, " |------------^------------|");
log(LOG_NONE, " | 0x%x |", (uint64_t)segment); log(LOG_NONE, " | Header (size: 0x%xw) |", sizeof(heap_segment_T));
log(LOG_NONE, " | Valid: %? |", heap_segment_validate(segment)); log(LOG_NONE, " |-------------------------|");
log(LOG_NONE, " | Free: %? |", segment->free); log(LOG_NONE, " | 0x%x |", (uint64_t)segment);
log(LOG_NONE, " | Size: 0x%xw |", segment->size); log(LOG_NONE, " | Valid: %? |", heap_segment_validate(segment));
log(LOG_NONE, " |----------v----------|"); log(LOG_NONE, " | Free: %? |", segment->free);
log(LOG_NONE, " | Size: 0x%xd |", segment->size);
log(LOG_NONE, " |------------v------------|");
segment = segment->next; segment = segment->next;
} }
log(LOG_NONE, " |"); log(LOG_NONE, " |");
log(LOG_NONE, " |"); log(LOG_NONE, " |");
log(LOG_NONE, " |----------^----------|"); log(LOG_NONE, " |------------^------------|");
log(LOG_NONE, " | END |"); log(LOG_NONE, " | END |");
log(LOG_NONE, " | 0x%x |", heap->end); log(LOG_NONE, " | 0x%x |", heap->end);
log(LOG_NONE, " |---------------------|"); log(LOG_NONE, " |-------------------------|");
} }
void heap_memory_free(heap_T* heap, void* address) { void heap_memory_free(heap_T* heap, void* address) {