<div dir="ltr">Thanks. I think I know why this happened, it was because previously GetLLDBPath() was calling GetDirectory().SetCString(), now it just calls file_spec.SetFile(), which as you mentioned does the directory / filename split. I think the fix is in lldb-gdbserver, to call AppendPathComponent. Can you try that and see if it fixes it?<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 21, 2014 at 4:14 PM, Jason Molenda <span dir="ltr"><<a href="mailto:jmolenda@apple.com" target="_blank">jmolenda@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hm, I'm seeing two problems trying to build the current sources on Mac OS X. Did you mean to have a GetFeectiveUserID method in Host or HostInfo? I needed to do<br>
<br>
Index: source/Host/macosx/Host.mm<br>
===================================================================<br>
--- source/Host/macosx/Host.mm (revision 216236)<br>
+++ source/Host/macosx/Host.mm (working copy)<br>
@@ -1255,7 +1255,7 @@<br>
const char *xpc_service = nil;<br>
bool send_auth = false;<br>
AuthorizationExternalForm extForm;<br>
- if ((requested_uid == UINT32_MAX) || (requested_uid == Host::GetEffectiveUserID()))<br>
+ if ((requested_uid == UINT32_MAX) || (requested_uid == HostInfoMacOSX::GetEffectiveUserID()))<br>
{<br>
xpc_service = "com.apple.lldb.launcherXPCService";<br>
}<br>
@@ -1392,7 +1392,7 @@<br>
<br>
#if !NO_XPC_SERVICES<br>
bool launchingAsRoot = launch_info.GetUserID() == 0;<br>
- bool currentUserIsRoot = Host::GetEffectiveUserID() == 0;<br>
+ bool currentUserIsRoot = HostInfoMacOSX::GetEffectiveUserID() == 0;<br>
<br>
if (launchingAsRoot && !currentUserIsRoot)<br>
{<br>
<br>
to get it to compile.<br>
<br>
A second problem is that I can't attach/launch native processes on Mac OS X, I get<br>
<br>
error: process launch failed: unable to locate debugserver<br>
<br>
Previously, it looks like Host::GetLLDBPath would return a FileSpec with a directory like ".../lldb/build/Debug/LLDB.framework/Resources" and no filename. Then in GDBRemoteCommunication.cpp it sets the filename component -<br>
<br>
// The debugserver binary is in the LLDB.framework/Resources<br>
// directory.<br>
if (HostInfo::GetLLDBPath(ePathTypeSupportExecutableDir, debugserver_file_spec))<br>
{<br>
debugserver_file_spec.GetFilename().SetCString(DEBUGSERVER_BASENAME);<br>
<br>
<br>
But right now the FileSpec returned by HostInfo::GetLLDBPath has a directory of ".../lldb/build/Debug/LLDB.framework/" and a filename of "Resources" - which gets overwritten by that SetCString() method call.<br>
<br>
I'm sure the fix is easy but I wanted to mention it on the list in case other people are also seeing this.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
> On Aug 21, 2014, at 2:49 PM, Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br>
><br>
> Author: zturner<br>
> Date: Thu Aug 21 16:49:24 2014<br>
> New Revision: 216230<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=216230&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=216230&view=rev</a><br>
> Log:<br>
> Move the rest of the HostInfo functions over.<br>
><br>
> This should bring HostInfo up to 99% completion. The remainder<br>
> of code in Host will be split into instantiatable classes<br>
> representing host processes, threads, dynamic libraries, and<br>
> process launching strategies.<br>
><br>
> Modified:<br>
> lldb/trunk/include/lldb/Host/Host.h<br>
> lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h<br>
> lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h<br>
> lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h<br>
> lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h<br>
> lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h<br>
> lldb/trunk/source/API/SBHostOS.cpp<br>
> lldb/trunk/source/Host/common/Host.cpp<br>
> lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp<br>
> lldb/trunk/source/Host/linux/HostInfoLinux.cpp<br>
> lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm<br>
> lldb/trunk/source/Host/posix/HostInfoPosix.cpp<br>
> lldb/trunk/source/Host/windows/Host.cpp<br>
> lldb/trunk/source/Host/windows/HostInfoWindows.cpp<br>
> lldb/trunk/source/Interpreter/CommandInterpreter.cpp<br>
><br>
> Modified: lldb/trunk/include/lldb/Host/Host.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Host/Host.h (original)<br>
> +++ lldb/trunk/include/lldb/Host/Host.h Thu Aug 21 16:49:24 2014<br>
> @@ -91,25 +91,6 @@ public:<br>
> lldb::pid_t pid,<br>
> bool monitor_signals);<br>
><br>
> - static const char *<br>
> - GetUserName (uint32_t uid, std::string &user_name);<br>
> -<br>
> - static const char *<br>
> - GetGroupName (uint32_t gid, std::string &group_name);<br>
> -<br>
> - static uint32_t<br>
> - GetUserID ();<br>
> -<br>
> - static uint32_t<br>
> - GetGroupID ();<br>
> -<br>
> - static uint32_t<br>
> - GetEffectiveUserID ();<br>
> -<br>
> - static uint32_t<br>
> - GetEffectiveGroupID ();<br>
> -<br>
> -<br>
> enum SystemLogType<br>
> {<br>
> eSystemLogWarning,<br>
> @@ -261,27 +242,6 @@ public:<br>
> SetShortThreadName (lldb::pid_t pid, lldb::tid_t tid, const char *name, size_t len);<br>
><br>
> //------------------------------------------------------------------<br>
> - /// Gets the FileSpec of the user profile directory. On Posix-platforms<br>
> - /// this is ~, and on windows this is generally something like<br>
> - /// C:\Users\Alice.<br>
> - ///<br>
> - /// @return<br>
> - /// \b A file spec with the path to the user's home directory.<br>
> - //------------------------------------------------------------------<br>
> - static FileSpec<br>
> - GetUserProfileFileSpec ();<br>
> -<br>
> - //------------------------------------------------------------------<br>
> - /// Gets the FileSpec of the current process (the process that<br>
> - /// that is running the LLDB code).<br>
> - ///<br>
> - /// @return<br>
> - /// \b A file spec with the program name.<br>
> - //------------------------------------------------------------------<br>
> - static FileSpec<br>
> - GetProgramFileSpec ();<br>
> -<br>
> - //------------------------------------------------------------------<br>
> /// Given an address in the current process (the process that<br>
> /// is running the LLDB code), return the name of the module that<br>
> /// it comes from. This can be useful when you need to know the<br>
> @@ -298,8 +258,6 @@ public:<br>
> //------------------------------------------------------------------<br>
> static FileSpec<br>
> GetModuleFileSpecForHostAddress (const void *host_addr);<br>
> -<br>
> -<br>
><br>
> //------------------------------------------------------------------<br>
> /// If you have an executable that is in a bundle and want to get<br>
><br>
> Modified: lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h (original)<br>
> +++ lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h Thu Aug 21 16:49:24 2014<br>
> @@ -10,6 +10,7 @@<br>
> #ifndef lldb_Host_freebsd_HostInfoFreeBSD_h_<br>
> #define lldb_Host_freebsd_HostInfoFreeBSD_h_<br>
><br>
> +#include "lldb/Host/FileSpec.h"<br>
> #include "lldb/Host/posix/HostInfoPosix.h"<br>
><br>
> namespace lldb_private<br>
> @@ -21,6 +22,7 @@ class HostInfoFreeBSD : public HostInfoP<br>
> static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);<br>
> static bool GetOSBuildString(std::string &s);<br>
> static bool GetOSKernelDescription(std::string &s);<br>
> + static FileSpec GetProgramFileSpec();<br>
> };<br>
> }<br>
><br>
><br>
> Modified: lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h (original)<br>
> +++ lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h Thu Aug 21 16:49:24 2014<br>
> @@ -10,7 +10,9 @@<br>
> #ifndef lldb_Host_linux_HostInfoLinux_h_<br>
> #define lldb_Host_linux_HostInfoLinux_h_<br>
><br>
> +#include "lldb/Host/FileSpec.h"<br>
> #include "lldb/Host/posix/HostInfoPosix.h"<br>
> +<br>
> #include "llvm/ADT/StringRef.h"<br>
><br>
> #include <string><br>
> @@ -32,6 +34,7 @@ class HostInfoLinux : public HostInfoPos<br>
><br>
> static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);<br>
> static llvm::StringRef GetDistributionId();<br>
> + static FileSpec GetProgramFileSpec();<br>
><br>
> protected:<br>
> static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);<br>
><br>
> Modified: lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h (original)<br>
> +++ lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h Thu Aug 21 16:49:24 2014<br>
> @@ -10,6 +10,7 @@<br>
> #ifndef lldb_Host_macosx_HostInfoMacOSX_h_<br>
> #define lldb_Host_macosx_HostInfoMacOSX_h_<br>
><br>
> +#include "lldb/Host/FileSpec.h"<br>
> #include "lldb/Host/posix/HostInfoPosix.h"<br>
><br>
> namespace lldb_private<br>
> @@ -30,6 +31,7 @@ class HostInfoMacOSX : public HostInfoPo<br>
> static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);<br>
> static bool GetOSBuildString(std::string &s);<br>
> static bool GetOSKernelDescription(std::string &s);<br>
> + static FileSpec GetProgramFileSpec();<br>
><br>
> protected:<br>
> static bool ComputeSupportExeDirectory(FileSpec &file_spec);<br>
><br>
> Modified: lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h (original)<br>
> +++ lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h Thu Aug 21 16:49:24 2014<br>
> @@ -25,6 +25,11 @@ class HostInfoPosix : public HostInfoBas<br>
> static const char *LookupUserName(uint32_t uid, std::string &user_name);<br>
> static const char *LookupGroupName(uint32_t gid, std::string &group_name);<br>
><br>
> + static uint32_t GetUserID();<br>
> + static uint32_t GetGroupID();<br>
> + static uint32_t GetEffectiveUserID();<br>
> + static uint32_t GetEffectiveGroupID();<br>
> +<br>
> protected:<br>
> static bool ComputeSupportExeDirectory(FileSpec &file_spec);<br>
> static bool ComputeHeaderDirectory(FileSpec &file_spec);<br>
><br>
> Modified: lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h (original)<br>
> +++ lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h Thu Aug 21 16:49:24 2014<br>
> @@ -11,6 +11,7 @@<br>
> #define lldb_Host_windows_HostInfoWindows_h_<br>
><br>
> #include "lldb/Host/HostInfoBase.h"<br>
> +#include "lldb/Host/FileSpec.h"<br>
><br>
> namespace lldb_private<br>
> {<br>
> @@ -31,9 +32,13 @@ class HostInfoWindows : public HostInfoB<br>
> static bool GetOSBuildString(std::string &s);<br>
> static bool GetOSKernelDescription(std::string &s);<br>
> static bool GetHostname(std::string &s);<br>
> + static FileSpec GetProgramFileSpec();<br>
><br>
> protected:<br>
> static bool ComputePythonDirectory(FileSpec &file_spec);<br>
> +<br>
> + private:<br>
> + static FileSpec m_program_filespec;<br>
> };<br>
> }<br>
><br>
><br>
> Modified: lldb/trunk/source/API/SBHostOS.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/API/SBHostOS.cpp (original)<br>
> +++ lldb/trunk/source/API/SBHostOS.cpp Thu Aug 21 16:49:24 2014<br>
> @@ -23,7 +23,7 @@ SBFileSpec<br>
> SBHostOS::GetProgramFileSpec ()<br>
> {<br>
> SBFileSpec sb_filespec;<br>
> - sb_filespec.SetFileSpec (Host::GetProgramFileSpec ());<br>
> + sb_filespec.SetFileSpec(HostInfo::GetProgramFileSpec());<br>
> return sb_filespec;<br>
> }<br>
><br>
><br>
> Modified: lldb/trunk/source/Host/common/Host.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Host/common/Host.cpp (original)<br>
> +++ lldb/trunk/source/Host/common/Host.cpp Thu Aug 21 16:49:24 2014<br>
> @@ -646,68 +646,6 @@ Host::SetShortThreadName (lldb::pid_t pi<br>
><br>
> #endif<br>
><br>
> -FileSpec<br>
> -Host::GetUserProfileFileSpec ()<br>
> -{<br>
> - static FileSpec g_profile_filespec;<br>
> - if (!g_profile_filespec)<br>
> - {<br>
> - llvm::SmallString<64> path;<br>
> - llvm::sys::path::home_directory(path);<br>
> - return FileSpec(path.c_str(), false);<br>
> - }<br>
> - return g_profile_filespec;<br>
> -}<br>
> -<br>
> -FileSpec<br>
> -Host::GetProgramFileSpec ()<br>
> -{<br>
> - static FileSpec g_program_filespec;<br>
> - if (!g_program_filespec)<br>
> - {<br>
> -#if defined (__APPLE__)<br>
> - char program_fullpath[PATH_MAX];<br>
> - // If DST is NULL, then return the number of bytes needed.<br>
> - uint32_t len = sizeof(program_fullpath);<br>
> - int err = _NSGetExecutablePath (program_fullpath, &len);<br>
> - if (err == 0)<br>
> - g_program_filespec.SetFile (program_fullpath, false);<br>
> - else if (err == -1)<br>
> - {<br>
> - char *large_program_fullpath = (char *)::malloc (len + 1);<br>
> -<br>
> - err = _NSGetExecutablePath (large_program_fullpath, &len);<br>
> - if (err == 0)<br>
> - g_program_filespec.SetFile (large_program_fullpath, false);<br>
> -<br>
> - ::free (large_program_fullpath);<br>
> - }<br>
> -#elif defined (__linux__)<br>
> - char exe_path[PATH_MAX];<br>
> - ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);<br>
> - if (len > 0) {<br>
> - exe_path[len] = 0;<br>
> - g_program_filespec.SetFile(exe_path, false);<br>
> - }<br>
> -#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)<br>
> - int exe_path_mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid() };<br>
> - size_t exe_path_size;<br>
> - if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0)<br>
> - {<br>
> - char *exe_path = new char[exe_path_size];<br>
> - if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)<br>
> - g_program_filespec.SetFile(exe_path, false);<br>
> - delete[] exe_path;<br>
> - }<br>
> -#elif defined(_WIN32)<br>
> - std::vector<char> buffer(PATH_MAX);<br>
> - ::GetModuleFileName(NULL, &buffer[0], buffer.size());<br>
> - g_program_filespec.SetFile(&buffer[0], false);<br>
> -#endif<br>
> - }<br>
> - return g_program_filespec;<br>
> -}<br>
> -<br>
> #if !defined (__APPLE__) // see Host.mm<br>
><br>
> bool<br>
> @@ -864,34 +802,6 @@ Host::GetModuleFileSpecForHostAddress (c<br>
> }<br>
><br>
> #endif<br>
> -<br>
> -#ifndef _WIN32<br>
> -<br>
> -uint32_t<br>
> -Host::GetUserID ()<br>
> -{<br>
> - return getuid();<br>
> -}<br>
> -<br>
> -uint32_t<br>
> -Host::GetGroupID ()<br>
> -{<br>
> - return getgid();<br>
> -}<br>
> -<br>
> -uint32_t<br>
> -Host::GetEffectiveUserID ()<br>
> -{<br>
> - return geteuid();<br>
> -}<br>
> -<br>
> -uint32_t<br>
> -Host::GetEffectiveGroupID ()<br>
> -{<br>
> - return getegid();<br>
> -}<br>
> -<br>
> -#endif<br>
><br>
> #if !defined(__linux__)<br>
> bool<br>
><br>
> Modified: lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp (original)<br>
> +++ lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp Thu Aug 21 16:49:24 2014<br>
> @@ -64,3 +64,22 @@ HostInfoFreeBSD::GetOSKernelDescription(<br>
><br>
> return true;<br>
> }<br>
> +<br>
> +FileSpec<br>
> +HostInfoFreeBSD::GetProgramFileSpec()<br>
> +{<br>
> + static FileSpec g_program_filespec;<br>
> + if (!g_program_filespec)<br>
> + {<br>
> + int exe_path_mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid()};<br>
> + size_t exe_path_size;<br>
> + if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0)<br>
> + {<br>
> + char *exe_path = new char[exe_path_size];<br>
> + if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)<br>
> + g_program_filespec.SetFile(exe_path, false);<br>
> + delete[] exe_path;<br>
> + }<br>
> + }<br>
> + return g_program_filespec;<br>
> +}<br>
> \ No newline at end of file<br>
><br>
> Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original)<br>
> +++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Thu Aug 21 16:49:24 2014<br>
> @@ -172,6 +172,25 @@ HostInfoLinux::GetDistributionId()<br>
> return g_fields->m_distribution_id.c_str();<br>
> }<br>
><br>
> +FileSpec<br>
> +HostInfoLinux::GetProgramFileSpec()<br>
> +{<br>
> + static FileSpec g_program_filespec;<br>
> +<br>
> + if (!g_program_filespec)<br>
> + {<br>
> + char exe_path[PATH_MAX];<br>
> + ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);<br>
> + if (len > 0)<br>
> + {<br>
> + exe_path[len] = 0;<br>
> + g_program_filespec.SetFile(exe_path, false);<br>
> + }<br>
> + }<br>
> +<br>
> + return g_program_filespec;<br>
> +}<br>
> +<br>
> bool<br>
> HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec)<br>
> {<br>
><br>
> Modified: lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm (original)<br>
> +++ lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm Thu Aug 21 16:49:24 2014<br>
> @@ -27,6 +27,7 @@<br>
> // Objective C/C++ includes<br>
> #include <CoreFoundation/CoreFoundation.h><br>
> #include <Foundation/Foundation.h><br>
> +#include <mach-o/dyld.h><br>
> #include <objc/objc-auto.h><br>
><br>
> using namespace lldb_private;<br>
> @@ -91,6 +92,32 @@ HostInfoMacOSX::GetOSVersion(uint32_t &m<br>
> return false;<br>
> }<br>
><br>
> +FileSpec<br>
> +HostInfoMacOSX::GetProgramFileSpec()<br>
> +{<br>
> + static FileSpec g_program_filespec;<br>
> + if (!g_program_filespec)<br>
> + {<br>
> + char program_fullpath[PATH_MAX];<br>
> + // If DST is NULL, then return the number of bytes needed.<br>
> + uint32_t len = sizeof(program_fullpath);<br>
> + int err = _NSGetExecutablePath(program_fullpath, &len);<br>
> + if (err == 0)<br>
> + g_program_filespec.SetFile(program_fullpath, false);<br>
> + else if (err == -1)<br>
> + {<br>
> + char *large_program_fullpath = (char *)::malloc(len + 1);<br>
> +<br>
> + err = _NSGetExecutablePath(large_program_fullpath, &len);<br>
> + if (err == 0)<br>
> + g_program_filespec.SetFile(large_program_fullpath, false);<br>
> +<br>
> + ::free(large_program_fullpath);<br>
> + }<br>
> + }<br>
> + return g_program_filespec;<br>
> +}<br>
> +<br>
> bool<br>
> HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec)<br>
> {<br>
><br>
> Modified: lldb/trunk/source/Host/posix/HostInfoPosix.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/HostInfoPosix.cpp?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/HostInfoPosix.cpp?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Host/posix/HostInfoPosix.cpp (original)<br>
> +++ lldb/trunk/source/Host/posix/HostInfoPosix.cpp Thu Aug 21 16:49:24 2014<br>
> @@ -97,6 +97,30 @@ HostInfoPosix::LookupGroupName(uint32_t<br>
> return NULL;<br>
> }<br>
><br>
> +uint32_t<br>
> +HostInfoPosix::GetUserID()<br>
> +{<br>
> + return getuid();<br>
> +}<br>
> +<br>
> +uint32_t<br>
> +HostInfoPosix::GetGroupID()<br>
> +{<br>
> + return getgid();<br>
> +}<br>
> +<br>
> +uint32_t<br>
> +HostInfoPosix::GetEffectiveUserID()<br>
> +{<br>
> + return geteuid();<br>
> +}<br>
> +<br>
> +uint32_t<br>
> +HostInfoPosix::GetEffectiveGroupID()<br>
> +{<br>
> + return getegid();<br>
> +}<br>
> +<br>
> bool<br>
> HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec)<br>
> {<br>
><br>
> Modified: lldb/trunk/source/Host/windows/Host.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Host/windows/Host.cpp (original)<br>
> +++ lldb/trunk/source/Host/windows/Host.cpp Thu Aug 21 16:49:24 2014<br>
> @@ -236,33 +236,6 @@ Host::DynamicLibraryGetSymbol(void *opaq<br>
> }<br>
><br>
> uint32_t<br>
> -Host::GetUserID ()<br>
> -{<br>
> - llvm_unreachable("Windows does not support uid");<br>
> -}<br>
> -<br>
> -uint32_t<br>
> -Host::GetGroupID ()<br>
> -{<br>
> - llvm_unreachable("Windows does not support gid");<br>
> - return 0;<br>
> -}<br>
> -<br>
> -uint32_t<br>
> -Host::GetEffectiveUserID ()<br>
> -{<br>
> - llvm_unreachable("Windows does not support euid");<br>
> - return 0;<br>
> -}<br>
> -<br>
> -uint32_t<br>
> -Host::GetEffectiveGroupID ()<br>
> -{<br>
> - llvm_unreachable("Windows does not support egid");<br>
> - return 0;<br>
> -}<br>
> -<br>
> -uint32_t<br>
> Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos)<br>
> {<br>
> process_infos.Clear();<br>
><br>
> Modified: lldb/trunk/source/Host/windows/HostInfoWindows.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostInfoWindows.cpp?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostInfoWindows.cpp?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Host/windows/HostInfoWindows.cpp (original)<br>
> +++ lldb/trunk/source/Host/windows/HostInfoWindows.cpp Thu Aug 21 16:49:24 2014<br>
> @@ -15,6 +15,8 @@<br>
><br>
> using namespace lldb_private;<br>
><br>
> +FileSpec HostInfoWindows::m_program_filespec;<br>
> +<br>
> size_t<br>
> HostInfoWindows::GetPageSize()<br>
> {<br>
> @@ -79,6 +81,21 @@ HostInfoWindows::GetHostname(std::string<br>
> return true;<br>
> }<br>
><br>
> +FileSpec<br>
> +HostInfoWindows::GetProgramFileSpec()<br>
> +{<br>
> + static bool is_initialized = false;<br>
> + if (!is_initialized)<br>
> + {<br>
> + is_initialized = true;<br>
> +<br>
> + std::vector<char> buffer(PATH_MAX);<br>
> + ::GetModuleFileName(NULL, &buffer[0], buffer.size());<br>
> + m_program_filespec.SetFile(&buffer[0], false);<br>
> + }<br>
> + return m_program_filespec;<br>
> +}<br>
> +<br>
> bool<br>
> HostInfoWindows::ComputePythonDirectory(FileSpec &file_spec)<br>
> {<br>
><br>
> Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=216230&r1=216229&r2=216230&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=216230&r1=216229&r2=216230&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)<br>
> +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Aug 21 16:49:24 2014<br>
> @@ -51,6 +51,7 @@<br>
><br>
> #include "lldb/Host/Editline.h"<br>
> #include "lldb/Host/Host.h"<br>
> +#include "lldb/Host/HostInfo.h"<br>
><br>
> #include "lldb/Interpreter/Args.h"<br>
> #include "lldb/Interpreter/CommandCompletions.h"<br>
> @@ -67,7 +68,9 @@<br>
><br>
> #include "lldb/Utility/CleanUp.h"<br>
><br>
> +#include "llvm/ADT/SmallString.h"<br>
> #include "llvm/ADT/STLExtras.h"<br>
> +#include "llvm/Support/Path.h"<br>
><br>
> using namespace lldb;<br>
> using namespace lldb_private;<br>
> @@ -2381,13 +2384,15 @@ CommandInterpreter::SourceInitFile (bool<br>
> // "-" and the name of the program. If this file doesn't exist, we fall<br>
> // back to just the "~/.lldbinit" file. We also obey any requests to not<br>
> // load the init files.<br>
> - FileSpec profilePath = Host::GetUserProfileFileSpec();<br>
> + llvm::SmallString<64> home_dir_path;<br>
> + llvm::sys::path::home_directory(home_dir_path);<br>
> + FileSpec profilePath(home_dir_path.c_str(), false);<br>
> profilePath.AppendPathComponent(".lldbinit");<br>
> std::string init_file_path = profilePath.GetPath();<br>
><br>
> if (m_skip_app_init_files == false)<br>
> {<br>
> - FileSpec program_file_spec (Host::GetProgramFileSpec());<br>
> + FileSpec program_file_spec(HostInfo::GetProgramFileSpec());<br>
> const char *program_name = program_file_spec.GetFilename().AsCString();<br>
><br>
> if (program_name)<br>
><br>
><br>
> _______________________________________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
<br>
</div></div></blockquote></div><br></div>