summaryrefslogtreecommitdiff
path: root/addr2line.c
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2021-02-02 13:05:19 +0000
committerGitHub <noreply@github.com>2021-02-02 22:05:19 +0900
commit739f9297c562a387aa012bad781ac2f07f434c1e (patch)
tree8181282f8f64ea423ee29b9ef8050cf6048f69b0 /addr2line.c
parentbe1486568abac364c12e36d8dc49018ba8918c73 (diff)
NetBSD build update. (#4079)
Notes
Notes: Merged-By: nurse <naruse@airemix.jp>
Diffstat (limited to 'addr2line.c')
-rw-r--r--addr2line.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/addr2line.c b/addr2line.c
index dc4364aaf5..9669427d36 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -2101,11 +2101,15 @@ fail:
* and returns strlen(binary_filename).
* it is NUL terminated.
*/
-#if defined(__linux__)
+#if defined(__linux__) || defined(__NetBSD__)
static ssize_t
main_exe_path(void)
{
-# define PROC_SELF_EXE "/proc/self/exe"
+# if defined(__linux__)
+# define PROC_SELF_EXE "/proc/self/exe"
+# elif defined(__NetBSD__)
+# define PROC_SELF_EXE "/proc/curproc/exe"
+# endif
ssize_t len = readlink(PROC_SELF_EXE, binary_filename, PATH_MAX);
if (len < 0) return 0;
binary_filename[len] = 0;