unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Hit eassert introduced in r110971
@ 2013-04-06 16:35 Dmitry Antipov
  2013-04-06 18:37 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Antipov @ 2013-04-06 16:35 UTC (permalink / raw)
  To: Emacs development discussions; +Cc: Stefan Monnier

Found 100% method to hit eassert introduced in r110971 within update_tool_bar:

1) ./src/emacs -nw -Q
2) M-x make-frame-on-display :0
3) Move mouse to new X frame and left-click;
4) Move mouse back to TTY frame and left-click;
5) Press C-g staying in TTY frame ==>

#0  0x0000003daf40eedb in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:41
#1  0x00000000005a1cf2 in terminate_due_to_signal (sig=6, backtrace_limit=2147483647)
     at src/emacs.c:343
#2  0x000000000065d92d in die (msg=0x79db98 "assertion failed: EQ (selected_window, XFRAME (selected_frame)->selected_window)", file=
     0x79b560 "src/xdisp.c", line=11427) at src/alloc.c:6522
#3  0x000000000044c6b5 in update_tool_bar (f=f@entry=0x14a29d8, save_match_data=save_match_data@entry=0)
     at src/xdisp.c:11424
#4  0x000000000045fd3a in update_tool_bar (save_match_data=0, f=0x14a29d8) at src/xdisp.c:11094
#5  prepare_menu_bars () at src/xdisp.c:11123
#6  0x000000000046beea in redisplay_internal () at src/xdisp.c:12929
#7  0x00000000005aa3eb in read_char (commandflag=1, map=..., prev_event=..., used_mouse_menu=0x7fffb36ebbff, end_time=0x0)
     at src/keyboard.c:2417
#8  0x00000000005c0a59 in read_decoded_char (commandflag=1, map=..., prev_event=..., used_mouse_menu=0x7fffb36ebbff)
     at src/keyboard.c:8712
#9  0x00000000005c17ad in read_key_sequence (keybuf=0x7fffb36ebdc0, bufsize=30, prompt=..., dont_downcase_last=false,
     can_return_switch_frame=true, fix_current_buffer=true) at src/keyboard.c:9044
#10 0x00000000005a71ca in command_loop_1 () at src/keyboard.c:1452
#11 0x0000000000681f1b in internal_condition_case (bfun=0x5a6c44 <command_loop_1>, handlers=..., hfun=0x5a634a <cmd_error>)
     at src/eval.c:1193
#12 0x00000000005a6861 in command_loop_2 (ignore=...) at src/keyboard.c:1167
#13 0x00000000006817cb in internal_catch (tag=..., func=0x5a683e <command_loop_2>, arg=...)
     at src/eval.c:964
#14 0x00000000005a6815 in command_loop () at src/keyboard.c:1146
#15 0x00000000005a5b9a in recursive_edit_1 () at src/keyboard.c:779
#16 0x00000000005a5f77 in Frecursive_edit () at src/keyboard.c:843
#17 0x00000000005a367f in main (argc=3, argv=0x7fffb36ec488) at src/emacs.c:1531

