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. llvm-svn: 216230
This commit is contained in:
parent
6b36337c09
commit
a21fee0ee4
|
@ -91,25 +91,6 @@ public:
|
||||||
lldb::pid_t pid,
|
lldb::pid_t pid,
|
||||||
bool monitor_signals);
|
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
|
enum SystemLogType
|
||||||
{
|
{
|
||||||
eSystemLogWarning,
|
eSystemLogWarning,
|
||||||
|
@ -260,27 +241,6 @@ public:
|
||||||
static bool
|
static bool
|
||||||
SetShortThreadName (lldb::pid_t pid, lldb::tid_t tid, const char *name, size_t len);
|
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
|
/// Given an address in the current process (the process that
|
||||||
/// is running the LLDB code), return the name of the module that
|
/// is running the LLDB code), return the name of the module that
|
||||||
|
@ -298,8 +258,6 @@ public:
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
static FileSpec
|
static FileSpec
|
||||||
GetModuleFileSpecForHostAddress (const void *host_addr);
|
GetModuleFileSpecForHostAddress (const void *host_addr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
/// If you have an executable that is in a bundle and want to get
|
/// If you have an executable that is in a bundle and want to get
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef lldb_Host_freebsd_HostInfoFreeBSD_h_
|
#ifndef lldb_Host_freebsd_HostInfoFreeBSD_h_
|
||||||
#define lldb_Host_freebsd_HostInfoFreeBSD_h_
|
#define lldb_Host_freebsd_HostInfoFreeBSD_h_
|
||||||
|
|
||||||
|
#include "lldb/Host/FileSpec.h"
|
||||||
#include "lldb/Host/posix/HostInfoPosix.h"
|
#include "lldb/Host/posix/HostInfoPosix.h"
|
||||||
|
|
||||||
namespace lldb_private
|
namespace lldb_private
|
||||||
|
@ -21,6 +22,7 @@ class HostInfoFreeBSD : public HostInfoPosix
|
||||||
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
|
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
|
||||||
static bool GetOSBuildString(std::string &s);
|
static bool GetOSBuildString(std::string &s);
|
||||||
static bool GetOSKernelDescription(std::string &s);
|
static bool GetOSKernelDescription(std::string &s);
|
||||||
|
static FileSpec GetProgramFileSpec();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
#ifndef lldb_Host_linux_HostInfoLinux_h_
|
#ifndef lldb_Host_linux_HostInfoLinux_h_
|
||||||
#define lldb_Host_linux_HostInfoLinux_h_
|
#define lldb_Host_linux_HostInfoLinux_h_
|
||||||
|
|
||||||
|
#include "lldb/Host/FileSpec.h"
|
||||||
#include "lldb/Host/posix/HostInfoPosix.h"
|
#include "lldb/Host/posix/HostInfoPosix.h"
|
||||||
|
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -32,6 +34,7 @@ class HostInfoLinux : public HostInfoPosix
|
||||||
|
|
||||||
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
|
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
|
||||||
static llvm::StringRef GetDistributionId();
|
static llvm::StringRef GetDistributionId();
|
||||||
|
static FileSpec GetProgramFileSpec();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
|
static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef lldb_Host_macosx_HostInfoMacOSX_h_
|
#ifndef lldb_Host_macosx_HostInfoMacOSX_h_
|
||||||
#define lldb_Host_macosx_HostInfoMacOSX_h_
|
#define lldb_Host_macosx_HostInfoMacOSX_h_
|
||||||
|
|
||||||
|
#include "lldb/Host/FileSpec.h"
|
||||||
#include "lldb/Host/posix/HostInfoPosix.h"
|
#include "lldb/Host/posix/HostInfoPosix.h"
|
||||||
|
|
||||||
namespace lldb_private
|
namespace lldb_private
|
||||||
|
@ -30,6 +31,7 @@ class HostInfoMacOSX : public HostInfoPosix
|
||||||
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
|
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
|
||||||
static bool GetOSBuildString(std::string &s);
|
static bool GetOSBuildString(std::string &s);
|
||||||
static bool GetOSKernelDescription(std::string &s);
|
static bool GetOSKernelDescription(std::string &s);
|
||||||
|
static FileSpec GetProgramFileSpec();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
|
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
|
||||||
|
|
|
@ -25,6 +25,11 @@ class HostInfoPosix : public HostInfoBase
|
||||||
static const char *LookupUserName(uint32_t uid, std::string &user_name);
|
static const char *LookupUserName(uint32_t uid, std::string &user_name);
|
||||||
static const char *LookupGroupName(uint32_t gid, std::string &group_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:
|
protected:
|
||||||
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
|
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
|
||||||
static bool ComputeHeaderDirectory(FileSpec &file_spec);
|
static bool ComputeHeaderDirectory(FileSpec &file_spec);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#define lldb_Host_windows_HostInfoWindows_h_
|
#define lldb_Host_windows_HostInfoWindows_h_
|
||||||
|
|
||||||
#include "lldb/Host/HostInfoBase.h"
|
#include "lldb/Host/HostInfoBase.h"
|
||||||
|
#include "lldb/Host/FileSpec.h"
|
||||||
|
|
||||||
namespace lldb_private
|
namespace lldb_private
|
||||||
{
|
{
|
||||||
|
@ -31,9 +32,13 @@ class HostInfoWindows : public HostInfoBase
|
||||||
static bool GetOSBuildString(std::string &s);
|
static bool GetOSBuildString(std::string &s);
|
||||||
static bool GetOSKernelDescription(std::string &s);
|
static bool GetOSKernelDescription(std::string &s);
|
||||||
static bool GetHostname(std::string &s);
|
static bool GetHostname(std::string &s);
|
||||||
|
static FileSpec GetProgramFileSpec();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool ComputePythonDirectory(FileSpec &file_spec);
|
static bool ComputePythonDirectory(FileSpec &file_spec);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static FileSpec m_program_filespec;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ SBFileSpec
|
||||||
SBHostOS::GetProgramFileSpec ()
|
SBHostOS::GetProgramFileSpec ()
|
||||||
{
|
{
|
||||||
SBFileSpec sb_filespec;
|
SBFileSpec sb_filespec;
|
||||||
sb_filespec.SetFileSpec (Host::GetProgramFileSpec ());
|
sb_filespec.SetFileSpec(HostInfo::GetProgramFileSpec());
|
||||||
return sb_filespec;
|
return sb_filespec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -646,68 +646,6 @@ Host::SetShortThreadName (lldb::pid_t pid, lldb::tid_t tid,
|
||||||
|
|
||||||
#endif
|
#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
|
#if !defined (__APPLE__) // see Host.mm
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -865,34 +803,6 @@ Host::GetModuleFileSpecForHostAddress (const void *host_addr)
|
||||||
|
|
||||||
#endif
|
#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__)
|
#if !defined(__linux__)
|
||||||
bool
|
bool
|
||||||
Host::FindProcessThreads (const lldb::pid_t pid, TidMap &tids_to_attach)
|
Host::FindProcessThreads (const lldb::pid_t pid, TidMap &tids_to_attach)
|
||||||
|
|
|
@ -64,3 +64,22 @@ HostInfoFreeBSD::GetOSKernelDescription(std::string &s)
|
||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
|
@ -172,6 +172,25 @@ HostInfoLinux::GetDistributionId()
|
||||||
return g_fields->m_distribution_id.c_str();
|
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
|
bool
|
||||||
HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec)
|
HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
// Objective C/C++ includes
|
// Objective C/C++ includes
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
#include <objc/objc-auto.h>
|
#include <objc/objc-auto.h>
|
||||||
|
|
||||||
using namespace lldb_private;
|
using namespace lldb_private;
|
||||||
|
@ -91,6 +92,32 @@ HostInfoMacOSX::GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update)
|
||||||
return false;
|
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
|
bool
|
||||||
HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec)
|
HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,6 +97,30 @@ HostInfoPosix::LookupGroupName(uint32_t gid, std::string &group_name)
|
||||||
return NULL;
|
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
|
bool
|
||||||
HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec)
|
HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -235,33 +235,6 @@ Host::DynamicLibraryGetSymbol(void *opaque, const char *symbol_name, Error &erro
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
uint32_t
|
||||||
Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos)
|
Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
using namespace lldb_private;
|
using namespace lldb_private;
|
||||||
|
|
||||||
|
FileSpec HostInfoWindows::m_program_filespec;
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
HostInfoWindows::GetPageSize()
|
HostInfoWindows::GetPageSize()
|
||||||
{
|
{
|
||||||
|
@ -79,6 +81,21 @@ HostInfoWindows::GetHostname(std::string &s)
|
||||||
return true;
|
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
|
bool
|
||||||
HostInfoWindows::ComputePythonDirectory(FileSpec &file_spec)
|
HostInfoWindows::ComputePythonDirectory(FileSpec &file_spec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
#include "lldb/Host/Editline.h"
|
#include "lldb/Host/Editline.h"
|
||||||
#include "lldb/Host/Host.h"
|
#include "lldb/Host/Host.h"
|
||||||
|
#include "lldb/Host/HostInfo.h"
|
||||||
|
|
||||||
#include "lldb/Interpreter/Args.h"
|
#include "lldb/Interpreter/Args.h"
|
||||||
#include "lldb/Interpreter/CommandCompletions.h"
|
#include "lldb/Interpreter/CommandCompletions.h"
|
||||||
|
@ -67,7 +68,9 @@
|
||||||
|
|
||||||
#include "lldb/Utility/CleanUp.h"
|
#include "lldb/Utility/CleanUp.h"
|
||||||
|
|
||||||
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
|
#include "llvm/Support/Path.h"
|
||||||
|
|
||||||
using namespace lldb;
|
using namespace lldb;
|
||||||
using namespace lldb_private;
|
using namespace lldb_private;
|
||||||
|
@ -2381,13 +2384,15 @@ CommandInterpreter::SourceInitFile (bool in_cwd, CommandReturnObject &result)
|
||||||
// "-" and the name of the program. If this file doesn't exist, we fall
|
// "-" 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
|
// back to just the "~/.lldbinit" file. We also obey any requests to not
|
||||||
// load the init files.
|
// 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");
|
profilePath.AppendPathComponent(".lldbinit");
|
||||||
std::string init_file_path = profilePath.GetPath();
|
std::string init_file_path = profilePath.GetPath();
|
||||||
|
|
||||||
if (m_skip_app_init_files == false)
|
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();
|
const char *program_name = program_file_spec.GetFilename().AsCString();
|
||||||
|
|
||||||
if (program_name)
|
if (program_name)
|
||||||
|
|
Loading…
Reference in New Issue