view etc/DEBUG @ 31383:860d7ac182e3

(vc-rcs-show-log-entry): New function. (vc-rcs-checkin, vc-rcs-checkout): Don't set all properties. (vc-rcs-register): If there is no RCS subdir, ask the user whether to create one. (vc-rcs-state-heuristic): Use file-ownership-preserved-p. (vc-rcs-checkout): Remove the error-handling for missing-rcs. (vc-rcs-state-heuristic): Don't use file-writable-p. (vc-rcs-print-log): Insert in the current buffer. (vc-rcs-diff): Insert in the current buffer and remove unused arg CMP. (vc-rcs-workfile-unchanged-p): Use vc-do-command instead of vc-simple-command. (vc-rcs-fetch-master-state): Removed check for unlocked-changes to avoid doing a diff when opening a file. (vc-rcs-state): Added check for unlocked-changes. (vc-rcs-header): Escape Id. (vc-rcs-workfile-unchanged-p): Remove optional arg VERSION. (vc-rcs-state): Call vc-workfile-unchanged-p, not the RCS-specific version. (vc-rcs-state-heuristic): Use file-writable-p instead of comparing userids. (vc-rcs-fetch-master-state): Handle the case where rcs is missing. Simplify the logic by eliminating unreachable code. (vc-rcs-diff): Only pass `2' to vc-do-command if necessary and just do a recursive call if we need to retry. (vc-rcs-checkout): Handle the case where rcs is missing by making the buffer read-write if requested and re-signalling the error. (vc-rcs-find-most-recent-rev): New function. The code derives from the old vc-parse-buffer but uses the revision number rather than the date (much easier to compare robustly). (vc-rcs-fetch-master-state): Use `with-temp-buffer'. Adapt to the new vc-parse-buffer (and vc-rcs-find-most-recent-rev). Find the locking-user more directly. Check strict locking and set checkout-model appropriately. (vc-rcs-parse-locks): Remove. (vc-rcs-latest-on-branch-p): Use with-temp-buffer and adapt to the new vc-parse-buffer (and vc-rcs-find-most-recent-rev). (vc-rcs-system-release): Use with-current-buffer and vc-parse-buffer. (vc-rcs-register, vc-rcs-checkout): Use with-current-buffer. Merge in code from vc-rcs-hooks.el. Don't require 'vc anymore. (vc-rcs-responsible-p): Use expand-file-name instead of concat and file-directory-p instead of file-exists-p. (vc-rcs-exists): Remove. (vc-rcs-header): New var. Update Copyright. (vc-rcs-rename-file): New function. (vc-rcs-diff): Remove unused `backend' variable. (vc-rcs-clear-headers): New function; code moved here from vc-clear-headers in vc.el. (tail): Provide vc-rcs and remove vc-rcs-logentry-check. (vc-rcs-register): Parse command output to find master file name and workfile version. (vc-rcs-checkout): Removed call to vc-file-clear-masterprops. Require vc and vc-rcs-hooks. (vc-rcs-trunk-p, vc-rcs-branch-part): Move to vc-rcs-hooks. (vc-rcs-backend-release-p): Remove (use vc-rcs-release-p). (vc-release-greater-or-equal-p): Move from vc. (vc-rcs-trunk-p, vc-rcs-branch-p, vc-rcs-branch-part, vc-rcs-minor-part, vc-rcs-previous-version): Remove duplicates. (vc-rcs-checkout): Add a missing `new-version' argument in the call to vc-rcs-latest-on-branch-p. Hopefully that was the right one. (vc-rcs-steal-lock): Renamed from `vc-rcs-steal'. Updated everything to use `vc-checkout-model'. (vc-rcs-backend-release-p): function added. other stuff updated to reference this function instead of the old `vc-backend-release-p'. (vc-rcs-logentry-check): Function added. (vc-rcs-checkin, vc-rcs-previous-version) (vc-rcs-checkout): Name space cleaned up. No more revision number crunching function names that are not prefixed with vc-rcs. (vc-rcs-checkout-model): Function added. References to `vc-checkout-model' replaced. (vc-rcs-admin): Added the query-only option as required by the vc.el file. (vc-rcs-exists): Function added. (vc-*-checkout): Use with-temp-file instead of /bin/sh. Merged from mainline (vc-rcs-latest-on-branch-p): Moved to vc-rcs-hooks.el. (vc-rcs-latest-on-branch-p, vc-rcs-trunk-p) (vc-rcs-branch-p, vc-rcs-branch-part, vc-rcs-minor-part) (vc-rcs-previous-version): Functions added. (vc-rcs-diff): Function added. (vc-rcs-checkout) Bug (typo) found and fixed. (vc-rcs-register-switches) Variable `vc-rcs-register-switches' added. Require vc when compiling. (vc-rcs-print-log, vc-rcs-assign-name, vc-rcs-merge) (vc-rcs-check-headers, vc-rcs-steal, vc-rcs-uncheck, vc-rcs-revert) (vc-rcs-checkin): New functions (code from vc.el). (vc-rcs-previous-version, vc-rcs-system-release, vc-rcs-checkout): Doc fix. (vc-rcs-release): Deleted. (Duplicated vc-rcs-system-release). (vc-rcs-trunk-p, vc-rcs-branch-p, vc-rcs-branch-part) (vc-rcs-minor-part, vc-rcs-previous-version, vc-rcs-release) (vc-rcs-release-p, vc-rcs-admin, vc-rcs-checkout): New functions from vc.el. (vc-rcs-system-release): Renamed from vc-rcs-backend-release.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 04 Sep 2000 19:47:43 +0000
parents e96ffe544684
children 4881cd839f12
line wrap: on
line source

