diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:53:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:53:01 +0000 |
commit | ead246455adf1a215ec2715dad6533073a6beb4e (patch) | |
tree | f3f97a47d77053bf96fe74cdbd6fae74380e8a92 /source/Plugins/Platform/gdb-server | |
parent | fdb00c4408990a0a63ef7f496d809ce59f263bc5 (diff) | |
download | src-vendor/lldb.tar.gz src-vendor/lldb.zip |
Vendor import of stripped lldb trunk r375505, the last commit before thevendor/lldb/lldb-trunk-r375505vendor/lldb
upstream Subversion repository was made read-only, and the LLVM project
migrated to GitHub:
https://llvm.org/svn/llvm-project/lldb/trunk@375505
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=353952
svn path=/vendor/lldb/lldb-r375505/; revision=353953; tag=vendor/lldb/lldb-trunk-r375505
Diffstat (limited to 'source/Plugins/Platform/gdb-server')
-rw-r--r-- | source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp | 108 | ||||
-rw-r--r-- | source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h | 2 |
2 files changed, 53 insertions, 57 deletions
diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 9c52b59e2b06..1e62ddfe94fd 100644 --- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -169,21 +169,21 @@ bool PlatformRemoteGDBServer::GetModuleSpec(const FileSpec &module_file_spec, const auto module_path = module_file_spec.GetPath(false); if (!m_gdb_client.GetModuleInfo(module_file_spec, arch, module_spec)) { - if (log) - log->Printf( - "PlatformRemoteGDBServer::%s - failed to get module info for %s:%s", - __FUNCTION__, module_path.c_str(), - arch.GetTriple().getTriple().c_str()); + LLDB_LOGF( + log, + "PlatformRemoteGDBServer::%s - failed to get module info for %s:%s", + __FUNCTION__, module_path.c_str(), + arch.GetTriple().getTriple().c_str()); return false; } if (log) { StreamString stream; module_spec.Dump(stream); - log->Printf( - "PlatformRemoteGDBServer::%s - got module info for (%s:%s) : %s", - __FUNCTION__, module_path.c_str(), arch.GetTriple().getTriple().c_str(), - stream.GetData()); + LLDB_LOGF(log, + "PlatformRemoteGDBServer::%s - got module info for (%s:%s) : %s", + __FUNCTION__, module_path.c_str(), + arch.GetTriple().getTriple().c_str(), stream.GetData()); } return true; @@ -253,9 +253,9 @@ FileSpec PlatformRemoteGDBServer::GetRemoteWorkingDirectory() { Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); FileSpec working_dir; if (m_gdb_client.GetWorkingDir(working_dir) && log) - log->Printf( - "PlatformRemoteGDBServer::GetRemoteWorkingDirectory() -> '%s'", - working_dir.GetCString()); + LLDB_LOGF(log, + "PlatformRemoteGDBServer::GetRemoteWorkingDirectory() -> '%s'", + working_dir.GetCString()); return working_dir; } else { return Platform::GetRemoteWorkingDirectory(); @@ -268,9 +268,8 @@ bool PlatformRemoteGDBServer::SetRemoteWorkingDirectory( // Clear the working directory it case it doesn't get set correctly. This // will for use to re-read it Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); - if (log) - log->Printf("PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')", - working_dir.GetCString()); + LLDB_LOGF(log, "PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')", + working_dir.GetCString()); return m_gdb_client.SetWorkingDir(working_dir) == 0; } else return Platform::SetRemoteWorkingDirectory(working_dir); @@ -370,8 +369,7 @@ Status PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); Status error; - if (log) - log->Printf("PlatformRemoteGDBServer::%s() called", __FUNCTION__); + LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() called", __FUNCTION__); auto num_file_actions = launch_info.GetNumFileActions(); for (decltype(num_file_actions) i = 0; i < num_file_actions; ++i) { @@ -408,10 +406,10 @@ Status PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) { const char *arch_triple = arch_spec.GetTriple().str().c_str(); m_gdb_client.SendLaunchArchPacket(arch_triple); - if (log) - log->Printf( - "PlatformRemoteGDBServer::%s() set launch architecture triple to '%s'", - __FUNCTION__, arch_triple ? arch_triple : "<NULL>"); + LLDB_LOGF( + log, + "PlatformRemoteGDBServer::%s() set launch architecture triple to '%s'", + __FUNCTION__, arch_triple ? arch_triple : "<NULL>"); int arg_packet_err; { @@ -427,22 +425,21 @@ Status PlatformRemoteGDBServer::LaunchProcess(ProcessLaunchInfo &launch_info) { const auto pid = m_gdb_client.GetCurrentProcessID(false); if (pid != LLDB_INVALID_PROCESS_ID) { launch_info.SetProcessID(pid); - if (log) - log->Printf("PlatformRemoteGDBServer::%s() pid %" PRIu64 - " launched successfully", - __FUNCTION__, pid); + LLDB_LOGF(log, + "PlatformRemoteGDBServer::%s() pid %" PRIu64 + " launched successfully", + __FUNCTION__, pid); } else { - if (log) - log->Printf("PlatformRemoteGDBServer::%s() launch succeeded but we " - "didn't get a valid process id back!", - __FUNCTION__); + LLDB_LOGF(log, + "PlatformRemoteGDBServer::%s() launch succeeded but we " + "didn't get a valid process id back!", + __FUNCTION__); error.SetErrorString("failed to get PID"); } } else { error.SetErrorString(error_str.c_str()); - if (log) - log->Printf("PlatformRemoteGDBServer::%s() launch failed: %s", - __FUNCTION__, error.AsCString()); + LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() launch failed: %s", + __FUNCTION__, error.AsCString()); } } else { error.SetErrorStringWithFormat("'A' packet returned an error: %i", @@ -600,11 +597,10 @@ Status PlatformRemoteGDBServer::MakeDirectory(const FileSpec &file_spec, uint32_t mode) { Status error = m_gdb_client.MakeDirectory(file_spec, mode); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); - if (log) - log->Printf("PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) " - "error = %u (%s)", - file_spec.GetCString(), mode, error.GetError(), - error.AsCString()); + LLDB_LOGF(log, + "PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) " + "error = %u (%s)", + file_spec.GetCString(), mode, error.GetError(), error.AsCString()); return error; } @@ -612,11 +608,11 @@ Status PlatformRemoteGDBServer::GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions) { Status error = m_gdb_client.GetFilePermissions(file_spec, file_permissions); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); - if (log) - log->Printf("PlatformRemoteGDBServer::GetFilePermissions(path='%s', " - "file_permissions=%o) error = %u (%s)", - file_spec.GetCString(), file_permissions, error.GetError(), - error.AsCString()); + LLDB_LOGF(log, + "PlatformRemoteGDBServer::GetFilePermissions(path='%s', " + "file_permissions=%o) error = %u (%s)", + file_spec.GetCString(), file_permissions, error.GetError(), + error.AsCString()); return error; } @@ -624,16 +620,17 @@ Status PlatformRemoteGDBServer::SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions) { Status error = m_gdb_client.SetFilePermissions(file_spec, file_permissions); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); - if (log) - log->Printf("PlatformRemoteGDBServer::SetFilePermissions(path='%s', " - "file_permissions=%o) error = %u (%s)", - file_spec.GetCString(), file_permissions, error.GetError(), - error.AsCString()); + LLDB_LOGF(log, + "PlatformRemoteGDBServer::SetFilePermissions(path='%s', " + "file_permissions=%o) error = %u (%s)", + file_spec.GetCString(), file_permissions, error.GetError(), + error.AsCString()); return error; } lldb::user_id_t PlatformRemoteGDBServer::OpenFile(const FileSpec &file_spec, - uint32_t flags, uint32_t mode, + File::OpenOptions flags, + uint32_t mode, Status &error) { return m_gdb_client.OpenFile(file_spec, flags, mode, error); } @@ -671,20 +668,19 @@ Status PlatformRemoteGDBServer::CreateSymlink( { Status error = m_gdb_client.CreateSymlink(src, dst); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); - if (log) - log->Printf("PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') " - "error = %u (%s)", - src.GetCString(), dst.GetCString(), error.GetError(), - error.AsCString()); + LLDB_LOGF(log, + "PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') " + "error = %u (%s)", + src.GetCString(), dst.GetCString(), error.GetError(), + error.AsCString()); return error; } Status PlatformRemoteGDBServer::Unlink(const FileSpec &file_spec) { Status error = m_gdb_client.Unlink(file_spec); Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); - if (log) - log->Printf("PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)", - file_spec.GetCString(), error.GetError(), error.AsCString()); + LLDB_LOGF(log, "PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)", + file_spec.GetCString(), error.GetError(), error.AsCString()); return error; } diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h index c774daa8ab73..13edcbab9f59 100644 --- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -113,7 +113,7 @@ public: Status SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions) override; - lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, + lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags, uint32_t mode, Status &error) override; bool CloseFile(lldb::user_id_t fd, Status &error) override; |