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/Target/FileAction.cpp | |
parent | 375432e4d8f50212bca3d9228e349b5a00f770d7 (diff) | |
download | llvm-d3173f34e8546a96b8d0df0d9de133f88f10c127.zip llvm-d3173f34e8546a96b8d0df0d9de133f88f10c127.tar.gz llvm-d3173f34e8546a96b8d0df0d9de133f88f10c127.tar.bz2 |
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/Target/FileAction.cpp')
-rw-r--r-- | lldb/source/Target/FileAction.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lldb/source/Target/FileAction.cpp b/lldb/source/Target/FileAction.cpp index 8611ff5..21c37e8 100644 --- a/lldb/source/Target/FileAction.cpp +++ b/lldb/source/Target/FileAction.cpp @@ -26,7 +26,7 @@ FileAction::FileAction() : m_action(eFileActionNone), m_fd(-1), m_arg(-1), - m_path() + m_file_spec() { } @@ -36,21 +36,25 @@ FileAction::Clear() m_action = eFileActionNone; m_fd = -1; m_arg = -1; - m_path.clear(); + m_file_spec.Clear(); } const char * FileAction::GetPath() const { - if (m_path.empty()) - return NULL; - return m_path.c_str(); + return m_file_spec.GetCString(); +} + +const FileSpec & +FileAction::GetFileSpec() const +{ + return m_file_spec; } bool -FileAction::Open(int fd, const char *path, bool read, bool write) +FileAction::Open(int fd, const FileSpec &file_spec, bool read, bool write) { - if ((read || write) && fd >= 0 && path && path[0]) + if ((read || write) && fd >= 0 && file_spec) { m_action = eFileActionOpen; m_fd = fd; @@ -60,7 +64,7 @@ FileAction::Open(int fd, const char *path, bool read, bool write) m_arg = O_NOCTTY | O_RDONLY; else m_arg = O_NOCTTY | O_CREAT | O_WRONLY; - m_path.assign(path); + m_file_spec = file_spec; return true; } else @@ -111,7 +115,8 @@ FileAction::Dump(Stream &stream) const stream.PutCString("no action"); break; case eFileActionOpen: - stream.Printf("open fd %d with '%s', OFLAGS = 0x%x", m_fd, m_path.c_str(), m_arg); + stream.Printf("open fd %d with '%s', OFLAGS = 0x%x", + m_fd, m_file_spec.GetCString(), m_arg); break; } } |