unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Eli Zaretskii'" <eliz@gnu.org>
Cc: michael_heerdegen@web.de, 8789@debbugs.gnu.org
Subject: bug#8789: 23.3; debug backtrace buffer changes window on step-through
Date: Thu, 20 Sep 2012 13:59:06 -0700	[thread overview]
Message-ID: <9858A6718B624C2798943F59CEDFB74E@us.oracle.com> (raw)
In-Reply-To: <83zk4kxw9o.fsf@gnu.org>

> One such solution already exists: set inhibit-eval-during-redisplay to
> a non-nil value (it will inhibit _all_ calls to Lisp by all display
> features, though).  I'm not sure how visible is that feature.  Perhaps
> we need to advertise it more.

More than what? ;-)  I never heard of it.  And it does not appear to be
documented in the Elisp manual.

But how about an option that does that only for eval when the debugger is
active?  IOW, that sounds like something that is a broader brush than what is
needed here.

> This is a potential problem with any code, C or Lisp, that runs during
> each redisplay cycle.  On the C level, the only sane way of dealing
> with this is to use conditional breakpoints with cleverly designed
> conditions that cause the breakpoints break only when the function
> being debugged is called in the right context, bypassing the myriads
> of irrelevant calls.
> 
> > I would say that it is indeed unfortunate if we are now 
> > calling `file-remote-p' as part of displaying the mode line.
> 
> Surely, there's nothing special in 'file-remote-p', except the fact
> that you needed to debug it in this case.

No, of course there is nothing special about it.  The point is that it is a
commonly called function, and now it is also called to display the mode line.
That is a powder-keg combination.  That is the problem.  It is asking for
trouble to call such a function as part of the mode-line display.

> Any code that is eval'ed as
> part of displaying the mode line, or redisplay in general, will be
> susceptible to similar problems.

Precisely.

> A solution specific to a single function won't do, would it?

It would do for this particular bug. ;-)  But yes, the same principle and
potential problem applies to all functions called during display of the mode
line (or other redisplay stuff).

> > > > This is a regression, and should just be fixed.
> > > 
> > > How do you "fix"  situation where a function you want to debug is
> > > called at a very high frequency?
> > 
> > It should not be called for mode-line display.  IMHO.  That 
> > was a misguided enhancement.
> 
> I disagree.  That indication is important when you work with remote
> files a lot.

No one said it was not useful.  In fact, I explicitly said it was.

> And again, this particular function is not the issue;
> the issue is more general.

Yes and no.  Agreed that there is a general problem.  But let's not let the
perfect become the enemy of the good.

This particular regression was introduced because `file-remote-p' is now called
to update the mode line.  Take care of that bug and you take care of that bug
;-), which is already a good thing.

> > Perhaps the debugger could do that automatically.
> 
> Not unconditionally, because it is perfectly valid to debug code that
> runs off redisplay.

Agreed.  That's why I mentioned doing so optionally (and probably by default, to
lessen surprise).

> > Whether it should or not, and whether that should be a user option,
> > I also don't know.  But we should not expect users to dig in and
> > discover this stuff and work around it on an individual basis.
> 
> Even if we have an option (please see if inhibit-eval-during-redisplay
> suits your needs), using it already requires to know or suspect that
> calls from redisplay are the reason for "strange" behavior during
> debugging.  So I'm not sure I see how any such option will solve the
> problem of discoverability; again, ideas welcome.

Make it not only optional, but the default behavior for the debugger.  No, I do
not mean `inhibit-eval-during-redisplay', which paints with a broader brush.  I
mean an option to have the debugger skip over/through calls involving redisplay.

But you ignored the simple solution I proposed: just make the mode-line code
call a separate function from `file-remote-p'.  That function can do the same
thing, and it could even have exactly the same definition.  But it would be
called out as being something that is intended to be called only by the
mode-line code.  IOW, try to keep this separate and make that intention
explicit.

It seems to me that that would go a long way - maybe all the way - to preventing
typical debugging from falling down the hole that this discussion is about. 






  reply	other threads:[~2012-09-20 20:59 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 17:07 bug#8789: 23.3; debug backtrace buffer changes window on step-through Pete Beardmore
2011-06-02 18:00 ` Drew Adams
2011-06-03 13:19 ` martin rudalics
2011-06-08 15:29   ` Stefan Monnier
2012-02-09  5:31     ` Michael Heerdegen
2012-02-09 18:21       ` Stefan Monnier
2012-02-11  0:04         ` Michael Heerdegen
2012-02-15 17:00         ` martin rudalics
2012-02-15 19:05           ` Stefan Monnier
2012-02-16  8:03             ` martin rudalics
2012-02-16 13:52               ` Stefan Monnier
2012-02-16 17:50                 ` martin rudalics
2012-02-16 21:53                   ` Michael Heerdegen
2012-02-17  9:58                     ` martin rudalics
2012-02-24 18:42                     ` martin rudalics
2012-02-28 23:56                       ` Michael Heerdegen
2012-02-29  8:47                         ` martin rudalics
2012-03-03 19:48                           ` Michael Heerdegen
2012-09-08 13:33                     ` martin rudalics
2012-09-12 14:20                       ` Michael Heerdegen
2012-09-12 15:50                         ` martin rudalics
2012-10-19  7:53                           ` Michael Heerdegen
2012-10-19 10:02                             ` martin rudalics
2012-09-17 20:34                         ` Drew Adams
2012-09-17 22:30                           ` martin rudalics
2012-09-17 22:46                             ` Drew Adams
2012-09-18  7:10                               ` martin rudalics
2012-09-18 14:28                                 ` Drew Adams
2012-09-19 16:46                                   ` Drew Adams
2012-09-19 17:10                                     ` martin rudalics
2012-09-19 17:48                                       ` Drew Adams
2012-09-19 20:39                                         ` Drew Adams
2012-09-19 20:55                                           ` Drew Adams
2012-09-20 13:50                                             ` martin rudalics
2012-09-20 18:22                                               ` Drew Adams
2012-09-20 13:50                                           ` martin rudalics
2012-09-20 17:10                                             ` Michael Heerdegen
2012-09-20 17:26                                               ` martin rudalics
2012-09-20 18:08                                                 ` Drew Adams
2012-09-20 18:30                                                   ` Eli Zaretskii
2012-09-20 18:49                                                     ` Drew Adams
2012-09-20 20:41                                                       ` Eli Zaretskii
2012-09-20 20:59                                                         ` Drew Adams [this message]
2012-09-20 22:15                                                           ` Stefan Monnier
2012-09-20 20:17                                                     ` Michael Heerdegen
2012-09-20 20:34                                                       ` Drew Adams
2012-09-20 20:52                                                         ` Eli Zaretskii
2012-09-20 21:11                                                           ` Drew Adams
2012-09-20 21:25                                                         ` Michael Heerdegen
2012-09-20 21:33                                                           ` Drew Adams
2012-09-20 22:01                                                             ` Michael Heerdegen
2012-09-20 23:16                                                               ` Drew Adams
2012-09-19 17:17                                     ` Drew Adams
2012-10-03  9:13                       ` martin rudalics
2012-10-03 16:09                         ` Drew Adams
2012-03-11 18:14           ` martin rudalics
2012-02-09 18:24       ` martin rudalics
2012-02-11  0:00         ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9858A6718B624C2798943F59CEDFB74E@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=8789@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).