diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 |
commit | b76161e41bc2c07cd47f9c61f875d1be95e26d10 (patch) | |
tree | d03c19ce10dec6419f97df1d4dac9d47eb88982f /source/Target | |
parent | 8b4000f13b303cc154136abc74c55670673e2a96 (diff) |
Notes
Diffstat (limited to 'source/Target')
-rw-r--r-- | source/Target/Language.cpp | 2 | ||||
-rw-r--r-- | source/Target/LanguageRuntime.cpp | 3 | ||||
-rw-r--r-- | source/Target/Memory.cpp | 7 | ||||
-rw-r--r-- | source/Target/ModuleCache.cpp | 89 | ||||
-rw-r--r-- | source/Target/ObjCLanguageRuntime.cpp | 6 | ||||
-rw-r--r-- | source/Target/PathMappingList.cpp | 2 | ||||
-rw-r--r-- | source/Target/Platform.cpp | 196 | ||||
-rw-r--r-- | source/Target/Process.cpp | 191 | ||||
-rw-r--r-- | source/Target/ProcessLaunchInfo.cpp | 2 | ||||
-rw-r--r-- | source/Target/RegisterContext.cpp | 17 | ||||
-rw-r--r-- | source/Target/StackFrame.cpp | 18 | ||||
-rw-r--r-- | source/Target/StopInfo.cpp | 4 | ||||
-rw-r--r-- | source/Target/Target.cpp | 111 | ||||
-rw-r--r-- | source/Target/TargetList.cpp | 58 | ||||
-rw-r--r-- | source/Target/Thread.cpp | 69 | ||||
-rw-r--r-- | source/Target/ThreadPlanCallFunction.cpp | 2 | ||||
-rw-r--r-- | source/Target/ThreadPlanTracer.cpp | 2 | ||||
-rw-r--r-- | source/Target/ThreadSpec.cpp | 10 |
18 files changed, 398 insertions, 391 deletions
diff --git a/source/Target/Language.cpp b/source/Target/Language.cpp index 8fef32a3b1869..cde6f8654aec2 100644 --- a/source/Target/Language.cpp +++ b/source/Target/Language.cpp @@ -387,7 +387,7 @@ DumpValueObjectOptions::DeclPrintingHelper Language::GetDeclPrintingHelper() { return nullptr; } -LazyBool Language::IsLogicalTrue(ValueObject &valobj, Error &error) { +LazyBool Language::IsLogicalTrue(ValueObject &valobj, Status &error) { return eLazyBoolCalculate; } diff --git a/source/Target/LanguageRuntime.cpp b/source/Target/LanguageRuntime.cpp index d0018b6df1145..bd02121f6a4d3 100644 --- a/source/Target/LanguageRuntime.cpp +++ b/source/Target/LanguageRuntime.cpp @@ -89,7 +89,8 @@ ExceptionSearchFilter::DoCopyForBreakpoint(Breakpoint &breakpoint) { } SearchFilter *ExceptionSearchFilter::CreateFromStructuredData( - Target &target, const StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, + Status &error) { SearchFilter *result = nullptr; return result; } diff --git a/source/Target/Memory.cpp b/source/Target/Memory.cpp index c78bd7ad7b34d..ced3594186821 100644 --- a/source/Target/Memory.cpp +++ b/source/Target/Memory.cpp @@ -129,7 +129,8 @@ bool MemoryCache::RemoveInvalidRange(lldb::addr_t base_addr, return false; } -size_t MemoryCache::Read(addr_t addr, void *dst, size_t dst_len, Error &error) { +size_t MemoryCache::Read(addr_t addr, void *dst, size_t dst_len, + Status &error) { size_t bytes_left = dst_len; // Check the L1 cache for a range that contain the entire memory read. @@ -344,7 +345,7 @@ void AllocatedMemoryCache::Clear() { AllocatedMemoryCache::AllocatedBlockSP AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions, - uint32_t chunk_size, Error &error) { + uint32_t chunk_size, Status &error) { AllocatedBlockSP block_sp; const size_t page_size = 4096; const size_t num_pages = (byte_size + page_size - 1) / page_size; @@ -370,7 +371,7 @@ AllocatedMemoryCache::AllocatePage(uint32_t byte_size, uint32_t permissions, lldb::addr_t AllocatedMemoryCache::AllocateMemory(size_t byte_size, uint32_t permissions, - Error &error) { + Status &error) { std::lock_guard<std::recursive_mutex> guard(m_mutex); addr_t addr = LLDB_INVALID_ADDRESS; diff --git a/source/Target/ModuleCache.cpp b/source/Target/ModuleCache.cpp index a4aa26a0e480e..2b654772639a9 100644 --- a/source/Target/ModuleCache.cpp +++ b/source/Target/ModuleCache.cpp @@ -54,7 +54,7 @@ private: FileSpec m_file_spec; public: - ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, Error &error); + ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, Status &error); void Delete(); }; @@ -64,7 +64,7 @@ static FileSpec JoinPath(const FileSpec &path1, const char *path2) { return result_spec; } -static Error MakeDirectory(const FileSpec &dir_path) { +static Status MakeDirectory(const FileSpec &dir_path) { namespace fs = llvm::sys::fs; return fs::create_directories(dir_path.GetPath(), true, fs::perms::owner_all); @@ -92,7 +92,7 @@ void DeleteExistingModule(const FileSpec &root_dir_spec, if (!module_uuid.IsValid()) return; - Error error; + Status error; ModuleLock lock(root_dir_spec, module_uuid, error); if (error.Fail()) { if (log) @@ -125,17 +125,17 @@ void DecrementRefExistingModule(const FileSpec &root_dir_spec, llvm::sys::fs::remove(symfile_spec.GetPath()); } -Error CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, - const char *hostname, - const FileSpec &platform_module_spec, - const FileSpec &local_module_spec, - bool delete_existing) { +Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, + const char *hostname, + const FileSpec &platform_module_spec, + const FileSpec &local_module_spec, + bool delete_existing) { const auto sysroot_module_path_spec = JoinPath(JoinPath(root_dir_spec, hostname), platform_module_spec.GetPath().c_str()); if (sysroot_module_path_spec.Exists()) { if (!delete_existing) - return Error(); + return Status(); DecrementRefExistingModule(root_dir_spec, sysroot_module_path_spec); } @@ -152,7 +152,7 @@ Error CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, } // namespace ModuleLock::ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid, - Error &error) { + Status &error) { const auto lock_dir_spec = JoinPath(root_dir_spec, kLockDirName); error = MakeDirectory(lock_dir_spec); if (error.Fail()) @@ -184,9 +184,9 @@ void ModuleLock::Delete() { ///////////////////////////////////////////////////////////////////////// -Error ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, const FileSpec &tmp_file, - const FileSpec &target_file) { +Status ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, const FileSpec &tmp_file, + const FileSpec &target_file) { const auto module_spec_dir = GetModuleDirectory(root_dir_spec, module_spec.GetUUID()); const auto module_file_path = @@ -196,27 +196,27 @@ Error ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname, const auto err_code = llvm::sys::fs::rename(tmp_file_path, module_file_path.GetPath()); if (err_code) - return Error("Failed to rename file %s to %s: %s", tmp_file_path.c_str(), - module_file_path.GetPath().c_str(), - err_code.message().c_str()); + return Status("Failed to rename file %s to %s: %s", tmp_file_path.c_str(), + module_file_path.GetPath().c_str(), + err_code.message().c_str()); const auto error = CreateHostSysRootModuleLink( root_dir_spec, hostname, target_file, module_file_path, true); if (error.Fail()) - return Error("Failed to create link to %s: %s", - module_file_path.GetPath().c_str(), error.AsCString()); - return Error(); + return Status("Failed to create link to %s: %s", + module_file_path.GetPath().c_str(), error.AsCString()); + return Status(); } -Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, - const ModuleSpec &module_spec, - ModuleSP &cached_module_sp, bool *did_create_ptr) { +Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, + ModuleSP &cached_module_sp, bool *did_create_ptr) { const auto find_it = m_loaded_modules.find(module_spec.GetUUID().GetAsString()); if (find_it != m_loaded_modules.end()) { cached_module_sp = (*find_it).second.lock(); if (cached_module_sp) - return Error(); + return Status(); m_loaded_modules.erase(find_it); } @@ -226,10 +226,10 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, module_spec_dir, module_spec.GetFileSpec().GetFilename().AsCString()); if (!module_file_path.Exists()) - return Error("Module %s not found", module_file_path.GetPath().c_str()); + return Status("Module %s not found", module_file_path.GetPath().c_str()); if (module_file_path.GetByteSize() != module_spec.GetObjectSize()) - return Error("Module %s has invalid file size", - module_file_path.GetPath().c_str()); + return Status("Module %s has invalid file size", + module_file_path.GetPath().c_str()); // We may have already cached module but downloaded from an another host - in // this case let's create a link to it. @@ -237,8 +237,8 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, module_spec.GetFileSpec(), module_file_path, false); if (error.Fail()) - return Error("Failed to create link to %s: %s", - module_file_path.GetPath().c_str(), error.AsCString()); + return Status("Failed to create link to %s: %s", + module_file_path.GetPath().c_str(), error.AsCString()); auto cached_module_spec(module_spec); cached_module_spec.GetUUID().Clear(); // Clear UUID since it may contain md5 @@ -258,16 +258,16 @@ Error ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname, m_loaded_modules.insert( std::make_pair(module_spec.GetUUID().GetAsString(), cached_module_sp)); - return Error(); + return Status(); } -Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, - const char *hostname, - const ModuleSpec &module_spec, - const ModuleDownloader &module_downloader, - const SymfileDownloader &symfile_downloader, - lldb::ModuleSP &cached_module_sp, - bool *did_create_ptr) { +Status ModuleCache::GetAndPut(const FileSpec &root_dir_spec, + const char *hostname, + const ModuleSpec &module_spec, + const ModuleDownloader &module_downloader, + const SymfileDownloader &symfile_downloader, + lldb::ModuleSP &cached_module_sp, + bool *did_create_ptr) { const auto module_spec_dir = GetModuleDirectory(root_dir_spec, module_spec.GetUUID()); auto error = MakeDirectory(module_spec_dir); @@ -276,9 +276,9 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, ModuleLock lock(root_dir_spec, module_spec.GetUUID(), error); if (error.Fail()) - return Error("Failed to lock module %s: %s", - module_spec.GetUUID().GetAsString().c_str(), - error.AsCString()); + return Status("Failed to lock module %s: %s", + module_spec.GetUUID().GetAsString().c_str(), + error.AsCString()); const auto escaped_hostname(GetEscapedHostname(hostname)); // Check local cache for a module. @@ -291,13 +291,13 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, error = module_downloader(module_spec, tmp_download_file_spec); llvm::FileRemover tmp_file_remover(tmp_download_file_spec.GetPath()); if (error.Fail()) - return Error("Failed to download module: %s", error.AsCString()); + return Status("Failed to download module: %s", error.AsCString()); // Put downloaded file into local module cache. error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec, tmp_download_file_spec, module_spec.GetFileSpec()); if (error.Fail()) - return Error("Failed to put module into cache: %s", error.AsCString()); + return Status("Failed to put module into cache: %s", error.AsCString()); tmp_file_remover.releaseFile(); error = Get(root_dir_spec, escaped_hostname.c_str(), module_spec, @@ -315,17 +315,18 @@ Error ModuleCache::GetAndPut(const FileSpec &root_dir_spec, // module might // contain the necessary symbols and the debugging is also possible without // a symfile. - return Error(); + return Status(); error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec, tmp_download_sym_file_spec, GetSymbolFileSpec(module_spec.GetFileSpec())); if (error.Fail()) - return Error("Failed to put symbol file into cache: %s", error.AsCString()); + return Status("Failed to put symbol file into cache: %s", + error.AsCString()); tmp_symfile_remover.releaseFile(); FileSpec symfile_spec = GetSymbolFileSpec(cached_module_sp->GetFileSpec()); cached_module_sp->SetSymbolFileFileSpec(symfile_spec); - return Error(); + return Status(); } diff --git a/source/Target/ObjCLanguageRuntime.cpp b/source/Target/ObjCLanguageRuntime.cpp index 6aeb4c46df48b..165c75a0952b3 100644 --- a/source/Target/ObjCLanguageRuntime.cpp +++ b/source/Target/ObjCLanguageRuntime.cpp @@ -250,7 +250,7 @@ ObjCLanguageRuntime::GetClassDescriptor(ValueObject &valobj) { Process *process = exe_ctx.GetProcessPtr(); if (process) { - Error error; + Status error; ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error); if (isa != LLDB_INVALID_ADDRESS) objc_class_sp = GetClassDescriptorFromISA(isa); @@ -377,9 +377,9 @@ bool ObjCLanguageRuntime::ObjCExceptionPrecondition::EvaluatePrecondition( void ObjCLanguageRuntime::ObjCExceptionPrecondition::GetDescription( Stream &stream, lldb::DescriptionLevel level) {} -Error ObjCLanguageRuntime::ObjCExceptionPrecondition::ConfigurePrecondition( +Status ObjCLanguageRuntime::ObjCExceptionPrecondition::ConfigurePrecondition( Args &args) { - Error error; + Status error; if (args.GetArgumentCount() > 0) error.SetErrorString( "The ObjC Exception breakpoint doesn't support extra options."); diff --git a/source/Target/PathMappingList.cpp b/source/Target/PathMappingList.cpp index 4fbaee98da615..b834a3600d0b1 100644 --- a/source/Target/PathMappingList.cpp +++ b/source/Target/PathMappingList.cpp @@ -16,8 +16,8 @@ // Project includes #include "lldb/Host/PosixApi.h" #include "lldb/Target/PathMappingList.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp index fd909075a240f..cfd971e9de62f 100644 --- a/source/Target/Platform.cpp +++ b/source/Target/Platform.cpp @@ -39,9 +39,9 @@ #include "lldb/Target/Target.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/DataBufferHeap.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/FileSystem.h" @@ -170,11 +170,11 @@ void Platform::SetHostPlatform(const lldb::PlatformSP &platform_sp) { } } -Error Platform::GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, FileSpec &local_file) { +Status Platform::GetFileWithUUID(const FileSpec &platform_file, + const UUID *uuid_ptr, FileSpec &local_file) { // Default to the local case local_file = platform_file; - return Error(); + return Status(); } FileSpecList @@ -217,11 +217,11 @@ Platform::LocateExecutableScriptingResources(Target *target, Module &module, // return PlatformSP(); //} -Error Platform::GetSharedModule(const ModuleSpec &module_spec, Process *process, - ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - ModuleSP *old_module_sp_ptr, - bool *did_create_ptr) { +Status Platform::GetSharedModule(const ModuleSpec &module_spec, + Process *process, ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + ModuleSP *old_module_sp_ptr, + bool *did_create_ptr) { if (IsHost()) return ModuleList::GetSharedModule( module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, @@ -229,7 +229,7 @@ Error Platform::GetSharedModule(const ModuleSpec &module_spec, Process *process, return GetRemoteSharedModule(module_spec, process, module_sp, [&](const ModuleSpec &spec) { - Error error = ModuleList::GetSharedModule( + Status error = ModuleList::GetSharedModule( spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr, false); if (error.Success() && module_sp) @@ -267,7 +267,7 @@ PlatformSP Platform::Find(const ConstString &name) { return PlatformSP(); } -PlatformSP Platform::Create(const ConstString &name, Error &error) { +PlatformSP Platform::Create(const ConstString &name, Status &error) { PlatformCreateInstance create_callback = nullptr; lldb::PlatformSP platform_sp; if (name) { @@ -295,7 +295,7 @@ PlatformSP Platform::Create(const ConstString &name, Error &error) { } PlatformSP Platform::Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr, - Error &error) { + Status &error) { lldb::PlatformSP platform_sp; if (arch.IsValid()) { // Scope for locker @@ -540,7 +540,7 @@ FileSpec Platform::GetWorkingDirectory() { struct RecurseCopyBaton { const FileSpec &dst; Platform *platform_ptr; - Error error; + Status error; }; static FileSpec::EnumerateDirectoryResult @@ -560,7 +560,7 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, FileSpec dst_dir = rc_baton->dst; if (!dst_dir.GetFilename()) dst_dir.GetFilename() = src.GetLastPathComponent(); - Error error = rc_baton->platform_ptr->MakeDirectory( + Status error = rc_baton->platform_ptr->MakeDirectory( dst_dir, lldb::eFilePermissionsDirectoryDefault); if (error.Fail()) { rc_baton->error.SetErrorStringWithFormat( @@ -575,7 +575,8 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, // when we enumerate we can quickly fill in the filename for dst copies FileSpec recurse_dst; recurse_dst.GetDirectory().SetCString(dst_dir.GetPath().c_str()); - RecurseCopyBaton rc_baton2 = {recurse_dst, rc_baton->platform_ptr, Error()}; + RecurseCopyBaton rc_baton2 = {recurse_dst, rc_baton->platform_ptr, + Status()}; FileSpec::EnumerateDirectory(src_dir_path, true, true, true, RecurseCopy_Callback, &rc_baton2); if (rc_baton2.error.Fail()) { @@ -612,7 +613,7 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, FileSpec dst_file = rc_baton->dst; if (!dst_file.GetFilename()) dst_file.GetFilename() = src.GetFilename(); - Error err = rc_baton->platform_ptr->PutFile(src, dst_file); + Status err = rc_baton->platform_ptr->PutFile(src, dst_file); if (err.Fail()) { rc_baton->error.SetErrorString(err.AsCString()); return FileSpec::eEnumerateDirectoryResultQuit; // got an error, bail out @@ -629,8 +630,8 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, llvm_unreachable("Unhandled file_type!"); } -Error Platform::Install(const FileSpec &src, const FileSpec &dst) { - Error error; +Status Platform::Install(const FileSpec &src, const FileSpec &dst) { + Status error; Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); if (log) @@ -708,7 +709,7 @@ Error Platform::Install(const FileSpec &src, const FileSpec &dst) { FileSpec recurse_dst; recurse_dst.GetDirectory().SetCString(fixed_dst.GetCString()); std::string src_dir_path(src.GetPath()); - RecurseCopyBaton baton = {recurse_dst, this, Error()}; + RecurseCopyBaton baton = {recurse_dst, this, Status()}; FileSpec::EnumerateDirectory(src_dir_path, true, true, true, RecurseCopy_Callback, &baton); return baton.error; @@ -757,11 +758,12 @@ bool Platform::SetWorkingDirectory(const FileSpec &file_spec) { } } -Error Platform::MakeDirectory(const FileSpec &file_spec, uint32_t permissions) { +Status Platform::MakeDirectory(const FileSpec &file_spec, + uint32_t permissions) { if (IsHost()) return llvm::sys::fs::create_directory(file_spec.GetPath(), permissions); else { - Error error; + Status error; error.SetErrorStringWithFormat("remote platform %s doesn't support %s", GetPluginName().GetCString(), LLVM_PRETTY_FUNCTION); @@ -769,15 +771,15 @@ Error Platform::MakeDirectory(const FileSpec &file_spec, uint32_t permissions) { } } -Error Platform::GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions) { +Status Platform::GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions) { if (IsHost()) { auto Value = llvm::sys::fs::getPermissions(file_spec.GetPath()); if (Value) file_permissions = Value.get(); - return Error(Value.getError()); + return Status(Value.getError()); } else { - Error error; + Status error; error.SetErrorStringWithFormat("remote platform %s doesn't support %s", GetPluginName().GetCString(), LLVM_PRETTY_FUNCTION); @@ -785,13 +787,13 @@ Error Platform::GetFilePermissions(const FileSpec &file_spec, } } -Error Platform::SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions) { +Status Platform::SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions) { if (IsHost()) { auto Perms = static_cast<llvm::sys::fs::perms>(file_permissions); return llvm::sys::fs::setPermissions(file_spec.GetPath(), Perms); } else { - Error error; + Status error; error.SetErrorStringWithFormat("remote platform %s doesn't support %s", GetPluginName().GetCString(), LLVM_PRETTY_FUNCTION); @@ -877,10 +879,11 @@ bool Platform::SetOSVersion(uint32_t major, uint32_t minor, uint32_t update) { return false; } -Error Platform::ResolveExecutable(const ModuleSpec &module_spec, - lldb::ModuleSP &exe_module_sp, - const FileSpecList *module_search_paths_ptr) { - Error error; +Status +Platform::ResolveExecutable(const ModuleSpec &module_spec, + lldb::ModuleSP &exe_module_sp, + const FileSpecList *module_search_paths_ptr) { + Status error; if (module_spec.GetFileSpec().Exists()) { if (module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(module_spec, exe_module_sp, @@ -909,9 +912,9 @@ Error Platform::ResolveExecutable(const ModuleSpec &module_spec, return error; } -Error Platform::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, - FileSpec &sym_file) { - Error error; +Status Platform::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, + FileSpec &sym_file) { + Status error; if (sym_spec.GetSymbolFileSpec().Exists()) sym_file = sym_spec.GetSymbolFileSpec(); else @@ -960,8 +963,8 @@ const ArchSpec &Platform::GetSystemArchitecture() { return m_system_arch; } -Error Platform::ConnectRemote(Args &args) { - Error error; +Status Platform::ConnectRemote(Args &args) { + Status error; if (IsHost()) error.SetErrorStringWithFormat("The currently selected platform (%s) is " "the host platform and is always connected.", @@ -973,8 +976,8 @@ Error Platform::ConnectRemote(Args &args) { return error; } -Error Platform::DisconnectRemote() { - Error error; +Status Platform::DisconnectRemote() { + Status error; if (IsHost()) error.SetErrorStringWithFormat("The currently selected platform (%s) is " "the host platform and is always connected.", @@ -1005,8 +1008,8 @@ uint32_t Platform::FindProcesses(const ProcessInstanceInfoMatch &match_info, return match_count; } -Error Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { - Error error; +Status Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { + Status error; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("Platform::%s()", __FUNCTION__); @@ -1057,13 +1060,13 @@ Error Platform::LaunchProcess(ProcessLaunchInfo &launch_info) { return error; } -Error Platform::ShellExpandArguments(ProcessLaunchInfo &launch_info) { +Status Platform::ShellExpandArguments(ProcessLaunchInfo &launch_info) { if (IsHost()) return Host::ShellExpandArguments(launch_info); - return Error("base lldb_private::Platform class can't expand arguments"); + return Status("base lldb_private::Platform class can't expand arguments"); } -Error Platform::KillProcess(const lldb::pid_t pid) { +Status Platform::KillProcess(const lldb::pid_t pid) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("Platform::%s, pid %" PRIu64, __FUNCTION__, pid); @@ -1083,19 +1086,19 @@ Error Platform::KillProcess(const lldb::pid_t pid) { } if (!IsHost()) { - return Error( + return Status( "base lldb_private::Platform class can't kill remote processes unless " "they are controlled by a process plugin"); } Host::Kill(pid, SIGTERM); - return Error(); + return Status(); } lldb::ProcessSP Platform::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be nullptr, if nullptr create a // new target, else use existing one - Error &error) { + Status &error) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("Platform::%s entered (target %p)", __FUNCTION__, @@ -1186,7 +1189,7 @@ lldb::PlatformSP Platform::GetPlatformForArchitecture(const ArchSpec &arch, ArchSpec *platform_arch_ptr) { lldb::PlatformSP platform_sp; - Error error; + Status error; if (arch.IsValid()) platform_sp = Platform::Create(arch, platform_arch_ptr, error); return platform_sp; @@ -1230,8 +1233,8 @@ bool Platform::IsCompatibleArchitecture(const ArchSpec &arch, return false; } -Error Platform::PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid, uint32_t gid) { +Status Platform::PutFile(const FileSpec &source, const FileSpec &destination, + uint32_t uid, uint32_t gid) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("[PutFile] Using block by block transfer....\n"); @@ -1243,13 +1246,13 @@ Error Platform::PutFile(const FileSpec &source, const FileSpec &destination, source_open_options |= File::eOpenOptionDontFollowSymlinks; File source_file(source, source_open_options, lldb::eFilePermissionsUserRW); - Error error; + Status error; uint32_t permissions = source_file.GetPermissions(error); if (permissions == 0) permissions = lldb::eFilePermissionsFileDefault; if (!source_file.IsValid()) - return Error("PutFile: unable to open source file"); + return Status("PutFile: unable to open source file"); lldb::user_id_t dest_file = OpenFile( destination, File::eOpenOptionCanCreate | File::eOpenOptionWrite | File::eOpenOptionTruncate | File::eOpenOptionCloseOnExec, @@ -1260,7 +1263,7 @@ Error Platform::PutFile(const FileSpec &source, const FileSpec &destination, if (error.Fail()) return error; if (dest_file == UINT64_MAX) - return Error("unable to open target file"); + return Status("unable to open target file"); lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024, 0)); uint64_t offset = 0; for (;;) { @@ -1291,16 +1294,16 @@ Error Platform::PutFile(const FileSpec &source, const FileSpec &destination, return error; } -Error Platform::GetFile(const FileSpec &source, const FileSpec &destination) { - Error error("unimplemented"); +Status Platform::GetFile(const FileSpec &source, const FileSpec &destination) { + Status error("unimplemented"); return error; } -Error Platform::CreateSymlink( - const FileSpec &src, // The name of the link is in src - const FileSpec &dst) // The symlink points to dst +Status +Platform::CreateSymlink(const FileSpec &src, // The name of the link is in src + const FileSpec &dst) // The symlink points to dst { - Error error("unimplemented"); + Status error("unimplemented"); return error; } @@ -1308,8 +1311,8 @@ bool Platform::GetFileExists(const lldb_private::FileSpec &file_spec) { return false; } -Error Platform::Unlink(const FileSpec &path) { - Error error("unimplemented"); +Status Platform::Unlink(const FileSpec &path) { + Status error("unimplemented"); return error; } @@ -1323,7 +1326,7 @@ uint64_t Platform::ConvertMmapFlagsToPlatform(const ArchSpec &arch, return flags_platform; } -lldb_private::Error Platform::RunShellCommand( +lldb_private::Status Platform::RunShellCommand( const char *command, // Shouldn't be nullptr const FileSpec & working_dir, // Pass empty FileSpec to use the current working directory @@ -1339,7 +1342,7 @@ lldb_private::Error Platform::RunShellCommand( return Host::RunShellCommand(command, working_dir, status_ptr, signo_ptr, command_output, timeout_sec); else - return Error("unimplemented"); + return Status("unimplemented"); } bool Platform::CalculateMD5(const FileSpec &file_spec, uint64_t &low, @@ -1402,11 +1405,11 @@ void OptionGroupPlatformRSync::OptionParsingStarting( m_ignores_remote_hostname = false; } -lldb_private::Error +lldb_private::Status OptionGroupPlatformRSync::SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; char short_option = (char)GetDefinitions()[option_idx].short_option; switch (short_option) { case 'r': @@ -1448,11 +1451,11 @@ void OptionGroupPlatformSSH::OptionParsingStarting( m_ssh_opts.clear(); } -lldb_private::Error +lldb_private::Status OptionGroupPlatformSSH::SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; char short_option = (char)GetDefinitions()[option_idx].short_option; switch (short_option) { case 's': @@ -1480,10 +1483,10 @@ void OptionGroupPlatformCaching::OptionParsingStarting( m_cache_dir.clear(); } -lldb_private::Error OptionGroupPlatformCaching::SetOptionValue( +lldb_private::Status OptionGroupPlatformCaching::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; char short_option = (char)GetDefinitions()[option_idx].short_option; switch (short_option) { case 'c': @@ -1514,10 +1517,9 @@ const std::vector<ConstString> &Platform::GetTrapHandlerSymbolNames() { return m_trap_handlers; } -Error Platform::GetCachedExecutable(ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - Platform &remote_platform) { +Status Platform::GetCachedExecutable( + ModuleSpec &module_spec, lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, Platform &remote_platform) { const auto platform_spec = module_spec.GetFileSpec(); const auto error = LoadCachedExecutable( module_spec, module_sp, module_search_paths_ptr, remote_platform); @@ -1529,7 +1531,7 @@ Error Platform::GetCachedExecutable(ModuleSpec &module_spec, return error; } -Error Platform::LoadCachedExecutable( +Status Platform::LoadCachedExecutable( const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, Platform &remote_platform) { return GetRemoteSharedModule(module_spec, nullptr, module_sp, @@ -1540,11 +1542,11 @@ Error Platform::LoadCachedExecutable( nullptr); } -Error Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, - Process *process, - lldb::ModuleSP &module_sp, - const ModuleResolver &module_resolver, - bool *did_create_ptr) { +Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, + Process *process, + lldb::ModuleSP &module_sp, + const ModuleResolver &module_resolver, + bool *did_create_ptr) { // Get module information from a target. ModuleSpec resolved_module_spec; bool got_module_spec = false; @@ -1561,7 +1563,7 @@ Error Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, } if (module_spec.GetArchitecture().IsValid() == false) { - Error error; + Status error; // No valid architecture was specified, ask the platform for // the architectures that we should be using (in the correct order) // and see if we can find a match that way @@ -1600,7 +1602,7 @@ Error Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, const auto error = module_resolver(resolved_module_spec); if (error.Fail()) { if (GetCachedSharedModule(resolved_module_spec, module_sp, did_create_ptr)) - return Error(); + return Status(); } return error; @@ -1640,11 +1642,11 @@ bool Platform::GetCachedSharedModule(const ModuleSpec &module_spec, return false; } -Error Platform::DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, - const uint64_t src_size, - const FileSpec &dst_file_spec) { - Error error; +Status Platform::DownloadModuleSlice(const FileSpec &src_file_spec, + const uint64_t src_offset, + const uint64_t src_size, + const FileSpec &dst_file_spec) { + Status error; std::error_code EC; llvm::raw_fd_ostream dst(dst_file_spec.GetPath(), EC, llvm::sys::fs::F_None); @@ -1682,15 +1684,15 @@ Error Platform::DownloadModuleSlice(const FileSpec &src_file_spec, dst.write(&buffer[0], n_read); } - Error close_error; + Status close_error; CloseFile(src_fd, close_error); // Ignoring close error. return error; } -Error Platform::DownloadSymbolFile(const lldb::ModuleSP &module_sp, - const FileSpec &dst_file_spec) { - return Error( +Status Platform::DownloadSymbolFile(const lldb::ModuleSP &module_sp, + const FileSpec &dst_file_spec) { + return Status( "Symbol file downloading not supported by the default platform."); } @@ -1716,7 +1718,7 @@ const UnixSignalsSP &Platform::GetUnixSignals() { uint32_t Platform::LoadImage(lldb_private::Process *process, const lldb_private::FileSpec &local_file, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error) { + lldb_private::Status &error) { if (local_file && remote_file) { // Both local and remote file was specified. Install the local file to the // given location. @@ -1752,21 +1754,21 @@ uint32_t Platform::LoadImage(lldb_private::Process *process, uint32_t Platform::DoLoadImage(lldb_private::Process *process, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error) { + lldb_private::Status &error) { error.SetErrorString("LoadImage is not supported on the current platform"); return LLDB_INVALID_IMAGE_TOKEN; } -Error Platform::UnloadImage(lldb_private::Process *process, - uint32_t image_token) { - return Error("UnloadImage is not supported on the current platform"); +Status Platform::UnloadImage(lldb_private::Process *process, + uint32_t image_token) { + return Status("UnloadImage is not supported on the current platform"); } lldb::ProcessSP Platform::ConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error) { + lldb_private::Status &error) { error.Clear(); if (!target) { @@ -1795,7 +1797,7 @@ lldb::ProcessSP Platform::ConnectProcess(llvm::StringRef connect_url, } size_t Platform::ConnectToWaitingProcesses(lldb_private::Debugger &debugger, - lldb_private::Error &error) { + lldb_private::Status &error) { error.Clear(); return 0; } diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp index 0bc58f073bf1a..ff86b0dbe051a 100644 --- a/source/Target/Process.cpp +++ b/source/Target/Process.cpp @@ -415,10 +415,10 @@ void ProcessInstanceInfo::DumpAsTableRow(Stream &s, Platform *platform, } } -Error ProcessLaunchCommandOptions::SetOptionValue( +Status ProcessLaunchCommandOptions::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { - Error error; + Status error; const int short_option = m_getopt_table[option_idx].val; switch (short_option) { @@ -1610,13 +1610,13 @@ void Process::SetPublicState(StateType new_state, bool restarted) { } } -Error Process::Resume() { +Status Process::Resume() { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::Resume -- locking run lock"); if (!m_public_run_lock.TrySetRunning()) { - Error error("Resume request failed - process still running."); + Status error("Resume request failed - process still running."); if (log) log->Printf("Process::Resume: -- TrySetRunning failed, not resuming."); return error; @@ -1624,13 +1624,13 @@ Error Process::Resume() { return PrivateResume(); } -Error Process::ResumeSynchronous(Stream *stream) { +Status Process::ResumeSynchronous(Stream *stream) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS)); if (log) log->Printf("Process::ResumeSynchronous -- locking run lock"); if (!m_public_run_lock.TrySetRunning()) { - Error error("Resume request failed - process still running."); + Status error("Resume request failed - process still running."); if (log) log->Printf("Process::Resume: -- TrySetRunning failed, not resuming."); return error; @@ -1640,7 +1640,7 @@ Error Process::ResumeSynchronous(Stream *stream) { Listener::MakeListener("lldb.Process.ResumeSynchronous.hijack")); HijackProcessEvents(listener_sp); - Error error = PrivateResume(); + Status error = PrivateResume(); if (error.Success()) { StateType state = WaitForProcessToStop(llvm::None, NULL, true, listener_sp, stream); @@ -1813,8 +1813,8 @@ void Process::DisableAllBreakpointSites() { }); } -Error Process::ClearBreakpointSiteByID(lldb::user_id_t break_id) { - Error error(DisableBreakpointSiteByID(break_id)); +Status Process::ClearBreakpointSiteByID(lldb::user_id_t break_id) { + Status error(DisableBreakpointSiteByID(break_id)); if (error.Success()) m_breakpoint_site_list.Remove(break_id); @@ -1822,8 +1822,8 @@ Error Process::ClearBreakpointSiteByID(lldb::user_id_t break_id) { return error; } -Error Process::DisableBreakpointSiteByID(lldb::user_id_t break_id) { - Error error; +Status Process::DisableBreakpointSiteByID(lldb::user_id_t break_id) { + Status error; BreakpointSiteSP bp_site_sp = m_breakpoint_site_list.FindByID(break_id); if (bp_site_sp) { if (bp_site_sp->IsEnabled()) @@ -1836,8 +1836,8 @@ Error Process::DisableBreakpointSiteByID(lldb::user_id_t break_id) { return error; } -Error Process::EnableBreakpointSiteByID(lldb::user_id_t break_id) { - Error error; +Status Process::EnableBreakpointSiteByID(lldb::user_id_t break_id) { + Status error; BreakpointSiteSP bp_site_sp = m_breakpoint_site_list.FindByID(break_id); if (bp_site_sp) { if (!bp_site_sp->IsEnabled()) @@ -1882,7 +1882,7 @@ Process::CreateBreakpointSite(const BreakpointLocationSP &owner, if (owner->ShouldResolveIndirectFunctions()) { Symbol *symbol = owner->GetAddress().CalculateSymbolContextSymbol(); if (symbol && symbol->IsIndirect()) { - Error error; + Status error; Address symbol_address = symbol->GetAddress(); load_addr = ResolveIndirectFunction(&symbol_address, error); if (!error.Success() && show_error) { @@ -1919,7 +1919,7 @@ Process::CreateBreakpointSite(const BreakpointLocationSP &owner, bp_site_sp.reset(new BreakpointSite(&m_breakpoint_site_list, owner, load_addr, use_hardware)); if (bp_site_sp) { - Error error = EnableBreakpointSite(bp_site_sp.get()); + Status error = EnableBreakpointSite(bp_site_sp.get()); if (error.Success()) { owner->SetBreakpointSite(bp_site_sp); return m_breakpoint_site_list.Add(bp_site_sp); @@ -1989,8 +1989,8 @@ size_t Process::GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site) { return 0; } -Error Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { - Error error; +Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { + Status error; assert(bp_site != nullptr); Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); const addr_t bp_addr = bp_site->GetLoadAddress(); @@ -2065,8 +2065,8 @@ Error Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) { return error; } -Error Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) { - Error error; +Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) { + Status error; assert(bp_site != nullptr); Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); addr_t bp_addr = bp_site->GetLoadAddress(); @@ -2158,7 +2158,7 @@ Error Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) { // Uncomment to verify memory caching works after making changes to caching code //#define VERIFY_MEMORY_READS -size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Error &error) { +size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Status &error) { error.Clear(); if (!GetDisableMemoryCache()) { #if defined(VERIFY_MEMORY_READS) @@ -2177,7 +2177,7 @@ size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Error &error) { assert(verify_buf.size() == size); const size_t cache_bytes_read = m_memory_cache.Read(this, addr, buf, size, error); - Error verify_error; + Status verify_error; const size_t verify_bytes_read = ReadMemoryFromInferior(addr, const_cast<char *>(verify_buf.data()), verify_buf.size(), verify_error); @@ -2200,7 +2200,7 @@ size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Error &error) { } size_t Process::ReadCStringFromMemory(addr_t addr, std::string &out_str, - Error &error) { + Status &error) { char buf[256]; out_str.clear(); addr_t curr_addr = addr; @@ -2220,7 +2220,7 @@ size_t Process::ReadCStringFromMemory(addr_t addr, std::string &out_str, } size_t Process::ReadStringFromMemory(addr_t addr, char *dst, size_t max_bytes, - Error &error, size_t type_width) { + Status &error, size_t type_width) { size_t total_bytes_read = 0; if (dst && max_bytes && type_width && max_bytes >= type_width) { // Ensure a null terminator independent of the number of bytes that is read. @@ -2273,13 +2273,14 @@ size_t Process::ReadStringFromMemory(addr_t addr, char *dst, size_t max_bytes, // correct code to find // null terminators. size_t Process::ReadCStringFromMemory(addr_t addr, char *dst, - size_t dst_max_len, Error &result_error) { + size_t dst_max_len, + Status &result_error) { size_t total_cstr_len = 0; if (dst && dst_max_len) { result_error.Clear(); // NULL out everything just to be safe memset(dst, 0, dst_max_len); - Error error; + Status error; addr_t curr_addr = addr; const size_t cache_line_size = m_memory_cache.GetMemoryCacheLineSize(); size_t bytes_left = dst_max_len - 1; @@ -2318,7 +2319,7 @@ size_t Process::ReadCStringFromMemory(addr_t addr, char *dst, } size_t Process::ReadMemoryFromInferior(addr_t addr, void *buf, size_t size, - Error &error) { + Status &error) { if (buf == nullptr || size == 0) return 0; @@ -2344,7 +2345,7 @@ size_t Process::ReadMemoryFromInferior(addr_t addr, void *buf, size_t size, uint64_t Process::ReadUnsignedIntegerFromMemory(lldb::addr_t vm_addr, size_t integer_byte_size, uint64_t fail_value, - Error &error) { + Status &error) { Scalar scalar; if (ReadScalarIntegerFromMemory(vm_addr, integer_byte_size, false, scalar, error)) @@ -2354,7 +2355,8 @@ uint64_t Process::ReadUnsignedIntegerFromMemory(lldb::addr_t vm_addr, int64_t Process::ReadSignedIntegerFromMemory(lldb::addr_t vm_addr, size_t integer_byte_size, - int64_t fail_value, Error &error) { + int64_t fail_value, + Status &error) { Scalar scalar; if (ReadScalarIntegerFromMemory(vm_addr, integer_byte_size, true, scalar, error)) @@ -2362,7 +2364,7 @@ int64_t Process::ReadSignedIntegerFromMemory(lldb::addr_t vm_addr, return fail_value; } -addr_t Process::ReadPointerFromMemory(lldb::addr_t vm_addr, Error &error) { +addr_t Process::ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error) { Scalar scalar; if (ReadScalarIntegerFromMemory(vm_addr, GetAddressByteSize(), false, scalar, error)) @@ -2371,7 +2373,7 @@ addr_t Process::ReadPointerFromMemory(lldb::addr_t vm_addr, Error &error) { } bool Process::WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, - Error &error) { + Status &error) { Scalar scalar; const uint32_t addr_byte_size = GetAddressByteSize(); if (addr_byte_size <= 4) @@ -2383,7 +2385,7 @@ bool Process::WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, } size_t Process::WriteMemoryPrivate(addr_t addr, const void *buf, size_t size, - Error &error) { + Status &error) { size_t bytes_written = 0; const uint8_t *bytes = (const uint8_t *)buf; @@ -2399,7 +2401,7 @@ size_t Process::WriteMemoryPrivate(addr_t addr, const void *buf, size_t size, } size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size, - Error &error) { + Status &error) { #if defined(ENABLE_MEMORY_CACHING) m_memory_cache.Flush(addr, size); #endif @@ -2478,7 +2480,7 @@ size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size, } size_t Process::WriteScalarToMemory(addr_t addr, const Scalar &scalar, - size_t byte_size, Error &error) { + size_t byte_size, Status &error) { if (byte_size == UINT32_MAX) byte_size = scalar.GetByteSize(); if (byte_size > 0) { @@ -2497,7 +2499,7 @@ size_t Process::WriteScalarToMemory(addr_t addr, const Scalar &scalar, size_t Process::ReadScalarIntegerFromMemory(addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, - Error &error) { + Status &error) { uint64_t uval = 0; if (byte_size == 0) { error.SetErrorString("byte size is zero"); @@ -2527,7 +2529,7 @@ size_t Process::ReadScalarIntegerFromMemory(addr_t addr, uint32_t byte_size, #define USE_ALLOCATE_MEMORY_CACHE 1 addr_t Process::AllocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { if (GetPrivateState() != eStateStopped) return LLDB_INVALID_ADDRESS; @@ -2548,7 +2550,7 @@ addr_t Process::AllocateMemory(size_t size, uint32_t permissions, } addr_t Process::CallocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { addr_t return_addr = AllocateMemory(size, permissions, error); if (error.Success()) { std::string buffer(size, 0); @@ -2560,7 +2562,7 @@ addr_t Process::CallocateMemory(size_t size, uint32_t permissions, bool Process::CanJIT() { if (m_can_jit == eCanJITDontKnow) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - Error err; + Status err; uint64_t allocated_memory = AllocateMemory( 8, ePermissionsReadable | ePermissionsWritable | ePermissionsExecutable, @@ -2595,8 +2597,8 @@ void Process::SetCanRunCode(bool can_run_code) { m_can_interpret_function_calls = can_run_code; } -Error Process::DeallocateMemory(addr_t ptr) { - Error error; +Status Process::DeallocateMemory(addr_t ptr) { + Status error; #if defined(USE_ALLOCATE_MEMORY_CACHE) if (!m_allocated_memory_cache.DeallocateMemory(ptr)) { error.SetErrorStringWithFormat( @@ -2625,7 +2627,7 @@ ModuleSP Process::ReadModuleFromMemory(const FileSpec &file_spec, } ModuleSP module_sp(new Module(file_spec, ArchSpec())); if (module_sp) { - Error error; + Status error; ObjectFile *objfile = module_sp->GetMemoryObjectFile( shared_from_this(), header_addr, error, size_to_read); if (objfile) @@ -2638,7 +2640,7 @@ bool Process::GetLoadAddressPermissions(lldb::addr_t load_addr, uint32_t &permissions) { MemoryRegionInfo range_info; permissions = 0; - Error error(GetMemoryRegionInfo(load_addr, range_info)); + Status error(GetMemoryRegionInfo(load_addr, range_info)); if (!error.Success()) return false; if (range_info.GetReadable() == MemoryRegionInfo::eDontKnow || @@ -2659,14 +2661,14 @@ bool Process::GetLoadAddressPermissions(lldb::addr_t load_addr, return true; } -Error Process::EnableWatchpoint(Watchpoint *watchpoint, bool notify) { - Error error; +Status Process::EnableWatchpoint(Watchpoint *watchpoint, bool notify) { + Status error; error.SetErrorString("watchpoints are not supported"); return error; } -Error Process::DisableWatchpoint(Watchpoint *watchpoint, bool notify) { - Error error; +Status Process::DisableWatchpoint(Watchpoint *watchpoint, bool notify) { + Status error; error.SetErrorString("watchpoints are not supported"); return error; } @@ -2702,8 +2704,8 @@ void Process::LoadOperatingSystemPlugin(bool flush) { Flush(); } -Error Process::Launch(ProcessLaunchInfo &launch_info) { - Error error; +Status Process::Launch(ProcessLaunchInfo &launch_info) { + Status error; m_abi_sp.reset(); m_dyld_ap.reset(); m_jit_loaders_ap.reset(); @@ -2823,8 +2825,8 @@ Error Process::Launch(ProcessLaunchInfo &launch_info) { return error; } -Error Process::LoadCore() { - Error error = DoLoadCore(); +Status Process::LoadCore() { + Status error = DoLoadCore(); if (error.Success()) { ListenerSP listener_sp( Listener::MakeListener("lldb.process.load_core_listener")); @@ -2977,7 +2979,7 @@ ListenerSP ProcessAttachInfo::GetListenerForProcess(Debugger &debugger) { return debugger.GetListener(); } -Error Process::Attach(ProcessAttachInfo &attach_info) { +Status Process::Attach(ProcessAttachInfo &attach_info) { m_abi_sp.reset(); m_process_input_reader.reset(); m_dyld_ap.reset(); @@ -2987,7 +2989,7 @@ Error Process::Attach(ProcessAttachInfo &attach_info) { m_stop_info_override_callback = nullptr; lldb::pid_t attach_pid = attach_info.GetProcessID(); - Error error; + Status error; if (attach_pid == LLDB_INVALID_PROCESS_ID) { char process_name[PATH_MAX]; @@ -3221,14 +3223,14 @@ void Process::CompleteAttach() { m_stop_info_override_callback = process_arch.GetStopInfoOverrideCallback(); } -Error Process::ConnectRemote(Stream *strm, llvm::StringRef remote_url) { +Status Process::ConnectRemote(Stream *strm, llvm::StringRef remote_url) { m_abi_sp.reset(); m_process_input_reader.reset(); // Find the process and its architecture. Make sure it matches the // architecture of the current Target, and if not adjust it. - Error error(DoConnectRemote(strm, remote_url)); + Status error(DoConnectRemote(strm, remote_url)); if (error.Success()) { if (GetID() != LLDB_INVALID_PROCESS_ID) { EventSP event_sp; @@ -3253,7 +3255,7 @@ Error Process::ConnectRemote(Stream *strm, llvm::StringRef remote_url) { return error; } -Error Process::PrivateResume() { +Status Process::PrivateResume() { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_STEP)); if (log) @@ -3266,7 +3268,7 @@ Error Process::PrivateResume() { // our signal filters before resuming. UpdateAutomaticSignalFiltering(); - Error error(WillResume()); + Status error(WillResume()); // Tell the process it is about to resume before the thread list if (error.Success()) { // Now let the thread list know we are about to resume so it @@ -3311,9 +3313,9 @@ Error Process::PrivateResume() { return error; } -Error Process::Halt(bool clear_thread_plans, bool use_run_lock) { +Status Process::Halt(bool clear_thread_plans, bool use_run_lock) { if (!StateIsRunningState(m_public_state.GetValue())) - return Error("Process is not running."); + return Status("Process is not running."); // Don't clear the m_clear_thread_plans_on_stop, only set it to true if // in case it was already set and some thread plan logic calls halt on its @@ -3334,7 +3336,7 @@ Error Process::Halt(bool clear_thread_plans, bool use_run_lock) { RestoreProcessEvents(); SetExitStatus(SIGKILL, "Cancelled async attach."); Destroy(false); - return Error(); + return Status(); } // Wait for 10 second for the process to stop. @@ -3344,16 +3346,16 @@ Error Process::Halt(bool clear_thread_plans, bool use_run_lock) { if (state == eStateInvalid || !event_sp) { // We timed out and didn't get a stop event... - return Error("Halt timed out. State = %s", StateAsCString(GetState())); + return Status("Halt timed out. State = %s", StateAsCString(GetState())); } BroadcastEvent(event_sp); - return Error(); + return Status(); } -Error Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) { - Error error; +Status Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) { + Status error; // Check both the public & private states here. If we're hung evaluating an // expression, for instance, then @@ -3400,18 +3402,19 @@ Error Process::StopForDestroyOrDetach(lldb::EventSP &exit_event_sp) { // then continue on. StateType private_state = m_private_state.GetValue(); if (private_state != eStateStopped) { - return Error("Attempt to stop the target in order to detach timed out. " - "State = %s", - StateAsCString(GetState())); + return Status( + "Attempt to stop the target in order to detach timed out. " + "State = %s", + StateAsCString(GetState())); } } } return error; } -Error Process::Detach(bool keep_stopped) { +Status Process::Detach(bool keep_stopped) { EventSP exit_event_sp; - Error error; + Status error; m_destroy_in_process = true; error = WillDetach(); @@ -3463,7 +3466,7 @@ Error Process::Detach(bool keep_stopped) { return error; } -Error Process::Destroy(bool force_kill) { +Status Process::Destroy(bool force_kill) { // Tell ourselves we are in the process of destroying the process, so that we // don't do any unnecessary work @@ -3483,7 +3486,7 @@ Error Process::Destroy(bool force_kill) { m_destroy_in_process = true; - Error error(WillDestroy()); + Status error(WillDestroy()); if (error.Success()) { EventSP exit_event_sp; if (DestroyRequiresHalt()) { @@ -3538,8 +3541,8 @@ Error Process::Destroy(bool force_kill) { return error; } -Error Process::Signal(int signal) { - Error error(WillSignal()); +Status Process::Signal(int signal) { + Status error(WillSignal()); if (error.Success()) { error = DoSignal(signal); if (error.Success()) @@ -3967,9 +3970,9 @@ void Process::HandlePrivateEvent(EventSP &event_sp) { } } -Error Process::HaltPrivate() { +Status Process::HaltPrivate() { EventSP event_sp; - Error error(WillHalt()); + Status error(WillHalt()); if (error.Fail()) return error; @@ -4037,7 +4040,7 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) { log->Printf("Process::%s (arg = %p, pid = %" PRIu64 ") woke up with an interrupt - Halting.", __FUNCTION__, static_cast<void *>(this), GetID()); - Error error = HaltPrivate(); + Status error = HaltPrivate(); if (error.Fail() && log) log->Printf("Process::%s (arg = %p, pid = %" PRIu64 ") failed to halt the process: %s", @@ -4477,7 +4480,7 @@ Process::GetStructuredDataPlugin(const ConstString &type_name) const { return StructuredDataPluginSP(); } -size_t Process::GetAsyncProfileData(char *buf, size_t buf_size, Error &error) { +size_t Process::GetAsyncProfileData(char *buf, size_t buf_size, Status &error) { std::lock_guard<std::recursive_mutex> guard(m_profile_data_comm_mutex); if (m_profile_data.empty()) return 0; @@ -4505,7 +4508,7 @@ size_t Process::GetAsyncProfileData(char *buf, size_t buf_size, Error &error) { // Process STDIO //------------------------------------------------------------------ -size_t Process::GetSTDOUT(char *buf, size_t buf_size, Error &error) { +size_t Process::GetSTDOUT(char *buf, size_t buf_size, Status &error) { std::lock_guard<std::recursive_mutex> guard(m_stdio_communication_mutex); size_t bytes_available = m_stdout_data.size(); if (bytes_available > 0) { @@ -4525,7 +4528,7 @@ size_t Process::GetSTDOUT(char *buf, size_t buf_size, Error &error) { return bytes_available; } -size_t Process::GetSTDERR(char *buf, size_t buf_size, Error &error) { +size_t Process::GetSTDERR(char *buf, size_t buf_size, Status &error) { std::lock_guard<std::recursive_mutex> gaurd(m_stdio_communication_mutex); size_t bytes_available = m_stderr_data.size(); if (bytes_available > 0) { @@ -4588,7 +4591,7 @@ public: SelectHelper select_helper; select_helper.FDSetRead(read_fd); select_helper.FDSetRead(pipe_read_fd); - Error error = select_helper.Select(); + Status error = select_helper.Select(); if (error.Fail()) { SetIsDone(true); @@ -4606,7 +4609,7 @@ public: if (select_helper.FDIsSetRead(pipe_read_fd)) { size_t bytes_read; // Consume the interrupt byte - Error error = m_pipe.Read(&ch, 1, bytes_read); + Status error = m_pipe.Read(&ch, 1, bytes_read); if (error.Success()) { switch (ch) { case 'q': @@ -4657,7 +4660,7 @@ public: if (m_active) { char ch = 'i'; // Send 'i' for interrupt size_t bytes_written = 0; - Error result = m_pipe.Write(&ch, 1, bytes_written); + Status result = m_pipe.Write(&ch, 1, bytes_written); return result.Success(); } else { // This IOHandler might be pushed on the stack, but not being run @@ -5082,7 +5085,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx, if (do_resume) { num_resumes++; - Error resume_error = PrivateResume(); + Status resume_error = PrivateResume(); if (!resume_error.Success()) { diagnostic_manager.Printf( eDiagnosticSeverityError, @@ -5361,7 +5364,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx, bool do_halt = true; const uint32_t num_retries = 5; while (try_halt_again < num_retries) { - Error halt_error; + Status halt_error; if (do_halt) { if (log) log->Printf("Process::RunThreadPlan(): Running Halt."); @@ -5473,7 +5476,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx, // plan, shut it down now. if (backup_private_state_thread.IsJoinable()) { StopPrivateStateThread(); - Error error; + Status error; m_private_state_thread = backup_private_state_thread; if (stopper_base_plan_sp) { thread->DiscardThreadPlansUpToPlan(stopper_base_plan_sp); @@ -5862,7 +5865,7 @@ void Process::DidExec() { target.DidExec(); } -addr_t Process::ResolveIndirectFunction(const Address *address, Error &error) { +addr_t Process::ResolveIndirectFunction(const Address *address, Status &error) { if (address == nullptr) { error.SetErrorString("Invalid address argument"); return LLDB_INVALID_ADDRESS; @@ -6090,10 +6093,10 @@ Process::AdvanceAddressToNextBranchInstruction(Address default_stop_addr, return retval; } -Error Process::GetMemoryRegions( - std::vector<lldb::MemoryRegionInfoSP> ®ion_list) { +Status +Process::GetMemoryRegions(std::vector<lldb::MemoryRegionInfoSP> ®ion_list) { - Error error; + Status error; lldb::addr_t range_end = 0; @@ -6116,12 +6119,13 @@ Error Process::GetMemoryRegions( return error; } -Error Process::ConfigureStructuredData( - const ConstString &type_name, const StructuredData::ObjectSP &config_sp) { +Status +Process::ConfigureStructuredData(const ConstString &type_name, + const StructuredData::ObjectSP &config_sp) { // If you get this, the Process-derived class needs to implement a method // to enable an already-reported asynchronous structured data feature. // See ProcessGDBRemote for an example implementation over gdb-remote. - return Error("unimplemented"); + return Status("unimplemented"); } void Process::MapSupportedStructuredDataPlugins( @@ -6158,8 +6162,7 @@ void Process::MapSupportedStructuredDataPlugins( } const_type_names.insert(ConstString(type_name->GetValue())); - if (log) - log->Printf("- %s", type_name->GetValue().c_str()); + LLDB_LOG(log, "- {0}", type_name->GetValue()); return true; }); @@ -6229,8 +6232,8 @@ bool Process::RouteAsyncStructuredData( return true; } -Error Process::UpdateAutomaticSignalFiltering() { +Status Process::UpdateAutomaticSignalFiltering() { // Default implementation does nothign. // No automatic signal filtering to speak of. - return Error(); + return Status(); } diff --git a/source/Target/ProcessLaunchInfo.cpp b/source/Target/ProcessLaunchInfo.cpp index 7de55f2fdcf9a..3fa40dcc5cab2 100644 --- a/source/Target/ProcessLaunchInfo.cpp +++ b/source/Target/ProcessLaunchInfo.cpp @@ -330,7 +330,7 @@ void ProcessLaunchInfo::FinalizeFileActions(Target *target, } bool ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell( - Error &error, bool localhost, bool will_debug, + Status &error, bool localhost, bool will_debug, bool first_arg_is_full_shell_command, int32_t num_resumes) { error.Clear(); diff --git a/source/Target/RegisterContext.cpp b/source/Target/RegisterContext.cpp index 6cbfb04a6e9ab..66164c175e416 100644 --- a/source/Target/RegisterContext.cpp +++ b/source/Target/RegisterContext.cpp @@ -91,7 +91,7 @@ RegisterContext::UpdateDynamicRegisterSize(const lldb_private::ArchSpec &arch, DWARFExpression dwarf_expr(opcode_ctx, dwarf_data, nullptr, 0, dwarf_opcode_len); Value result; - Error error; + Status error; const lldb::offset_t offset = 0; if (dwarf_expr.Evaluate(&exe_ctx, nullptr, nullptr, this, opcode_ctx, dwarf_data, nullptr, offset, dwarf_opcode_len, @@ -299,11 +299,10 @@ bool RegisterContext::ClearHardwareWatchpoint(uint32_t hw_index) { bool RegisterContext::HardwareSingleStep(bool enable) { return false; } -Error RegisterContext::ReadRegisterValueFromMemory(const RegisterInfo *reg_info, - lldb::addr_t src_addr, - uint32_t src_len, - RegisterValue ®_value) { - Error error; +Status RegisterContext::ReadRegisterValueFromMemory( + const RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, + RegisterValue ®_value) { + Status error; if (reg_info == nullptr) { error.SetErrorString("invalid register info argument."); return error; @@ -318,7 +317,7 @@ Error RegisterContext::ReadRegisterValueFromMemory(const RegisterInfo *reg_info, // // Case 2: src_len > dst_len // - // Error! (The register should always be big enough to hold the data) + // Status! (The register should always be big enough to hold the data) // // Case 3: src_len < dst_len // @@ -371,12 +370,12 @@ Error RegisterContext::ReadRegisterValueFromMemory(const RegisterInfo *reg_info, return error; } -Error RegisterContext::WriteRegisterValueToMemory( +Status RegisterContext::WriteRegisterValueToMemory( const RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value) { uint8_t dst[RegisterValue::kMaxRegisterByteSize]; - Error error; + Status error; ProcessSP process_sp(m_thread.GetProcess()); if (process_sp) { diff --git a/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp index 7b7b596c9773d..9deebcaf9250d 100644 --- a/source/Target/StackFrame.cpp +++ b/source/Target/StackFrame.cpp @@ -488,7 +488,7 @@ StackFrame::GetInScopeVariableList(bool get_file_globals, ValueObjectSP StackFrame::GetValueForVariableExpressionPath( llvm::StringRef var_expr, DynamicValueType use_dynamic, uint32_t options, - VariableSP &var_sp, Error &error) { + VariableSP &var_sp, Status &error) { llvm::StringRef original_var_expr = var_expr; // We can't fetch variable information for a history stack frame. if (m_is_history_frame) @@ -631,7 +631,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // If we have a non pointer type with a sythetic value then lets check if // we have an sythetic dereference specified. if (!valobj_sp->IsPointerType() && valobj_sp->HasSyntheticValue()) { - Error deref_error; + Status deref_error; if (valobj_sp->GetCompilerType().IsReferenceType()) { valobj_sp = valobj_sp->GetSyntheticValue()->Dereference(deref_error); if (error.Fail()) { @@ -775,7 +775,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // what we have is *ptr[low]. the most similar C++ syntax is to deref // ptr and extract bit low out of it. reading array item low would be // done by saying ptr[low], without a deref * sign - Error error; + Status error; ValueObjectSP temp(valobj_sp->Dereference(error)); if (error.Fail()) { valobj_sp->GetExpressionPath(var_expr_path_strm, false); @@ -794,7 +794,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // (an operation that is equivalent to deref-ing arr) // and extract bit low out of it. reading array item low // would be done by saying arr[low], without a deref * sign - Error error; + Status error; ValueObjectSP temp(valobj_sp->GetChildAtIndex(0, true)); if (error.Fail()) { valobj_sp->GetExpressionPath(var_expr_path_strm, false); @@ -977,7 +977,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // deref ptr and extract bits low thru high out of it. reading array // items low thru high would be done by saying ptr[low-high], without // a deref * sign - Error error; + Status error; ValueObjectSP temp(valobj_sp->Dereference(error)); if (error.Fail()) { valobj_sp->GetExpressionPath(var_expr_path_strm, false); @@ -994,7 +994,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( // arr[0] (an operation that is equivalent to deref-ing arr) and extract // bits low thru high out of it. reading array items low thru high would // be done by saying arr[low-high], without a deref * sign - Error error; + Status error; ValueObjectSP temp(valobj_sp->GetChildAtIndex(0, true)); if (error.Fail()) { valobj_sp->GetExpressionPath(var_expr_path_strm, false); @@ -1065,7 +1065,7 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath( return valobj_sp; } -bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Error *error_ptr) { +bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Status *error_ptr) { std::lock_guard<std::recursive_mutex> guard(m_mutex); if (!m_cfa_is_valid) { m_frame_base_error.SetErrorString( @@ -1111,7 +1111,7 @@ bool StackFrame::GetFrameBaseValue(Scalar &frame_base, Error *error_ptr) { return m_frame_base_error.Success(); } -DWARFExpression *StackFrame::GetFrameBaseExpression(Error *error_ptr) { +DWARFExpression *StackFrame::GetFrameBaseExpression(Status *error_ptr) { if (!m_sc.function) { if (error_ptr) { error_ptr->SetErrorString("No function in symbol context."); @@ -1426,7 +1426,7 @@ ValueObjectSP GetValueForDereferincingOffset(StackFrame &frame, return ValueObjectSP(); } - Error error; + Status error; ValueObjectSP pointee = base->Dereference(error); if (!pointee) { diff --git a/source/Target/StopInfo.cpp b/source/Target/StopInfo.cpp index 8d40c7678b967..6af5ce1b2ebf9 100644 --- a/source/Target/StopInfo.cpp +++ b/source/Target/StopInfo.cpp @@ -435,7 +435,7 @@ protected: // shouldn't stop that will win. if (bp_loc_sp->GetConditionText() != nullptr) { - Error condition_error; + Status condition_error; bool condition_says_stop = bp_loc_sp->ConditionSaysStop(exe_ctx, condition_error); @@ -796,7 +796,7 @@ protected: expr_options.SetUnwindOnError(true); expr_options.SetIgnoreBreakpoints(true); ValueObjectSP result_value_sp; - Error error; + Status error; result_code = UserExpression::Evaluate( exe_ctx, expr_options, wp_sp->GetConditionText(), llvm::StringRef(), result_value_sp, error); diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp index 5c9e92aaaa27b..5c46a024be60f 100644 --- a/source/Target/Target.cpp +++ b/source/Target/Target.cpp @@ -182,7 +182,7 @@ const lldb::ProcessSP &Target::CreateProcess(ListenerSP listener_sp, const lldb::ProcessSP &Target::GetProcessSP() const { return m_process_sp; } -lldb::REPLSP Target::GetREPL(Error &err, lldb::LanguageType language, +lldb::REPLSP Target::GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create) { if (language == eLanguageTypeUnknown) { std::set<LanguageType> repl_languages; @@ -547,7 +547,7 @@ BreakpointSP Target::CreateFuncRegexBreakpoint( lldb::BreakpointSP Target::CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, - Args *additional_args, Error *error) { + Args *additional_args, Status *error) { BreakpointSP exc_bkpt_sp = LanguageRuntime::CreateExceptionBreakpoint( *this, language, catch_bp, throw_bp, internal); if (exc_bkpt_sp && additional_args) { @@ -604,9 +604,9 @@ bool Target::ProcessIsValid() { return (m_process_sp && m_process_sp->IsAlive()); } -static bool CheckIfWatchpointsExhausted(Target *target, Error &error) { +static bool CheckIfWatchpointsExhausted(Target *target, Status &error) { uint32_t num_supported_hardware_watchpoints; - Error rc = target->GetProcessSP()->GetWatchpointSupportInfo( + Status rc = target->GetProcessSP()->GetWatchpointSupportInfo( num_supported_hardware_watchpoints); if (num_supported_hardware_watchpoints == 0) { error.SetErrorStringWithFormat( @@ -621,7 +621,7 @@ static bool CheckIfWatchpointsExhausted(Target *target, Error &error) { // the OptionGroupWatchpoint::WatchType enum type. WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, - Error &error) { + Status &error) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf("Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64 @@ -797,10 +797,10 @@ bool Target::EnableBreakpointByID(break_id_t break_id) { return false; } -Error Target::SerializeBreakpointsToFile(const FileSpec &file, - const BreakpointIDList &bp_ids, - bool append) { - Error error; +Status Target::SerializeBreakpointsToFile(const FileSpec &file, + const BreakpointIDList &bp_ids, + bool append) { + Status error; if (!file) { error.SetErrorString("Invalid FileSpec."); @@ -891,19 +891,19 @@ Error Target::SerializeBreakpointsToFile(const FileSpec &file, return error; } -Error Target::CreateBreakpointsFromFile(const FileSpec &file, - BreakpointIDList &new_bps) { +Status Target::CreateBreakpointsFromFile(const FileSpec &file, + BreakpointIDList &new_bps) { std::vector<std::string> no_names; return CreateBreakpointsFromFile(file, no_names, new_bps); } -Error Target::CreateBreakpointsFromFile(const FileSpec &file, - std::vector<std::string> &names, - BreakpointIDList &new_bps) { +Status Target::CreateBreakpointsFromFile(const FileSpec &file, + std::vector<std::string> &names, + BreakpointIDList &new_bps) { std::unique_lock<std::recursive_mutex> lock; GetBreakpointList().GetListMutex(lock); - Error error; + Status error; StructuredData::ObjectSP input_data_sp = StructuredData::ParseJSONFromFile(file, error); if (!error.Success()) { @@ -979,7 +979,7 @@ bool Target::RemoveAllWatchpoints(bool end_to_end) { if (!wp_sp) return false; - Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } @@ -1011,7 +1011,7 @@ bool Target::DisableAllWatchpoints(bool end_to_end) { if (!wp_sp) return false; - Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } @@ -1041,7 +1041,7 @@ bool Target::EnableAllWatchpoints(bool end_to_end) { if (!wp_sp) return false; - Error rc = m_process_sp->EnableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->EnableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } @@ -1114,7 +1114,7 @@ bool Target::DisableWatchpointByID(lldb::watch_id_t watch_id) { WatchpointSP wp_sp = m_watchpoint_list.FindByID(watch_id); if (wp_sp) { - Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Success()) return true; @@ -1134,7 +1134,7 @@ bool Target::EnableWatchpointByID(lldb::watch_id_t watch_id) { WatchpointSP wp_sp = m_watchpoint_list.FindByID(watch_id); if (wp_sp) { - Error rc = m_process_sp->EnableWatchpoint(wp_sp.get()); + Status rc = m_process_sp->EnableWatchpoint(wp_sp.get()); if (rc.Success()) return true; @@ -1198,7 +1198,7 @@ Module *Target::GetExecutableModulePointer() { static void LoadScriptingResourceForModule(const ModuleSP &module_sp, Target *target) { - Error error; + Status error; StreamString feedback_stream; if (module_sp && !module_sp->LoadScriptingResourceInTarget(target, error, @@ -1235,7 +1235,8 @@ void Target::SetExecutableModule(ModuleSP &executable_sp, ClearModules(false); if (executable_sp) { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer(func_cat, "Target::SetExecutableModule (executable = '%s')", executable_sp->GetFileSpec().GetPath().c_str()); @@ -1335,9 +1336,9 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec) { arch_spec.GetArchitectureName(), arch_spec.GetTriple().getTriple().c_str()); ModuleSpec module_spec(executable_sp->GetFileSpec(), other); - Error error = ModuleList::GetSharedModule(module_spec, executable_sp, - &GetExecutableSearchPaths(), - nullptr, nullptr); + Status error = ModuleList::GetSharedModule(module_spec, executable_sp, + &GetExecutableSearchPaths(), + nullptr, nullptr); if (!error.Fail() && executable_sp) { SetExecutableModule(executable_sp, true); @@ -1474,7 +1475,7 @@ bool Target::ModuleIsExcludedForUnconstrainedSearches( } size_t Target::ReadMemoryFromFileCache(const Address &addr, void *dst, - size_t dst_len, Error &error) { + size_t dst_len, Status &error) { SectionSP section_sp(addr.GetSection()); if (section_sp) { // If the contents of this section are encrypted, the on-disk file is @@ -1506,7 +1507,7 @@ size_t Target::ReadMemoryFromFileCache(const Address &addr, void *dst, } size_t Target::ReadMemory(const Address &addr, bool prefer_file_cache, - void *dst, size_t dst_len, Error &error, + void *dst, size_t dst_len, Status &error, lldb::addr_t *load_addr_ptr) { error.Clear(); @@ -1598,7 +1599,7 @@ size_t Target::ReadMemory(const Address &addr, bool prefer_file_cache, } size_t Target::ReadCStringFromMemory(const Address &addr, std::string &out_str, - Error &error) { + Status &error) { char buf[256]; out_str.clear(); addr_t curr_addr = addr.GetLoadAddress(this); @@ -1620,13 +1621,13 @@ size_t Target::ReadCStringFromMemory(const Address &addr, std::string &out_str, } size_t Target::ReadCStringFromMemory(const Address &addr, char *dst, - size_t dst_max_len, Error &result_error) { + size_t dst_max_len, Status &result_error) { size_t total_cstr_len = 0; if (dst && dst_max_len) { result_error.Clear(); // NULL out everything just to be safe memset(dst, 0, dst_max_len); - Error error; + Status error; addr_t curr_addr = addr.GetLoadAddress(this); Address address(addr); @@ -1675,7 +1676,7 @@ size_t Target::ReadCStringFromMemory(const Address &addr, char *dst, size_t Target::ReadScalarIntegerFromMemory(const Address &addr, bool prefer_file_cache, uint32_t byte_size, bool is_signed, - Scalar &scalar, Error &error) { + Scalar &scalar, Status &error) { uint64_t uval; if (byte_size <= sizeof(uval)) { @@ -1705,7 +1706,7 @@ uint64_t Target::ReadUnsignedIntegerFromMemory(const Address &addr, bool prefer_file_cache, size_t integer_byte_size, uint64_t fail_value, - Error &error) { + Status &error) { Scalar scalar; if (ReadScalarIntegerFromMemory(addr, prefer_file_cache, integer_byte_size, false, scalar, error)) @@ -1714,7 +1715,7 @@ uint64_t Target::ReadUnsignedIntegerFromMemory(const Address &addr, } bool Target::ReadPointerFromMemory(const Address &addr, bool prefer_file_cache, - Error &error, Address &pointer_addr) { + Status &error, Address &pointer_addr) { Scalar scalar; if (ReadScalarIntegerFromMemory(addr, prefer_file_cache, m_arch.GetAddressByteSize(), false, scalar, @@ -1744,10 +1745,10 @@ bool Target::ReadPointerFromMemory(const Address &addr, bool prefer_file_cache, } ModuleSP Target::GetSharedModule(const ModuleSpec &module_spec, - Error *error_ptr) { + Status *error_ptr) { ModuleSP module_sp; - Error error; + Status error; // First see if we already have this module in our module list. If we do, // then we're done, we don't need @@ -1918,7 +1919,7 @@ void Target::ImageSearchPathsChanged(const PathMappingList &path_list, target->SetExecutableModule(exe_module_sp, true); } -TypeSystem *Target::GetScratchTypeSystemForLanguage(Error *error, +TypeSystem *Target::GetScratchTypeSystemForLanguage(Status *error, lldb::LanguageType language, bool create_on_demand) { if (!m_valid) @@ -1968,8 +1969,8 @@ Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) { UserExpression *Target::GetUserExpressionForLanguage( llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, - const EvaluateExpressionOptions &options, Error &error) { - Error type_system_error; + const EvaluateExpressionOptions &options, Status &error) { + Status type_system_error; TypeSystem *type_system = GetScratchTypeSystemForLanguage(&type_system_error, language); @@ -1996,8 +1997,8 @@ UserExpression *Target::GetUserExpressionForLanguage( FunctionCaller *Target::GetFunctionCallerForLanguage( lldb::LanguageType language, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, - const char *name, Error &error) { - Error type_system_error; + const char *name, Status &error) { + Status type_system_error; TypeSystem *type_system = GetScratchTypeSystemForLanguage(&type_system_error, language); FunctionCaller *persistent_fn = nullptr; @@ -2023,8 +2024,8 @@ FunctionCaller *Target::GetFunctionCallerForLanguage( UtilityFunction * Target::GetUtilityFunctionForLanguage(const char *text, lldb::LanguageType language, - const char *name, Error &error) { - Error type_system_error; + const char *name, Status &error) { + Status type_system_error; TypeSystem *type_system = GetScratchTypeSystemForLanguage(&type_system_error, language); UtilityFunction *utility_fn = nullptr; @@ -2162,7 +2163,7 @@ ExpressionResults Target::EvaluateExpression( execution_results = eExpressionCompleted; } else { const char *prefix = GetExpressionPrefixContentsAsCString(); - Error error; + Status error; execution_results = UserExpression::Evaluate(exe_ctx, options, expr, prefix, result_valobj_sp, error, 0, // Line Number @@ -2653,8 +2654,8 @@ const TargetPropertiesSP &Target::GetGlobalProperties() { return *g_settings_sp_ptr; } -Error Target::Install(ProcessLaunchInfo *launch_info) { - Error error; +Status Target::Install(ProcessLaunchInfo *launch_info) { + Status error; PlatformSP platform_sp(GetPlatform()); if (platform_sp) { if (platform_sp->IsRemote()) { @@ -2784,8 +2785,8 @@ bool Target::SetSectionUnloaded(const lldb::SectionSP §ion_sp, void Target::ClearAllLoadedSections() { m_section_load_history.Clear(); } -Error Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { - Error error; +Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { + Status error; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET)); if (log) @@ -2933,7 +2934,7 @@ Error Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { error = m_process_sp->PrivateResume(); } if (!error.Success()) { - Error error2; + Status error2; error2.SetErrorStringWithFormat( "process resume at entry point failed: %s", error.AsCString()); error = error2; @@ -2971,7 +2972,7 @@ Error Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { } m_process_sp->RestoreProcessEvents(); } else { - Error error2; + Status error2; error2.SetErrorStringWithFormat("process launch failed: %s", error.AsCString()); error = error2; @@ -2979,15 +2980,15 @@ Error Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) { return error; } -Error Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { +Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { auto state = eStateInvalid; auto process_sp = GetProcessSP(); if (process_sp) { state = process_sp->GetState(); if (process_sp->IsAlive() && state != eStateConnected) { if (state == eStateAttaching) - return Error("process attach is in progress"); - return Error("a process is already being debugged"); + return Status("process attach is in progress"); + return Status("a process is already being debugged"); } } @@ -3001,8 +3002,8 @@ Error Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { old_exec_module_sp->GetPlatformFileSpec().GetFilename(); if (!attach_info.ProcessInfoSpecified()) { - return Error("no process specified, create a target with a file, or " - "specify the --pid or --name"); + return Status("no process specified, create a target with a file, or " + "specify the --pid or --name"); } } @@ -3016,7 +3017,7 @@ Error Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { attach_info.SetHijackListener(hijack_listener_sp); } - Error error; + Status error; if (state != eStateConnected && platform_sp != nullptr && platform_sp->CanDebugProcess()) { SetPlatform(platform_sp); diff --git a/source/Target/TargetList.cpp b/source/Target/TargetList.cpp index 0849c18b89e0c..43e1227ba205f 100644 --- a/source/Target/TargetList.cpp +++ b/source/Target/TargetList.cpp @@ -55,33 +55,33 @@ TargetList::~TargetList() { m_target_list.clear(); } -Error TargetList::CreateTarget(Debugger &debugger, - llvm::StringRef user_exe_path, - llvm::StringRef triple_str, - bool get_dependent_files, - const OptionGroupPlatform *platform_options, - TargetSP &target_sp) { +Status TargetList::CreateTarget(Debugger &debugger, + llvm::StringRef user_exe_path, + llvm::StringRef triple_str, + bool get_dependent_files, + const OptionGroupPlatform *platform_options, + TargetSP &target_sp) { return CreateTargetInternal(debugger, user_exe_path, triple_str, get_dependent_files, platform_options, target_sp, false); } -Error TargetList::CreateTarget(Debugger &debugger, - llvm::StringRef user_exe_path, - const ArchSpec &specified_arch, - bool get_dependent_files, - PlatformSP &platform_sp, TargetSP &target_sp) { +Status TargetList::CreateTarget(Debugger &debugger, + llvm::StringRef user_exe_path, + const ArchSpec &specified_arch, + bool get_dependent_files, + PlatformSP &platform_sp, TargetSP &target_sp) { return CreateTargetInternal(debugger, user_exe_path, specified_arch, get_dependent_files, platform_sp, target_sp, false); } -Error TargetList::CreateTargetInternal( +Status TargetList::CreateTargetInternal( Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, bool get_dependent_files, const OptionGroupPlatform *platform_options, TargetSP &target_sp, bool is_dummy_target) { - Error error; + Status error; PlatformSP platform_sp; // This is purposely left empty unless it is specified by triple_cstr. @@ -302,34 +302,34 @@ lldb::TargetSP TargetList::GetDummyTarget(lldb_private::Debugger &debugger) { ArchSpec arch(Target::GetDefaultArchitecture()); if (!arch.IsValid()) arch = HostInfo::GetArchitecture(); - Error err = CreateDummyTarget( + Status err = CreateDummyTarget( debugger, arch.GetTriple().getTriple().c_str(), m_dummy_target_sp); } return m_dummy_target_sp; } -Error TargetList::CreateDummyTarget(Debugger &debugger, - llvm::StringRef specified_arch_name, - lldb::TargetSP &target_sp) { +Status TargetList::CreateDummyTarget(Debugger &debugger, + llvm::StringRef specified_arch_name, + lldb::TargetSP &target_sp) { PlatformSP host_platform_sp(Platform::GetHostPlatform()); return CreateTargetInternal( debugger, (const char *)nullptr, specified_arch_name, false, (const OptionGroupPlatform *)nullptr, target_sp, true); } -Error TargetList::CreateTargetInternal(Debugger &debugger, - llvm::StringRef user_exe_path, - const ArchSpec &specified_arch, - bool get_dependent_files, - lldb::PlatformSP &platform_sp, - lldb::TargetSP &target_sp, - bool is_dummy_target) { - Timer scoped_timer(LLVM_PRETTY_FUNCTION, - "TargetList::CreateTarget (file = '%s', arch = '%s')", - user_exe_path.str().c_str(), - specified_arch.GetArchitectureName()); - Error error; +Status TargetList::CreateTargetInternal(Debugger &debugger, + llvm::StringRef user_exe_path, + const ArchSpec &specified_arch, + bool get_dependent_files, + lldb::PlatformSP &platform_sp, + lldb::TargetSP &target_sp, + bool is_dummy_target) { + static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); + Timer scoped_timer( + func_cat, "TargetList::CreateTarget (file = '%s', arch = '%s')", + user_exe_path.str().c_str(), specified_arch.GetArchitectureName()); + Status error; ArchSpec arch(specified_arch); diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp index 4b21382ff86fb..43ae7b5413be7 100644 --- a/source/Target/Thread.cpp +++ b/source/Target/Thread.cpp @@ -1335,8 +1335,8 @@ bool Thread::PlanIsBasePlan(ThreadPlan *plan_ptr) { return m_plan_stack[0].get() == plan_ptr; } -Error Thread::UnwindInnermostExpression() { - Error error; +Status Thread::UnwindInnermostExpression() { + Status error; int stack_size = m_plan_stack.size(); // If the input plan is nullptr, discard all plans. Otherwise make sure this @@ -1635,11 +1635,11 @@ lldb::StackFrameSP Thread::GetFrameWithConcreteFrameIndex(uint32_t unwind_idx) { return GetStackFrameList()->GetFrameWithConcreteFrameIndex(unwind_idx); } -Error Thread::ReturnFromFrameWithIndex(uint32_t frame_idx, - lldb::ValueObjectSP return_value_sp, - bool broadcast) { +Status Thread::ReturnFromFrameWithIndex(uint32_t frame_idx, + lldb::ValueObjectSP return_value_sp, + bool broadcast) { StackFrameSP frame_sp = GetStackFrameAtIndex(frame_idx); - Error return_error; + Status return_error; if (!frame_sp) { return_error.SetErrorStringWithFormat( @@ -1650,10 +1650,10 @@ Error Thread::ReturnFromFrameWithIndex(uint32_t frame_idx, return ReturnFromFrame(frame_sp, return_value_sp, broadcast); } -Error Thread::ReturnFromFrame(lldb::StackFrameSP frame_sp, - lldb::ValueObjectSP return_value_sp, - bool broadcast) { - Error return_error; +Status Thread::ReturnFromFrame(lldb::StackFrameSP frame_sp, + lldb::ValueObjectSP return_value_sp, + bool broadcast) { + Status return_error; if (!frame_sp) { return_error.SetErrorString("Can't return to a null frame."); @@ -1740,8 +1740,8 @@ static void DumpAddressList(Stream &s, const std::vector<Address> &list, } } -Error Thread::JumpToLine(const FileSpec &file, uint32_t line, - bool can_leave_function, std::string *warnings) { +Status Thread::JumpToLine(const FileSpec &file, uint32_t line, + bool can_leave_function, std::string *warnings) { ExecutionContext exe_ctx(GetStackFrameAtIndex(0)); Target *target = exe_ctx.GetTargetPtr(); TargetSP target_sp = exe_ctx.GetTargetSP(); @@ -1769,16 +1769,16 @@ Error Thread::JumpToLine(const FileSpec &file, uint32_t line, // Check if we got anything. if (candidates.empty()) { if (outside_function.empty()) { - return Error("Cannot locate an address for %s:%i.", - file.GetFilename().AsCString(), line); + return Status("Cannot locate an address for %s:%i.", + file.GetFilename().AsCString(), line); } else if (outside_function.size() == 1) { - return Error("%s:%i is outside the current function.", - file.GetFilename().AsCString(), line); + return Status("%s:%i is outside the current function.", + file.GetFilename().AsCString(), line); } else { StreamString sstr; DumpAddressList(sstr, outside_function, target); - return Error("%s:%i has multiple candidate locations:\n%s", - file.GetFilename().AsCString(), line, sstr.GetData()); + return Status("%s:%i has multiple candidate locations:\n%s", + file.GetFilename().AsCString(), line, sstr.GetData()); } } @@ -1794,9 +1794,9 @@ Error Thread::JumpToLine(const FileSpec &file, uint32_t line, } if (!reg_ctx->SetPC(dest)) - return Error("Cannot change PC to target address."); + return Status("Cannot change PC to target address."); - return Error(); + return Status(); } void Thread::DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, @@ -2001,8 +2001,8 @@ bool Thread::GetDescription(Stream &strm, lldb::DescriptionLevel level, StructuredData::ObjectSP name = activity_dict->GetValueForKey("name"); if (name && name->GetType() == StructuredData::Type::eTypeString && id && id->GetType() == StructuredData::Type::eTypeInteger) { - strm.Printf(" Activity '%s', 0x%" PRIx64 "\n", - name->GetAsString()->GetValue().c_str(), + strm.Format(" Activity '{0}', {1:x}\n", + name->GetAsString()->GetValue(), id->GetAsInteger()->GetValue()); } printed_activity = true; @@ -2018,8 +2018,8 @@ bool Thread::GetDescription(Stream &strm, lldb::DescriptionLevel level, breadcrumb_dict->GetValueForKey("name"); if (breadcrumb_text && breadcrumb_text->GetType() == StructuredData::Type::eTypeString) { - strm.Printf(" Current Breadcrumb: %s\n", - breadcrumb_text->GetAsString()->GetValue().c_str()); + strm.Format(" Current Breadcrumb: {0}\n", + breadcrumb_text->GetAsString()->GetValue()); } printed_breadcrumb = true; } @@ -2040,8 +2040,7 @@ bool Thread::GetDescription(Stream &strm, lldb::DescriptionLevel level, message_dict->GetValueForKey("message"); if (message_text && message_text->GetType() == StructuredData::Type::eTypeString) { - strm.Printf(" %s\n", - message_text->GetAsString()->GetValue().c_str()); + strm.Format(" {0}\n", message_text->GetAsString()->GetValue()); } } } @@ -2117,12 +2116,12 @@ bool Thread::IsStillAtLastBreakpointHit() { return false; } -Error Thread::StepIn(bool source_step, - LazyBool step_in_avoids_code_without_debug_info, - LazyBool step_out_avoids_code_without_debug_info) +Status Thread::StepIn(bool source_step, + LazyBool step_in_avoids_code_without_debug_info, + LazyBool step_out_avoids_code_without_debug_info) { - Error error; + Status error; Process *process = GetProcess().get(); if (StateIsStoppedState(process->GetState(), true)) { StackFrameSP frame_sp = GetStackFrameAtIndex(0); @@ -2153,9 +2152,9 @@ Error Thread::StepIn(bool source_step, return error; } -Error Thread::StepOver(bool source_step, - LazyBool step_out_avoids_code_without_debug_info) { - Error error; +Status Thread::StepOver(bool source_step, + LazyBool step_out_avoids_code_without_debug_info) { + Status error; Process *process = GetProcess().get(); if (StateIsStoppedState(process->GetState(), true)) { StackFrameSP frame_sp = GetStackFrameAtIndex(0); @@ -2186,8 +2185,8 @@ Error Thread::StepOver(bool source_step, return error; } -Error Thread::StepOut() { - Error error; +Status Thread::StepOut() { + Status error; Process *process = GetProcess().get(); if (StateIsStoppedState(process->GetState(), true)) { const bool first_instruction = false; diff --git a/source/Target/ThreadPlanCallFunction.cpp b/source/Target/ThreadPlanCallFunction.cpp index 2c630d59e84c1..e3b9ae15dc95e 100644 --- a/source/Target/ThreadPlanCallFunction.cpp +++ b/source/Target/ThreadPlanCallFunction.cpp @@ -58,7 +58,7 @@ bool ThreadPlanCallFunction::ConstructorSetup( // If we can't read memory at the point of the process where we are planning // to put our function, we're // not going to get any further... - Error error; + Status error; process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error); if (!error.Success()) { m_constructor_errors.Printf( diff --git a/source/Target/ThreadPlanTracer.cpp b/source/Target/ThreadPlanTracer.cpp index f8368123a0c72..014c7fd27975c 100644 --- a/source/Target/ThreadPlanTracer.cpp +++ b/source/Target/ThreadPlanTracer.cpp @@ -145,7 +145,7 @@ void ThreadPlanAssemblyTracer::Log() { Disassembler *disassembler = GetDisassembler(); if (disassembler) { - Error err; + Status err; process_sp->ReadMemory(pc, buffer, sizeof(buffer), err); if (err.Success()) { diff --git a/source/Target/ThreadSpec.cpp b/source/Target/ThreadSpec.cpp index c7eec078612a4..f769d1a775af5 100644 --- a/source/Target/ThreadSpec.cpp +++ b/source/Target/ThreadSpec.cpp @@ -39,11 +39,11 @@ const ThreadSpec &ThreadSpec::operator=(const ThreadSpec &rhs) { } std::unique_ptr<ThreadSpec> ThreadSpec::CreateFromStructuredData( - const StructuredData::Dictionary &spec_dict, Error &error) { + const StructuredData::Dictionary &spec_dict, Status &error) { uint32_t index = UINT32_MAX; lldb::tid_t tid = LLDB_INVALID_THREAD_ID; - std::string name; - std::string queue_name; + llvm::StringRef name; + llvm::StringRef queue_name; std::unique_ptr<ThreadSpec> thread_spec_up(new ThreadSpec()); bool success = spec_dict.GetValueForKeyAsInteger( @@ -59,12 +59,12 @@ std::unique_ptr<ThreadSpec> ThreadSpec::CreateFromStructuredData( success = spec_dict.GetValueForKeyAsString(GetKey(OptionNames::ThreadName), name); if (success) - thread_spec_up->SetName(name.c_str()); + thread_spec_up->SetName(name); success = spec_dict.GetValueForKeyAsString(GetKey(OptionNames::ThreadName), queue_name); if (success) - thread_spec_up->SetQueueName(queue_name.c_str()); + thread_spec_up->SetQueueName(queue_name); return thread_spec_up; } |