[Lldb-commits] [lldb] [lldb][Linux] Moving APIs from HostInfoLinux to HostInfoPosix (PR #119694)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 16 03:43:27 PST 2024
================
@@ -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:
Probably best just to make an exact copy of the code for AIX, instead of making yet another class. If it's literally the same code then it's easy to find later if we really care about it.
https://github.com/llvm/llvm-project/pull/119694
More information about the lldb-commits
mailing list