emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

address@hidden: Emacs 21.2 -- debugger-frame-offset is 8, should be 6]


From: Richard Stallman
Subject: address@hidden: Emacs 21.2 -- debugger-frame-offset is 8, should be 6]
Date: Wed, 06 Feb 2008 14:20:12 -0500

[I sent this message a week ago but did not get a response.]

Would someone please DTRT, then ack?

------- Start of forwarded message -------
Date: Tue, 29 Jan 2008 14:35:01 -0800
From: Derek Peschel <address@hidden>
To: address@hidden
Message-ID: <address@hidden>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Subject: Emacs 21.2 -- debugger-frame-offset is 8, should be 6

The debugger (not edebug, the one in debug.el) uses the
debugger-frame-offset constant to affect breakpoints on stack frames.
So if the constant becomes wrong, breakpoint commands will appear to work
but actually affect the wrong frame.  I have included a patch.  I don't
think the problem (and the change) depend on or affect any other parts
of Emacs, but I haven't checked.

The guidelines on bug reporting basically don't trust users to analyze
problems, so I have also included steps you can follow to see if you
agree with me.  As a side effect they add a new function and keystroke
to debug.el, so that Emacs can help find the correct value of
debugger-frame-offset in the future.  This is much easier than having
to go into gdb (I know, I did that), and I suggest keeping the function
in debug.el even if it's not bound to any keys.

Please let me know if you have any questions.

- -- Derek


My system:
- ----------

I'm running Mac OS 10.3.7 -- uname -a gives
Darwin Derek-Peschels-Computer.local 7.7.0 Darwin Kernel Version 7.7.0: Sun Nov 
 7 16:06:51 PST 2004; root:xnu/xnu-517.9.5.obj~1/RELEASE_PPC  Power Macintosh 
powerpc

My Emacs is the one Apple shipped -- M-x emacs-version gives
GNU Emacs 21.2.1 (powerpc-apple-darwin7.0) of 1976-04-01 on localhost

The shell commands below use bash -- echo $BASH_VERSION gives
2.05b.0(1)-release

The shell commands also use patch -- patch -v starts with
patch 2.5.8
Copyright (C) 1988 Larry Wall
Copyright (C) 2002 Free Software Foundation, Inc.

Notations:
- ----------

?> refers to a step I haven't written commands for
shell> refers to a command typed at the bash prompt.
emacs> refers to keys typed in Emacs.
emacs= followed by a space and a line of text shows the message line
       (which could be a prompt for an argument, or the result of a command).
emacs= followed by dashes, a screen of text, and dashes shows the contents
       of a buffer.

Included files:
- ---------------

debug.el.patch-fix                      patch to apply fix -- not used
                                        in the procedure

debug.el.patch-test-orig                patch to add information command
debug.el.patch-test-fix                 patch to add information command
                                        and apply fix

debugger-frame-offset-test.el           LISP code to set up debugger
                                        for tests described in this procedure

Created or changed files:
- -------------------------

working directory                       created below (or may already exist)
  debug.el.patch-test-orig              copied from mail
  debug.el.patch-test-fix               copied from mail
  debugger-frame-offset-test.el         copied from mail
  debug.el                              created below
  debug.elc                             created below
  debug.el.old                          created below
  debug.el.new                          created below
  debug.el.disabled-during-bug-fix      temporary name for existing debug.el
  debug.elc.disabled-during-bug-fix     temporary name for existing debug.elc
home directory
  .emacs                                created below
  .emacs.disabled-during-bug-fix        temporary name for existing .emacs

Procedure -- Setup:
- -------------------

1. start a new shell since current directory and some environment variables
   will be changed

?>

2. create working directory, then change to it

shell> export WORK=~/share/emacs/site-lisp      could be any directory
                                                since it will be added
                                                to Emacs's load-path later
shell> mkdir -p $WORK                           create it if needed
shell> cd $WORK

3. put debug.el.patch-test-orig and debug.el.patch-test-fix and
   debugger-frame-offset-test.el in working directory

?>

4. create versions of debug.el used by later steps

shell> mv -i debug.el debug.el.disabled-during-bug-fix
                                                if debug.el exists
shell> mv -i debug.elc debug.elc.disabled-during-bug-fix
                                                if debug.elc exists
shell> cp /usr/share/emacs/21.2/lisp/emacs-lisp/debug.el .
                                                or from another appropriate
                                                directory
shell> cp -i debug.el debug.el.new
shell> patch <debug.el.patch-test-orig          patches debug.el
shell> patch <debug.el.patch-test-fix           patches debug.el.new

5. create working .emacs

shell> mv -i ~/.emacs ~/.emacs.disabled-during-bug-fix
                                                if .emacs exists
