diff options
author | Chaoren Lin <chaorenl@google.com> | 2015-05-29 19:52:29 +0000 |
---|---|---|
committer | Chaoren Lin <chaorenl@google.com> | 2015-05-29 19:52:29 +0000 |
commit | d3173f34e8546a96b8d0df0d9de133f88f10c127 (patch) | |
tree | 5e778446085cbd4a4d43fc3b488b3ac6ff17f2b5 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | |
parent | 375432e4d8f50212bca3d9228e349b5a00f770d7 (diff) | |
download | bcm5719-llvm-d3173f34e8546a96b8d0df0d9de133f88f10c127.tar.gz bcm5719-llvm-d3173f34e8546a96b8d0df0d9de133f88f10c127.zip |
Refactor many file functions to use FileSpec over strings.
Summary:
This should solve the issue of sending denormalized paths over gdb-remote
if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the
server handle any denormalization.
Reviewers: ovyalov, zturner, vharron, clayborg
Reviewed By: clayborg
Subscribers: tberghammer, emaste, lldb-commits
Differential Revision: http://reviews.llvm.org/D9728
llvm-svn: 238604
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index c61d9f4f130..18e8118b14a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -584,8 +584,8 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Open (StringExtractorGDBRemote { mode_t mode = packet.GetHexMaxU32(false, 0600); Error error; - const FileSpec path_spec(path.c_str(), true); - int fd = ::open (path_spec.GetPath().c_str(), flags, mode); + const FileSpec path_spec{path, true}; + int fd = ::open(path_spec.GetCString(), flags, mode); const int save_errno = fd == -1 ? errno : 0; StreamString response; response.PutChar('F'); @@ -734,7 +734,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_Mode (StringExtractorGDBRemote if (!path.empty()) { Error error; - const uint32_t mode = File::GetPermissions(path.c_str(), error); + const uint32_t mode = File::GetPermissions(FileSpec{path, true}, error); StreamString response; response.Printf("F%u", mode); if (mode == 0 || error.Fail()) @@ -773,7 +773,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_symlink (StringExtractorGDBRemo packet.GetHexByteStringTerminatedBy(dst, ','); packet.GetChar(); // Skip ',' char packet.GetHexByteString(src); - Error error = FileSystem::Symlink(src.c_str(), dst.c_str()); + Error error = FileSystem::Symlink(FileSpec{src, true}, FileSpec{dst, false}); StreamString response; response.Printf("F%u,%u", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetData(), response.GetSize()); @@ -785,7 +785,7 @@ GDBRemoteCommunicationServerCommon::Handle_vFile_unlink (StringExtractorGDBRemot packet.SetFilePos(::strlen("vFile:unlink:")); std::string path; packet.GetHexByteString(path); - Error error = FileSystem::Unlink(path.c_str()); + Error error = FileSystem::Unlink(FileSpec{path, true}); StreamString response; response.Printf("F%u,%u", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetData(), response.GetSize()); @@ -810,7 +810,7 @@ GDBRemoteCommunicationServerCommon::Handle_qPlatform_shell (StringExtractorGDBRe int status, signo; std::string output; Error err = Host::RunShellCommand(path.c_str(), - working_dir.empty() ? NULL : working_dir.c_str(), + FileSpec{working_dir, true}, &status, &signo, &output, timeout); StreamGDBRemote response; if (err.Fail()) @@ -875,8 +875,8 @@ GDBRemoteCommunicationServerCommon::Handle_qPlatform_mkdir (StringExtractorGDBRe { std::string path; packet.GetHexByteString(path); - Error error = FileSystem::MakeDirectory(path.c_str(), mode); - + Error error = FileSystem::MakeDirectory(FileSpec{path, false}, mode); + StreamGDBRemote response; response.Printf("F%u", error.GetError()); @@ -895,7 +895,7 @@ GDBRemoteCommunicationServerCommon::Handle_qPlatform_chmod (StringExtractorGDBRe { std::string path; packet.GetHexByteString(path); - Error error = FileSystem::SetFilePermissions(path.c_str(), mode); + Error error = FileSystem::SetFilePermissions(FileSpec{path, true}, mode); StreamGDBRemote response; response.Printf("F%u", error.GetError()); @@ -968,7 +968,7 @@ GDBRemoteCommunicationServerCommon::Handle_QSetSTDIN (StringExtractorGDBRemote & packet.GetHexByteString(path); const bool read = false; const bool write = true; - if (file_action.Open(STDIN_FILENO, path.c_str(), read, write)) + if (file_action.Open(STDIN_FILENO, FileSpec{path, false}, read, write)) { m_process_launch_info.AppendFileAction(file_action); return SendOKResponse (); @@ -985,7 +985,7 @@ GDBRemoteCommunicationServerCommon::Handle_QSetSTDOUT (StringExtractorGDBRemote packet.GetHexByteString(path); const bool read = true; const bool write = false; - if (file_action.Open(STDOUT_FILENO, path.c_str(), read, write)) + if (file_action.Open(STDOUT_FILENO, FileSpec{path, false}, read, write)) { m_process_launch_info.AppendFileAction(file_action); return SendOKResponse (); @@ -1002,7 +1002,7 @@ GDBRemoteCommunicationServerCommon::Handle_QSetSTDERR (StringExtractorGDBRemote packet.GetHexByteString(path); const bool read = true; const bool write = false; - if (file_action.Open(STDERR_FILENO, path.c_str(), read, write)) + if (file_action.Open(STDERR_FILENO, FileSpec{path, false}, read, write)) { m_process_launch_info.AppendFileAction(file_action); return SendOKResponse (); @@ -1217,7 +1217,7 @@ GDBRemoteCommunicationServerCommon::Handle_qModuleInfo (StringExtractorGDBRemote response.PutChar(';'); response.PutCString("file_path:"); - response.PutCStringAsRawHex8(module_path_spec.GetPath().c_str()); + response.PutCStringAsRawHex8(module_path_spec.GetCString()); response.PutChar(';'); response.PutCString("file_offset:"); response.PutHex64(file_offset); @@ -1241,7 +1241,7 @@ GDBRemoteCommunicationServerCommon::CreateProcessInfoResponse (const ProcessInst proc_info.GetEffectiveUserID(), proc_info.GetEffectiveGroupID()); response.PutCString ("name:"); - response.PutCStringAsRawHex8(proc_info.GetExecutableFile().GetPath().c_str()); + response.PutCStringAsRawHex8(proc_info.GetExecutableFile().GetCString()); response.PutChar(';'); const ArchSpec &proc_arch = proc_info.GetArchitecture(); if (proc_arch.IsValid()) |