From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Post-mortem debugging and abort Date: Fri, 13 Jun 2008 21:48:54 +0200 Message-ID: <85wsktp13t.fsf@lola.goethe.zz> References: <86od65gyyr.fsf@lola.quinscape.zz> <8663sdgu1p.fsf@lola.quinscape.zz> <4852AA77.5050305@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213386572 5202 80.91.229.12 (13 Jun 2008 19:49:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Jun 2008 19:49:32 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: "Lennart Borgman \(gmail\)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 13 21:50:14 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K7FHi-0000DM-Pd for ged-emacs-devel@m.gmane.org; Fri, 13 Jun 2008 21:50:07 +0200 Original-Received: from localhost ([127.0.0.1]:58768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7FGt-0000ZL-SV for ged-emacs-devel@m.gmane.org; Fri, 13 Jun 2008 15:49:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7FGo-0000Wj-5i for emacs-devel@gnu.org; Fri, 13 Jun 2008 15:49:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7FGl-0000UN-BE for emacs-devel@gnu.org; Fri, 13 Jun 2008 15:49:08 -0400 Original-Received: from [199.232.76.173] (port=43417 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7FGl-0000U8-5H for emacs-devel@gnu.org; Fri, 13 Jun 2008 15:49:07 -0400 Original-Received: from mail-in-06.arcor-online.net ([151.189.21.46]:52650) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K7FGd-0008JO-Qh; Fri, 13 Jun 2008 15:49:00 -0400 Original-Received: from mail-in-14-z2.arcor-online.net (mail-in-14-z2.arcor-online.net [151.189.8.31]) by mail-in-06.arcor-online.net (Postfix) with ESMTP id 29ECF31E847; Fri, 13 Jun 2008 21:48:56 +0200 (CEST) Original-Received: from mail-in-03.arcor-online.net (mail-in-03.arcor-online.net [151.189.21.43]) by mail-in-14-z2.arcor-online.net (Postfix) with ESMTP id 19E59100F6; Fri, 13 Jun 2008 21:48:56 +0200 (CEST) Original-Received: from lola.goethe.zz (dslb-084-061-073-040.pools.arcor-ip.net [84.61.73.40]) by mail-in-03.arcor-online.net (Postfix) with ESMTP id E09DC3425E1; Fri, 13 Jun 2008 21:48:55 +0200 (CEST) Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 04B1B1C39583; Fri, 13 Jun 2008 21:48:54 +0200 (CEST) In-Reply-To: <4852AA77.5050305@gmail.com> (Lennart Borgman's message of "Fri, 13 Jun 2008 19:12:23 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-Virus-Scanned: ClamAV 0.93/7407/Mon Jun 9 04:21:00 2008 on mail-in-03.arcor-online.net X-Virus-Status: Clean X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:99140 Archived-At: "Lennart Borgman (gmail)" writes: > David Kastrup wrote: >> Eli Zaretskii writes: >> >>>> From: David Kastrup >>>> Date: Fri, 13 Jun 2008 17:02:20 +0200 >>>> >>>> >>>> I just wanted to report that the declaration of "abort" in glibc is not >>>> going to be changed to be more compatible with debugging. >>>> >>>> shows my >>>> report and its resolution. >>> Sigh. I concluded a long time ago that it is useless to ask GCC and >>> glibc developers to cater to debugging needs. At best, you are >>> ignored; but more often you are flamed back into silence. >> >> I was a bit amused about "stop keeping to reopen". I reopened once, >> giving detailed reasons and citing additional manpage data. When the >> thing was basically closed without looking at the argument after a month >> of silence. So it could not have been all that painful. >> >>> I'm sorry that you, David, wasted your effort as well on this. > > The discussion of the bug looked like a very difficult thing ;-) > > I do not understand the details, but the only thing that looked like a > response at all was that UD said there was a workaround, "just add gcc > flag". Just from the non-friendly tone I would expect this to be a > half lie - half true. > > What did he mean and why does it not work as you would like it to? He means that if you want to have useful post-mortem debugging (namely, seeing where an assertion went wrong or abort() had been called), you need to add -fno-crossjumping to the compiler flags. I found this out the hard way, by searching for days at the wrong place in Emacs sources. Naturally, there is no information whatsoever in the gcc or glibc docs about the importance of this flag for getting usable tracebacks. There have been at least two occasions where other Emacs developers have also spent days of debugging in the wrong place because of this. I wrote down in the file etc/DEBUG in Emacs that one should use this flag when trying to track down the cause of failed assertions. But of course, people tend not to read such things before being written, and of course, failed assertions and calls of abort are not exactly specific to Emacs. When you don't use the flag, there will tend to be just a single call to abort compiled into the code and everybody jumps to that call without bothering to clean up the stack or bothering what happens after the call. So at the time the debugger gets to see the stack frame, the information which abort call in the source code is responsible is lost, and the stack frame and data on it can only be usefully interpreted when this information is not lost. Basically, this will bite you whenever you debug failed assertions and have not used -O0 for compiling. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum