aboutsummaryrefslogtreecommitdiffstats
path: root/etc/DEBUG
diff options
context:
space:
mode:
authorKaroly Lorentey2006-03-22 15:16:06 +0000
committerKaroly Lorentey2006-03-22 15:16:06 +0000
commitd4717700cc0b7af6197c19e22bd912e3b1ed67ee (patch)
tree4e2a630584b23f670aff57a512a8f2d8182e39c4 /etc/DEBUG
parentf1be5774242454844bf21fbf32e0f6541e2add34 (diff)
parentd63cd76657e12b92a5d7736a15bc9b97a7f9990e (diff)
downloademacs-d4717700cc0b7af6197c19e22bd912e3b1ed67ee.tar.gz
emacs-d4717700cc0b7af6197c19e22bd912e3b1ed67ee.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-160 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-161 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-162 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-163 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-164 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-165 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-166 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-167 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-168 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-169 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-170 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-171 Update from CVS: man/mh-e.texi (Folders): Various edits. * emacs@sv.gnu.org/emacs--devo--0--patch-172 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-58 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-59 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-60 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-61 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-62 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-63 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-64 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-534
Diffstat (limited to 'etc/DEBUG')
-rw-r--r--etc/DEBUG40
1 files changed, 31 insertions, 9 deletions
diff --git a/etc/DEBUG b/etc/DEBUG
index 5b4ccc0f964..b8edb12e474 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -506,22 +506,44 @@ the machine where you started GDB and use the debugger from there.
506The array `last_marked' (defined on alloc.c) can be used to display up 506The array `last_marked' (defined on alloc.c) can be used to display up
507to 500 last objects marked by the garbage collection process. 507to 500 last objects marked by the garbage collection process.
508Whenever the garbage collector marks a Lisp object, it records the 508Whenever the garbage collector marks a Lisp object, it records the
509pointer to that object in the `last_marked' array. The variable 509pointer to that object in the `last_marked' array, which is maintained
510`last_marked_index' holds the index into the `last_marked' array one 510as a circular buffer. The variable `last_marked_index' holds the
511place beyond where the pointer to the very last marked object is 511index into the `last_marked' array one place beyond where the pointer
512stored. 512to the very last marked object is stored.
513 513
514The single most important goal in debugging GC problems is to find the 514The single most important goal in debugging GC problems is to find the
515Lisp data structure that got corrupted. This is not easy since GC 515Lisp data structure that got corrupted. This is not easy since GC
516changes the tag bits and relocates strings which make it hard to look 516changes the tag bits and relocates strings which make it hard to look
517at Lisp objects with commands such as `pr'. It is sometimes necessary 517at Lisp objects with commands such as `pr'. It is sometimes necessary
518to convert Lisp_Object variables into pointers to C struct's manually. 518to convert Lisp_Object variables into pointers to C struct's manually.
519Use the `last_marked' array and the source to reconstruct the sequence
520that objects were marked.
521 519
522Once you discover the corrupted Lisp object or data structure, it is 520Use the `last_marked' array and the source to reconstruct the sequence
523useful to look at it in a fresh Emacs session and compare its contents 521that objects were marked. In general, you need to correlate the
524with a session that you are debugging. 522values recorded in the `last_marked' array with the corresponding
523stack frames in the backtrace, beginning with the innermost frame.
524Some subroutines of `mark_object' are invoked recursively, others loop
525over portions of the data structure and mark them as they go. By
526looking at the code of those routines and comparing the frames in the
527backtrace with the values in `last_marked', you will be able to find
528connections between the values in `last_marked'. E.g., when GC finds
529a cons cell, it recursively marks its car and its cdr. Similar things
530happen with properties of symbols, elements of vectors, etc. Use
531these connections to reconstruct the data structure that was being
532marked, paying special attention to the strings and names of symbols
533that you encounter: these strings and symbol names can be used to grep
534the sources to find out what high-level symbols and global variables
535are involved in the crash.
536
537Once you discover the corrupted Lisp object or data structure, grep
538the sources for its uses and try to figure out what could cause the
539corruption. If looking at the sources doesn;t help, you could try
540setting a watchpoint on the corrupted data, and see what code modifies
541it in some invalid way. (Obviously, this technique is only useful for
542data that is modified only very rarely.)
543
544It is also useful to look at the corrupted object or data structure in
545a fresh Emacs session and compare its contents with a session that you
546are debugging.
525 547
526** Debugging problems with non-ASCII characters 548** Debugging problems with non-ASCII characters
527 549