source: src/libcfa/libhdr/libdebug.h @ c13b2b8

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since c13b2b8 was 9d944b2, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Implemented interposing for abort and exit, implemented safer debug output

  • Property mode set to 100644
File size: 2.2 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// libdebug.h --
8//
9// Author           : Thierry Delisle
10// Created On       : Mon Nov 28 12:27:26 2016
11// Last Modified By : Thierry Delisle
12// Last Modified On : Mon Nov 28 12:27:26 2016
13// Update Count     : 0
14//
15
16#ifndef __LIB_DEBUG_H__
17#define __LIB_DEBUG_H__
18
19#ifdef __CFA_DEBUG__
20      #define LIB_DEBUG_DO(x) x
21      #define LIB_NO_DEBUG_DO(x) ((void)0)
22#else
23      #define LIB_DEBUG_DO(x) ((void)0)
24      #define LIB_NO_DEBUG_DO(x) x     
25#endif
26
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
43#ifdef __CFA_DEBUG_PRINT__
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__)
50#else
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)
57#endif
58
59#endif //__LIB_DEBUG_H__
60
61// Local Variables: //
62// mode: c //
63// tab-width: 4 //
64// End: //
Note: See TracBrowser for help on using the repository browser.