Subject: bug#7728: 24.0.50; GDB backtrace from abort

From: "Drew Adams" <[email-masked]>
Date: Fri, 24 Dec 2010 08:55:20 -0800

Eli suggested I report this now, even though I have only the backtrace
and didn't follow up with more commands when GDB was open.  This was in
my own setup, not emacs -Q.
 
$ ./gdb -p 3684
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Attaching to process 3684
[New Thread 3684.0x1210]
[New Thread 3684.0x154]
[New Thread 3684.0xe00]
Reading symbols from C:\Emacs-24-2010-12-20\bin\emacs.exe...done.
[Switching to Thread 3684.0xe00]
Warning: c:\drews-lisp-20\bin/../lwlib: No such file or directory.
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) [answered Y; input not from
terminal]
Environment variable "DISPLAY" not defined.
TERM = cygwin
Breakpoint 1 at 0x1309b68: file w32fns.c, line 7298.
Temporary breakpoint 2 at 0x11cf699: file sysdep.c, line 839.
(gdb) c
Continuing.
 
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 3684.0x1210]
0x7c90120f in ntdll!DbgUiConnectToDbg () from C:\WINDOWS\system32\ntdll.dll
(gdb) bt
#0  0x7c90120f in ntdll!DbgUiConnectToDbg () from C:\WINDOWS\system32\ntdll.dll
#1  0x01309b9f in w32_abort () at w32fns.c:7312
#2  0x0104a0af in die (msg=0x159401c "assertion failed:
WINDOWP(selected_window)",
    file=0x1593ee0 "xdisp.c", line=1156) at alloc.c:6129
#3  0x0116327a in window_text_bottom_y (w=0x58b2c00) at xdisp.c:1156
#4  0x011c0d07 in erase_phys_cursor (w=0x58b2c00) at xdisp.c:23802
#5  0x011c1fcb in display_and_set_cursor (w=0x58b2c00, on=1, hpos=1, vpos=4,
x=8, y=56)
    at xdisp.c:23936
#6  0x011c20e4 in update_window_cursor (w=0x58b2c00, on=1) at xdisp.c:23973
#7  0x011c229e in update_cursor_in_window_tree (w=0x58b2c00, on_p=1) at
xdisp.c:23993
#8  0x011c23e8 in x_update_cursor (f=0x58b2800, on_p=1) at xdisp.c:24007
#9  0x012eb871 in frame_highlight (f=0x58b2800) at w32term.c:2743
#10 0x012ebd84 in x_frame_rehighlight (dpyinfo=0x16c6918) at w32term.c:2901
#11 0x012ebbb2 in w32_frame_rehighlight (frame=0x58b2800) at w32term.c:2873
#12 0x01288ef3 in Fredirect_frame_focus (frame=93005829, focus_frame=93005829)
    at frame.c:2082
#13 0x0127f4c8 in do_switch_frame (frame=93005829, track=1, for_deletion=0,
    norecord=49010714) at frame.c:847
#14 0x01280733 in Fselect_frame (frame=93005829, norecord=49010714) at
frame.c:899
#15 0x01252702 in Fselect_window (window=93006853, norecord=49010714) at
window.c:3581
#16 0x0125e7c8 in Fset_window_configuration (configuration=99327941) at
window.c:6148
#17 0x0103ca56 in unbind_to (count=39, value=49010714) at eval.c:3370
#18 0x0125fefb in Fsave_window_excursion (args=50081366) at window.c:6453
#19 0x010f43ad in Fbyte_code (bytestr=49145937, vector=49031429, maxdepth=28)
    at bytecode.c:840
#20 0x0103bc8e in funcall_lambda (fun=51265541, nargs=2, arg_vector=0x83ea54)
    at eval.c:3174
#21 0x0103b3a5 in Ffuncall (nargs=3, args=0x83ea50) at eval.c:3037
#22 0x010f3824 in Fbyte_code (bytestr=49040673, vector=54388229, maxdepth=16)
    at bytecode.c:679
