Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid /proc on BSDs as it may not be mounted #22

Closed
wants to merge 1 commit into from
Closed

Avoid /proc on BSDs as it may not be mounted #22

wants to merge 1 commit into from

Conversation

jbeich
Copy link

@jbeich jbeich commented Dec 31, 2018

Get path to executable via KERN_PROC_PATHNAME on BSDs, where /proc is not mounted by default. Let's implement getexecname() to avoid complicating

libbacktrace/fileline.c

Lines 86 to 114 in 5a99ff7

for (pass = 0; pass < 5; ++pass)
{
int does_not_exist;
switch (pass)
{
case 0:
filename = state->filename;
break;
case 1:
filename = getexecname ();
break;
case 2:
filename = "/proc/self/exe";
break;
case 3:
filename = "/proc/curproc/file";
break;
case 4:
snprintf (buf, sizeof (buf), "/proc/%ld/object/a.out",
(long) getpid ());
filename = buf;
break;
default:
abort ();
}
if (filename == NULL)
continue;

Fixes rust-lang/rust#54434
These changes are in the public domain.

	(fileline_initialize): Prefer local `getexecname' on BSDs.
	* configure.ac: Detect sys/sysctl.h on BSDs.
	* configure: Regenerate.
	* config.h.in: Regenerate.
@ghost
Copy link

ghost commented Jan 27, 2020

@ianlancetaylor Is there any chance to get this merged?

@ianlancetaylor
Copy link
Owner

Thanks. I fixed this in a different way, that seemed cleaner to me. Thanks for sending the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

backtraces have blank lines and <unknown> instead of function names on FreeBSD
2 participants