|
LLDB mainline
|
Represents a file descriptor action to be performed during process launch. More...
#include <FileAction.h>
Public Types | |
| enum | Action { eFileActionNone , eFileActionClose , eFileActionDuplicate , eFileActionOpen } |
Public Member Functions | |
| FileAction () | |
| void | Clear () |
| Reset this FileAction to its default state. | |
| bool | Close (int fd) |
| Configure this action to close a file descriptor. | |
| bool | Duplicate (int fd, int dup_fd) |
| Configure this action to duplicate a file descriptor. | |
| bool | Open (int fd, const FileSpec &file_spec, bool read, bool write) |
| Configure this action to open a file. | |
| int | GetFD () const |
| Get the file descriptor this action applies to. | |
| Action | GetAction () const |
| Get the type of action. | |
| int | GetActionArgument () const |
| Get the action-specific argument. | |
| const FileSpec & | GetFileSpec () const |
| Get the file specification for open actions. | |
| void | Dump (Stream &stream) const |
Protected Attributes | |
| Action | m_action = eFileActionNone |
| The action for this file. | |
| int | m_fd = -1 |
| The file descriptor this action applies to. | |
| int | m_arg = -1 |
| oflag for eFileActionOpen, dup_fd for eFileActionDuplicate. | |
| FileSpec | m_file_spec |
| File spec to use for opening after fork or posix_spawn. | |
Represents a file descriptor action to be performed during process launch.
FileAction encapsulates operations like opening, closing, or duplicating file descriptors that should be applied when spawning a new process.
Definition at line 21 of file FileAction.h.
| Enumerator | |
|---|---|
| eFileActionNone | |
| eFileActionClose | |
| eFileActionDuplicate | |
| eFileActionOpen | |
Definition at line 23 of file FileAction.h.
| FileAction::FileAction | ( | ) |
Definition at line 19 of file FileAction.cpp.
References m_file_spec.
Referenced by lldb_private::WindowsFileAction::WindowsFileAction().
| void FileAction::Clear | ( | ) |
Reset this FileAction to its default state.
Definition at line 21 of file FileAction.cpp.
References eFileActionNone, m_action, m_arg, m_fd, and m_file_spec.
Referenced by lldb_private::WindowsFileAction::Clear(), Close(), Duplicate(), and Open().
| bool FileAction::Close | ( | int | fd | ) |
Configure this action to close a file descriptor.
Definition at line 49 of file FileAction.cpp.
References Clear(), eFileActionClose, m_action, and m_fd.
Referenced by lldb_private::ProcessLaunchInfo::AppendCloseFileAction().
| void FileAction::Dump | ( | Stream & | stream | ) | const |
Definition at line 68 of file FileAction.cpp.
References eFileActionClose, eFileActionDuplicate, eFileActionNone, eFileActionOpen, m_action, m_arg, m_fd, m_file_spec, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by PlatformPOSIX::DebugProcess().
| bool FileAction::Duplicate | ( | int | fd, |
| int | dup_fd ) |
Configure this action to duplicate a file descriptor.
| [in] | fd | The file descriptor to duplicate. |
| [in] | dup_fd | The target file descriptor number. |
Definition at line 58 of file FileAction.cpp.
References Clear(), eFileActionDuplicate, m_action, m_arg, and m_fd.
Referenced by lldb_private::ProcessLaunchInfo::AppendDuplicateFileAction().
|
inline |
Get the type of action.
Definition at line 62 of file FileAction.h.
References m_action.
Referenced by AddPosixSpawnFileAction(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoLaunch(), lldb_private::ProcessLauncherWindows::GetInheritedHandles(), and HandleFileAction().
|
inline |
Get the action-specific argument.
For eFileActionOpen, returns the open flags (O_RDONLY, etc.). For eFileActionDuplicate, returns the target fd to duplicate to.
Definition at line 68 of file FileAction.h.
References m_arg.
Referenced by AddPosixSpawnFileAction(), lldb_private::ProcessLauncherWindows::GetInheritedHandles(), and HandleFileAction().
|
inline |
Get the file descriptor this action applies to.
Definition at line 59 of file FileAction.h.
References m_fd.
Referenced by AddPosixSpawnFileAction(), and lldb_private::ProcessLauncherWindows::GetInheritedHandles().
| const FileSpec & FileAction::GetFileSpec | ( | ) | const |
Get the file specification for open actions.
Definition at line 28 of file FileAction.cpp.
References m_file_spec.
Referenced by AddPosixSpawnFileAction(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoLaunch(), lldb_private::ProcessLauncherWindows::GetStdioHandle(), HandleFileAction(), LaunchProcessXPC(), and lldb_private::TargetProperties::SetProcessLaunchInfo().
Configure this action to open a file.
| [in] | fd | The file descriptor to use for the opened file. |
| [in] | file_spec | The file to open. |
| [in] | read | Open for reading. |
| [in] | write | Open for writing. |
Definition at line 30 of file FileAction.cpp.
References Clear(), eFileActionOpen, m_action, m_arg, m_fd, m_file_spec, and O_NOCTTY.
Referenced by lldb_private::ProcessLaunchInfo::AppendOpenFileAction(), lldb_private::ProcessLaunchInfo::AppendSuppressFileAction(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QSetSTDERR(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QSetSTDIN(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QSetSTDOUT(), lldb_private::ProcessLaunchInfo::ProcessLaunchInfo(), and lldb_private::CommandOptionsProcessLaunch::SetOptionValue().
|
protected |
The action for this file.
Definition at line 77 of file FileAction.h.
Referenced by Clear(), Close(), Dump(), Duplicate(), lldb_private::WindowsFileAction::Duplicate(), GetAction(), Open(), and lldb_private::WindowsFileAction::Open().
|
protected |
oflag for eFileActionOpen, dup_fd for eFileActionDuplicate.
Definition at line 81 of file FileAction.h.
Referenced by Clear(), Dump(), Duplicate(), GetActionArgument(), Open(), and lldb_private::WindowsFileAction::Open().
|
protected |
The file descriptor this action applies to.
Definition at line 79 of file FileAction.h.
Referenced by Clear(), Close(), Dump(), Duplicate(), GetFD(), lldb_private::WindowsFileAction::GetHandle(), and Open().
|
protected |
File spec to use for opening after fork or posix_spawn.
Definition at line 83 of file FileAction.h.
Referenced by Clear(), Dump(), FileAction(), GetFileSpec(), Open(), and lldb_private::WindowsFileAction::Open().