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 SBData;
81 friend class SBDebugger;
82 friend class SBFile;
83 friend class SBFormat;
84 friend class SBHostOS;
85 friend class SBPlatform;
86 friend class SBProcess;
87 friend class SBReproducer;
88 friend class SBStructuredData;
89 friend class SBTarget;
90 friend class SBThread;
91 friend class SBTrace;
92 friend class SBValue;
93 friend class SBValueList;
94 friend class SBWatchpoint;
95
97 friend class lldb_private::python::SWIGBridge;
98
100
102
103 lldb_private::Status *operator->();
104
105 const lldb_private::Status &operator*() const;
106
108
109 void SetError(const lldb_private::Status &lldb_error);
110
111private:
112 std::unique_ptr<lldb_private::Status> m_opaque_up;
113
114 void CreateIfNeeded();
115};
116
117} // namespace lldb
118
119#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:112
__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: SBAttachInfo.h:14
Definition: SBAddress.h:15