1 //===-- StreamGDBRemote.cpp -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Utility/StreamGDBRemote.h"
12 #include "lldb/Utility/Flags.h" // for Flags
13 #include "lldb/Utility/Stream.h" // for Stream::::eBinary
18 using namespace lldb_private;
20 StreamGDBRemote::StreamGDBRemote() : StreamString() {}
22 StreamGDBRemote::StreamGDBRemote(uint32_t flags, uint32_t addr_size,
24 : StreamString(flags, addr_size, byte_order) {}
26 StreamGDBRemote::~StreamGDBRemote() {}
28 int StreamGDBRemote::PutEscapedBytes(const void *s, size_t src_len) {
29 int bytes_written = 0;
30 const uint8_t *src = (const uint8_t *)s;
31 bool binary_is_set = m_flags.Test(eBinary);
32 m_flags.Clear(eBinary);
37 if (byte == 0x23 || byte == 0x24 || byte == 0x7d || byte == 0x2a) {
38 bytes_written += PutChar(0x7d);
41 bytes_written += PutChar(byte);