Commit 84cb4663 authored by malenov's avatar malenov
Browse files

raise warning if stack is not empty in print_mem()

parent ed82f183
Loading
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -807,6 +807,16 @@ int pop_stack( const char *filename, const char *fctname )
    /* Erase Entry */
    caller_info_ptr->function_name[0] = 0;

    /* Retrieve previous stack pointer */
    if ( current_calls == 0 )
    {
        ptr_current_stack = ptr_base_stack;
    }
    else
    {
        ptr_current_stack = stack_callers[0][current_calls - 1].stack_ptr;
    }

    return 0 /* for Now */;
}

@@ -1785,6 +1795,12 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
        fprintf( stdout, "Maximum RAM (stack + heap) size: not available\n" );
    }

    /* check, if the stack is empty */
    if ( ptr_current_stack != ptr_base_stack )
    {
        fprintf( stderr, "Warning: Stack is not empty.\n" );
    }

    if ( ptr_base_stack - ptr_max_stack > 0 )
    {
        fprintf( stdout, "Maximum stack size: %lu %s in frame %d\n", ( ( ptr_base_stack - ptr_max_stack ) * sizeof( int16_t ) ) >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size],