Mercurial > hg > xemacs-beta
annotate src/debug.c @ 5518:3cc7470ea71c
gnuclient: if TMPDIR was set and connect failed, try again with /tmp
2011-06-03 Aidan Kehoe <kehoea@parhasard.net>
* gnuslib.c (connect_to_unix_server):
Retry with /tmp as a directory in which to search for Unix sockets
if an attempt to connect with some other directory failed (which
may be because gnuclient and gnuserv don't share an environment
value for TMPDIR, or because gnuserv was compiled with USE_TMPDIR
turned off).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Fri, 03 Jun 2011 18:40:57 +0100 |
parents | 308d34e9f07d |
children | 56144c8593a8 |
rev | line source |
---|---|
428 | 1 /* Debugging aids -- togglable assertions. |
2 Copyright (C) 1994 Free Software Foundation, Inc. | |
3 | |
4 This file is part of XEmacs. | |
5 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4852
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
428 | 7 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4852
diff
changeset
|
8 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4852
diff
changeset
|
9 option) any later version. |
428 | 10 |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4852
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
428 | 18 |
19 /* Synched up with: Not in FSF. */ | |
20 | |
21 /* This file has been Mule-ized. */ | |
22 | |
23 /* Written by Chuck Thompson */ | |
24 | |
25 #include <config.h> | |
26 #include "lisp.h" | |
27 #include "debug.h" | |
28 #include "bytecode.h" | |
29 | |
30 /* | |
31 * To add a new debug class: | |
1318 | 32 * 1. Add a symbol definition for it here or in general-slots.h, if one |
33 * doesn't exist elsewhere. If you add it here, make sure to add a | |
34 * defsymbol line for it in syms_of_debug. | |
428 | 35 * 2. Add an extern definition for the symbol to debug.h. |
36 * 3. Add entries for the class to struct debug_classes in debug.h. | |
37 * 4. Add a FROB line for it in xemacs_debug_loop. | |
38 */ | |
39 | |
40 struct debug_classes active_debug_classes; | |
41 | |
42 enum debug_loop | |
43 { | |
436 | 44 X_ADD, |
45 X_DELETE, | |
46 X_LIST, | |
47 X_ACTIVE, | |
48 X_INIT, | |
49 X_VALIDATE, | |
50 X_TYPE, | |
51 X_SETTYPE | |
428 | 52 }; |
53 | |
54 static Lisp_Object | |
1204 | 55 xemacs_debug_loop (enum debug_loop op, Lisp_Object class_, Lisp_Object type) |
428 | 56 { |
436 | 57 int flag = (op == X_ADD) ? 1 : 0; |
428 | 58 Lisp_Object retval = Qnil; |
59 | |
1318 | 60 #define FROB(item) \ |
61 if (op == X_LIST || op == X_ACTIVE || op == X_INIT || EQ (class_, Q##item)) \ | |
62 { \ | |
63 if (op == X_ADD || op == X_DELETE || op == X_INIT) \ | |
64 active_debug_classes.item = flag; \ | |
65 else if (op == X_LIST \ | |
66 || (op == X_ACTIVE && active_debug_classes.item)) \ | |
67 retval = Fcons (Q##item, retval); \ | |
68 else if (op == X_VALIDATE) \ | |
69 return Qt; \ | |
70 else if (op == X_SETTYPE) \ | |
71 active_debug_classes.types_of_##item = XINT (type); \ | |
72 else if (op == X_TYPE) \ | |
73 retval = make_int (active_debug_classes.types_of_##item); \ | |
74 if (op == X_INIT) active_debug_classes.types_of_##item = VALBITS; \ | |
428 | 75 } |
76 | |
77 FROB (redisplay); | |
78 FROB (buffers); | |
79 FROB (extents); | |
80 FROB (faces); | |
81 FROB (windows); | |
82 FROB (frames); | |
83 FROB (devices); | |
84 FROB (byte_code); | |
85 | |
86 return retval; | |
87 #undef FROB | |
88 } | |
89 | |
90 DEFUN ("add-debug-class-to-check", Fadd_debug_class_to_check, 1, 1, 0, /* | |
91 Add a debug class to the list of active classes. | |
92 */ | |
1204 | 93 (class_)) |
428 | 94 { |
1204 | 95 if (NILP (xemacs_debug_loop (X_VALIDATE, class_, Qnil))) |
563 | 96 invalid_argument ("No such debug class exists", Qunbound); |
428 | 97 else |
1204 | 98 xemacs_debug_loop (X_ADD, class_, Qnil); |
428 | 99 |
436 | 100 return (xemacs_debug_loop (X_ACTIVE, Qnil, Qnil)); |
428 | 101 } |
102 | |
103 DEFUN ("delete-debug-class-to-check", Fdelete_debug_class_to_check, 1, 1, 0, /* | |
104 Delete a debug class from the list of active classes. | |
105 */ | |
1204 | 106 (class_)) |
428 | 107 { |
1204 | 108 if (NILP (xemacs_debug_loop (X_VALIDATE, class_, Qnil))) |
563 | 109 invalid_argument ("No such debug class exists", Qunbound); |
428 | 110 else |
1204 | 111 xemacs_debug_loop (X_DELETE, class_, Qnil); |
428 | 112 |
436 | 113 return (xemacs_debug_loop (X_ACTIVE, Qnil, Qnil)); |
428 | 114 } |
115 | |
116 DEFUN ("debug-classes-being-checked", Fdebug_classes_being_checked, 0, 0, 0, /* | |
117 Return a list of active debug classes. | |
118 */ | |
119 ()) | |
120 { | |
436 | 121 return (xemacs_debug_loop (X_ACTIVE, Qnil, Qnil)); |
428 | 122 } |
123 | |
124 DEFUN ("debug-classes-list", Fdebug_classes_list, 0, 0, 0, /* | |
125 Return a list of all defined debug classes. | |
126 */ | |
127 ()) | |
128 { | |
436 | 129 return (xemacs_debug_loop (X_LIST, Qnil, Qnil)); |
428 | 130 } |
131 | |
132 DEFUN ("set-debug-classes-to-check", Fset_debug_classes_to_check, 1, 1, 0, /* | |
133 Set which classes of debug statements should be active. | |
134 CLASSES should be a list of debug classes. | |
135 */ | |
136 (classes)) | |
137 { | |
138 Lisp_Object rest; | |
139 | |
140 CHECK_LIST (classes); | |
141 | |
142 /* Make sure all objects in the list are valid. If anyone is not | |
143 valid, reject the entire list without doing anything. */ | |
1204 | 144 LIST_LOOP (rest, classes) |
428 | 145 { |
436 | 146 if (NILP (xemacs_debug_loop (X_VALIDATE, XCAR (rest), Qnil))) |
563 | 147 sferror ("Invalid object in class list", Qunbound); |
428 | 148 } |
149 | |
150 LIST_LOOP (rest, classes) | |
151 Fadd_debug_class_to_check (XCAR (rest)); | |
152 | |
436 | 153 return (xemacs_debug_loop (X_ACTIVE, Qnil, Qnil)); |
428 | 154 } |
155 | |
156 DEFUN ("set-debug-class-types-to-check", Fset_debug_class_types_to_check, 2, 2, 0, /* | |
157 For the given debug CLASS, set which TYPES are actually interesting. | |
158 TYPES should be an integer representing the or'd value of all desired types. | |
159 Lists of defined types and their values are located in the source code. | |
160 */ | |
1204 | 161 (class_, type)) |
428 | 162 { |
163 CHECK_INT (type); | |
1204 | 164 if (NILP (xemacs_debug_loop (X_VALIDATE, class_, Qnil))) |
563 | 165 invalid_argument ("Invalid debug class", Qunbound); |
428 | 166 |
1204 | 167 xemacs_debug_loop (X_SETTYPE, class_, type); |
428 | 168 |
1204 | 169 return (xemacs_debug_loop (X_TYPE, class_, Qnil)); |
428 | 170 } |
171 | |
172 DEFUN ("debug-types-being-checked", Fdebug_types_being_checked, 1, 1, 0, /* | |
173 For the given CLASS, return the associated type value. | |
174 */ | |
1204 | 175 (class_)) |
428 | 176 { |
1204 | 177 if (NILP (xemacs_debug_loop (X_VALIDATE, class_, Qnil))) |
563 | 178 invalid_argument ("Invalid debug class", Qunbound); |
428 | 179 |
1204 | 180 return (xemacs_debug_loop (X_TYPE, class_, Qnil)); |
428 | 181 } |
182 | |
183 void | |
184 syms_of_debug (void) | |
185 { | |
186 DEFSUBR (Fadd_debug_class_to_check); | |
187 DEFSUBR (Fdelete_debug_class_to_check); | |
188 DEFSUBR (Fdebug_classes_being_checked); | |
189 DEFSUBR (Fdebug_classes_list); | |
190 DEFSUBR (Fset_debug_classes_to_check); | |
191 DEFSUBR (Fset_debug_class_types_to_check); | |
192 DEFSUBR (Fdebug_types_being_checked); | |
193 } | |
194 | |
195 void | |
196 reinit_vars_of_debug (void) | |
197 { | |
198 /* If you need to have any classes active early on in startup, then | |
199 the flags should be set here. | |
200 All functions called by this function are "allowed" according | |
201 to emacs.c. */ | |
436 | 202 xemacs_debug_loop (X_INIT, Qnil, Qnil); |
428 | 203 } |
204 | |
205 void | |
206 vars_of_debug (void) | |
207 { | |
4852
e0138eaaca0c
need to provide debug-xemacs for debug-on-error changes to work
Ben Wing <ben@xemacs.org>
parents:
2367
diff
changeset
|
208 Fprovide (intern ("debug-xemacs")); |
428 | 209 } |