LLDB mainline
SBCommandReturnObject.h
Go to the documentation of this file.
1//===-- SBCommandReturnObject.h ---------------------------------*- C++ -*-===//
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
9#ifndef LLDB_API_SBCOMMANDRETURNOBJECT_H
10#define LLDB_API_SBCOMMANDRETURNOBJECT_H
11
12#include <cstdio>
13
14#include <memory>
15
16#include "lldb/API/SBDefines.h"
17
18namespace lldb_private {
19class CommandPluginInterfaceImplementation;
20class SBCommandReturnObjectImpl;
21namespace python {
22class SWIGBridge;
23}
24} // namespace lldb_private
25
26namespace lldb {
27
29public:
31
32 // rvalue ctor+assignment are incompatible with Reproducers.
33
35
37
39 operator=(const lldb::SBCommandReturnObject &rhs);
40
41 explicit operator bool() const;
42
43 bool IsValid() const;
44
45 const char *GetOutput();
46
47 const char *GetError();
48
49#ifndef SWIG
50 LLDB_DEPRECATED_FIXME("Use PutOutput(SBFile) or PutOutput(FileSP)",
51 "PutOutput(SBFile)")
52 size_t PutOutput(FILE *fh);
53#endif
54
55 size_t PutOutput(SBFile file);
56
57 size_t PutOutput(FileSP BORROWED);
58
59 size_t GetOutputSize();
60
61 size_t GetErrorSize();
62
63#ifndef SWIG
64 LLDB_DEPRECATED_FIXME("Use PutError(SBFile) or PutError(FileSP)",
65 "PutError(SBFile)")
66 size_t PutError(FILE *fh);
67#endif
68
69 size_t PutError(SBFile file);
70
71 size_t PutError(FileSP BORROWED);
72
73 void Clear();
74
75 lldb::ReturnStatus GetStatus();
76
77 void SetStatus(lldb::ReturnStatus status);
78
79 bool Succeeded();
80
81 bool HasResult();
82
83 void AppendMessage(const char *message);
84
85 void AppendWarning(const char *message);
86
87 bool GetDescription(lldb::SBStream &description);
88
89#ifndef SWIG
91 "Use SetImmediateOutputFile(SBFile) or SetImmediateOutputFile(FileSP)",
92 "SetImmediateOutputFile(SBFile)")
93 void SetImmediateOutputFile(FILE *fh);
94
96 "Use SetImmediateErrorFile(SBFile) or SetImmediateErrorFile(FileSP)",
97 "SetImmediateErrorFile(SBFile)")
98 void SetImmediateErrorFile(FILE *fh);
99
101 "Use SetImmediateOutputFile(SBFile) or SetImmediateOutputFile(FileSP)",
102 "SetImmediateOutputFile(SBFile)")
103 void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
104
106 "Use SetImmediateErrorFile(SBFile) or SetImmediateErrorFile(FileSP)",
107 "SetImmediateErrorFile(SBFile)")
108 void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
109#endif
110
111 void SetImmediateOutputFile(SBFile file);
112
113 void SetImmediateErrorFile(SBFile file);
114
115 void SetImmediateOutputFile(FileSP BORROWED);
116
117 void SetImmediateErrorFile(FileSP BORROWED);
118
119 void PutCString(const char *string, int len = -1);
120
121#ifndef SWIG
122 __attribute__((format(printf, 2, 3))) size_t Printf(const char *format, ...);
123#endif
124
125 const char *GetOutput(bool only_if_no_immediate);
126
127 const char *GetError(bool only_if_no_immediate);
128
129 void SetError(lldb::SBError &error,
130 const char *fallback_error_cstr = nullptr);
131
132 void SetError(const char *error_cstr);
133
134protected:
136 friend class SBOptions;
137
139 friend class lldb_private::python::SWIGBridge;
140
142
143 lldb_private::CommandReturnObject *operator->() const;
144
146
147 lldb_private::CommandReturnObject &operator*() const;
148
149private:
151
152 std::unique_ptr<lldb_private::SBCommandReturnObjectImpl> m_opaque_up;
153};
154
155} // namespace lldb
156
157#endif // LLDB_API_SBCOMMANDRETURNOBJECT_H
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_API
Definition: SBDefines.h:28
#define LLDB_DEPRECATED_FIXME(MSG, FIX)
Definition: SBDefines.h:39
LLDB_DEPRECATED_FIXME("Use PutOutput(SBFile) or PutOutput(FileSP)", "PutOutput(SBFile)") size_t PutOutput(FILE *fh)
LLDB_DEPRECATED_FIXME("Use SetImmediateOutputFile(SBFile) or SetImmediateOutputFile(FileSP)", "SetImmediateOutputFile(SBFile)") void SetImmediateOutputFile(FILE *fh)
LLDB_DEPRECATED_FIXME("Use PutError(SBFile) or PutError(FileSP)", "PutError(SBFile)") size_t PutError(FILE *fh)
std::unique_ptr< lldb_private::SBCommandReturnObjectImpl > m_opaque_up
__attribute__((format(printf, 2, 3))) size_t Printf(const char *format
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
ReturnStatus
Command Return Status Types.
std::shared_ptr< lldb_private::File > FileSP
Definition: lldb-forward.h:351