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
47/// GDB remote packet as used by the GDB remote communication history. Packets
48/// can be serialized to file.
50
52
53 GDBRemotePacket() = default;
54
55 void Clear() {
56 packet.data.clear();
59 packet_idx = 0;
61 }
62
63 struct BinaryData {
64 std::string data;
65 };
66
67 void Dump(Stream &strm) const;
68
71 uint32_t bytes_transmitted = 0;
72 uint32_t packet_idx = 0;
74
75private:
76 llvm::StringRef GetTypeStr() const;
77};
78
79} // namespace lldb_private
80
81#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:27
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:59
llvm::StringRef GetTypeStr() const
Definition GDBRemote.cpp:47