Sync to HEAD
[bpt/emacs.git] / admin / emacs-pretesters
CommitLineData
64b9637c
PJ
1Here are the guidelines for being an Emacs pretester.
2If you would like to do this, say so, and I'll add you to
3the pretest list.
4
5
6 Information for Emacs Pretesters
7
8The purpose of Emacs pretesting is to verify that the new Emacs
9distribution, about to be released, works properly on your system *with
10no change whatever*, when installed following the precise
11recommendations that come with the Emacs distribution.
12
13Here are some guidelines on how to do pretesting so as to make it
14helpful. All of them follow from common sense together with the
15nature of the purpose and the situation.
16
17Please save this file, and reread it when a new series of pretests
18starts.
19
20* Get the pretest from gnu/emacs/emacs-MM.NN.tar.gz and
21gnu/emacs/leim-MM.NN.tar.gz on alpha.gnu.org.
22
23* After a few days of testing, if there are no problems, please report
24that Emacs works for you and what configuration you are testing it on.
25
26* If you want to communicate with other pretesters, send mail to
27emacs-pretesters@gnu.org. I don't use that mailing list when I send
28to you because I've found that mailing lists tend to amplify random
29noise into long discussions or even arguments, and that can waste a
30lot of time. But when you have a reason to ask other pretesters for
31help, you can do it that way.
32
33* It is absolutely vital that you tell me about even the smallest
34change or departure from the standard sources and procedure.
35
36Otherwise, you are not testing the same program that I asked you to
37test. Testing a different program is usually of no use whatever. It
38can even cause trouble if you fail to tell me that you tested some
39other program instead of what I am about to release. I might think
40that Emacs works, when in fact it has not even been tried, and might
41have a glaring fault.
42
43* Don't use a site-load.el file or a site-init.el file when you pretest.
44Using either of those files means you are not testing Emacs as a typical
45site would use it.
46
47Actually, it does no harm to test Emacs with such customizations *as
48well as* testing it "out of the box". Anything you do that could find
49a bug is useful, as long as you make sure I know exactly what you did.
50The important point is that testing with local changes is no
51substitute for testing Emacs exactly as it is distributed.
52
53* Even changing the compilation options counts as a change in the
54program. The Emacs sources specify which compilation options to use.
55Some of them are specified in makefiles, and some in machine-specific
56configuration files. They also give you ways to override this--but if
57you do, then you are not testing what ordinary users will do.
58Therefore, when pretesting, it is vital to test with the default
59compilation options.
60
61(Testing with a different set of options can be useful *in addition*,
62but not *instead of* the default options.)
63
64* The machine and system configuration files of Emacs are parts of
65Emacs. So when you test Emacs, you need to do it with the
66configuration files that come with Emacs.
67
68If Emacs does not come with configuration files for a certain machine,
69and you test it with configuration files that don't come with Emacs,
70this is effectively changing Emacs. Because the crucial fact about
71the planned release is that, without changes, it doesn't work on that
72machine.
73
74To make Emacs work on that machine, I would need to install new
75configuration files. That is not out of the question, since it is
76safe--it certainly won't break any other machines that already work.
77But you will have to rush me the legal papers to give the FSF
78permission to use such a large piece of text.
79
80* Look in the etc/MACHINES file.
81
82The etc/MACHINES file says which configuration files to use for your
83machine, so use the ones that are recommended. If you guess, you might
84guess wrong and encounter spurious difficulties. What's more, if you
85don't follow etc/MACHINES then you aren't helping to test that its
86recommendations are valid.
87
88The etc/MACHINES file may describe other things that you need to do
89to make Emacs work on your machine. If so, you should follow these
90recommendations also, for the same reason.
91
92* Send your problem reports to emacs-pretest-bug@gnu.org, not
93bug-gnu-emacs.
94
95Sometimes I won't know what to do about a system-dependent issue, and
96I may need people to tell me what happens if you try a certain thing
97on a certain system. When this happens, I'll send out a query.
98
99* Don't delay sending information.
100
101When you test on a system and encounter no problems, please tell me
102about it right away. That way, I will know that someone has tested
103Emacs on that kind of system.
104
105Please don't wait for several days "to see if it really works before
106you say anything." Tell me right away that Emacs seems basically to
107work; then, if you notice a problem a few days later, tell me
108immediately about that when you see it.
109
110It is okay if you double check things before reporting a problem, such
111as to see if you can easily fix it. But don't wait very long. A good
112rule to use in pretesting is always to tell me about every problem on
113the same day you encounter it, even if that means you can't find a
114solution before you report the problem.
115
116I'd much rather hear about a problem today and a solution tomorrow
117than get both of them tomorrow at the same time.
118
119* Make each bug report self-contained.
120
121If you refer back to another message, whether from you or from someone
122else, then it will be necessary for anyone who wants to investigate
123the bug to find the other message. This may be difficult, it is
124probably time-consuming.
125
126To help me save time, simply copy the relevant parts of any previous
127messages into your own bug report.
128
129In particular, if I ask you for more information because a bug report
130was incomplete, it is best to send me the *entire* collection of
131relevant information, all together. If you send just the additional
132information, that makes me do extra work. There is even a risk that
133I won't remember what question you are sending me the answer to.
134
135* When you encounter a bug that manifests itself as a Lisp error,
136try setting debug-on-error to t and making the bug happen again.
137Then you will get a Lisp backtrace. Including that in your bug report
138is very useful.
139
140* Debugging optimized code is possible, if you compile with GCC, but
141in some cases the optimized code can be confusing. If you are not
142accustomed to that, recompile Emacs without -O. One way to do this is
143
144 make clean
145 make CFLAGS=-g
146
147* If you use X windows, it is a good idea to run Emacs under GDB (or
148some other suitable debugger) *all the time*, at least while
149pretesting.
150
151Then, when Emacs crashes, you will be able to debug the live process,
152not just a core dump. The `pr' command defined in src/.gdbinit is very
153useful in this case for examining Lisp_Object values as they would
154appear in Lisp.
155
156If you can't use `pr' because Emacs has got a fault already, or
157because you have only a core dump, you can use `xtype' to look at the
158type of a value, and then choose one of the other commands `xsymbol',
159`xstring', `xcons', `xvector' and so on to examine the contents.
160
161I myself *always* run Emacs under GDB so that I can debug conveniently
162if the occasion arises.
163
164* To get Lisp-level backtrace information within GDB,
165look for stack frames that call Ffuncall. Select them one by one in GDB
166and type this:
167
168 p *args
169 pr
170
171This will print the name of the Lisp function called by that level
172of function calling.
173
174By printing the remaining elements of args, you can see the argument
175values. Here's how to print the first argument:
177c0ea7 176
64b9637c
PJ
177 p args[1]
178 pr
179
180If you do not have a live process, you can use xtype and the other
181x... commands such as xsymbol to get such information, albeit less
182conveniently.
183
184* Even with a live process, these x... commands are useful for
185examining the fields in a buffer, window, process, frame or marker.
186Here's an example using concepts explained in the node "Value History"
187of the GDB manual to print the variable frame from this line in
188xmenu.c:
189
190 buf.frame_or_window = Fcons (frame, prefix);
191
192First, use these commands:
193
194 cd src
195 gdb emacs
196 b xmenu.c:1209
177c0ea7 197 r -q
64b9637c
PJ
198
199Then type C-x 5 2 to create a new frame, and it hits the breakpoint:
200
201 (gdb) p frame
202 $1 = 1077872640
203 (gdb) xtype
204 Lisp_Vectorlike
205 PVEC_FRAME
206 (gdb) xframe
207 $2 = (struct frame *) 0x3f0800
208 (gdb) p *$
209 $3 = {
177c0ea7
JB
210 size = 536871989,
211 next = 0x366240,
212 name = 809661752,
64b9637c
PJ
213 [...]
214 }
215 (gdb) p $3->name
216 $4 = 809661752
217
218Now we can use `pr' to print the name of the frame:
219
220 (gdb) pr
221 "emacs@steenrod.math.nwu.edu"
222
223* The Emacs C code heavily uses macros defined in lisp.h. So suppose
224we want the address of the l-value expression near the bottom of
225`kbd_buffer_store_event' from keyboard.c:
226
227 XVECTOR (kbd_buffer_frame_or_window)->contents[kbd_store_ptr
228 - kbd_buffer]
229 = event->frame_or_window);
230
231XVECTOR is a macro, and therefore GDB does not know about it.
232GDB cannot evaluate p XVECTOR (kbd_buffer_frame_or_window).
233
234However, you can use the xvector command in GDB to get the same
235result. Here is how:
236
237 (gdb) p kbd_buffer_frame_or_window
238 $1 = 1078005760
239 (gdb) xvector
240 $2 = (struct Lisp_Vector *) 0x411000
241 0
242 (gdb) p $->contents[kbd_store_ptr - kbd_buffer]
243 $3 = 1077872640
244 (gdb) p &$
245 $4 = (int *) 0x411008
246
247* Here's a related example of macros and the GDB `define' command.
248There are many Lisp vectors such as `recent_keys', which contains the
249last 100 keystrokes. We can print this Lisp vector
250
251p recent_keys
252pr
253
254But this may be inconvenient, since `recent_keys' is much more verbose
255than `C-h l'. We might want to print only the last 10 elements of
256this vector. `recent_keys' is updated in keyboard.c by the command
257
258 XVECTOR (recent_keys)->contents[recent_keys_index] = c;
259
260So we define a GDB command `xvector-elts', so the last 10 keystrokes
177c0ea7 261are printed by
64b9637c
PJ
262
263 xvector-elts recent_keys recent_keys_index 10
264
265where you can define xvector-elts as follows:
266
267 define xvector-elts
268 set $i = 0
269 p $arg0
270 xvector
271 set $foo = $
272 while $i < $arg2
177c0ea7 273 p $foo->contents[$arg1-($i++)]
64b9637c
PJ
274 pr
275 end
276 document xvector-elts
277 Prints a range of elements of a Lisp vector.
278 xvector-elts v n i
279 prints `i' elements of the vector `v' ending at the index `n'.
280 end
281
282* To debug what happens while preloading and dumping Emacs,
283do `gdb temacs' and start it with `r -batch -l loadup dump'.
284
285If temacs actually succeeds when running under GDB in this way, do not
286try to run the dumped Emacs, because it was dumped with the GDB
287breakpoints in it.
288
289* If you encounter X protocol errors, try evaluating (x-synchronize t).
290That puts Emacs into synchronous mode, where each Xlib call checks for
291errors before it returns. This mode is much slower, but when you get
292an error, you will see exactly which call really caused the error.
293
294* If the symptom of the bug is that Emacs fails to respond, don't
295assume Emacs is `hung'--it may instead be in an infinite loop. To
296find out which, make the problem happen under GDB and stop Emacs once
297it is not responding. (If Emacs is using X Windows directly, you can
298stop Emacs by typing C-z at the GDB job.) Then try stepping with
299`step'. If Emacs is hung, the `step' command won't return. If it is
300looping, `step' will return.
301
302If this shows Emacs is hung in a system call, stop it again and
303examine the arguments of the call. In your bug report, state exactly
304where in the source the system call is, and what the arguments are.
305
306If Emacs is in an infinite loop, please determine where the loop
307starts and ends. The easiest way to do this is to use the GDB command
308`finish'. Each time you use it, Emacs resumes execution until it
309exits one stack frame. Keep typing `finish' until it doesn't
310return--that means the infinite loop is in the stack frame which you
311just tried to finish.
312
313Stop Emacs again, and use `finish' repeatedly again until you get back
314to that frame. Then use `next' to step through that frame. By
315stepping, you will see where the loop starts and ends. Also please
316examine the data being used in the loop and try to determine why the
317loop does not exit when it should. Include all of this information in
318your bug report.
319
320* If certain operations in Emacs are slower than they used to be, here
321is some advice for how to find out why.
322
323Stop Emacs repeatedly during the slow operation, and make a backtrace
324each time. Compare the backtraces looking for a pattern--a specific
325function that shows up more often than you'd expect.
326
327If you don't see a pattern in the C backtraces, get some Lisp
328backtrace information by looking at Ffuncall frames (see above), and
329again look for a pattern.
330
331When using X, you can stop Emacs at any time by typing C-z at GDB.
332When not using X, you can do this with C-g.
333
334* Configure tries to figure out what kind of system you have by
335compiling and linking programs which calls various functions and looks
336at whether that succeeds. The file config.log contains any messages
337produced by compilers while running configure, to aid debugging if
338configure makes a mistake. But note that config.cache reads:
339
340# Giving --cache-file=/dev/null disables caching, for debugging configure.
341
177c0ea7 342or more simply,
64b9637c
PJ
343
344rm config.cache
345./configure
346
347* Always be precise when talking about changes you have made. Show
348things rather than describing them. Use exact filenames (relative to
349the main directory of the distribution), not partial ones. For
350example, say "I changed Makefile" rather than "I changed the
351makefile". Instead of saying "I defined the MUMBLE macro", send a
352diff.
353
354* Always use `diff -c' to make diffs. If you don't include context, it
355may be hard for me to figure out where you propose to make the
356changes. So I might have to ignore your patch.
357
358* When you write a fix, keep in mind that I can't install a change
359that *might* break other systems without the risk that it will fail to
360work and therefore require an additional cycle of pretesting.
361
362People often suggest fixing a problem by changing config.h or
363src/ymakefile or even src/Makefile to do something special that a
364particular system needs. Sometimes it is totally obvious that such
365changes would break Emacs for almost all users. I can't possibly make
366a change like that. All I can do is send it back to you and ask you
367to find a fix that is safe to install.
368
369Sometimes people send fixes that *might* be an improvement in
370general--but it is hard to be sure of this. I can install such
371changes some of the time, but not during pretest, when I am trying to
372get a new version to work reliably as quickly as possible.
373
374The safest changes for me to install are changes to the s- and m-
375files. At least I know those can't affect most systems.
376
377Another safe kind of change is one that uses a conditional to make
378sure it will apply only to a particular kind of system. Ordinarily,
379that is a bad way to solve a problem, and I would want to find a
380cleaner alternative. But the virtue of safety can make it superior at
381pretest time.
382
383* Don't try changing Emacs *in any way* unless it fails to work unchanged.
384
385* Don't even suggest changes to add features or make something
386cleaner. Every change I install could introduce a bug, so I won't
387install a change during pretest unless I see it is *necessary*.
388
389* If you would like to suggest changes for purposes other than fixing
390user-visible bugs, don't wait till pretest time. Instead, send them
391after I have made a release that proves to be stable. Then I can give
392your suggestions proper consideration. If you send them at pretest
393time, I will have to defer them till later, and that might mean I
394forget all about them.
395
396* In some cases, if you don't follow these guidelines, your
397information might still be useful, but I might have to do more work to
398make use of it. Unfortunately, I am so far behind in my work that I
399just can't keep up unless you help me to do it efficiently.
400\f
401Some suggestions for debugging on MS Windows:
402
403 Marc Fleischeuers, Geoff Voelker and Andrew Innes
404
405To debug emacs with Microsoft Visual C++, you either start emacs from
406the debugger or attach the debugger to a running emacs process. To
407start emacs from the debugger, you can use the file bin/debug.bat. The
408Microsoft Developer studio will start and under Project, Settings,
409Debug, General you can set the command-line arguments and emacs'
410startup directory. Set breakpoints (Edit, Breakpoints) at Fsignal and
411other functions that you want to examine. Run the program (Build,
412Start debug). Emacs will start and the debugger will take control as
413soon as a breakpoint is hit.
414
415You can also attach the debugger to an already running emacs process.
416To do this, start up the Microsoft Developer studio and select Build,
417Start debug, Attach to process. Choose the emacs process from the
418list. Send a break to the running process (Debug, Break) and you will
419find that execution is halted somewhere in user32.dll. Open the stack
420trace window and go up the stack to w32_msg_pump. Now you can set
421breakpoints in emacs (Edit, Breakpoints). Continue the running emacs
422process (Debug, Step out) and control will return to emacs, until a
423breakpoint is hit.
424
425To examine the contents of a lisp variable, you can use the function
426'debug_print'. Right-click on a variable, select QuickWatch, and
427place 'debug_print(' and ')' around the expression. Press
428'Recalculate' and the output is sent to the 'Debug' pane in the Output
429window. If emacs was started from the debugger, a console window was
430opened at emacs' startup; this console window also shows the output of
431'debug_print'. It is also possible to keep appropriately masked and
432typecast lisp symbols in the Watch window, this is more convenient
433when steeping though the code. For instance, on entering
434apply_lambda, you can watch (struct Lisp_Symbol *) (0xfffffff &
435args[0]).
436
437\f
438Local Variables:
439mode: text
440End:
6b61353c
KH
441
442# arch-tag: caf47b2c-b56b-44f7-a760-b5bfbed15fd3