diff options
author | Konstantin Belousov <kostikbel@gmail.com> | 2017-01-18 21:03:51 +0200 |
---|---|---|
committer | Dave Watson <davejwatson@fb.com> | 2017-01-19 10:07:13 -0800 |
commit | 9e97c9b17ae9b6922980465656b14bac5df2ea32 (patch) | |
tree | 1902202ecb657651054842e15654862ad85e0ec8 /src/os-freebsd.c | |
parent | 7885596b9cf8c329e1985ac091140aa4c222f6b2 (diff) | |
download | libunwind-9e97c9b17ae9b6922980465656b14bac5df2ea32.tar.gz |
dwarf: Make binary path calculation os-specific.
/proc/self/exe only works on Linux, move path computation to os-* files
Diffstat (limited to 'src/os-freebsd.c')
-rw-r--r-- | src/os-freebsd.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/os-freebsd.c b/src/os-freebsd.c index 1aa1e078..a96877d9 100644 --- a/src/os-freebsd.c +++ b/src/os-freebsd.c @@ -143,3 +143,24 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, free_mem(buf, len1); return (ret); } + +#ifndef UNW_REMOTE_ONLY + +PROTECTED void +tdep_get_exe_image_path (char *path) +{ + int mib[4], error; + size_t len; + + len = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PATHNAME; + mib[3] = getpid(); + + error = sysctl(mib, 4, path, &len, NULL, 0); + if (error == -1) + path[0] = 0; +} + +#endif |