Debugging GNU Emacs
Copyright (c) 1985 Richard M. Stallman.

   Permission is granted to anyone to make or distribute verbatim copies
   of this document as received, in any medium, provided that the
   copyright notice and permission notice are preserved,
   and that the distributor grants the recipient permission
   for further redistribution as permitted by this notice.

   Permission is granted to distribute modified versions
   of this document, or of portions of it,
   under the above conditions, provided also that they
   carry prominent notices stating who last changed them.

On 4.2 you will probably find that dbx does not work for
debugging GNU Emacs.  For one thing, dbx does not keep the
inferior process's terminal modes separate from its own.
For another, dbx does not put the inferior in a separate
process group, which makes trouble when an inferior uses
interrupt input, which GNU Emacs must do on 4.2.

dbx has also been observed to have other problems,
such as getting incorrect values for register variables
in stack frames other than the innermost one.

The Emacs distribution now contains GDB, the new source-level
debugger for the GNU system.  GDB works for debugging Emacs.
GDB currently runs on vaxes under 4.2 and on Sun 2 and Sun 3
systems.


** Some useful techniques

`Fsignal' is a very useful place to stop in.
All Lisp errors go through there.

It is useful, when debugging, to have a guaranteed way
to return to the debugger at any time.  If you are using
interrupt-driven input, which is the default, then Emacs is using
RAW mode and the only way you can do it is to store
the code for some character into the variable stop_character:

    set stop_character = 29

makes Control-] (decimal code 29) the stop character.
Typing Control-] will cause immediate stop.  You cannot
use the set command until the inferior process has been started.
Put a breakpoint early in `main', or suspend the Emacs,
to get an opportunity to do the set command.

If you are using cbreak input (see the Lisp function set-input-mode),
then typing Control-g will cause a SIGINT, which will return control
to the debugger immediately unless you have done

    ignore 3  (in dbx)
or  handle 3 nostop noprint  (in gdb)

You will note that most of GNU Emacs is written to avoid
declaring a local variable in an inner block, even in
cases where using one would be the cleanest thing to do.
This is because dbx cannot access any of the variables
in a function which has even one variable defined in an
inner block.  A few functions in GNU Emacs do have variables
in inner blocks, only because I wrote them before realizing
that dbx had this problem and never rewrote them to avoid it.

I believe that GDB does not have such a problem.


** Examining Lisp object values.

When you have a live process to debug, and it has not encountered a
fatal error, you can use the GDB command `pr'.  First print the value
in the ordinary way, with the `p' command.  Then type `pr' with no
arguments.  This calls a subroutine which uses the Lisp printer.

If you can't use this command, either because the process can't run
a subroutine or because the data is invalid, you can fall back on
lower-level commands.

Use the `xtype' command to print out the data type of the last data
value.  Once you know the data type, use the command that corresponds
to that type.  Here are these commands:

    xint xptr xwindow xmarker xoverlay xmiscfree xintfwd xboolfwd xobjfwd
    xbufobjfwd xkbobjfwd xbuflocal xbuffer xsymbol xstring xvector xframe
    xwinconfig xcompiled xcons xcar xcdr xsubr xprocess xfloat xscrollbar

Each one of them applies to a certain type or class of types.
(Some of these types are not visible in Lisp, because they exist only
internally.)

Each x... command prints some information about the value, and
produces a GDB value (subsequently available in $) through which you
can get at the rest of the contents.

In general, most of the rest of the contents will be addition Lisp
objects which you can examine in turn with the x... commands.

** If GDB does not run and your debuggers can't load Emacs.

On some systems, no debugger can load Emacs with a symbol table,
perhaps because they all have fixed limits on the number of symbols
and Emacs exceeds the limits.  Here is a method that can be used
in such an extremity.  Do

    nm -n temacs > nmout
    strip temacs
    adb temacs
    0xd:i
    0xe:i
    14:i
    17:i
    :r -l loadup   (or whatever)

It is necessary to refer to the file `nmout' to convert
numeric addresses into symbols and vice versa.

It is useful to be running under a window system.
Then, if Emacs becomes hopelessly wedged, you can create
another window to do kill -9 in.  kill -ILL is often
useful too, since that may make Emacs dump core or return
to adb.


** Debugging incorrect screen updating.

To debug Emacs problems that update the screen wrong, it is useful
to have a record of what input you typed and what Emacs sent to the
screen.  To make these records, do

(open-dribble-file "~/.dribble")
(open-termscript "~/.termscript")

The dribble file contains all characters read by Emacs from the
terminal, and the termscript file contains all characters it sent to
the terminal.  The use of the directory `~/' prevents interference
with any other user.

If you have irreproducible display problems, put those two expressions
in your ~/.emacs file.  When the problem happens, exit the Emacs that
you were running, kill it, and rename the two files.  Then you can start
another Emacs without clobbering those files, and use it to examine them.