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 SBStructuredData GetErrorData();
49
50#ifndef SWIG
51 LLDB_DEPRECATED_FIXME("Use PutOutput(SBFile) or PutOutput(FileSP)",
52 "PutOutput(SBFile)")
53 size_t PutOutput(FILE *fh);
54#endif
55
56 size_t PutOutput(SBFile file);
57
58 size_t PutOutput(FileSP BORROWED);
59
60 size_t GetOutputSize();
61
62 size_t GetErrorSize();
63
64#ifndef SWIG
65 LLDB_DEPRECATED_FIXME("Use PutError(SBFile) or PutError(FileSP)",
66 "PutError(SBFile)")
67 size_t PutError(FILE *fh);
68#endif
69
70 size_t PutError(SBFile file);
71
72 size_t PutError(FileSP BORROWED);
73
74 void Clear();
75
76 lldb::ReturnStatus GetStatus();
77
78 void SetStatus(lldb::ReturnStatus status);
79
80 bool Succeeded();
81
82 bool HasResult();
83
84 void AppendMessage(const char *message);
85
86 void AppendWarning(const char *message);
87
88 bool GetDescription(lldb::SBStream &description);
89
90#ifndef SWIG
92 "Use SetImmediateOutputFile(SBFile) or SetImmediateOutputFile(FileSP)",
93 "SetImmediateOutputFile(SBFile)")
94 void SetImmediateOutputFile(FILE *fh);
95
97 "Use SetImmediateErrorFile(SBFile) or SetImmediateErrorFile(FileSP)",
98 "SetImmediateErrorFile(SBFile)")
99 void SetImmediateErrorFile(FILE *fh);
100
102 "Use SetImmediateOutputFile(SBFile) or SetImmediateOutputFile(FileSP)",
103 "SetImmediateOutputFile(SBFile)")
104 void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
105
107 "Use SetImmediateErrorFile(SBFile) or SetImmediateErrorFile(FileSP)",
108 "SetImmediateErrorFile(SBFile)")
109 void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
110#endif
111
112 void SetImmediateOutputFile(SBFile file);
113
114 void SetImmediateErrorFile(SBFile file);
115
116 void SetImmediateOutputFile(FileSP BORROWED);
117
118 void SetImmediateErrorFile(FileSP BORROWED);
119
120 void PutCString(const char *string, int len = -1);
121
122#ifndef SWIG
123 __attribute__((format(printf, 2, 3))) size_t Printf(const char *format, ...);
124#endif
125
126 const char *GetOutput(bool only_if_no_immediate);
127
128 const char *GetError(bool only_if_no_immediate);
129
130 void SetError(lldb::SBError &error,
131 const char *fallback_error_cstr = nullptr);
132
133 void SetError(const char *error_cstr);
134
135protected:
137 friend class SBOptions;
138
140 friend class lldb_private::python::SWIGBridge;
141
143
144 lldb_private::CommandReturnObject *operator->() const;
145
147
148 lldb_private::CommandReturnObject &operator*() const;
149
150private:
152
153 std::unique_ptr<lldb_private::SBCommandReturnObjectImpl> m_opaque_up;
154};
155
156} // namespace lldb
157
158#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:353