LLDB  mainline
GDBRemote.h
Go to the documentation of this file.
1 //===-- GDBRemote.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_UTILITY_GDBREMOTE_H
10 #define LLDB_UTILITY_GDBREMOTE_H
11 
12 #include "lldb/Utility/FileSpec.h"
14 #include "lldb/lldb-enumerations.h"
15 #include "lldb/lldb-public.h"
16 #include "llvm/Support/raw_ostream.h"
17 
18 #include <cstddef>
19 #include <cstdint>
20 #include <string>
21 #include <vector>
22 
23 namespace lldb_private {
24 
25 class StreamGDBRemote : public StreamString {
26 public:
28 
29  StreamGDBRemote(uint32_t flags, uint32_t addr_size,
30  lldb::ByteOrder byte_order);
31 
32  ~StreamGDBRemote() override;
33 
34  /// Output a block of data to the stream performing GDB-remote escaping.
35  ///
36  /// \param[in] s
37  /// A block of data.
38  ///
39  /// \param[in] src_len
40  /// The amount of data to write.
41  ///
42  /// \return
43  /// Number of bytes written.
44  // TODO: Convert this function to take ArrayRef<uint8_t>
45  int PutEscapedBytes(const void *s, size_t src_len);
46 };
47 
48 /// GDB remote packet as used by the GDB remote communication history. Packets
49 /// can be serialized to file.
51 
53 
54  GDBRemotePacket() = default;
55 
56  void Clear() {
57  packet.data.clear();
60  packet_idx = 0;
62  }
63 
64  struct BinaryData {
66  };
67 
68  void Dump(Stream &strm) const;
69 
75 
76 private:
77  llvm::StringRef GetTypeStr() const;
78 };
79 
80 } // namespace lldb_private
81 
82 #endif // LLDB_UTILITY_GDBREMOTE_H
lldb-public.h
lldb_private::GDBRemotePacket::packet
BinaryData packet
Definition: GDBRemote.h:70
lldb_private::GDBRemotePacket::Dump
void Dump(Stream &strm) const
Definition: GDBRemote.cpp:60
lldb_private::GDBRemotePacket::packet_idx
uint32_t packet_idx
Definition: GDBRemote.h:73
lldb_private::Stream
Definition: Stream.h:28
lldb_private::GDBRemotePacket::Type
Type
Definition: GDBRemote.h:52
StreamString.h
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::GDBRemotePacket::type
Type type
Definition: GDBRemote.h:71
lldb-enumerations.h
lldb_private::GDBRemotePacket::GetTypeStr
llvm::StringRef GetTypeStr() const
Definition: GDBRemote.cpp:48
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::GDBRemotePacket::Clear
void Clear()
Definition: GDBRemote.h:56
lldb_private::GDBRemotePacket::ePacketTypeRecv
@ ePacketTypeRecv
Definition: GDBRemote.h:52
lldb_private::GDBRemotePacket::ePacketTypeSend
@ ePacketTypeSend
Definition: GDBRemote.h:52
uint32_t
lldb_private::StreamGDBRemote::StreamGDBRemote
StreamGDBRemote()
Definition: GDBRemote.cpp:20
lldb_private::GDBRemotePacket
GDB remote packet as used by the GDB remote communication history.
Definition: GDBRemote.h:50
lldb_private::GDBRemotePacket::tid
lldb::tid_t tid
Definition: GDBRemote.h:74
lldb_private::StreamGDBRemote
Definition: GDBRemote.h:25
lldb_private::GDBRemotePacket::bytes_transmitted
uint32_t bytes_transmitted
Definition: GDBRemote.h:72
lldb_private::StreamGDBRemote::~StreamGDBRemote
~StreamGDBRemote() override
lldb_private::GDBRemotePacket::ePacketTypeInvalid
@ ePacketTypeInvalid
Definition: GDBRemote.h:52
lldb_private::GDBRemotePacket::BinaryData
Definition: GDBRemote.h:64
lldb_private::GDBRemotePacket::GDBRemotePacket
GDBRemotePacket()=default
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::StreamGDBRemote::PutEscapedBytes
int PutEscapedBytes(const void *s, size_t src_len)
Output a block of data to the stream performing GDB-remote escaping.
Definition: GDBRemote.cpp:28
FileSpec.h
lldb_private::GDBRemotePacket::BinaryData::data
std::string data
Definition: GDBRemote.h:65
LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_THREAD_ID
Definition: lldb-defines.h:82
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:139