diff options
Diffstat (limited to 'source/Host/linux')
-rw-r--r-- | source/Host/linux/Host.cpp | 20 | ||||
-rw-r--r-- | source/Host/linux/HostInfoLinux.cpp | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/source/Host/linux/Host.cpp b/source/Host/linux/Host.cpp index cb7369fe7aec4..62bf5362de01c 100644 --- a/source/Host/linux/Host.cpp +++ b/source/Host/linux/Host.cpp @@ -8,12 +8,14 @@ //===----------------------------------------------------------------------===// // C Includes -#include <stdio.h> -#include <sys/utsname.h> -#include <sys/types.h> -#include <sys/stat.h> #include <dirent.h> +#include <errno.h> #include <fcntl.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <sys/utsname.h> // C++ Includes // Other libraries and framework includes @@ -291,15 +293,25 @@ GetProcessAndStatInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info, Proce ::memset (&stat_info, 0, sizeof(stat_info)); stat_info.ppid = LLDB_INVALID_PROCESS_ID; + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); + // Use special code here because proc/[pid]/exe is a symbolic link. char link_path[PATH_MAX]; char exe_path[PATH_MAX] = ""; if (snprintf (link_path, PATH_MAX, "/proc/%" PRIu64 "/exe", pid) <= 0) + { + if (log) + log->Printf("%s: failed to sprintf pid %" PRIu64, __FUNCTION__, pid); return false; + } ssize_t len = readlink (link_path, exe_path, sizeof(exe_path) - 1); if (len <= 0) + { + if (log) + log->Printf("%s: failed to read link %s: %s", __FUNCTION__, link_path, strerror(errno)); return false; + } // readlink does not append a null byte. exe_path[len] = 0; diff --git a/source/Host/linux/HostInfoLinux.cpp b/source/Host/linux/HostInfoLinux.cpp index 4732a2a571b66..0d0ba3323d6c5 100644 --- a/source/Host/linux/HostInfoLinux.cpp +++ b/source/Host/linux/HostInfoLinux.cpp @@ -235,7 +235,7 @@ HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec) bool HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec) { - FileSpec temp_file("/usr/lib/lldb", true); + FileSpec temp_file("/usr/lib/lldb/plugins", true); file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str()); return true; } |