From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#13864: 24.3.50; emacsclient -t loops when connected to emacs server running in X11 Date: Mon, 25 Mar 2013 12:56:06 +0200 Message-ID: <831ub33fzt.fsf@gnu.org> References: <86y5e4xpd8.fsf@chateau.d.if> <83ehfvt5pp.fsf@gnu.org> <86mwujou60.fsf@chateau.d.if> <83y5e2synt.fsf@gnu.org> <86ip56adz3.fsf@chateau.d.if> <83txoo1mp3.fsf@gnu.org> <868v60743o.fsf@chateau.d.if> <83ppzc1bx9.fsf@gnu.org> <866214m1bh.fsf@chateau.d.if> <838v5z1yx4.fsf@gnu.org> <86mwuf8xrq.fsf@chateau.d.if> <8362131sf1.fsf@gnu.org> <86ip538qb8.fsf@chateau.d.if> <83y5dzz88b.fsf@gnu.org> <868v5y9pb5.fsf@chateau.d.if> <837glhzxvs.fsf@gnu.org> <86sj3zy8ru.fsf@chateau.d.if> <83620t57e1.fsf@gnu.org> <864ng3hae1.fsf@chateau.d.if> <83k3ow376r.fsf@gnu.org> <86li9bde1j.fsf@chateau.d.if> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1364209016 29848 80.91.229.3 (25 Mar 2013 10:56:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Mar 2013 10:56:56 +0000 (UTC) Cc: 13864@debbugs.gnu.org To: ashish.is@lostca.se (Ashish SHUKLA) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 25 11:57:22 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UK55d-0006bk-4O for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Mar 2013 11:57:21 +0100 Original-Received: from localhost ([::1]:49171 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK55F-0000oi-Er for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Mar 2013 06:56:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK55A-0000oS-2Z for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2013 06:56:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UK558-0004er-M5 for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2013 06:56:52 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK558-0004en-Is for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2013 06:56:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UK57G-0001rd-Oh for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2013 06:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Mar 2013 10:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13864 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13864-submit@debbugs.gnu.org id=B13864.13642091007116 (code B ref 13864); Mon, 25 Mar 2013 10:59:02 +0000 Original-Received: (at 13864) by debbugs.gnu.org; 25 Mar 2013 10:58:20 +0000 Original-Received: from localhost ([127.0.0.1]:44308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UK56Z-0001qi-Uf for submit@debbugs.gnu.org; Mon, 25 Mar 2013 06:58:20 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:59016) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UK56W-0001qW-Hm for 13864@debbugs.gnu.org; Mon, 25 Mar 2013 06:58:17 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MK700L00PUI1F00@a-mtaout22.012.net.il> for 13864@debbugs.gnu.org; Mon, 25 Mar 2013 12:56:01 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MK700KGGQD8RV90@a-mtaout22.012.net.il>; Mon, 25 Mar 2013 12:55:57 +0200 (IST) In-reply-to: <86li9bde1j.fsf@chateau.d.if> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72872 Archived-At: > From: ashish.is@lostca.se (Ashish SHUKLA) > Cc: 13864@debbugs.gnu.org > Date: Mon, 25 Mar 2013 14:58:08 +0530 > > > (gdb) break dispnew.c:2623 if vpos == 5 > > s/vpos/row/ I guess Yes, sorry. > Please refer to the attached gdb output with annotations prefixed with '=====> '. OK, the reason for constant redrawing of the emacsclient TTY frame is that Emacs thinks that frame is "garbaged" (i.e. its display is completely outdated and should be redrawn): Hardware watchpoint 6: ((struct glyph_row *) 0x196e500)->enabled_p Old value = 1 New value = 0 clear_glyph_matrix_rows (matrix=0x1825f00, start=5, end=28) at dispnew.c:728 728 for (; start < end; ++start) #0 clear_glyph_matrix_rows (matrix=0x1825f00, start=5, end=28) at dispnew.c:728 #1 0x0000000000417028 in clear_glyph_matrix (matrix=0x1825f00) at dispnew.c:747 #2 0x00000000004175bc in clear_current_matrices (f=0x117ac48) at dispnew.c:795 #3 0x000000000044c348 in clear_garbaged_frames () at xdisp.c:10611 #4 0x0000000000450de9 in redisplay_internal () at xdisp.c:12925 The function clear_garbaged_frames does this: FOR_EACH_FRAME (tail, frame) { struct frame *f = XFRAME (frame); if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f)) <<<<<<<<< { if (f->resized_p) { redraw_frame (f); f->force_flush_display_p = 1; } clear_current_matrices (f); <<<<<<<<<<<<<<<<<<<<<<<<<<< changed_count++; f->garbaged = 0; f->resized_p = 0; } } And the call to clear_current_matrices invalidates the record of what's currently displayed on the TTY frame, and therefore causes constant redrawing of that frame. So the question now is: which code sets the frame's 'garbaged' flag? To find out, do this in GDB: (gdb) tbreak dispnew.c:4861 if vpos == 5 (gdb) c The breakpoint is here: else /* Make sure we are in the right row, otherwise cursor movement with cmgoto might use `ch' in the wrong row. */ cursor_to (f, vpos, 0); make_current (desired_matrix, current_matrix, vpos); <<<<<<<<<<<<<<<< return; } Note that the breakpoint is temporary ("tbreak"), so it will only break once. This is to avoid hitting it again, after you set the watchpoint below, because we only need this breakpoint to find out the address of the TTY frame structure, whose 'garbaged' flag we want to watch. When this breakpoint breaks, type these commands: (gdb) p f $1 = (struct frame *) 0x12345678 (gdb) watch ((struct frame *) 0x12345678)->garbaged (gdb) commands > if ((struct frame *) 0x12345678)->garbaged == 1 > bt > end > continue (gdb) Again, the value of f will be different in your case; use whatever GDB shows in your case for the following 'watch' command. Now do whatever is needed to cause Emacs flicker, and the backtrace from the watchpoint should show who sets the garbaged flag of the TTY frame. Thanks.