From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1979 invoked by alias); 24 May 2011 09:30:56 -0000 Received: (qmail 1961 invoked by uid 22791); 24 May 2011 09:30:55 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-pv0-f175.google.com (HELO mail-pv0-f175.google.com) (74.125.83.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 May 2011 09:30:41 +0000 Received: by pvc30 with SMTP id 30so3103044pvc.20 for ; Tue, 24 May 2011 02:30:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.34.40 with SMTP id w8mr2707145pbi.498.1306229440762; Tue, 24 May 2011 02:30:40 -0700 (PDT) Received: by 10.68.51.166 with HTTP; Tue, 24 May 2011 02:30:40 -0700 (PDT) In-Reply-To: References: Date: Tue, 24 May 2011 11:38:00 -0000 Message-ID: Subject: Re: [Patch, libfortran] PR 48931 Async-signal-safety of backtrace signal handler From: Janne Blomqvist To: FX Cc: gfortran List , gcc-patches@gcc.gnu.org, Steve Kargl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg01705.txt.bz2 On Sun, May 22, 2011 at 23:21, FX wrote: > Dear Janne, > > Sorry I'm a bit late on this, but since async-signal-safe code is so hard= to get right (at least for me), I wanted to help review your new code. It'= s very nice to have this instead of my initial ugly implementation, and I h= ave only spotted on issue: AFAICT, execvp() is not safe to use here; only e= xecle() and execve() are. Ah, good catch! That's a bit of a bummer though, since the nice thing about execvp() is that it searches the path for the executable, so it'll work even if the user has addr2line installed somewhere else than /usr/bin. For execve(), one needs to provide an absolute path. 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(). --=20 Janne Blomqvist