diff options
author | emaste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
commit | c727fe695d28799acb499e9961f11ec07d4f9fe2 (patch) | |
tree | 56d79f94966870db1cecd65a7264510a25fd1cba /source/Core/StreamGDBRemote.cpp | |
parent | 2e8c9206a971efee1b77ad2ae852265d6f4ecaa0 (diff) | |
download | FreeBSD-src-c727fe695d28799acb499e9961f11ec07d4f9fe2.zip FreeBSD-src-c727fe695d28799acb499e9961f11ec07d4f9fe2.tar.gz |
Import lldb as of SVN r194122
Sponsored by: DARPA, AFRL
Diffstat (limited to 'source/Core/StreamGDBRemote.cpp')
-rw-r--r-- | source/Core/StreamGDBRemote.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/source/Core/StreamGDBRemote.cpp b/source/Core/StreamGDBRemote.cpp new file mode 100644 index 0000000..46cb99c --- /dev/null +++ b/source/Core/StreamGDBRemote.cpp @@ -0,0 +1,54 @@ +//===-- StreamGDBRemote.cpp -------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Core/StreamGDBRemote.h" +#include <stdio.h> + +using namespace lldb; +using namespace lldb_private; + +StreamGDBRemote::StreamGDBRemote () : +StreamString () +{ +} + +StreamGDBRemote::StreamGDBRemote(uint32_t flags, uint32_t addr_size, ByteOrder byte_order) : +StreamString (flags, addr_size, byte_order) +{ +} + +StreamGDBRemote::~StreamGDBRemote() +{ +} + + +int +StreamGDBRemote::PutEscapedBytes (const void* s, + size_t src_len) +{ + int bytes_written = 0; + const uint8_t *src = (const uint8_t *)s; + bool binary_is_set = m_flags.Test(eBinary); + m_flags.Clear(eBinary); + while (src_len) + { + uint8_t byte = *src; + src++; src_len--; + if (byte == 0x23 || byte == 0x24 || byte == 0x7d || byte == 0x2a) + { + bytes_written += PutChar(0x7d); + byte ^= 0x20; + } + bytes_written += PutChar(byte); + }; + if (binary_is_set) + m_flags.Set(eBinary); + return bytes_written; +} + |