LLDB mainline
lldb_private::WindowsFileAction Class Reference

A Windows-specific extension of FileAction that supports HANDLE-based file operations in addition to the standard file descriptor operations. More...

#include <WindowsFileAction.h>

Inheritance diagram for lldb_private::WindowsFileAction:
[legend]

Public Member Functions

 WindowsFileAction ()=default
 WindowsFileAction (const FileAction &fa)
 Allow implicit conversion from a base FileAction.
void Clear ()
 Reset this WindowsFileAction to its default state.
bool Duplicate (HANDLE fh, HANDLE dup_fh)
 Configure this action to duplicate a Windows file handle.
bool Open (HANDLE fh, const FileSpec &file_spec, bool read, bool write)
 Configure this action to associate a Windows file handle with a file.
HANDLE GetHandle () const
 Get the Windows HANDLE for this action's file.
HANDLE GetActionArgumentHandle () const
 Get the Windows HANDLE argument for eFileActionDuplicate actions.
Public Member Functions inherited from lldb_private::FileAction
 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 FileSpecGetFileSpec () const
 Get the file specification for open actions.
void Dump (Stream &stream) const

Private Attributes

HANDLE m_handle = LLDB_INVALID_PIPE
HANDLE m_arg_handle = LLDB_INVALID_PIPE

Additional Inherited Members

Public Types inherited from lldb_private::FileAction
enum  Action { eFileActionNone , eFileActionClose , eFileActionDuplicate , eFileActionOpen }
Protected Attributes inherited from lldb_private::FileAction
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.

Detailed Description

A Windows-specific extension of FileAction that supports HANDLE-based file operations in addition to the standard file descriptor operations.

Definition at line 21 of file WindowsFileAction.h.

Constructor & Destructor Documentation

◆ WindowsFileAction() [1/2]

lldb_private::WindowsFileAction::WindowsFileAction ( )
default

◆ WindowsFileAction() [2/2]

lldb_private::WindowsFileAction::WindowsFileAction ( const FileAction & fa)
inline

Allow implicit conversion from a base FileAction.

The Windows-specific handle fields default to INVALID_HANDLE_VALUE.

Definition at line 27 of file WindowsFileAction.h.

References lldb_private::FileAction::FileAction().

Member Function Documentation

◆ Clear()

void lldb_private::WindowsFileAction::Clear ( )
inline

Reset this WindowsFileAction to its default state.

Definition at line 30 of file WindowsFileAction.h.

References lldb_private::FileAction::Clear(), LLDB_INVALID_PIPE, m_arg_handle, and m_handle.

Referenced by Duplicate(), and Open().

◆ Duplicate()

bool WindowsFileAction::Duplicate ( HANDLE fh,
HANDLE dup_fh )

Configure this action to duplicate a Windows file handle.

Parameters
[in]fhThe source file handle to duplicate.
[in]dup_fhThe target file handle.

Definition at line 17 of file WindowsFileAction.cpp.

References Clear(), lldb_private::FileAction::eFileActionDuplicate, lldb_private::FileAction::m_action, m_arg_handle, and m_handle.

◆ GetActionArgumentHandle()

HANDLE WindowsFileAction::GetActionArgumentHandle ( ) const

Get the Windows HANDLE argument for eFileActionDuplicate actions.

Definition at line 62 of file WindowsFileAction.cpp.

References m_arg_handle.

Referenced by lldb_private::ProcessLauncherWindows::GetInheritedHandles().

◆ GetHandle()

HANDLE WindowsFileAction::GetHandle ( ) const

Get the Windows HANDLE for this action's file.

If a HANDLE was stored directly, it is returned. Otherwise, the standard handles for STDIN/STDOUT/STDERR are returned based on the stored fd.

Definition at line 47 of file WindowsFileAction.cpp.

References lldb_private::FileAction::m_fd, and m_handle.

Referenced by lldb_private::ProcessLauncherWindows::GetInheritedHandles().

◆ Open()

bool WindowsFileAction::Open ( HANDLE fh,
const FileSpec & file_spec,
bool read,
bool write )

Configure this action to associate a Windows file handle with a file.

Parameters
[in]fhThe file handle to use for the opened file.
[in]file_specThe file to open.
[in]readOpen for reading.
[in]writeOpen for writing.

Definition at line 28 of file WindowsFileAction.cpp.

References Clear(), lldb_private::FileAction::eFileActionOpen, lldb_private::FileAction::m_action, lldb_private::FileAction::m_arg, lldb_private::FileAction::m_file_spec, m_handle, and O_NOCTTY.

Member Data Documentation

◆ m_arg_handle

HANDLE lldb_private::WindowsFileAction::m_arg_handle = LLDB_INVALID_PIPE
private

Definition at line 67 of file WindowsFileAction.h.

Referenced by Clear(), Duplicate(), and GetActionArgumentHandle().

◆ m_handle

HANDLE lldb_private::WindowsFileAction::m_handle = LLDB_INVALID_PIPE
private

Definition at line 66 of file WindowsFileAction.h.

Referenced by Clear(), Duplicate(), GetHandle(), and Open().


The documentation for this class was generated from the following files: