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, lldb::ByteOrder byte_order);
30
31 ~StreamGDBRemote() override;
32
33 /// Output a block of data to the stream performing GDB-remote escaping.
34 ///
35 /// \param[in] s
36 /// A block of data.
37 ///
38 /// \param[in] src_len
39 /// The amount of data to write.
40 ///
41 /// \return
42 /// Number of bytes written.
43 // TODO: Convert this function to take ArrayRef<uint8_t>
44 int PutEscapedBytes(const void *s, size_t src_len);
45
46 /// Equivalent to PutEscapedBytes(str.data(), str.size());
47 int PutEscapedBytes(llvm::StringRef str);
48};
49
50/// GDB remote packet as used by the GDB remote communication history. Packets
51/// can be serialized to file.
53
55
56 GDBRemotePacket() = default;
57
58 void Clear() {
59 packet.data.clear();
62 packet_idx = 0;
64 }
65
66 struct BinaryData {
67 std::string data;
68 };
69
70 void Dump(Stream &strm) const;
71
74 uint32_t bytes_transmitted = 0;
75 uint32_t packet_idx = 0;
77
78private:
79 llvm::StringRef GetTypeStr() const;
80};
81
82} // namespace lldb_private
83
84#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:31
StreamString(bool colors=false)
A stream class that can stream formatted output to a file.
Definition Stream.h:28
#define LLDB_INVALID_THREAD_ID
A class that represents a running process on the host machine.
ByteOrder
Byte ordering definitions.
uint64_t tid_t
Definition lldb-types.h:84
void Dump(Stream &strm) const
Definition GDBRemote.cpp:63
llvm::StringRef GetTypeStr() const
Definition GDBRemote.cpp:51