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 
18 namespace lldb_private {
19 class SBCommandReturnObjectImpl;
20 }
21 
22 namespace lldb {
23 
25 public:
27 
29 
30  // rvalue ctor+assignment are incompatible with Reproducers.
31 
33 
35 
37  operator=(const lldb::SBCommandReturnObject &rhs);
38 
39  explicit operator bool() const;
40 
41  bool IsValid() const;
42 
43  const char *GetOutput();
44 
45  const char *GetError();
46 
47  size_t PutOutput(FILE *fh); // DEPRECATED
48 
49  size_t PutOutput(SBFile file);
50 
51  size_t PutOutput(FileSP file);
52 
53  size_t GetOutputSize();
54 
55  size_t GetErrorSize();
56 
57  size_t PutError(FILE *fh); // DEPRECATED
58 
59  size_t PutError(SBFile file);
60 
61  size_t PutError(FileSP file);
62 
63  void Clear();
64 
65  lldb::ReturnStatus GetStatus();
66 
67  void SetStatus(lldb::ReturnStatus status);
68 
69  bool Succeeded();
70 
71  bool HasResult();
72 
73  void AppendMessage(const char *message);
74 
75  void AppendWarning(const char *message);
76 
77  bool GetDescription(lldb::SBStream &description);
78 
79  void SetImmediateOutputFile(FILE *fh); // DEPRECATED
80 
81  void SetImmediateErrorFile(FILE *fh); // DEPRECATED
82 
83  void SetImmediateOutputFile(FILE *fh, bool transfer_ownership); // DEPRECATED
84 
85  void SetImmediateErrorFile(FILE *fh, bool transfer_ownership); // DEPRECATED
86 
87  void SetImmediateOutputFile(SBFile file);
88 
89  void SetImmediateErrorFile(SBFile file);
90 
91  void SetImmediateOutputFile(FileSP file);
92 
93  void SetImmediateErrorFile(FileSP file);
94 
95  void PutCString(const char *string, int len = -1);
96 
97  size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
98 
99  const char *GetOutput(bool only_if_no_immediate);
100 
101  const char *GetError(bool only_if_no_immediate);
102 
104  const char *fallback_error_cstr = nullptr);
105 
106  void SetError(const char *error_cstr);
107 
108 protected:
109  friend class SBCommandInterpreter;
110  friend class SBOptions;
111 
112  lldb_private::CommandReturnObject *operator->() const;
113 
115 
117 
118 private:
120 
121  std::unique_ptr<lldb_private::SBCommandReturnObjectImpl> m_opaque_up;
122 };
123 
124 } // namespace lldb
125 
126 #endif // LLDB_API_SBCOMMANDRETURNOBJECT_H
SBDefines.h
lldb::SBCommandReturnObject::m_opaque_up
std::unique_ptr< lldb_private::SBCommandReturnObjectImpl > m_opaque_up
Definition: SBCommandReturnObject.h:121
lldb::SBCommandReturnObject
Definition: SBCommandReturnObject.h:24
lldb::SBError
Definition: SBError.h:20
lldb::SBCommandInterpreter
Definition: SBCommandInterpreter.h:19
LLDB_API
#define LLDB_API
Definition: lldb-defines.h:23
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb::SBFile
Definition: SBFile.h:16
lldb::ReturnStatus
ReturnStatus
Command Return Status Types.
Definition: lldb-enumerations.h:258
lldb::SBCommandReturnObject
class LLDB_API SBCommandReturnObject
Definition: SBDefines.h:33
lldb_private::CommandReturnObject
Definition: CommandReturnObject.h:25
message
message(FATAL_ERROR "invalid libipt include path provided") endif() include_directories($
Definition: Plugins/Trace/intel-pt/CMakeLists.txt:6
SetError
static void SetError(CommandReturnObject &result, Error err)
Definition: CommandObjectReproducer.cpp:140
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::SBStream
Definition: SBStream.h:18
lldb_private::operator*
const Scalar operator*(Scalar lhs, Scalar rhs)
Definition: Scalar.cpp:556
lldb
Definition: SBAddress.h:15