Dmitry



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-06 16:35 Hit eassert introduced in r110971 Dmitry Antipov
@ 2013-04-06 18:37 ` Eli Zaretskii
  2013-04-06 19:16   ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2013-04-06 18:37 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: monnier, emacs-devel

> Date: Sat, 06 Apr 2013 20:35:10 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>
> 
> Found 100% method to hit eassert introduced in r110971 within update_tool_bar:
> 
> 1) ./src/emacs -nw -Q
> 2) M-x make-frame-on-display :0
> 3) Move mouse to new X frame and left-click;
> 4) Move mouse back to TTY frame and left-click;
> 5) Press C-g staying in TTY frame ==>
> 
> #0  0x0000003daf40eedb in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:41
> #1  0x00000000005a1cf2 in terminate_due_to_signal (sig=6, backtrace_limit=2147483647)
>      at src/emacs.c:343
> #2  0x000000000065d92d in die (msg=0x79db98 "assertion failed: EQ (selected_window, XFRAME (selected_frame)->selected_window)", file=
>      0x79b560 "src/xdisp.c", line=11427) at src/alloc.c:6522
> #3  0x000000000044c6b5 in update_tool_bar (f=f@entry=0x14a29d8, save_match_data=save_match_data@entry=0)
>      at src/xdisp.c:11424

Which frame is the selected frame here: the X frame or the TTY frame?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-06 18:37 ` Eli Zaretskii
@ 2013-04-06 19:16   ` Eli Zaretskii
  2013-04-07  0:36     ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2013-04-06 19:16 UTC (permalink / raw)
  To: dmantipov, monnier; +Cc: emacs-devel

> Date: Sat, 06 Apr 2013 21:37:44 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org
> 
> > Date: Sat, 06 Apr 2013 20:35:10 +0400
> > From: Dmitry Antipov <dmantipov@yandex.ru>
> > Cc: Stefan Monnier <monnier@IRO.UMontreal.CA>
> > 
> > Found 100% method to hit eassert introduced in r110971 within update_tool_bar:
> > 
> > 1) ./src/emacs -nw -Q
> > 2) M-x make-frame-on-display :0
> > 3) Move mouse to new X frame and left-click;
> > 4) Move mouse back to TTY frame and left-click;
> > 5) Press C-g staying in TTY frame ==>
> > 
> > #0  0x0000003daf40eedb in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:41
> > #1  0x00000000005a1cf2 in terminate_due_to_signal (sig=6, backtrace_limit=2147483647)
> >      at src/emacs.c:343
> > #2  0x000000000065d92d in die (msg=0x79db98 "assertion failed: EQ (selected_window, XFRAME (selected_frame)->selected_window)", file=
> >      0x79b560 "src/xdisp.c", line=11427) at src/alloc.c:6522
> > #3  0x000000000044c6b5 in update_tool_bar (f=f@entry=0x14a29d8, save_match_data=save_match_data@entry=0)
> >      at src/xdisp.c:11424
> 
> Which frame is the selected frame here: the X frame or the TTY frame?

And btw, why do we at all care here about the selected window?
AFAICS, none of the code involved ever changes that.

Or, if we do care (maybe some weird code that updates the tool bar can
switch windows?), then simply saving and restoring it would be better
than the assertion.

Stefan, am I missing something?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-06 19:16   ` Eli Zaretskii
@ 2013-04-07  0:36     ` Stefan Monnier
  2013-04-07  2:49       ` Eli Zaretskii
  2013-04-08 15:02       ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2013-04-07  0:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dmantipov, emacs-devel

> And btw, why do we at all care here about the selected window?
> AFAICS, none of the code involved ever changes that.

As the comment indicates, this code needs to temporarily change the
selected frame, and hence the selected window.

> Or, if we do care (maybe some weird code that updates the tool bar can
> switch windows?), then simply saving and restoring it would be better
> than the assertion.

> Stefan, am I missing something?

