================
@@ -139,8 +177,53 @@ FileSpec HostInfoPosix::GetDefaultShell() {
return FileSpec("/bin/sh");
}
+FileSpec HostInfoPosix::GetProgramFileSpec() {
+ static FileSpec g_program_filespec;
+
+ if (!g_program_filespec) {
+ char exe_path[PATH_MAX];
+ ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
+ if (len > 0) {
+ exe_path[len] = 0;
+ g_program_filespec.SetFile(exe_path, FileSpec::Style::native);
+ }
+ }
+
+ return g_program_filespec;
+}
----------------
DavidSpickett wrote:
Let's leave this in Linux given that neither FreeBSD or NetBSD needed it until
now.
I tried this on FreeBSD and I think this from the manpage is relevant:
```
This functionality is deprecated. Users are advised to use
libprocstat(3) and kvm(3) instead.
```
I had to mount it manually and this is on an AWS instance so I expect any
default FreeBSD install to be the same.
Once I did, only `/curproc/` worked, not `/self/`.
NetBSD allows `/self/` for Linux compatibility
(https://man.netbsd.org/mount_procfs.8) but I wouldn't be surprised if it also
didn't mount procfs by default.
https://github.com/llvm/llvm-project/pull/119694
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits