Changeset 82 for trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h
- Timestamp:
- May 1, 2008, 6:48:45 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h
r81 r82 2 2 #define DEBUG_H 3 3 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 4 25 #include "Common/include/Message.h" 5 26 #include "Behavioural/include/Debug_component.h" 27 #include "Behavioural/include/Environment.h" 6 28 #include <stdio.h> 7 29 #include <string.h> … … 9 31 #include <sstream> 10 32 #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 information18 // * Info : print basic information19 // * Trace : trace internal variable20 // * Func : trace call and return function21 // * All : print all information22 33 23 34 enum _debug_verbosity … … 30 41 }; 31 42 43 std::string debug_tab (void); 44 void debug_tab_inc (void); 45 void debug_tab_dec (void); 46 32 47 #ifdef DEBUG 33 48 # define log_printf(level, component, func, str... ) \ … … 39 54 ( DEBUG_ ## component == true )) ) \ 40 55 { \ 41 msg(_("%s"),debug_tab().c_str()); \ 56 if (DEBUG >= DEBUG_FUNC) \ 57 { \ 58 msg(_("%s"),debug_tab().c_str()); \ 59 } \ 42 60 if (DEBUG >= DEBUG_ALL ) \ 43 61 { \ … … 64 82 } \ 65 83 } 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 66 99 #else 67 100 # 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) \ 68 111 do \ 69 112 { \ … … 77 120 msg(_("Breakpoint : file %s, line %d. Enter Any key to continue\n"),__FILE__,__LINE__); \ 78 121 msg(str); \ 79 msg(_("\n")); \80 122 getchar(); \ 81 123 } while(0) 82 124 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 83 142 #endif // !DEBUG_H
Note: See TracChangeset
for help on using the changeset viewer.