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
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
23namespace lldb_private {
24
26public:
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 {
65 std::string data;
66 };
67
68 void Dump(Stream &strm) const;
69
72 uint32_t bytes_transmitted = 0;
73 uint32_t packet_idx = 0;
75
76private:
77 llvm::StringRef GetTypeStr() const;
78};
79
80} // namespace lldb_private
81
82#endif // LLDB_UTILITY_GDBREMOTE_H
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
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
#define LLDB_INVALID_THREAD_ID
Definition: lldb-defines.h:90
A class that represents a running process on the host machine.
ByteOrder
Byte ordering definitions.
uint64_t tid_t
Definition: lldb-types.h:84
GDB remote packet as used by the GDB remote communication history.
Definition: GDBRemote.h:50
void Dump(Stream &strm) const
Definition: GDBRemote.cpp:60
llvm::StringRef GetTypeStr() const
Definition: GDBRemote.cpp:48