diff options
Diffstat (limited to 'lldb/source/Target')
| -rw-r--r-- | lldb/source/Target/FileAction.cpp | 23 | ||||
| -rw-r--r-- | lldb/source/Target/Platform.cpp | 15 | ||||
| -rw-r--r-- | lldb/source/Target/Process.cpp | 50 | ||||
| -rw-r--r-- | lldb/source/Target/ProcessLaunchInfo.cpp | 35 |
4 files changed, 65 insertions, 58 deletions
diff --git a/lldb/source/Target/FileAction.cpp b/lldb/source/Target/FileAction.cpp index 5756147eea4..18b039998bc 100644 --- a/lldb/source/Target/FileAction.cpp +++ b/lldb/source/Target/FileAction.cpp @@ -21,9 +21,16 @@ using namespace lldb_private; // FileAction member functions //---------------------------------------------------------------------------- -FileAction::FileAction() : m_action(eFileActionNone), m_fd(-1), m_arg(-1), m_path() {} +FileAction::FileAction() + : m_action(eFileActionNone) + , m_fd(-1) + , m_arg(-1) + , m_path() +{ +} -void FileAction::Clear() +void +FileAction::Clear() { m_action = eFileActionNone; m_fd = -1; @@ -31,14 +38,16 @@ void FileAction::Clear() m_path.clear(); } -const char *FileAction::GetPath() const +const char * +FileAction::GetPath() const { if (m_path.empty()) return NULL; return m_path.c_str(); } -bool FileAction::Open(int fd, const char *path, bool read, bool write) +bool +FileAction::Open(int fd, const char *path, bool read, bool write) { if ((read || write) && fd >= 0 && path && path[0]) { @@ -60,7 +69,8 @@ bool FileAction::Open(int fd, const char *path, bool read, bool write) return false; } -bool FileAction::Close(int fd) +bool +FileAction::Close(int fd) { Clear(); if (fd >= 0) @@ -71,7 +81,8 @@ bool FileAction::Close(int fd) return m_fd >= 0; } -bool FileAction::Duplicate(int fd, int dup_fd) +bool +FileAction::Duplicate(int fd, int dup_fd) { Clear(); if (fd >= 0 && dup_fd >= 0) diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 7187d88bed2..82185847f3f 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Host/FileSpec.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -494,8 +495,8 @@ RecurseCopy_Callback (void *baton, dst_file.GetFilename() = src.GetFilename(); char buf[PATH_MAX]; - - rc_baton->error = Host::Readlink (src.GetPath().c_str(), buf, sizeof(buf)); + + rc_baton->error = FileSystem::Readlink(src.GetPath().c_str(), buf, sizeof(buf)); if (rc_baton->error.Fail()) return FileSpec::eEnumerateDirectoryResultQuit; // got an error, bail out @@ -649,7 +650,7 @@ Platform::Install (const FileSpec& src, const FileSpec& dst) if (GetFileExists (fixed_dst)) Unlink (fixed_dst.GetPath().c_str()); char buf[PATH_MAX]; - error = Host::Readlink(src.GetPath().c_str(), buf, sizeof(buf)); + error = FileSystem::Readlink(src.GetPath().c_str(), buf, sizeof(buf)); if (error.Success()) error = CreateSymlink(dst.GetPath().c_str(), buf); } @@ -701,7 +702,7 @@ Error Platform::MakeDirectory (const char *path, uint32_t permissions) { if (IsHost()) - return Host::MakeDirectory (path, permissions); + return FileSystem::MakeDirectory(path, permissions); else { Error error; @@ -714,7 +715,7 @@ Error Platform::GetFilePermissions (const char *path, uint32_t &file_permissions) { if (IsHost()) - return Host::GetFilePermissions(path, file_permissions); + return FileSystem::GetFilePermissions(path, file_permissions); else { Error error; @@ -727,7 +728,7 @@ Error Platform::SetFilePermissions (const char *path, uint32_t file_permissions) { if (IsHost()) - return Host::SetFilePermissions(path, file_permissions); + return FileSystem::SetFilePermissions(path, file_permissions); else { Error error; @@ -1182,7 +1183,7 @@ Platform::CalculateMD5 (const FileSpec& file_spec, uint64_t &high) { if (IsHost()) - return Host::CalculateMD5(file_spec, low, high); + return FileSystem::CalculateMD5(file_spec, low, high); else return false; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index bb7b6c01ce4..3d44b240735 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -402,45 +402,44 @@ ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *op break; case 'i': // STDIN for read only - { - FileAction action; - if (action.Open (STDIN_FILENO, option_arg, true, false)) - launch_info.AppendFileAction (action); - } + { + FileAction action; + if (action.Open (STDIN_FILENO, option_arg, true, false)) + launch_info.AppendFileAction (action); break; + } case 'o': // Open STDOUT for write only - { - FileAction action; - if (action.Open (STDOUT_FILENO, option_arg, false, true)) - launch_info.AppendFileAction (action); - } + { + FileAction action; + if (action.Open (STDOUT_FILENO, option_arg, false, true)) + launch_info.AppendFileAction (action); break; + } case 'e': // STDERR for write only - { - FileAction action; - if (action.Open (STDERR_FILENO, option_arg, false, true)) - launch_info.AppendFileAction (action); - } + { + FileAction action; + if (action.Open (STDERR_FILENO, option_arg, false, true)) + launch_info.AppendFileAction (action); break; - + } case 'p': // Process plug-in name launch_info.SetProcessPluginName (option_arg); break; case 'n': // Disable STDIO - { - FileAction action; - if (action.Open (STDIN_FILENO, "/dev/null", true, false)) - launch_info.AppendFileAction (action); - if (action.Open (STDOUT_FILENO, "/dev/null", false, true)) - launch_info.AppendFileAction (action); - if (action.Open (STDERR_FILENO, "/dev/null", false, true)) - launch_info.AppendFileAction (action); - } + { + FileAction action; + if (action.Open (STDIN_FILENO, "/dev/null", true, false)) + launch_info.AppendFileAction (action); + if (action.Open (STDOUT_FILENO, "/dev/null", false, true)) + launch_info.AppendFileAction (action); + if (action.Open (STDERR_FILENO, "/dev/null", false, true)) + launch_info.AppendFileAction (action); break; + } case 'w': launch_info.SetWorkingDirectory (option_arg); @@ -473,7 +472,6 @@ ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *op default: error.SetErrorStringWithFormat("unrecognized short option character '%c'", short_option); break; - } return error; } diff --git a/lldb/source/Target/ProcessLaunchInfo.cpp b/lldb/source/Target/ProcessLaunchInfo.cpp index 7c5bae2205f..830f1470ed9 100644 --- a/lldb/source/Target/ProcessLaunchInfo.cpp +++ b/lldb/source/Target/ProcessLaunchInfo.cpp @@ -40,23 +40,20 @@ ProcessLaunchInfo::ProcessLaunchInfo () : { } -ProcessLaunchInfo::ProcessLaunchInfo (const char *stdin_path, - const char *stdout_path, - const char *stderr_path, - const char *working_directory, - uint32_t launch_flags) : - ProcessInfo(), - m_working_dir (), - m_plugin_name (), - m_shell (), - m_flags (launch_flags), - m_file_actions (), - m_pty (), - m_resume_count (0), - m_monitor_callback (NULL), - m_monitor_callback_baton (NULL), - m_monitor_signals (false), - m_hijack_listener_sp () +ProcessLaunchInfo::ProcessLaunchInfo(const char *stdin_path, const char *stdout_path, const char *stderr_path, + const char *working_directory, uint32_t launch_flags) + : ProcessInfo() + , m_working_dir() + , m_plugin_name() + , m_shell() + , m_flags(launch_flags) + , m_file_actions() + , m_pty() + , m_resume_count(0) + , m_monitor_callback(NULL) + , m_monitor_callback_baton(NULL) + , m_monitor_signals(false) + , m_hijack_listener_sp() { if (stdin_path) { @@ -135,7 +132,7 @@ ProcessLaunchInfo::AppendSuppressFileAction (int fd, bool read, bool write) } const FileAction * -ProcessLaunchInfo::GetFileActionAtIndex (size_t idx) const +ProcessLaunchInfo::GetFileActionAtIndex(size_t idx) const { if (idx < m_file_actions.size()) return &m_file_actions[idx]; @@ -143,7 +140,7 @@ ProcessLaunchInfo::GetFileActionAtIndex (size_t idx) const } const FileAction * -ProcessLaunchInfo::GetFileActionForFD (int fd) const +ProcessLaunchInfo::GetFileActionForFD(int fd) const { for (size_t idx=0, count=m_file_actions.size(); idx < count; ++idx) { |

