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