LLDB mainline
SBError.h
Go to the documentation of this file.
1//===-- SBError.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_SBERROR_H
10#define LLDB_API_SBERROR_H
11
12#include "lldb/API/SBDefines.h"
13
14namespace lldb_private {
15class ScriptInterpreter;
16namespace python {
17class SWIGBridge;
18}
19} // namespace lldb_private
20
21namespace lldb {
22
24public:
25 SBError();
26
27 SBError(const lldb::SBError &rhs);
28
29 SBError(const char *message);
30
32
33 const SBError &operator=(const lldb::SBError &rhs);
34
35 /// Get the error string as a NULL terminated UTF8 c-string.
36 ///
37 /// This SBError object owns the returned string and this object must be kept
38 /// around long enough to use the returned string.
39 const char *GetCString() const;
40
41 void Clear();
42
43 bool Fail() const;
44
45 bool Success() const;
46
47 uint32_t GetError() const;
48
49 lldb::ErrorType GetType() const;
50
51 void SetError(uint32_t err, lldb::ErrorType type);
52
53 void SetErrorToErrno();
54
55 void SetErrorToGenericError();
56
57 void SetErrorString(const char *err_str);
58
59#ifndef SWIG
60 __attribute__((format(printf, 2, 3)))
61#else
62 // clang-format off
63 %varargs(3, char *str = NULL) SetErrorStringWithFormat;
64 // clang-format on
65#endif
66 int SetErrorStringWithFormat(const char *format, ...);
67
68 explicit operator bool() const;
69
70 bool IsValid() const;
71
72 bool GetDescription(lldb::SBStream &description);
73
74protected:
75 friend class SBBreakpoint;
77 friend class SBBreakpointName;
79 friend class SBCommunication;
80 friend class SBSaveCoreOptions;
81 friend class SBData;
82 friend class SBDebugger;
83 friend class SBFile;
84 friend class SBFormat;
85 friend class SBHostOS;
86 friend class SBPlatform;
87 friend class SBProcess;
88 friend class SBReproducer;
89 friend class SBStructuredData;
90 friend class SBTarget;
91 friend class SBThread;
92 friend class SBTrace;
93 friend class SBValue;
94 friend class SBValueList;
95 friend class SBWatchpoint;
96
98 friend class lldb_private::python::SWIGBridge;
99
101
103
104 lldb_private::Status *operator->();
105
106 const lldb_private::Status &operator*() const;
107
109
110 void SetError(const lldb_private::Status &lldb_error);
111
112private:
113 std::unique_ptr<lldb_private::Status> m_opaque_up;
114
115 void CreateIfNeeded();
116};
117
118} // namespace lldb
119
120#endif // LLDB_API_SBERROR_H
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_API
Definition: SBDefines.h:28
std::unique_ptr< lldb_private::Status > m_opaque_up
Definition: SBError.h:113
__attribute__((format(printf, 2, 3))) int SetErrorStringWithFormat(const char *format
Class that represents a format string that can be used to generate descriptions of objects like frame...
Definition: SBFormat.h:28
The SBReproducer class is special because it bootstraps the capture and replay of SB API calls.
Definition: SBReproducer.h:42
An error handling class.
Definition: Status.h:44
A class that represents a running process on the host machine.
Definition: SBAddress.h:15