Index: source/Host/windows/FileSystem.cpp =================================================================== --- source/Host/windows/FileSystem.cpp +++ source/Host/windows/FileSystem.cpp @@ -10,6 +10,8 @@ #include "lldb/Host/windows/windows.h" #include +#include +#include #include "lldb/Host/FileSystem.h" #include "llvm/Support/FileSystem.h" @@ -71,7 +73,23 @@ FileSystem::GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions) { Error error; - error.SetErrorStringWithFormat("%s is not supported on this host", __PRETTY_FUNCTION__); + // Beware that Windows's permission model is different from Unix's, and it's + // not clear if this API is supposed to check ACLs. To match the caller's + // expectations as closely as possible, we'll use Microsoft's _stat, which + // attempts to emulate POSIX stat. This should be good enough for basic + // checks like FileSpec::Readable. + struct _stat file_stats; + if (::_stat(file_spec.GetCString(), &file_stats) == 0) + { + // The owner permission bits in "st_mode" currently match the definitions + // for the owner file mode bits. + file_permissions = file_stats.st_mode & (_S_IREAD | _S_IWRITE | _S_IEXEC); + } + else + { + error.SetErrorToErrno(); + } + return error; }