LLDB mainline
WindowsFileAction.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_HOST_WINDOWS_WINDOWSFILEACTION_H
10#define LLDB_HOST_WINDOWS_WINDOWSFILEACTION_H
11
13#include "lldb/lldb-types.h"
14
15typedef void *HANDLE;
16
17namespace lldb_private {
18
19/// A Windows-specific extension of FileAction that supports HANDLE-based
20/// file operations in addition to the standard file descriptor operations.
22public:
23 WindowsFileAction() = default;
24
25 /// Allow implicit conversion from a base FileAction. The Windows-specific
26 /// handle fields default to INVALID_HANDLE_VALUE.
28
29 /// Reset this WindowsFileAction to its default state.
35
36 /// Configure this action to duplicate a Windows file handle.
37 ///
38 /// \param[in] fh
39 /// The source file handle to duplicate.
40 /// \param[in] dup_fh
41 /// The target file handle.
42 bool Duplicate(HANDLE fh, HANDLE dup_fh);
43
44 /// Configure this action to associate a Windows file handle with a file.
45 ///
46 /// \param[in] fh
47 /// The file handle to use for the opened file.
48 /// \param[in] file_spec
49 /// The file to open.
50 /// \param[in] read
51 /// Open for reading.
52 /// \param[in] write
53 /// Open for writing.
54 bool Open(HANDLE fh, const FileSpec &file_spec, bool read, bool write);
55
56 /// Get the Windows HANDLE for this action's file.
57 ///
58 /// If a HANDLE was stored directly, it is returned. Otherwise, the standard
59 /// handles for STDIN/STDOUT/STDERR are returned based on the stored fd.
60 HANDLE GetHandle() const;
61
62 /// Get the Windows HANDLE argument for eFileActionDuplicate actions.
64
65private:
68};
69
70} // namespace lldb_private
71
72#endif // LLDB_HOST_WINDOWS_WINDOWSFILEACTION_H
void * HANDLE
void Clear()
Reset this FileAction to its default state.
A file utility class.
Definition FileSpec.h:57
HANDLE GetHandle() const
Get the Windows HANDLE for this action's file.
HANDLE GetActionArgumentHandle() const
Get the Windows HANDLE argument for eFileActionDuplicate actions.
WindowsFileAction(const FileAction &fa)
Allow implicit conversion from a base FileAction.
bool Open(HANDLE fh, const FileSpec &file_spec, bool read, bool write)
Configure this action to associate a Windows file handle with a file.
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.
#define LLDB_INVALID_PIPE
Definition lldb-types.h:70
A class that represents a running process on the host machine.