LLDB mainline
StreamAsynchronousIO.cpp
Go to the documentation of this file.
1//===-- StreamAsynchronousIO.cpp ------------------------------------------===//
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
10
11#include "lldb/Core/Debugger.h"
13
14using namespace lldb;
15using namespace lldb_private;
16
18 bool colors)
19 : Stream(0, 4, eByteOrderBig, colors), m_debugger(debugger), m_data(),
20 m_for_stdout(for_stdout) {}
21
23 // Flush when we destroy to make sure we display the data
24 Flush();
25}
26
28 if (!m_data.empty()) {
30 m_data = std::string();
31 }
32}
33
34size_t StreamAsynchronousIO::WriteImpl(const void *s, size_t length) {
35 m_data.append((const char *)s, length);
36 return length;
37}
A class to manage flag bits.
Definition: Debugger.h:80
void PrintAsync(const char *s, size_t len, bool is_stdout)
Definition: Debugger.cpp:1164
void Flush() override
Flush the stream.
size_t WriteImpl(const void *src, size_t src_len) override
Output character bytes to the stream.
StreamAsynchronousIO(Debugger &debugger, bool for_stdout, bool colors)
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
A class that represents a running process on the host machine.
Definition: SBAddress.h:15