all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: lekktu@gmail.com, Paul Eggert <eggert@cs.ucla.edu>,
	monnier@IRO.UMontreal.CA, emacs-devel@gnu.org
Subject: Re: C backtraces for Emacs
Date: Wed, 22 Aug 2012 17:40:08 -0700	[thread overview]
Message-ID: <50357BE8.8040302@dancol.org> (raw)
In-Reply-To: <83628ac3vd.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2274 bytes --]

On 8/22/2012 9:01 AM, Eli Zaretskii wrote:
>> Date: Wed, 22 Aug 2012 02:24:31 -0700
>> From: Paul Eggert <eggert@cs.ucla.edu>
>> Cc: Juanma Barranquero <lekktu@gmail.com>, Eli Zaretskii <eliz@gnu.org>,
>> 	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 <execinfo.h> on non-GNUish systems,
>> and the Windows build will need to do something similar.  If I understand
>> things correctly Windows already does backtraces in a different way, so
>> its execinfo.h can just be a copy of execinfo.in.h.
> 
> 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 stack
trace. Using the StackWalk64 function is recommended over writing your own
function because of all the complexities associated with stack walking on
platforms. In addition, there are compiler options that cause the stack to
appear differently, depending on how the module is compiled. By using this
function, your application has a portable stack trace that continues to work as
the compiler and operating system change."

Despite its name, StackWalk64 works on 32-bit platforms too. Windows actually
has very good support for this kind of thing.

By the way: when we assert, we should kill Emacs using RaiseFailFastException.
This function produces a nice WER (Windows Error Reporting) dialog and bypasses
a lot of layers of exception handling machinery that would ordinarily run in
userspace --- that is, with RaiseFailFastException, fewer things can go wrong.
abort() under Windows actually tried to run global destructors, send messages to
loaded DLLs about pending process termination, and a bunch of other things. RFFE
is much more reliable. On systems without RFFE, plain old RaiseException is fine
too, and RaiseException is present on all supported Windows versions.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  parent reply	other threads:[~2012-08-23  0:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17 23:48 inlinable functions instead of macros Stefan Monnier
2012-08-17 23:59 ` Paul Eggert
2012-08-18 22:15   ` Daniel Colascione
2012-08-18 22:55     ` John Yates
2012-08-19  4:22       ` Richard Stallman
2012-08-21 17:50   ` Stefan Monnier
2012-08-22  9:24     ` C backtraces for Emacs Paul Eggert
2012-08-22 16:01       ` Eli Zaretskii
2012-08-22 16:39         ` Paul Eggert
2012-08-23  0:40         ` Daniel Colascione [this message]
2012-08-23 16:55           ` Eli Zaretskii
2012-08-24 10:48       ` Paul Eggert
2012-08-25  4:41         ` Paul Eggert
2012-08-25  5:57           ` Eli Zaretskii
2012-08-22  9:28     ` inlinable functions instead of macros Paul Eggert
2012-08-22  9:48       ` Andreas Schwab
2012-08-22 14:31       ` Stefan Monnier
2012-08-24 21:37         ` Paul Eggert
2012-08-25  1:38           ` Tom Tromey
2012-08-25  2:58             ` Paul Eggert
2012-08-25  5:35               ` Eli Zaretskii
2012-08-25 20:13                 ` Tom Tromey
2012-08-26  4:42                   ` Paul Eggert
2012-08-25  2:05           ` Stefan Monnier
2012-08-26  5:31             ` Paul Eggert
2012-08-22 16:03       ` Eli Zaretskii
2012-08-18 19:08 ` Richard Stallman
2012-08-18 20:57   ` Paul Eggert
2012-08-18 21:03     ` Eli Zaretskii
2012-08-18 21:31       ` Paul Eggert
2012-08-19  2:45         ` Eli Zaretskii
2012-08-18 21:14   ` Óscar Fuentes
2012-08-19 17:28 ` Florian Weimer
2012-08-20 20:38 ` Sam Steingold

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

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

  git send-email \
    --in-reply-to=50357BE8.8040302@dancol.org \
    --to=dancol@dancol.org \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=monnier@IRO.UMontreal.CA \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.