Overview   API Reference  

api/debug.hpp

00001 #if !defined(__API_DEBUG_HPP__)
00002 #define __API_DEBUG_HPP__
00003 
00004 //
00005 // detailed debugging switches
00006 //
00007 #if L4VMM_BUILD_DEBUG
00008 
00009     //
00010     // use a global lock upon library entry.
00011     //     use only for debugging ! may cause deadlocks !
00012     //
00013     #define L4VMM_API_LOCK              0
00014 
00015     //
00016     // ***** API (code that implements the API functions only) *****
00017     //
00018 
00019     //
00020     // 0: disabled
00021     // 1: sanity checks
00022     // 2: verbose initialization including type size checks
00023     // 3: all library entries and corresponding informational messages
00024     // 4: additionally all library exits
00025     //
00026     #define L4VMM_DEBUG_VMM             2
00027 
00028     //
00029     // 0: disabled
00030     // 1: sanity checks
00031     // 2: print message when client threads wake up (IRQ assertions)
00032     // 3: print message when client threads go to sleep (IRQ waits)
00033     //
00034     #define L4VMM_DEBUG_OMEGA0          1
00035 
00036     //
00037     // 0: disabled
00038     // 1: sanity checks
00039     //
00040     #define L4VMM_DEBUG_L4IO            1
00041 
00042     //
00043     // 0: disabled
00044     // 1: sanity checks
00045     // 2/3: every piece of data read/written through I/O space API functions
00046     //
00047     #define L4VMM_DEBUG_L4UTIL          1
00048 
00049 #else /* L4VMM_BUILD_DEBUG */
00050 
00051     #define L4VMM_API_LOCK              0
00052 
00053     #define L4VMM_DEBUG_VMM             0
00054     #define L4VMM_DEBUG_OMEGA0          0
00055     #define L4VMM_DEBUG_L4IO            0
00056     #define L4VMM_DEBUG_L4UTIL          0
00057 
00058 #endif /* L4VMM_BUILD_DEBUG */
00059 
00060 //
00061 // debug routines
00062 //
00063 #if L4VMM_DEBUG_VMM >= 2
00064     #include "core/util/c++0x.hpp"
00065     void l4vmm_check_types(const char *header=nullptr);
00066 #endif
00067 
00068 //
00069 // traceing type
00070 //
00071 #if L4VMM_DEBUG_VMM >= 3
00072     struct l4vmm_entry_frame
00073     {
00074         const char *function;
00075         char notes[80];
00076 
00077         l4vmm_entry_frame(const char *function, const char *format=nullptr, ...);
00078         ~l4vmm_entry_frame(void);
00079 
00080         void print(const char *prefix=nullptr);
00081     };
00082 #endif
00083 
00084 //
00085 // global lock
00086 //
00087 #if L4VMM_API_LOCK
00088     extern struct lock l4vmm_library_lock;
00089 #endif
00090 
00091 //
00092 // library entry macro
00093 //
00094 #if L4VMM_DEBUG_VMM >= 3
00095     #define l4vmm_enter_nolock(args...)     l4vmm_entry_frame __enter__(args)
00096 #else
00097     #define l4vmm_enter_nolock(...)         do {} while(0)
00098 #endif
00099 
00100 #if L4VMM_API_LOCK
00101     #define l4vmm_enter(args...)            l4vmm_enter_nolock(args);                           \
00102                                             auto_lock<lock> __lock_guard__(l4vmm_library_lock)
00103 #else
00104     #define l4vmm_enter(args...)            l4vmm_enter_nolock(args);
00105 #endif
00106 
00107 #endif
00108 
00109 // ***** end of source ***** //
00110 

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008