Lawrence D'Anna 5750453020 new api class: SBFile
Summary:
SBFile is a scripting API wrapper for lldb_private::File

This is the first step in a project to enable arbitrary python
io.IOBase file objects -- including those that override the read()
and write() methods -- to be used as the main debugger IOStreams.

Currently this is impossible because python file objects must first
be converted into FILE* streams by SWIG in order to be passed into
the debugger.

full prototype: https://github.com/smoofra/llvm-project/tree/files

Reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath

Reviewed By: labath

Subscribers: labath, mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D67793

llvm-svn: 373562
2019-10-03 04:01:07 +00:00

39 lines
962 B
OpenEdge ABL

//===-- SWIG Interface for SBFile -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
namespace lldb {
%feature("docstring",
"Represents a file."
) SBFile;
class SBFile
{
public:
SBFile();
SBFile(int fd, const char *mode, bool transfer_ownership);
~SBFile ();
%feature("autodoc", "Read(buffer) -> SBError, bytes_read") Read;
SBError Read(uint8_t *buf, size_t num_bytes, size_t *OUTPUT);
%feature("autodoc", "Write(buffer) -> SBError, written_read") Write;
SBError Write(const uint8_t *buf, size_t num_bytes, size_t *OUTPUT);
void Flush();
bool IsValid() const;
operator bool() const;
SBError Close();
};
} // namespace lldb