diff options
Diffstat (limited to 'source/Host/macosx')
-rw-r--r-- | source/Host/macosx/Host.mm | 53 | ||||
-rw-r--r-- | source/Host/macosx/HostInfoMacOSX.mm | 7 | ||||
-rw-r--r-- | source/Host/macosx/Symbols.cpp | 42 | ||||
-rw-r--r-- | source/Host/macosx/ThisThread.cpp | 25 |
4 files changed, 47 insertions, 80 deletions
diff --git a/source/Host/macosx/Host.mm b/source/Host/macosx/Host.mm index 99bc7ec8ff15..4c51e8ff154b 100644 --- a/source/Host/macosx/Host.mm +++ b/source/Host/macosx/Host.mm @@ -56,24 +56,25 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Communication.h" -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/StructuredData.h" #include "lldb/Host/ConnectionFileDescriptor.h" -#include "lldb/Host/Endian.h" -#include "lldb/Host/FileSpec.h" -#include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Utility/CleanUp.h" +#include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Endian.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/NameMatches.h" +#include "lldb/Utility/StreamString.h" + +#include "llvm/Support/FileSystem.h" #include "cfcpp/CFCBundle.h" #include "cfcpp/CFCMutableArray.h" @@ -101,7 +102,7 @@ using namespace lldb_private; bool Host::GetBundleDirectory(const FileSpec &file, FileSpec &bundle_directory) { #if defined(__APPLE__) - if (file.GetFileType() == FileSpec::eFileTypeDirectory) { + if (llvm::sys::fs::is_directory(file.GetPath())) { char path[PATH_MAX]; if (file.GetPath(path, sizeof(path))) { CFCBundle bundle(path); @@ -118,7 +119,7 @@ bool Host::GetBundleDirectory(const FileSpec &file, bool Host::ResolveExecutableInBundle(FileSpec &file) { #if defined(__APPLE__) - if (file.GetFileType() == FileSpec::eFileTypeDirectory) { + if (llvm::sys::fs::is_directory(file.GetPath())) { char path[PATH_MAX]; if (file.GetPath(path, sizeof(path))) { CFCBundle bundle(path); @@ -528,7 +529,7 @@ LaunchInNewTerminalWithAppleScript(const char *exe_path, WaitForProcessToSIGSTOP(pid, 5); } - FileSystem::Unlink(FileSpec{unix_socket_name, false}); + llvm::sys::fs::remove(unix_socket_name); [applescript release]; if (pid != LLDB_INVALID_PROCESS_ID) launch_info.SetProcessID(pid); @@ -957,9 +958,7 @@ static Error getXPCAuthorization(ProcessLaunchInfo &launch_info) { if (createStatus != errAuthorizationSuccess) { error.SetError(1, eErrorTypeGeneric); error.SetErrorString("Can't create authorizationRef."); - if (log) { - error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); return error; } @@ -1012,9 +1011,7 @@ static Error getXPCAuthorization(ProcessLaunchInfo &launch_info) { error.SetError(2, eErrorTypeGeneric); error.SetErrorStringWithFormat( "Launching as root needs root authorization."); - if (log) { - error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); if (authorizationRef) { AuthorizationFree(authorizationRef, kAuthorizationFlagDefaults); @@ -1050,9 +1047,7 @@ static Error LaunchProcessXPC(const char *exe_path, error.SetError(3, eErrorTypeGeneric); error.SetErrorStringWithFormat("Launching root via XPC needs to " "externalize authorization reference."); - if (log) { - error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); return error; } xpc_service = LaunchUsingXPCRightName; @@ -1060,9 +1055,7 @@ static Error LaunchProcessXPC(const char *exe_path, error.SetError(4, eErrorTypeGeneric); error.SetErrorStringWithFormat( "Launching via XPC is only currently available for root."); - if (log) { - error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); return error; } @@ -1146,9 +1139,7 @@ static Error LaunchProcessXPC(const char *exe_path, error.SetErrorStringWithFormat( "Problems with launching via XPC. Error type : %i, code : %i", errorType, errorCode); - if (log) { - error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); if (authorizationRef) { AuthorizationFree(authorizationRef, kAuthorizationFlagDefaults); @@ -1160,9 +1151,7 @@ static Error LaunchProcessXPC(const char *exe_path, error.SetErrorStringWithFormat( "Problems with launching via XPC. XPC error : %s", xpc_dictionary_get_string(reply, XPC_ERROR_KEY_DESCRIPTION)); - if (log) { - error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); } return error; @@ -1196,8 +1185,8 @@ Error Host::LaunchProcess(ProcessLaunchInfo &launch_info) { ModuleSpec exe_module_spec(launch_info.GetExecutableFile(), launch_info.GetArchitecture()); - FileSpec::FileType file_type = exe_module_spec.GetFileSpec().GetFileType(); - if (file_type != FileSpec::eFileTypeRegular) { + if (!llvm::sys::fs::is_regular_file( + exe_module_spec.GetFileSpec().GetPath())) { lldb::ModuleSP exe_module_sp; error = host_platform_sp->ResolveExecutable(exe_module_spec, exe_module_sp, NULL); @@ -1458,7 +1447,3 @@ void Host::SystemLog(SystemLogType type, const char *format, va_list args) { ::asl_vlog(NULL, g_aslmsg, asl_level, format, args); } } - -lldb::DataBufferSP Host::GetAuxvData(lldb_private::Process *process) { - return lldb::DataBufferSP(); -} diff --git a/source/Host/macosx/HostInfoMacOSX.mm b/source/Host/macosx/HostInfoMacOSX.mm index 1c526c6ecccb..8774c76ef2da 100644 --- a/source/Host/macosx/HostInfoMacOSX.mm +++ b/source/Host/macosx/HostInfoMacOSX.mm @@ -11,13 +11,14 @@ #include "Plugins/ScriptInterpreter/Python/lldb-python.h" #endif -#include "lldb/Core/Log.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/macosx/HostInfoMacOSX.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Log.h" #include "lldb/Utility/SafeMachO.h" #include "llvm/ADT/SmallString.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/raw_ostream.h" // C++ Includes @@ -152,7 +153,7 @@ bool HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec) { // the lldb driver. raw_path.append("/../bin"); FileSpec support_dir_spec(raw_path, true); - if (!support_dir_spec.Exists() || !support_dir_spec.IsDirectory()) { + if (!llvm::sys::fs::is_directory(support_dir_spec.GetPath())) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (log) log->Printf("HostInfoMacOSX::%s(): failed to find support directory", @@ -334,5 +335,3 @@ void HostInfoMacOSX::ComputeHostArchitectureSupport(ArchSpec &arch_32, } } } - -uint32_t HostInfoMacOSX::GetMaxThreadNameLength() { return 64; } diff --git a/source/Host/macosx/Symbols.cpp b/source/Host/macosx/Symbols.cpp index c428377eb7d2..a5085681495d 100644 --- a/source/Host/macosx/Symbols.cpp +++ b/source/Host/macosx/Symbols.cpp @@ -24,20 +24,22 @@ #include "Host/macosx/cfcpp/CFCReleaser.h" #include "Host/macosx/cfcpp/CFCString.h" #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/DataBuffer.h" -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/Timer.h" -#include "lldb/Core/UUID.h" -#include "lldb/Host/Endian.h" #include "lldb/Host/Host.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Utility/CleanUp.h" +#include "lldb/Utility/DataBuffer.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Endian.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/Utility/UUID.h" #include "mach/machine.h" +#include "llvm/Support/FileSystem.h" + using namespace lldb; using namespace lldb_private; using namespace llvm::MachO; @@ -101,7 +103,7 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, } FileSpec dsym_filespec(path, path[0] == '~'); - if (dsym_filespec.GetFileType() == FileSpec::eFileTypeDirectory) { + if (llvm::sys::fs::is_directory(dsym_filespec.GetPath())) { dsym_filespec = Symbols::FindSymbolFileInBundle(dsym_filespec, uuid, arch); ++items_found; @@ -164,8 +166,10 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, FileSpec file_spec(path, true); ModuleSpecList module_specs; ModuleSpec matched_module_spec; - switch (file_spec.GetFileType()) { - case FileSpec::eFileTypeDirectory: // Bundle directory? + using namespace llvm::sys::fs; + switch (get_file_type(file_spec.GetPath())) { + + case file_type::directory_file: // Bundle directory? { CFCBundle bundle(path); CFCReleaser<CFURLRef> bundle_exe_url( @@ -193,15 +197,17 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec, } } break; - case FileSpec::eFileTypePipe: // Forget pipes - case FileSpec::eFileTypeSocket: // We can't process socket files - case FileSpec::eFileTypeInvalid: // File doesn't exist... + case file_type::fifo_file: // Forget pipes + case file_type::socket_file: // We can't process socket files + case file_type::file_not_found: // File doesn't exist... + case file_type::status_error: break; - case FileSpec::eFileTypeUnknown: - case FileSpec::eFileTypeRegular: - case FileSpec::eFileTypeSymbolicLink: - case FileSpec::eFileTypeOther: + case file_type::type_unknown: + case file_type::regular_file: + case file_type::symlink_file: + case file_type::block_file: + case file_type::character_file: if (ObjectFile::GetModuleSpecifications(file_spec, 0, 0, module_specs) && module_specs.FindMatchingModuleSpec(module_spec, @@ -263,7 +269,9 @@ FileSpec Symbols::FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, module_specs)) { ModuleSpec spec; for (size_t i = 0; i < module_specs.GetSize(); ++i) { - assert(module_specs.GetModuleSpecAtIndex(i, spec)); + bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); + UNUSED_IF_ASSERT_DISABLED(got_spec); + assert(got_spec); if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && (arch == NULL || diff --git a/source/Host/macosx/ThisThread.cpp b/source/Host/macosx/ThisThread.cpp deleted file mode 100644 index 5244ba014121..000000000000 --- a/source/Host/macosx/ThisThread.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===-- ThisThread.cpp ------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/Host/ThisThread.h" - -#include "llvm/ADT/SmallVector.h" -#include <pthread.h> - -using namespace lldb_private; - -void ThisThread::SetName(llvm::StringRef name) { -#if defined(__APPLE__) - ::pthread_setname_np(name.str().c_str()); -#endif -} - -void ThisThread::GetName(llvm::SmallVectorImpl<char> &name) { - // FIXME - implement this. -} |