Ignore:
Timestamp:
Dec 12, 2014, 5:06:18 PM (10 years ago)
Author:
alain
Message:

Cosmetic: Improving debug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/malloc.c

    r431 r468  
    88#include "malloc.h"
    99#include "stdio.h"
     10#include "giet_config.h"
    1011
    1112// Global variables defining the heap descriptors array (one heap per cluster)
     
    5152{
    5253    giet_shr_printf(
    53                 " - coordinates = [%d][%d]\n"
    5454                " - heap_base   = %x\n"
    5555                " - heap_size   = %x\n"
     
    8080                " - free[22]    = %x\n"
    8181                " - free[23]    = %x\n",
    82                 heap[x][y].x, heap[x][y].y,
    8382                heap[x][y].heap_base, heap[x][y].heap_size,
    8483                heap[x][y].alloc_base, heap[x][y].alloc_size,
     
    115114    heap_index = GET_SIZE_INDEX( heap_size );
    116115
     116#if GIET_DEBUG_USER_MALLOC
     117giet_shr_printf("\n[DEBUG USER_MALLOC] Starting Heap[%d][%d] initialisation /"
     118                " base = %x / size = %x\n", x, y, heap_base, heap_size );
     119#endif
     120
    117121    // checking heap segment constraints
    118122    if ( heap_size == 0 )                                    // heap segment exist
     
    166170    heap[x][y].alloc_base = alloc_base;
    167171
    168     lock_release( &heap[x][y].lock );
    169 
    170 #if GIET_DEBUG_MALLOC
    171 giet_shr_printf("\n[MALLOC DEBUG] Completing Heap[%d][%d] initialisation\n", x, y );
     172    lock_init( &heap[x][y].lock );
     173
     174#if GIET_DEBUG_USER_MALLOC
     175giet_shr_printf("\n[DEBUG USER_MALLOC] Completing Heap[%d][%d] initialisation\n", x, y );
    172176display_free_array(x,y);
    173177#endif
     
    238242{
    239243
    240 #if GIET_DEBUG_MALLOC
    241 giet_shr_printf("\n[MALLOC DEBUG] Malloc request for Heap[%d][%d] / size = %x\n",
     244#if GIET_DEBUG_USER_MALLOC
     245giet_shr_printf("\n[DEBUG USER_MALLOC] Malloc request for Heap[%d][%d] / size = %x\n",
    242246                 x, y, size );
    243247#endif
     
    260264    if ( heap[x][y].init != HEAP_INITIALIZED )
    261265    {
    262         heap_init( x, y );
     266        heap_init( x , y );
    263267    }
    264268
     
    288292    lock_release( &heap[x][y].lock );
    289293 
    290 #if GIET_DEBUG_MALLOC
    291 giet_shr_printf("\n[MALLOC DEBUG] Malloc vaddr from Heap[%d][%d] = %x\n",
     294#if GIET_DEBUG_USER_MALLOC
     295giet_shr_printf("\n[DEBUG USER_MALLOC] Malloc vaddr from Heap[%d][%d] = %x\n",
    292296                x, y, base );
    293297display_free_array(x,y);
     
    383387    giet_get_xy( ptr, &x, &y );
    384388
    385 #if GIET_DEBUG_MALLOC
    386 giet_shr_printf("\n[MALLOC DEBUG] Free for vaddr = %x / x = %d / y = %d\n",
     389#if GIET_DEBUG_USER_MALLOC
     390giet_shr_printf("\n[DEBUG USER_MALLOC] Free for vaddr = %x / x = %d / y = %d\n",
    387391                 (unsigned int)ptr, x, y );
    388392#endif
     
    418422    lock_release( &heap[x][y].lock );
    419423
    420 #if GIET_DEBUG_MALLOC
     424#if GIET_DEBUG_USER_MALLOC
    421425display_free_array(x,y);
    422426#endif
Note: See TracChangeset for help on using the changeset viewer.