Annotation of Gnu-Mach/ddb/tr.h, revision 1.1.1.2

1.1       root        1: /*
                      2:  * (c) Copyright 1992, 1993, 1994, 1995 OPEN SOFTWARE FOUNDATION, INC. 
                      3:  * ALL RIGHTS RESERVED 
                      4:  */
                      5: /*
                      6:  * OSF RI nmk19b2 5/2/95
                      7:  */
                      8: 
                      9: /*
                     10:  *     File:           ddb/tr.h
                     11:  *     Author:         Alan Langerman, Jeffrey Heller
                     12:  *     Date:           1992
                     13:  *
                     14:  *     Internal trace routines.  Like old-style XPRs but
                     15:  *     less formatting.
                     16:  */
                     17: 
1.1.1.2 ! root       18: #ifndef NDEBUG
        !            19: #define MACH_ASSERT 1
        !            20: #else
        !            21: #define MACH_ASSERT 0
        !            22: #endif
        !            23: 
1.1       root       24: #include <mach_tr.h>
                     25: 
                     26: /*
                     27:  *     Originally, we only wanted tracing when
                     28:  *     MACH_TR and MACH_ASSERT were turned on
                     29:  *     together.  Now, there's no reason why
                     30:  *     MACH_TR and MACH_ASSERT can't be completely
                     31:  *     orthogonal.
                     32:  */
                     33: #define        TRACE_BUFFER    (MACH_TR)
                     34: 
                     35: /*
                     36:  *     Log events in a circular trace buffer for future debugging.
                     37:  *     Events are unsigned integers.  Each event has a descriptive
                     38:  *     message.
                     39:  *
                     40:  *     TR_DECL must be used at the beginning of a routine using
                     41:  *     one of the tr calls.  The macro should be passed the name
                     42:  *     of the function surrounded by quotation marks, e.g.,
                     43:  *             TR_DECL("netipc_recv_intr");
                     44:  *     and should be terminated with a semi-colon.  The TR_DECL
                     45:  *     must be the *last* declaration in the variable declaration
                     46:  *     list, or syntax errors will be introduced when TRACE_BUFFER
                     47:  *     is turned off.
                     48:  */
                     49: #ifndef        _DDB_TR_H_
                     50: #define        _DDB_TR_H_
                     51: 
                     52: #if    TRACE_BUFFER
                     53: 
                     54: #include <machine/db_machdep.h>
                     55: 
                     56: #define        __ui__                  (unsigned int)
                     57: #define        TR_INIT()               tr_init()
                     58: #define TR_SHOW(a,b,c)         show_tr((a),(b),(c))
                     59: #define        TR_DECL(funcname)       char    *__ntr_func_name__ = funcname
                     60: #define        tr1(msg)                                                        \
                     61:        tr(__ntr_func_name__, __FILE__, __LINE__, (msg),                \
                     62:                0,0,0,0)
                     63: #define        tr2(msg,tag1)                                                   \
                     64:        tr(__ntr_func_name__, __FILE__, __LINE__, (msg),                \
                     65:                __ui__(tag1),0,0,0)
                     66: #define        tr3(msg,tag1,tag2)                                              \
                     67:        tr(__ntr_func_name__, __FILE__, __LINE__, (msg),                \
                     68:                __ui__(tag1),__ui__(tag2),0,0)
                     69: #define        tr4(msg,tag1,tag2,tag3)                                         \
                     70:        tr(__ntr_func_name__, __FILE__, __LINE__, (msg),                \
                     71:                __ui__(tag1),__ui__(tag2),__ui__(tag3),0)
                     72: #define        tr5(msg,tag1,tag2,tag3,tag4)                                    \
                     73:        tr(__ntr_func_name__, __FILE__, __LINE__, (msg),                \
                     74:                __ui__(tag1),__ui__(tag2),__ui__(tag3),__ui__(tag4))
                     75: 
                     76: /*
                     77:  *     Adjust tr log indentation based on function
                     78:  *     call graph; this method is quick-and-dirty
                     79:  *     and only works safely on a uniprocessor.
                     80:  */
                     81: extern int tr_indent;
                     82: #define        tr_start()      tr_indent++
                     83: #define tr_stop()      tr_indent--
                     84: 
                     85: extern void    tr_init(void);
                     86: extern void    tr(
                     87:                        char            *funcname,
                     88:                        char            *file,
                     89:                        unsigned int    lineno,
                     90:                        char            *fmt,
                     91:                        unsigned int    tag1,
                     92:                        unsigned int    tag2,
                     93:                        unsigned int    tag3,
                     94:                        unsigned int    tag4);
                     95: 
                     96: extern void db_show_tr(
                     97:                        db_expr_t       addr,
                     98:                        boolean_t       have_addr,
                     99:                        db_expr_t       count,
                    100:                        char *          modif);
                    101: 
                    102: #else  /* TRACE_BUFFER */
                    103: 
                    104: #define        TR_INIT()
                    105: #define TR_SHOW(a,b,c)
                    106: #define        TR_DECL(funcname)
                    107: #define tr1(msg)
                    108: #define tr2(msg, tag1)
                    109: #define tr3(msg, tag1, tag2)
                    110: #define tr4(msg, tag1, tag2, tag3)
                    111: #define tr5(msg, tag1, tag2, tag3, tag4)
                    112: #define        tr_start()
                    113: #define tr_stop()
                    114: 
                    115: #endif /* TRACE_BUFFER */
                    116: 
                    117: #endif /* _DDB_TR_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.