aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp')
-rw-r--r--source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp108
1 files changed, 52 insertions, 56 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;
}