From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: C backtraces for Emacs Date: Wed, 22 Aug 2012 17:40:08 -0700 Message-ID: <50357BE8.8040302@dancol.org> References: <502EDAF3.6030005@cs.ucla.edu> <5034A54F.6020006@cs.ucla.edu> <83628ac3vd.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCD2E1CD126FB6FECDA15C24B" X-Trace: ger.gmane.org 1345682453 14150 80.91.229.3 (23 Aug 2012 00:40:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Aug 2012 00:40:53 +0000 (UTC) Cc: lekktu@gmail.com, Paul Eggert , monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 23 02:40:52 2012 Return-path: Envelope-to: ged-emacs-devel@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 1T4LTc-0002uJ-VL for ged-emacs-devel@m.gmane.org; Thu, 23 Aug 2012 02:40:49 +0200 Original-Received: from localhost ([::1]:33940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4LTb-00005a-Cc for ged-emacs-devel@m.gmane.org; Wed, 22 Aug 2012 20:40:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4LTW-00005U-SK for emacs-devel@gnu.org; Wed, 22 Aug 2012 20:40:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4LTV-0000ox-Oo for emacs-devel@gnu.org; Wed, 22 Aug 2012 20:40:42 -0400 Original-Received: from dancol.org ([96.126.100.184]:57938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4LTT-0000n2-Ce; Wed, 22 Aug 2012 20:40:39 -0400 Original-Received: from c-76-22-66-162.hsd1.wa.comcast.net ([76.22.66.162] helo=[0.0.0.0]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1T4LTR-0008KG-2g; Wed, 22 Aug 2012 17:40:37 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: <83628ac3vd.fsf@gnu.org> X-Enigmail-Version: 1.4.2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 96.126.100.184 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152759 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCD2E1CD126FB6FECDA15C24B Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 8/22/2012 9:01 AM, Eli Zaretskii wrote: >> Date: Wed, 22 Aug 2012 02:24:31 -0700 >> From: Paul Eggert >> Cc: Juanma Barranquero , Eli Zaretskii , >> emacs-devel@gnu.org >> >> I'll hold off installing this to give Eli and Juanma a heads-up, as it= >> creates a new substitute header on non-GNUish systems, >> and the Windows build will need to do something similar. If I underst= and >> things correctly Windows already does backtraces in a different way, s= o >> its execinfo.h can just be a copy of execinfo.in.h. >=20 > I'm not sure what you mean. An assertion violation on Windows calls a > function that displays an abort dialogue, giving the user a chance to > attach a debugger. If the user does attach a debugger, she can then > display a backtrace from the debugger. There's no other facility to > display a backtrace on Windows that I'm aware of. You can use the StackWalk64 function from dbghelp.dll. "The StackWalk64 function provides a portable method for obtaining a stac= k trace. Using the StackWalk64 function is recommended over writing your ow= n function because of all the complexities associated with stack walking on= platforms. In addition, there are compiler options that cause the stack t= o appear differently, depending on how the module is compiled. By using thi= s function, your application has a portable stack trace that continues to w= ork as the compiler and operating system change." Despite its name, StackWalk64 works on 32-bit platforms too. Windows actu= ally has very good support for this kind of thing. By the way: when we assert, we should kill Emacs using RaiseFailFastExcep= tion. This function produces a nice WER (Windows Error Reporting) dialog and by= passes a lot of layers of exception handling machinery that would ordinarily run= in userspace --- that is, with RaiseFailFastException, fewer things can go w= rong. abort() under Windows actually tried to run global destructors, send mess= ages to loaded DLLs about pending process termination, and a bunch of other thing= s. RFFE is much more reliable. On systems without RFFE, plain old RaiseException = is fine too, and RaiseException is present on all supported Windows versions. --------------enigCD2E1CD126FB6FECDA15C24B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlA1e+4ACgkQ17c2LVA10VtUjwCaAnvOcE+3f5N6/fT09KQIPPRD kZQAn0Tt0HogB6B8soxjmkWleTscAQWa =Zmjs -----END PGP SIGNATURE----- --------------enigCD2E1CD126FB6FECDA15C24B--