#23 0x0103bc8e in funcall_lambda (fun=50492101, nargs=0, arg_vector=0x83ed70)
    at eval.c:3174
#24 0x0103b3a5 in Ffuncall (nargs=1, args=0x83ed6c) at eval.c:3037
#25 0x0103a03d in run_hook_with_args (nargs=1, args=0x83ed6c,
cond=to_completion)
    at eval.c:2679
#26 0x01039ce7 in Frun_hooks (nargs=1, args=0x83ee3c) at eval.c:2542
#27 0x0103aa95 in Ffuncall (nargs=2, args=0x83ee38) at eval.c:2970
#28 0x0103a35a in call1 (fn=49166986, arg1=49056298) at eval.c:2789
#29 0x01007e5a in safe_run_hooks_1 () at keyboard.c:2020
#30 0x010369fd in internal_condition_case (bfun=0x1007e27 <safe_run_hooks_1>,
    handlers=49010738, hfun=0x1007e5c <safe_run_hooks_error>) at eval.c:1460
#31 0x01007efa in safe_run_hooks (hook=49056298) at keyboard.c:2046
#32 0x01006c29 in command_loop_1 () at keyboard.c:1743
#33 0x010369fd in internal_condition_case (bfun=0x100562b <command_loop_1>,
    handlers=49064346, hfun=0x1004d5f <cmd_error>) at eval.c:1460
#34 0x01005231 in command_loop_2 (ignore=49010714) at keyboard.c:1327
#35 0x0103647c in internal_catch (tag=49166602, func=0x100520d <command_loop_2>,
    arg=49010714) at eval.c:1204
#36 0x0100519c in command_loop () at keyboard.c:1292
#37 0x0100446b in recursive_edit_1 () at keyboard.c:929
#38 0x010d394e in read_minibuf (map=60546878, initial=20177105, prompt=60971569,
    backup_n=49010714, expflag=1, histvar=49196394, histpos=0, defalt=49010714,
    allow_props=0, inherit_input_method=0) at minibuf.c:711
#39 0x010d49b3 in Fread_from_minibuffer (prompt=60971569,
initial_contents=20177105,
    keymap=60546878, sys_read=49010738, hist=49196394, default_value=49010714,
    inherit_input_method=49010714) at minibuf.c:998
#40 0x0103b24a in Ffuncall (nargs=8, args=0x83f400) at eval.c:3014
#41 0x010f3824 in Fbyte_code (bytestr=60281009, vector=60530821, maxdepth=32)
    at bytecode.c:679
#42 0x0103bc8e in funcall_lambda (fun=58351653, nargs=5, arg_vector=0x83f620)
    at eval.c:3174
#43 0x0103b6b4 in apply_lambda (fun=58351653, args=60588622, eval_flag=1) at
eval.c:3100
#44 0x01039251 in Feval (form=60588630) at eval.c:2395
#45 0x010389a7 in Feval (form=60588638) at eval.c:2314
#46 0x010f6f4e in Fcall_interactively (function=60488066, record_flag=49010714,
    keys=49031941) at callint.c:345
#47 0x0103af5a in Ffuncall (nargs=4, args=0x83fb60) at eval.c:2995
#48 0x0103a3d4 in call3 (fn=49179562, arg1=60488066, arg2=49010714,
arg3=49010714)
    at eval.c:2820
#49 0x01022793 in Fcommand_execute (cmd=60488066, record_flag=49010714,
keys=49010714,
    special=49010714) at keyboard.c:10393
#50 0x01006bcd in command_loop_1 () at keyboard.c:1726
#51 0x010369fd in internal_condition_case (bfun=0x100562b <command_loop_1>,
    handlers=49064346, hfun=0x1004d5f <cmd_error>) at eval.c:1460
#52 0x01005231 in command_loop_2 (ignore=49010714) at keyboard.c:1327
#53 0x0103647c in internal_catch (tag=49062442, func=0x100520d <command_loop_2>,
    arg=49010714) at eval.c:1204
