1
by brian
clean slate |
1 |
#error This file is not used in MySQL - see ../include/my_dbug.h instead
|
2 |
/******************************************************************************
|
|
3 |
* *
|
|
4 |
* N O T I C E *
|
|
5 |
* *
|
|
6 |
* Copyright Abandoned, 1987, Fred Fish *
|
|
7 |
* *
|
|
8 |
* *
|
|
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. *
|
|
12 |
* *
|
|
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. *
|
|
20 |
* *
|
|
21 |
* I would appreciate it, as a courtesy, if this notice is left in *
|
|
22 |
* all copies and derivative works. Thank you. *
|
|
23 |
* *
|
|
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. *
|
|
27 |
* *
|
|
28 |
******************************************************************************
|
|
29 |
*/
|
|
30 |
||
31 |
/*
|
|
32 |
* FILE
|
|
33 |
*
|
|
34 |
* dbug.h user include file for programs using the dbug package
|
|
35 |
*
|
|
36 |
* SYNOPSIS
|
|
37 |
*
|
|
38 |
* #include <local/dbug.h>
|
|
39 |
*
|
|
40 |
* SCCS ID
|
|
41 |
*
|
|
42 |
* @(#)dbug.h 1.13 7/17/89
|
|
43 |
*
|
|
44 |
* DESCRIPTION
|
|
45 |
*
|
|
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.
|
|
49 |
*
|
|
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).
|
|
58 |
*
|
|
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.
|
|
62 |
*
|
|
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.
|
|
67 |
*
|
|
68 |
* AUTHOR
|
|
69 |
*
|
|
70 |
* Fred Fish
|
|
71 |
* (Currently employed by Motorola Computer Division, Tempe, Az.)
|
|
72 |
* hao!noao!mcdsun!fnf
|
|
73 |
* (602) 438-3614
|
|
74 |
*
|
|
75 |
*/
|
|
76 |
||
77 |
/*
|
|
78 |
* Internally used dbug variables which must be global.
|
|
79 |
*/
|
|
80 |
||
81 |
#ifndef DBUG_OFF
|
|
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 */ |
|
95 |
# endif
|
|
96 |
||
97 |
||
98 |
/*
|
|
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.
|
|
102 |
*
|
|
103 |
* The symbols "__LINE__" and "__FILE__" are expanded by the
|
|
104 |
* preprocessor to the current source file line number and file
|
|
105 |
* name respectively.
|
|
106 |
*
|
|
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.
|
|
110 |
*
|
|
111 |
*/
|
|
112 |
||
113 |
# ifdef DBUG_OFF
|
|
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)
|
|
124 |
# define DBUG_POP()
|
|
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)
|
|
130 |
# else
|
|
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_, \
|
|
135 |
&_db_framep_)
|
|
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)
|
|
160 |
# endif
|