shell> emacs ~/.emacs
emacs> (add-to-list 'load-path "~/share/emacs/site-lisp") RET
                                                string in quotes must match
                                                WORK
emacs> C-x C-c

6. byte-compile debug.el (it must run byte-compiled)

shell> emacs
emacs> M-x byte-compile-file RET
emacs= Byte compile file: ~/share/emacs/site-lisp/
                                                prompt matches WORK
emacs> debug.el RET                             I get warnings about
                                                unread-command-char being
                                                obsolete; the debugger saves
                                                and restores it, probably so
                                                you can debug old code
emacs> C-x C-c

Procedure -- Show existing bug:
- -------------------------------

7. load test case, run test case

shell> emacs
emacs> M-x load-file RET
emacs= Load file: ~/share/emacs/site-lisp/
emacs> debugger-frame-offset-test.el RET
emacs=
- ------------------------------------------------------------------------------
Debugger entered: ("in fun8")
  fun8()
  fun7()
  fun6()
  fun5()
  fun4()
  fun3()
  fun2()
  fun1()
  eval-buffer(#<buffer  *load*> nil 
"/Users/dpeschel/share/emacs/site-lisp/debugger-frame-offset-test.el" nil t)
  
load-with-code-conversion("/Users/dpeschel/share/emacs/site-lisp/debugger-frame-offset-test.el"
 "/Users/dpeschel/share/emacs/site-lisp/debugger-frame-offset-test.el" nil nil)
  load("/Users/dpeschel/share/emacs/site-lisp/debugger-frame-offset-test.el" 
nil nil t)
  load-file("~/share/emacs/site-lisp/debugger-frame-offset-test.el")
* call-interactively(load-file)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)
- ------------------------------------------------------------------------------

8. in debugger, move to a frame, look at what "i" command says

emacs> i
emacs= (t fun6)                                 does not match function name
                                                of frame at cursor
emacs> C-u C-n C-u C-n C-u C-n                  get to
                                                "call-interactively(load-file)"
                                                frame, last one that I expect
                                                to have a printout
                                                corresponding to a real frame
emacs> i
emacs= (t call-interactively execute-extended-command)
                                                does not match function name
                                                of frame at cursor
emacs> C-n                                      if expectation is right,
                                                going down onscreen
                                                should not have a printout
                                                corresponding to a real frame
emacs> i
emacs= nil                                      does not match any function
emacs> C-x C-c

Procedure -- Apply fix:
- -----------------------

9. switch debug.el versions

shell> rm -f debug.elc
shell> mv -i debug.el debug.el.old
shell> mv -i debug.el.new debug.el

10. byte-compile debug.el
(repeat step #6)

Procedure -- Test fix:
- ----------------------

11. restart emacs, load test case, run test case
(repeat step #7; debugger window contents should be same)

12. in debugger, move to a frame, look at what "i" command says
emacs> i
emacs= (t fun8)                                 matches function name of
                                                frame at cursor
emacs> C-u C-n C-u C-n C-u C-n                  get to
                                                "call-interactively(load-file)"
                                                frame, which was a boundary
                                                case before the fix was
                                                applied
emacs> i
emacs= (t call-interactively load-file)         matches function name of
                                                frame at cursor
emacs> C-n                                      test next frame onscreen,
                                                which was past the boundary
                                                case before the fix was
                                                applied
emacs> i
emacs= (t execute-extended-command nil)         matches function name of
                                                frame at cursor
emacs> C-n                                      test next frame onscreen,
                                                boundary case now
emacs= (t call-interactively execute-extended-command)
                                                matches function name of
                                                frame at cursor
emacs> C-x C-c

Procedure -- Undo setup:
- ------------------------

13. undo changes to ~/.emacs

shell> rm ~/.emacs                              if .emacs didn't exist
                                                before this procedure
shell> mv ~/.emacs.disabled-during-bug-fix ~/.emacs
                                                if .emacs already existed
                                                before this procedure

14. undo changes to working directory

If the directory didn't exist before this procedure:

shell> cd                                       or whatever was the
                                                current directory when WORK
                                                was created
shell> rm -rf $WORK

If the directory did exist before this procedure:

shell> mv debug.el.disabled-during-bug-fix debug.el
                                                if debug.el already existed
                                                before this procedure
shell> mv debug.elc.disabled-during-bug-fix debug.elc
                                                if debug.elc already existed
                                                before this procedure

shell> rm debug.el.patch-test-orig
shell> rm debug.el-patch-test-fix
shell> rm debugger-frame-offset-test.el
shell> rm debug.el.old
shell> rm debug.el.new
------- End of forwarded message -------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]