Summary:
This merge brings in the improved 'platform' command that knows how to
interface with remote machines; that is, query OS/kernel information, push
and pull files, run shell commands, etc... and implementation for the new
communication packets that back that interface, at least on Darwin based
operating systems via the POSIXPlatform class. Linux support is coming soon.
Verified the test suite runs cleanly on Linux (x86_64), build OK on Mac OS
X Mountain Lion.
Additional improvements (not in the source SVN branch 'lldb-platform-work'):
- cmake build scripts for lldb-platform
- cleanup test suite
- documentation stub for qPlatform_RunCommand
- use log class instead of printf() directly
- reverted work-in-progress-looking changes from test/types/TestAbstract.py that work towards running the test suite remotely.
- add new logging category 'platform'
Reviewers: Matt Kopec, Greg Clayton
Review: http://llvm-reviews.chandlerc.com/D1493
llvm-svn: 189295
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
//===-- 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;
|
|
}
|
|
|