unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: rms@gnu.org
Cc: cyd@stupidchicken.com, jan.h.d@swipnet.se, emacs-devel@gnu.org
Subject: Re: crash: x_error_quitter
Date: Wed, 16 May 2007 08:58:42 +0200	[thread overview]
Message-ID: <86bqglw8yl.fsf@lola.quinscape.zz> (raw)
In-Reply-To: <E1Ho8U5-0001N4-2M@fencepost.gnu.org> (Richard Stallman's message of "Tue\, 15 May 2007 21\:39\:21 -0400")

Richard Stallman <rms@gnu.org> writes:

>     >       Which means that the traceback is likely completely
>     >     wrong, and local variables, in particular those that have been stored
>     >     in registers, are also completely unusable.
>     >
>     > I think that is incorrect.  The frames on the stack give all the
>     > necessary information, once (x-synchronize t) has been used.
>
>     It would be helpful if you actually quoted the _relevant_ parts of
>     what you are commenting on.
>
> I think did so.
>
>     x_connection_closed is declared NO_RETURN, so gcc will not bother
>     about leaving the stack in a recognizable state when calling it.
>     Whether or not that affects the calls of x_error_quitter may depend on
>     whether gcc consequently figures out it being NO_RETURN, too.  With
>     gcc's current optimization strategies, that is quite plausible.
>
> The crucial information for debugging this problem is which X
> library functions were called, and their arguments, and where the
> call came from.  I don't think that calling a NO_RETURN subroutine
> will spoil outer-level stack frames like this.  I think they will be
> visible.

The stack frames will usually not get affected.  But the return
address might be completely wrong, and that will affect gdb's idea of
what function the stack frame belongs to, and what variables are
stored in what registers at that point of time.

That's because gcc will, instead of calling a NO_RETURN function, just
jump to an arbitrary point elsewhere where it is called.  So at least
the information about the immediate caller of a NO_RETURN function
(one that gcc knows as being NO_RETURN, not necessarily one explictly
declared as such) is not fit for debugging.

Personally, I think the tradeoff of saving a few bytes for being able
to use a (potentially conditional) short jump instead of a call is not
worth the cost in savings unless one specified an option
--fsavememory=lethallyaggressive or so, but one would have to bring
this issue up with the gcc developers.

> But if there is a problem, then we should get rid of NO_RETURN for
> this function, because there is no point in optimizing it.

I think that if we are compiling with -g, we should also enable the
-fno-crossjumping option.  Drawback is that this will cause slightly
different code to be produced.  Advantage is that it makes actually
usable stack frames for post-mortem analysis much more likely.

-- 
David Kastrup

  reply	other threads:[~2007-05-16  6:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-10 18:05 crash: x_error_quitter sds
2007-05-11 18:48 ` Richard Stallman
2007-05-11 18:56   ` Sam Steingold
2007-05-12 16:47     ` Richard Stallman
2007-05-11 20:02 ` Chong Yidong
2007-05-12  6:51   ` Jan Djärv
2007-05-12 16:47   ` Richard Stallman
2007-05-12 23:31     ` Chong Yidong
2007-05-12 23:36       ` Chong Yidong
2007-05-13 13:29         ` Jan Djärv
2007-05-13 13:41         ` Chong Yidong
2007-05-13 13:00       ` Jan Djärv
2007-05-13 13:52         ` Chong Yidong
2007-05-13 15:33           ` Jan Djärv
2007-05-14  8:09           ` Richard Stallman
2007-05-14  8:40             ` David Kastrup
2007-05-15  9:47               ` Richard Stallman
2007-05-15  9:59                 ` David Kastrup
2007-05-16  1:39                   ` Richard Stallman
2007-05-16  6:58                     ` David Kastrup [this message]
2007-05-16 14:32                       ` Richard Stallman
2007-05-16 18:04                       ` Eli Zaretskii
2007-05-16 21:42                         ` David Kastrup

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=86bqglw8yl.fsf@lola.quinscape.zz \
    --to=dak@gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    --cc=rms@gnu.org \
    /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).