#54 0x010051ed in command_loop () at keyboard.c:1306
#55 0x0100446b in recursive_edit_1 () at keyboard.c:929
#56 0x01004985 in Frecursive_edit () at keyboard.c:991
#57 0x010027d7 in main (argc=3, argv=0x326d8) at emacs.c:1716
 
Lisp Backtrace:
"fit-frame" (0x83ea54)
"1on1-fit-minibuffer-frame" (0x83ed70)
"run-hooks" (0x83ee3c)
"old-read-from-minibuffer" (0x83f404)
"read-from-minibuffer" (0x83f620)
"list" (0x83f85c)
"call-interactively" (0x83fb64)
(gdb) 
 
-------------------------------
 
Some more info:
 
`fit-frame' is one of my commands. It fits a frame to its (typically
sole) buffer. In this case, it was run on a hook, and it was the
standalone minibuffer frame that was being fit.
 
The hook was no doubt from a run-hooks called in or just after (vanilla)
`read-from-minibuffer' (which is written in C - I don't have the recent
source code).
 
I invoke 1on1-fit-minibuffer-frame in several places, but it is on a
hook in only one place. I put it on post-command-hook.  So when
run-hooks was used for post-command hook, 1on1-fit-minibuffer-frame was
called.
 
This is the code that invoked `fit-frame'.
It is this code that determines which window is selected.
 
(defun 1on1-fit-minibuffer-frame ()
  "Fit the standalone minibuffer frame height to its contents.
Repeat to increase the height by 1.
Bind this in minibuffer keymaps to a key such as `C-o' that you can
use during minibuffer input.
This has no effect if you do not also use library `fit-frame.el'."
  (interactive)
  (unless (require 'fit-frame nil t)
    (error "You need to load library `fit-frame.el' to use this command"))
  ;; We could assume the minibuffer frame is `1on1-minibuffer-frame',
  ;; but we don't.
  (when (and 1on1-fit-minibuffer-frame-flag
             (active-minibuffer-window)
             (save-selected-window
               (select-window (minibuffer-window))
               ;; We should be able to use just (one-window-p),
               ;; but an Emacs bug means we need this:
               (one-window-p nil 'selected-frame)))
    (let* ((frame         (save-selected-window
                            (select-window (minibuffer-window))
                            (selected-frame)))
           (frame-height  (frame-height frame)))
      (cond
        ((eq last-command '1on1-fit-minibuffer-frame)
         (set-frame-height frame (1+ (frame-height frame)))
         (1on1-set-minibuffer-frame-top/bottom)
         (condition-case nil (scroll-down (frame-height frame))
           (error nil)))
        (t
         (let* ((beg  (1on1-minibuffer-prompt-end))
                (fit-frame-max-height
                 1on1-fit-minibuffer-frame-max-height)
                (fit-frame-max-height-percent
                 1on1-fit-minibuffer-frame-max-height-percent)
                (fit-frame-min-height  1on1-minibuffer-frame-height)
                (window-min-height     1on1-minibuffer-frame-height)
                (fit-frame-empty-height  1on1-minibuffer-frame-height)
                (fit-frame-empty-special-display-height
                 1on1-minibuffer-frame-height))
           (fit-frame frame (frame-width frame))
           (1on1-set-minibuffer-frame-top/bottom)
           (condition-case nil (scroll-down (frame-height frame))
             (error nil))))))))
 
The window that was expected to be selected was the currently active
minibuffer window.
 
HTH.
 
-------------------------------

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2010-12-20 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags
-Ic:/imagesupport/include'
 
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t
 
Major mode: Dired by name
 
Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
 
Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu> 
<send-emacs-bug-report>
 
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
 
Load-path shadows:
None found.
 
Features:
(shadow sort gnus-util mail-extr message rfc822 mml easymenu mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug dired regexp-opt tooltip ediff-hook vc-hooks lisp-float-type
mwheel dos-w32 disp-table ls-lisp w32-win w32-vars tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev button minibuffer faces cus-face files text-properties overlay
md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process multi-tty emacs)