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"
12 #include "lldb/lldb-enumerations.h"
13 
14 using namespace lldb;
15 using namespace lldb_private;
16 
17 StreamAsynchronousIO::StreamAsynchronousIO(Debugger &debugger, bool for_stdout)
18  : Stream(0, 4, eByteOrderBig), m_debugger(debugger), m_data(),
19  m_for_stdout(for_stdout) {}
20 
22  // Flush when we destroy to make sure we display the data
23  Flush();
24 }
25 
27  if (!m_data.empty()) {
29  m_data = std::string();
30  }
31 }
32 
33 size_t StreamAsynchronousIO::WriteImpl(const void *s, size_t length) {
34  m_data.append((const char *)s, length);
35  return length;
36 }
lldb_private::StreamAsynchronousIO::Flush
void Flush() override
Flush the stream.
Definition: StreamAsynchronousIO.cpp:26
lldb_private::StreamAsynchronousIO::WriteImpl
size_t WriteImpl(const void *src, size_t src_len) override
Output character bytes to the stream.
Definition: StreamAsynchronousIO.cpp:33
lldb_private::Stream
Definition: Stream.h:28
Debugger.h
lldb_private::StreamAsynchronousIO::m_debugger
Debugger & m_debugger
Definition: StreamAsynchronousIO.h:33
StreamAsynchronousIO.h
lldb-enumerations.h
lldb_private::Debugger
Definition: Debugger.h:70
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:38
lldb_private::StreamAsynchronousIO::m_for_stdout
bool m_for_stdout
Definition: StreamAsynchronousIO.h:35
lldb_private::Debugger::PrintAsync
void PrintAsync(const char *s, size_t len, bool is_stdout)
Definition: Debugger.cpp:930
lldb_private::StreamAsynchronousIO::~StreamAsynchronousIO
~StreamAsynchronousIO() override
Definition: StreamAsynchronousIO.cpp:21
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::eByteOrderBig
@ eByteOrderBig
Definition: lldb-enumerations.h:140
lldb_private::StreamAsynchronousIO::m_data
std::string m_data
Definition: StreamAsynchronousIO.h:34
lldb
Definition: SBAddress.h:15