1
#error This file is not used in MySQL - see ../include/my_dbug.h instead
2
/******************************************************************************
6
* Copyright Abandoned, 1987, Fred Fish *
9
* This previously copyrighted work has been placed into the public *
10
* domain by the author and may be freely used for any purpose, *
11
* private or commercial. *
13
* Because of the number of inquiries I was receiving about the use *
14
* of this product in commercially developed works I have decided to *
15
* simply make it public domain to further its unrestricted use. I *
16
* specifically would be most happy to see this material become a *
17
* part of the standard Unix distributions by AT&T and the Berkeley *
18
* Computer Science Research Group, and a standard part of the GNU *
19
* system from the Free Software Foundation. *
21
* I would appreciate it, as a courtesy, if this notice is left in *
22
* all copies and derivative works. Thank you. *
24
* The author makes no warranty of any kind with respect to this *
25
* product and explicitly disclaims any implied warranties of mer- *
26
* chantability or fitness for any particular purpose. *
28
******************************************************************************
34
* dbug.h user include file for programs using the dbug package
38
* #include <local/dbug.h>
42
* @(#)dbug.h 1.13 7/17/89
46
* Programs which use the dbug package must include this file.
47
* It contains the appropriate macros to call support routines
48
* in the dbug runtime library.
50
* To disable compilation of the macro expansions define the
51
* preprocessor symbol "DBUG_OFF". This will result in null
52
* macros expansions so that the resulting code will be smaller
53
* and faster. (The difference may be smaller than you think
54
* so this step is recommended only when absolutely necessary).
55
* In general, tradeoffs between space and efficiency are
56
* decided in favor of efficiency since space is seldom a
57
* problem on the new machines).
59
* All externally visible symbol names follow the pattern
60
* "_db_xxx..xx_" to minimize the possibility of a dbug package
61
* symbol colliding with a user defined symbol.
63
* The DBUG_<N> style macros are obsolete and should not be used
64
* in new code. Macros to map them to instances of DBUG_PRINT
65
* are provided for compatibility with older code. They may go
66
* away completely in subsequent releases.
71
* (Currently employed by Motorola Computer Division, Tempe, Az.)
78
* Internally used dbug variables which must be global.
82
extern int _db_on_; /* TRUE if debug currently enabled */
83
extern FILE *_db_fp_; /* Current debug output stream */
84
extern char *_db_process_; /* Name of current process */
85
extern int _db_keyword_ (); /* Accept/reject keyword */
86
extern void _db_push_ (); /* Push state, set up new state */
87
extern void _db_pop_ (); /* Pop previous debug state */
88
extern void _db_enter_ (); /* New user function entered */
89
extern void _db_return_ (); /* User function return */
90
extern void _db_pargs_ (); /* Remember args for line */
91
extern void _db_doprnt_ (); /* Print debug output */
92
extern void _db_setjmp_ (); /* Save debugger environment */
93
extern void _db_longjmp_ (); /* Restore debugger environment */
94
extern void _db_dump_(); /* Dump memory */
99
* These macros provide a user interface into functions in the
100
* dbug runtime support library. They isolate users from changes
101
* in the MACROS and/or runtime support.
103
* The symbols "__LINE__" and "__FILE__" are expanded by the
104
* preprocessor to the current source file line number and file
107
* WARNING --- Because the DBUG_ENTER macro allocates space on
108
* the user function's stack, it must precede any executable
109
* statements in the user function.
114
# define DBUG_ENTER(a1)
115
# define DBUG_RETURN(a1) return(a1)
116
# define DBUG_VOID_RETURN return
117
# define DBUG_EXECUTE(keyword,a1)
118
# define DBUG_PRINT(keyword,arglist)
119
# define DBUG_2(keyword,format) /* Obsolete */
120
# define DBUG_3(keyword,format,a1) /* Obsolete */
121
# define DBUG_4(keyword,format,a1,a2) /* Obsolete */
122
# define DBUG_5(keyword,format,a1,a2,a3) /* Obsolete */
123
# define DBUG_PUSH(a1)
125
# define DBUG_PROCESS(a1)
126
# define DBUG_FILE (stderr)
127
# define DBUG_SETJMP setjmp
128
# define DBUG_LONGJMP longjmp
129
# define DBUG_DUMP(keyword,a1)
131
# define DBUG_ENTER(a) \
132
auto char *_db_func_; auto char *_db_file_; auto int _db_level_; \
133
auto char **_db_framep_; \
134
_db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
136
# define DBUG_LEAVE \
137
(_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
138
# define DBUG_RETURN(a1) return (DBUG_LEAVE, (a1))
139
/* define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);} Alternate form */
140
# define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
141
# define DBUG_EXECUTE(keyword,a1) \
142
{if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
143
# define DBUG_PRINT(keyword,arglist) \
144
{if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
145
# define DBUG_2(keyword,format) \
146
DBUG_PRINT(keyword,(format)) /* Obsolete */
147
# define DBUG_3(keyword,format,a1) \
148
DBUG_PRINT(keyword,(format,a1)) /* Obsolete */
149
# define DBUG_4(keyword,format,a1,a2) \
150
DBUG_PRINT(keyword,(format,a1,a2)) /* Obsolete */
151
# define DBUG_5(keyword,format,a1,a2,a3) \
152
DBUG_PRINT(keyword,(format,a1,a2,a3)) /* Obsolete */
153
# define DBUG_PUSH(a1) _db_push_ (a1)
154
# define DBUG_POP() _db_pop_ ()
155
# define DBUG_PROCESS(a1) (_db_process_ = a1)
156
# define DBUG_FILE (_db_fp_)
157
# define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
158
# define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
159
# define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2)