LLDB mainline
ConnectionConPTYWindows.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_CONNECTIONCONPTYWINDOWS_H
10#define LLDB_HOST_WINDOWS_CONNECTIONCONPTYWINDOWS_H
11
17#include "lldb/lldb-types.h"
18#include <mutex>
19
20namespace lldb_private {
21
22/// A read only Connection implementation for the Windows ConPTY.
24public:
25 ConnectionConPTY(std::shared_ptr<PseudoConsole> pty);
26
28
29 lldb::ConnectionStatus Connect(llvm::StringRef s, Status *error_ptr) override;
30
31 lldb::ConnectionStatus Disconnect(Status *error_ptr) override;
32
33 /// Read from the ConPTY's pipe.
34 ///
35 /// Before reading, check if the ConPTY is closing and wait for it to close
36 /// before reading. This prevents race conditions when closing the ConPTY
37 /// during a read.
38 /// After reading, remove the ConPTY VT init sequence if present. On the first
39 /// read that contains ConPTY management sequences (cursor query, Win32 Input
40 /// Mode, focus events, window title), strips them in-place and sets
41 /// m_conpty_sequences_stripped to skip scanning on all subsequent reads.
42 size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout,
43 lldb::ConnectionStatus &status, Status *error_ptr) override;
44
45 size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
46 Status *error_ptr) override;
47
48protected:
49 std::shared_ptr<PseudoConsole> m_pty;
51};
52} // namespace lldb_private
53
54#endif
lldb::ConnectionStatus Disconnect(Status *error_ptr) override
Disconnect the communications connection if one is currently connected.
size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Status *error_ptr) override
The actual write function that attempts to write to the communications protocol.
ConnectionConPTY(std::shared_ptr< PseudoConsole > pty)
size_t Read(void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr) override
Read from the ConPTY's pipe.
std::shared_ptr< PseudoConsole > m_pty
lldb::ConnectionStatus Connect(llvm::StringRef s, Status *error_ptr) override
Connect using the connect string url.
An error handling class.
Definition Status.h:118
A class that represents a running process on the host machine.
ConnectionStatus
Connection Status Types.