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 size_t PutOutput(FILE *fh); // DEPRECATED
51#endif
52
53 size_t PutOutput(SBFile file);
54
55 size_t PutOutput(FileSP BORROWED);
56
57 size_t GetOutputSize();
58
59 size_t GetErrorSize();
60
61#ifndef SWIG
62 size_t PutError(FILE *fh); // DEPRECATED
63#endif
64
65 size_t PutError(SBFile file);
66
67 size_t PutError(FileSP BORROWED);
68
69 void Clear();
70
71 lldb::ReturnStatus GetStatus();
72
73 void SetStatus(lldb::ReturnStatus status);
74
75 bool Succeeded();
76
77 bool HasResult();
78
79 void AppendMessage(const char *message);
80
81 void AppendWarning(const char *message);
82
83 bool GetDescription(lldb::SBStream &description);
84
85#ifndef SWIG
86 void SetImmediateOutputFile(FILE *fh); // DEPRECATED
87
88 void SetImmediateErrorFile(FILE *fh); // DEPRECATED
89
90 void SetImmediateOutputFile(FILE *fh, bool transfer_ownership); // DEPRECATED
91
92 void SetImmediateErrorFile(FILE *fh, bool transfer_ownership); // DEPRECATED
93#endif
94
95 void SetImmediateOutputFile(SBFile file);
96
97 void SetImmediateErrorFile(SBFile file);
98
99 void SetImmediateOutputFile(FileSP BORROWED);
100
101 void SetImmediateErrorFile(FileSP BORROWED);
102
103 void PutCString(const char *string, int len = -1);
104
105#ifndef SWIG
106 __attribute__((format(printf, 2, 3))) size_t Printf(const char *format, ...);
107#endif
108
109 const char *GetOutput(bool only_if_no_immediate);
110
111 const char *GetError(bool only_if_no_immediate);
112
113 void SetError(lldb::SBError &error,
114 const char *fallback_error_cstr = nullptr);
115
116 void SetError(const char *error_cstr);
117
118protected:
120 friend class SBOptions;
121
123 friend class lldb_private::python::SWIGBridge;
124
126
127 lldb_private::CommandReturnObject *operator->() const;
128
130
131 lldb_private::CommandReturnObject &operator*() const;
132
133private:
135
136 std::unique_ptr<lldb_private::SBCommandReturnObjectImpl> m_opaque_up;
137};
138
139} // namespace lldb
140
141#endif // LLDB_API_SBCOMMANDRETURNOBJECT_H
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_API
Definition: SBDefines.h:28
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: SBAttachInfo.h:14
Definition: SBAddress.h:15
ReturnStatus
Command Return Status Types.