On Wed, Nov 7, 2012 at 5:50 AM, Rainer Orth <r...@cebitec.uni-bielefeld.de> 
wrote:
> Gerald Pfeifer <ger...@pfeifer.com> writes:
>
>> Just a small note, in the following
>>
>>   +#ifdef __FreeBSD__
>>   +# define DEFAULT_PROCESS_FILENAME "/proc/curproc/file"
>>   +#elif defined(HAVE_GETEXECNAME)
>>   +# define DEFAULT_PROCESS_FILENAME getexecname ()
>>   +#else
>>   +# define DEFAULT_PROCESS_FILENAME "/proc/self/exe"
>>   +#endif
>>
>> would it make sense to have the feature test (HAVE_GETEXECNAME) before
>> the OS test (__FreeBSD__), so that when/if the OS implements the feature
>> in newer versions that takes precedence?
>
> Good point.  I've incorporated this into my patch and regularly include
> it in my *-*-solaris2.{9, 10, 11} and x86_64-unknown-linux-gnu
> bootstraps.

Sorry for the delay on this.  I wanted to do it in a different way
that I think is more flexible and avoids #ifdef __FreeBSD__.  This
patch tries different approaches to find the executable.  It also ha a
chance of working if, e.g., the executable was removed.  Bootstrapped
and ran libbacktrace and Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.  Please let me know if this doesn't fix the
problems on Solaris and FreeBSD.

Thanks for the earlier patches.

Ian


2012-11-12  Ian Lance Taylor  <i...@google.com>
            Rainer Orth  <r...@cebitec.uni-bielefeld.de>
            Gerald Pfeifer  <ger...@pfeifer.com>

        * configure.ac: Check for getexecname.
        * fileline.c: #include <errno.h>.  Define getexecname if not
        available.
        (fileline_initialize): Try to find the executable in a few
        different ways.
        * print.c (error_callback): Only print the filename if it came
        from the backtrace state.
        * configure, config.h.in: Rebuild.

Attachment: foo.patch
Description: Binary data

Reply via email to