This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libbacktrace] Use getexecname() on Solaris

On Wed, Nov 7, 2012 at 5:50 AM, Rainer Orth <> wrote:
> Gerald Pfeifer <> 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.


2012-11-12  Ian Lance Taylor  <>
	    Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
	    Gerald Pfeifer  <>

	* Check for getexecname.
	* fileline.c: #include <errno.h>.  Define getexecname if not
	(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, Rebuild.

Attachment: foo.patch
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]