public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "N.M. Maclaren" <nmm1@cam.ac.uk>
To: gfortran List <fortran@gcc.gnu.org>, gcc-patches@gcc.gnu.org
Subject: Re: [Patch, libfortran] PR 48931 Async-signal-safety of backtrace signal handler
Date: Tue, 24 May 2011 13:19:00 -0000	[thread overview]
Message-ID: <Prayer.1.3.3.1105241237510.11552@hermes-2.csi.cam.ac.uk> (raw)
In-Reply-To: <2FD97A4D-2A6B-4DDB-888E-E32F9B93424B@gmail.com>

On May 24 2011, FX wrote:
>
>> One solution could be to search the PATH for addr2line during library
>> initialization (where we don't need to be async-signal-safe), and then
>> store it somewhere and use it in show_backtrace().
>
> That's one way. Another way is just to store a copy of the PATH during 
> initialization, and only search addr2line when really needed (which can 
> be done with a static buffer and a series of call to execve(), can't it?)

Well, yes, but it is better design to do as little as possible in such
handlers.  No matter what POSIX says, calling fork or exec is intrinsically
problematic - for example, ANY signal (including SIGCONT!) can cause
chaos if it is received in such circumstances, and the actual rules for
which processes get which signals are foul beyond belief, even when the
term 'rules' makes sense :-(

That favours Janne's approach.

Regards,
Nick Maclaren.

  reply	other threads:[~2011-05-24 11:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-22 21:50 FX
2011-05-24 11:38 ` Janne Blomqvist
2011-05-24 11:42   ` FX
2011-05-24 13:19     ` N.M. Maclaren [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-15 11:13 Janne Blomqvist
2011-05-15 17:43 ` Janne Blomqvist
2011-05-15 20:46   ` Janne Blomqvist
2011-05-20 16:15     ` Janne Blomqvist
2011-05-21 22:01     ` Steve Kargl
2011-05-18  1:11 ` Toon Moene
2011-05-18  6:03   ` Toon Moene

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=Prayer.1.3.3.1105241237510.11552@hermes-2.csi.cam.ac.uk \
    --to=nmm1@cam.ac.uk \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.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.
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).