Changes in libcfa/src/bits/debug.hfa [851fd92:ae66348]
- File:
-
- 1 edited
-
libcfa/src/bits/debug.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/debug.hfa
r851fd92 rae66348 9 9 // Author : Thierry Delisle 10 10 // Created On : Mon Nov 28 12:27:26 2016 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Apr 27 10:15:00202013 // Update Count : 1011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 4 12:29:21 2020 13 // Update Count : 9 14 14 // 15 15 … … 40 40 #endif 41 41 #include <stdarg.h> 42 #include <stdio.h> 42 43 43 44 extern void __cfaabi_bits_write( int fd, const char buffer[], int len ); … … 48 49 extern void __cfaabi_bits_print_vararg( int fd, const char fmt[], va_list arg ); 49 50 extern void __cfaabi_bits_print_buffer( int fd, char buffer[], int buffer_size, const char fmt[], ... ) __attribute__(( format(printf, 4, 5) )); 50 51 #if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_IO__) \52 || defined(__CFA_DEBUG_PRINT_MONITOR__) || defined(__CFA_DEBUG_PRINT_PREEMPTION__) \53 || defined(__CFA_DEBUG_PRINT_RUNTIME_CORE__) || defined(__CFA_DEBUG_PRINT_EXCEPTION__)54 #include <stdio.h>55 #include <unistd.h>56 #endif57 51 #ifdef __cforall 58 52 } 59 53 #endif 60 54 61 // Deprecated: Use the versions with the new module names.62 55 #ifdef __CFA_DEBUG_PRINT__ 63 56 #define __cfaabi_dbg_write( buffer, len ) __cfaabi_bits_write( STDERR_FILENO, buffer, len ) 64 57 #define __cfaabi_dbg_acquire() __cfaabi_bits_acquire() 65 58 #define __cfaabi_dbg_release() __cfaabi_bits_release() 66 #define __cfaabi_dbg_print_safe(...) __cfaabi_bits_print_safe ( STDERR_FILENO, __VA_ARGS__)67 #define __cfaabi_dbg_print_nolock(...) __cfaabi_bits_print_nolock ( STDERR_FILENO, __VA_ARGS__)68 #define __cfaabi_dbg_print_buffer(...) __cfaabi_bits_print_buffer ( STDERR_FILENO, __VA_ARGS__)69 #define __cfaabi_dbg_print_buffer_decl(...) char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_bits_write( STDERR_FILENO,__dbg_text, __dbg_len );70 #define __cfaabi_dbg_print_buffer_local(...) __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_write( STDERR_FILENO,__dbg_text, __dbg_len );59 #define __cfaabi_dbg_print_safe(...) __cfaabi_bits_print_safe (__VA_ARGS__) 60 #define __cfaabi_dbg_print_nolock(...) __cfaabi_bits_print_nolock (__VA_ARGS__) 61 #define __cfaabi_dbg_print_buffer(...) __cfaabi_bits_print_buffer (__VA_ARGS__) 62 #define __cfaabi_dbg_print_buffer_decl(...) char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_bits_write( __dbg_text, __dbg_len ); 63 #define __cfaabi_dbg_print_buffer_local(...) __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_dbg_write( __dbg_text, __dbg_len ); 71 64 #else 72 65 #define __cfaabi_dbg_write(...) ((void)0) … … 80 73 #endif 81 74 82 // Debug print functions and statements:83 // Most are wrappers around the bits printing function but are not always used.84 // If they are used depends if the group (first argument) is active or not. The group must be one85 // defined belowe. The other arguments depend on the wrapped function.86 #define __cfadbg_write(group, buffer, len) \87 __CFADBG_PRINT_GROUP_##group(__cfaabi_bits_write(STDERR_FILENO, buffer, len))88 #define __cfadbg_acquire(group) \89 __CFADBG_PRINT_GROUP_##group(__cfaabi_bits_acquire())90 #define __cfadbg_release(group) \91 __CFADBG_PRINT_GROUP_##group(__cfaabi_bits_release())92 #define __cfadbg_print_safe(group, ...) \93 __CFADBG_PRINT_GROUP_##group(__cfaabi_bits_print_safe(STDERR_FILENO, __VA_ARGS__))94 #define __cfadbg_print_nolock(group, ...) \95 __CFADBG_PRINT_GROUP_##group(__cfaabi_bits_print_nolock(STDERR_FILENO, __VA_ARGS__))96 #define __cfadbg_print_buffer(group, ...) \97 __CFADBG_PRINT_GROUP_##group(__cfaabi_bits_print_buffer(STDERR_FILENO, __VA_ARGS__))98 #define __cfadbg_print_buffer_decl(group, ...) \99 __CFADBG_PRINT_GROUP_##group(char __dbg_text[256]; int __dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_bits_write( __dbg_text, __dbg_len ))100 #define __cfadbg_print_buffer_local(group, ...) \101 __CFADBG_PRINT_GROUP_##group(__dbg_len = snprintf( __dbg_text, 256, __VA_ARGS__ ); __cfaabi_bits_write(STDERR_FILENO, __dbg_text, __dbg_len))102 103 // The debug print groups:104 #if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_IO__)105 # define __CFADBG_PRINT_GROUP_io(...) __VA_ARGS__106 #else107 # define __CFADBG_PRINT_GROUP_io(...) ((void)0)108 #endif109 #if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_MONITOR__)110 # define __CFADBG_PRINT_GROUP_monitor(...) __VA_ARGS__111 #else112 # define __CFADBG_PRINT_GROUP_monitor(...) ((void)0)113 #endif114 #if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_PREEMPTION__)115 # define __CFADBG_PRINT_GROUP_preemption(...) __VA_ARGS__116 #else117 # define __CFADBG_PRINT_GROUP_preemption(...) ((void)0)118 #endif119 #if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_RUNTIME_CORE__)120 # define __CFADBG_PRINT_GROUP_runtime_core(...) __VA_ARGS__121 #else122 # define __CFADBG_PRINT_GROUP_runtime_core(...) ((void)0)123 #endif124 #if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_READY_QUEUE__)125 # define __CFADBG_PRINT_GROUP_ready_queue(...) __VA_ARGS__126 #else127 # define __CFADBG_PRINT_GROUP_ready_queue(...) ((void)0)128 #endif129 #if defined(__CFA_DEBUG_PRINT__) || defined(__CFA_DEBUG_PRINT_EXCEPTION__)130 # define __CFADBG_PRINT_GROUP_exception(...) __VA_ARGS__131 #else132 # define __CFADBG_PRINT_GROUP_exception(...) ((void)0)133 #endif134 135 75 // Local Variables: // 136 76 // mode: c //
Note:
See TracChangeset
for help on using the changeset viewer.