LLDB  mainline
GDBRemoteCommunicationReplayServer.h
Go to the documentation of this file.
1 //===-- GDBRemoteCommunicationReplayServer.h --------------------*- C++ -*-===//
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_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONREPLAYSERVER_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONREPLAYSERVER_H
11 
12 // Other libraries and framework includes
13 #include "GDBRemoteCommunication.h"
16 
17 // Project includes
18 #include "lldb/Host/HostThread.h"
21 #include "llvm/Support/Error.h"
22 
23 // C Includes
24 // C++ Includes
25 #include <functional>
26 #include <map>
27 #include <thread>
28 
30 
31 namespace lldb_private {
32 namespace process_gdb_remote {
33 
34 class ProcessGDBRemote;
35 
36 /// Dummy GDB server that replays packets from the GDB Remote Communication
37 /// history. This is used to replay GDB packets.
39 public:
41 
43 
45  Status &error, bool &interrupt,
46  bool &quit);
47 
49 
51 
52  bool StartAsyncThread();
53  void StopAsyncThread();
54 
56 
57 protected:
58  enum {
61  };
62 
64  bool &done);
65  static lldb::thread_result_t AsyncThread(void *arg);
66 
67  /// Replay history with the oldest packet at the end.
68  std::vector<GDBRemotePacket> m_packet_history;
69 
70  /// Server thread.
72  lldb::ListenerSP m_async_listener_sp;
74  std::recursive_mutex m_async_thread_state_mutex;
75 
76  bool m_skip_acks = false;
77 
78 private:
80  const GDBRemoteCommunicationReplayServer &) = delete;
83 };
84 
85 } // namespace process_gdb_remote
86 } // namespace lldb_private
87 
88 #endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONREPLAYSERVER_H
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::operator=
const GDBRemoteCommunicationReplayServer & operator=(const GDBRemoteCommunicationReplayServer &)=delete
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer
Dummy GDB server that replays packets from the GDB Remote Communication history.
Definition: GDBRemoteCommunicationReplayServer.h:38
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::StopAsyncThread
void StopAsyncThread()
Definition: GDBRemoteCommunicationReplayServer.cpp:232
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::HandshakeWithClient
bool HandshakeWithClient()
Definition: GDBRemoteCommunicationReplayServer.h:48
lldb_private::HostThread
Definition: HostThread.h:29
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient
Definition: GDBRemoteCommunicationClient.h:58
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::m_skip_acks
bool m_skip_acks
Definition: GDBRemoteCommunicationReplayServer.h:76
lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult
PacketResult
Definition: GDBRemoteCommunication.h:93
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::LoadReplayHistory
llvm::Error LoadReplayHistory(const FileSpec &path)
Definition: GDBRemoteCommunicationReplayServer.cpp:191
lldb_private::process_gdb_remote::GDBRemoteCommunication
Definition: GDBRemoteCommunication.h:83
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::m_async_thread_state_mutex
std::recursive_mutex m_async_thread_state_mutex
Definition: GDBRemoteCommunicationReplayServer.h:74
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::Connect
Status Connect(process_gdb_remote::GDBRemoteCommunicationClient &client)
Definition: GDBRemoteCommunicationReplayServer.cpp:291
Broadcaster.h
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::eBroadcastBitAsyncContinue
@ eBroadcastBitAsyncContinue
Definition: GDBRemoteCommunicationReplayServer.h:59
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::m_packet_history
std::vector< GDBRemotePacket > m_packet_history
Replay history with the oldest packet at the end.
Definition: GDBRemoteCommunicationReplayServer.h:68
HostThread.h
lldb-private-forward.h
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::m_async_broadcaster
Broadcaster m_async_broadcaster
Server thread.
Definition: GDBRemoteCommunicationReplayServer.h:71
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::~GDBRemoteCommunicationReplayServer
~GDBRemoteCommunicationReplayServer() override
Definition: GDBRemoteCommunicationReplayServer.cpp:89
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::m_async_listener_sp
lldb::ListenerSP m_async_listener_sp
Definition: GDBRemoteCommunicationReplayServer.h:72
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::eBroadcastBitAsyncThreadShouldExit
@ eBroadcastBitAsyncThreadShouldExit
Definition: GDBRemoteCommunicationReplayServer.h:60
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::StartAsyncThread
bool StartAsyncThread()
Definition: GDBRemoteCommunicationReplayServer.cpp:209
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::AsyncThread
static lldb::thread_result_t AsyncThread(void *arg)
Definition: GDBRemoteCommunicationReplayServer.cpp:264
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::m_async_thread
HostThread m_async_thread
Definition: GDBRemoteCommunicationReplayServer.h:73
GDBRemoteCommunicationHistory.h
lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult::Success
@ Success
lldb_private::process_gdb_remote::GDBRemoteCommunication::GetAck
PacketResult GetAck()
Definition: GDBRemoteCommunication.cpp:194
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::GetPacketAndSendResponse
PacketResult GetPacketAndSendResponse(Timeout< std::micro > timeout, Status &error, bool &interrupt, bool &quit)
Definition: GDBRemoteCommunicationReplayServer.cpp:94
lldb_private::Status
Definition: Status.h:44
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::GDBRemoteCommunicationReplayServer
GDBRemoteCommunicationReplayServer()
Definition: GDBRemoteCommunicationReplayServer.cpp:72
lldb_private::Timeout< std::micro >
lldb::thread_result_t
void * thread_result_t
Definition: lldb-types.h:62
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::ReceivePacket
static void ReceivePacket(GDBRemoteCommunicationReplayServer &server, bool &done)
Definition: GDBRemoteCommunicationReplayServer.cpp:249
GDBRemoteCommunication.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
StringExtractorGDBRemote
Definition: StringExtractorGDBRemote.h:21
lldb_private::Broadcaster
Definition: Broadcaster.h:242
GDBRemoteCommunicationClient.h