Changeset 9d944b2 for src/libcfa/libhdr


Ignore:
Timestamp:
Mar 31, 2017, 12:16:14 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
077810d
Parents:
95448f1e
Message:

Implemented interposing for abort and exit, implemented safer debug output

Location:
src/libcfa/libhdr
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/libhdr/libdebug.h

    r95448f1e r9d944b2  
    2525#endif
    2626
     27#ifdef __cforall
     28extern "C" {
     29#endif
     30      #include <stdarg.h>
     31
     32      extern void __lib_debug_write( int fd, const char *buffer, int len );
     33      extern void __lib_debug_acquire();
     34      extern void __lib_debug_release();
     35      extern void __lib_debug_print_safe  ( const char fmt[], ... ) __attribute__(( format (printf, 1, 2) ));
     36      extern void __lib_debug_print_nolock( const char fmt[], ... ) __attribute__(( format (printf, 1, 2) ));
     37      extern void __lib_debug_print_vararg( const char fmt[], va_list arg );
     38      extern void __lib_debug_print_buffer( char buffer[], int buffer_size, const char fmt[], ... ) __attribute__(( format (printf, 3, 4) ));
     39#ifdef __cforall
     40}
     41#endif
     42
    2743#ifdef __CFA_DEBUG_PRINT__
    28       #define LIB_DEBUG_PRINTF(...)   printf (__VA_ARGS__)
    29       #define LIB_DEBUG_FPRINTF(...) fprintf (stderr, __VA_ARGS__)
     44      #define LIB_DEBUG_WRITE( fd, buffer, len )  __lib_debug_write( fd, buffer, len )
     45      #define LIB_DEBUG_ACQUIRE()                 __lib_debug_acquire()
     46      #define LIB_DEBUG_RELEASE()                 __lib_debug_release()
     47      #define LIB_DEBUG_PRINT_SAFE(...)           __lib_debug_print_safe   (__VA_ARGS__)
     48      #define LIB_DEBUG_PRINT_NOLOCK(...)         __lib_debug_print_nolock (__VA_ARGS__)
     49      #define LIB_DEBUG_PRINT_BUFFER(...)         __lib_debug_print_buffer (__VA_ARGS__)
    3050#else
    31       #define LIB_DEBUG_PRINTF(...)  ((void)0)
    32       #define LIB_DEBUG_FPRINTF(...) ((void)0)
     51      #define LIB_DEBUG_WRITE(...)          ((void)0)
     52      #define LIB_DEBUG_ACQUIRE()           ((void)0)
     53      #define LIB_DEBUG_RELEASE()           ((void)0)
     54      #define LIB_DEBUG_PRINT_SAFE(...)     ((void)0)
     55      #define LIB_DEBUG_PRINT_NOLOCK(...)   ((void)0)
     56      #define LIB_DEBUG_PRINT_BUFFER(...)   ((void)0)
    3357#endif
    3458
Note: See TracChangeset for help on using the changeset viewer.