[PATCH] [RFC] Use llvm-symbolizer to symbolize LLVM/Clang crash dumps
Ed Maste
emaste at freebsd.org
Wed Oct 8 18:11:25 PDT 2014
/proc/self/exe equivalent for FreeBSD:
```
#include <sys/param.h>
#include <sys/sysctl.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
char buf[MAXPATHLEN];
int error, name[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME };
size_t len = sizeof(buf);
name[3] = getpid();
error = sysctl(name, 4, buf, &len, NULL, 0);
if (error != 0 && errno != ESRCH)
warn("sysctl: kern.proc.pathname: %d", getpid());
if (len == 0)
buf[0] = '\0';
printf("kern.proc.pathname = %s\n", buf);
}
```
I'll clean this up and implement it for `lib/Support/Unix/Path.inc`
http://reviews.llvm.org/D5610
More information about the llvm-commits
mailing list