Ignore:
Timestamp:
May 1, 2008, 6:48:45 PM (16 years ago)
Author:
rosiere
Message:
  • support locale (now must "just" translate)
  • update all component with new test format
  • update all component with usage
  • New component : decod queue and prediction_unit
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h

    r81 r82  
    22#define DEBUG_H
    33
     4/*
     5 * $Id$
     6 *
     7 * [ Description ]
     8 *
     9 * function to help the debugging :
     10 *
     11 *  - debug_tab
     12 *  - log_printf
     13 *  - log_begin
     14 *  - log_end
     15 *  - breakpoint
     16 *
     17 *  Debug's Level :
     18 *  - None    : print elementary information
     19 *  - Info    : print basic information
     20 *  - Trace   : trace internal variable
     21 *  - Func    : trace call and return function
     22 *  - All     : print all information
     23 */
     24
    425#include "Common/include/Message.h"
    526#include "Behavioural/include/Debug_component.h"
     27#include "Behavioural/include/Environment.h"
    628#include <stdio.h>
    729#include <string.h>
     
    931#include <sstream>
    1032#include <string>
    11 
    12 std::string debug_tab            (void);
    13 void        debug_function_begin (std::string component, std::string function);
    14 void        debug_function_end   (std::string component, std::string function);
    15 
    16 // Debug's Level :
    17 //  * None    : print elementary information
    18 //  * Info    : print basic information
    19 //  * Trace   : trace internal variable
    20 //  * Func    : trace call and return function
    21 //  * All     : print all information
    2233
    2334enum _debug_verbosity
     
    3041  };
    3142
     43std::string debug_tab     (void);
     44void        debug_tab_inc (void);
     45void        debug_tab_dec (void);
     46
    3247#ifdef DEBUG
    3348# define log_printf(level, component, func, str... )                    \
     
    3954           ( DEBUG_ ## component == true )) )                           \
    4055        {                                                               \
    41           msg(_("%s"),debug_tab().c_str());                             \
     56          if (DEBUG >= DEBUG_FUNC)                                      \
     57            {                                                           \
     58              msg(_("%s"),debug_tab().c_str());                         \
     59            }                                                           \
    4260          if (DEBUG >= DEBUG_ALL )                                      \
    4361            {                                                           \
     
    6482        }                                                               \
    6583    } while(0)
     84
     85# define log_begin(component, func)                                     \
     86  do                                                                    \
     87    {                                                                   \
     88      debug_tab_inc ();                                                 \
     89      log_printf(FUNC,component,func,"Begin");                          \
     90    } while(0)
     91
     92# define log_end(component, func)                                       \
     93  do                                                                    \
     94    {                                                                   \
     95      log_printf(FUNC,component,func,"End");                            \
     96      debug_tab_dec ();                                                 \
     97    } while(0)
     98
    6699#else
    67100# define log_printf(level, component, func, str... )                    \
     101  do                                                                    \
     102    {                                                                   \
     103    } while(0)
     104
     105# define log_begin(component, func)                                     \
     106  do                                                                    \
     107    {                                                                   \
     108    } while(0)
     109
     110# define log_end(component, func)                                       \
    68111  do                                                                    \
    69112    {                                                                   \
     
    77120      msg(_("Breakpoint : file %s, line %d. Enter Any key to continue\n"),__FILE__,__LINE__); \
    78121      msg(str);                                                         \
    79       msg(_("\n"));                                                     \
    80122      getchar();                                                        \
    81123    } while(0)
    82124
     125#ifdef DEBUG_TEST
     126#define TEST_PTR(x)                                                     \
     127  do                                                                    \
     128    {                                                                   \
     129      if (x == NULL)                                                    \
     130        err(_("%s File %s, Line %d, this pointeur is null"),MSG_ERROR,__FILE__,__LINE__); \
     131    }                                                                   \
     132  while (0)
     133#else
     134#define TEST_PTR(x)      \
     135  do                     \
     136    {                    \
     137    }                    \
     138  while (0)
     139#endif
     140
     141
    83142#endif // !DEBUG_H
Note: See TracChangeset for help on using the changeset viewer.