AFAIK, if this assertion fails, it means we have a problem somewhere.
Not necessarily in update_tool_bar, but somewhere.  OTOH it is a problem
that will very rarely cause real trouble once you deactivate
the assertion.  So what we need to do is to add similar assertions
elsewhere to work our way up to the root of the problem.


        Stefan



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-07  0:36     ` Stefan Monnier
@ 2013-04-07  2:49       ` Eli Zaretskii
  2013-04-07 13:50         ` Stefan Monnier
  2013-04-08 15:02       ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2013-04-07  2:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: dmantipov, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: dmantipov@yandex.ru,  emacs-devel@gnu.org
> Date: Sat, 06 Apr 2013 20:36:35 -0400
> 
> > And btw, why do we at all care here about the selected window?
> > AFAICS, none of the code involved ever changes that.
> 
> As the comment indicates, this code needs to temporarily change the
> selected frame, and hence the selected window.

But we will immediately change the frame back, and with it the
window.  So I still don't see the problem.

> AFAIK, if this assertion fails, it means we have a problem somewhere.
> Not necessarily in update_tool_bar, but somewhere.

update_tool_bar is in this case called repeatedly for every frame we
have.  For each frame, it needs to make that frame the selected frame,
in order to do its job.  It doesn't care about the selected window,
and neither does its caller (redisplay_internal), because this code is
supposed to loop over all the frames.

So why do you think we have a problem here?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-07  2:49       ` Eli Zaretskii
@ 2013-04-07 13:50         ` Stefan Monnier
  2013-04-07 15:37           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2013-04-07 13:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dmantipov, emacs-devel

> So why do you think we have a problem here?

Because the assertion checks an invariant that should pretty always
be true (there used to be known cases where it's broken, such as in
update_tool_bar, but nowadays I don't know of any remaining such case).


        Stefan



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-07 13:50         ` Stefan Monnier
@ 2013-04-07 15:37           ` Eli Zaretskii
  2013-04-07 17:54             ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2013-04-07 15:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: dmantipov, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: dmantipov@yandex.ru,  emacs-devel@gnu.org
> Date: Sun, 07 Apr 2013 09:50:16 -0400
> 
> > So why do you think we have a problem here?
> 
> Because the assertion checks an invariant that should pretty always
> be true

Not when redisplay marches through all the frames for the purpose of
updating the menus and the tool bars as it goes.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-07 15:37           ` Eli Zaretskii
@ 2013-04-07 17:54             ` Stefan Monnier
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2013-04-07 17:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dmantipov, emacs-devel

>> > So why do you think we have a problem here?
>> Because the assertion checks an invariant that should pretty always
>> be true
> Not when redisplay marches through all the frames for the purpose of
> updating the menus and the tool bars as it goes.

AFAIK the redisplay also preserves this invariant (it used to break it
temporarily, by that also was fixed).


        Stefan



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-07  0:36     ` Stefan Monnier
  2013-04-07  2:49       ` Eli Zaretskii
@ 2013-04-08 15:02       ` Eli Zaretskii
  2013-04-08 17:40         ` Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2013-04-08 15:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: dmantipov, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: dmantipov@yandex.ru,  emacs-devel@gnu.org
> Date: Sat, 06 Apr 2013 20:36:35 -0400
> 
> AFAIK, if this assertion fails, it means we have a problem somewhere.
> Not necessarily in update_tool_bar, but somewhere.  OTOH it is a problem
> that will very rarely cause real trouble once you deactivate
> the assertion.  So what we need to do is to add similar assertions
> elsewhere to work our way up to the root of the problem.

OK, let's investigate this.  But I don't have access to a system that
can open a GUI and a TTY frame from the same Emacs session.  So can
someone please reproduce this assertion violation and tell:

  . which frame is the selected frame at the assertion spot?

  . which code changes the selected frame and/or the selected window
    in the course of the recipe?  (this could be done by setting
    watchpoints on selected_frame and selected_window, for example.)



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Hit eassert introduced in r110971
  2013-04-08 15:02       ` Eli Zaretskii
@ 2013-04-08 17:40         ` Stefan Monnier
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2013-04-08 17:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: dmantipov, emacs-devel

> OK, let's investigate this.

I think I found the culprit.


        Stefan



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-04-08 17:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-06 16:35 Hit eassert introduced in r110971 Dmitry Antipov
2013-04-06 18:37 ` Eli Zaretskii
2013-04-06 19:16   ` Eli Zaretskii
2013-04-07  0:36     ` Stefan Monnier
2013-04-07  2:49       ` Eli Zaretskii
2013-04-07 13:50         ` Stefan Monnier
2013-04-07 15:37           ` Eli Zaretskii
2013-04-07 17:54             ` Stefan Monnier
2013-04-08 15:02       ` Eli Zaretskii
2013-04-08 17:40         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).