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 
14 namespace lldb_private {
15 class ScriptInterpreter;
16 } // namespace lldb_private
17 
18 namespace lldb {
19 
21 public:
22  SBError();
23 
24  SBError(const lldb::SBError &rhs);
25 
27 
28  ~SBError();
29 
30  const SBError &operator=(const lldb::SBError &rhs);
31 
32  /// Get the error string as a NULL terminated UTF8 c-string.
33  ///
34  /// This SBError object owns the returned string and this object must be kept
35  /// around long enough to use the returned string.
36  const char *GetCString() const;
37 
38  void Clear();
39 
40  bool Fail() const;
41 
42  bool Success() const;
43 
44  uint32_t GetError() const;
45 
46  lldb::ErrorType GetType() const;
47 
48  void SetError(uint32_t err, lldb::ErrorType type);
49 
50  void SetErrorToErrno();
51 
52  void SetErrorToGenericError();
53 
54  void SetErrorString(const char *err_str);
55 
56  int SetErrorStringWithFormat(const char *format, ...)
57  __attribute__((format(printf, 2, 3)));
58 
59  explicit operator bool() const;
60 
61  bool IsValid() const;
62 
63  bool GetDescription(lldb::SBStream &description);
64 
65 protected:
66  friend class SBBreakpoint;
67  friend class SBBreakpointLocation;
68  friend class SBBreakpointName;
69  friend class SBCommandReturnObject;
70  friend class SBCommunication;
71  friend class SBData;
72  friend class SBDebugger;
73  friend class SBFile;
74  friend class SBHostOS;
75  friend class SBPlatform;
76  friend class SBProcess;
77  friend class SBReproducer;
78  friend class SBStructuredData;
79  friend class SBTarget;
80  friend class SBThread;
81  friend class SBTrace;
82  friend class SBValue;
83  friend class SBValueList;
84  friend class SBWatchpoint;
85 
87 
88  lldb_private::Status *get();
89 
90  lldb_private::Status *operator->();
91 
92  const lldb_private::Status &operator*() const;
93 
94  lldb_private::Status &ref();
95 
96  void SetError(const lldb_private::Status &lldb_error);
97 
98 private:
99  std::unique_ptr<lldb_private::Status> m_opaque_up;
100 
101  void CreateIfNeeded();
102 };
103 
104 } // namespace lldb
105 
106 #endif // LLDB_API_SBERROR_H
lldb::SBValueList
Definition: SBValueList.h:18
lldb::SBBreakpointLocation
Definition: SBBreakpointLocation.h:17
lldb::SBCommunication
Definition: SBCommunication.h:17
lldb::SBThread
Definition: SBThread.h:20
SBDefines.h
lldb::SBError
class LLDB_API SBError
Definition: SBDefines.h:52
lldb::SBCommandReturnObject
Definition: SBCommandReturnObject.h:24
lldb::SBError
Definition: SBError.h:20
__attribute__
__attribute__((always_inline)) int uuid_is_null(uuid_t uuid)
Definition: UuidCompatibility.h:18
lldb::SBValue
Definition: SBValue.h:21
lldb::SBProcess
Definition: SBProcess.h:23
lldb::SBHostOS
Definition: SBHostOS.h:17
lldb::SBTrace
Definition: SBTrace.h:18
lldb::SBTarget
Definition: SBTarget.h:29
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb::SBFile
Definition: SBFile.h:16
lldb::SBDebugger
Definition: SBDebugger.h:34
lldb::ErrorType
ErrorType
Definition: lldb-enumerations.h:307
lldb::SBWatchpoint
Definition: SBWatchpoint.h:16
lldb_private::Status
Definition: Status.h:44
uint32_t
lldb::SBStructuredData
Definition: SBStructuredData.h:17
lldb::SBBreakpoint
Definition: SBBreakpoint.h:18
lldb::SBData
Definition: SBData.h:20
lldb_private::ScriptInterpreter
Definition: ScriptInterpreter.h:126
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::SBStream
Definition: SBStream.h:18
lldb::SBError::m_opaque_up
std::unique_ptr< lldb_private::Status > m_opaque_up
Definition: SBError.h:99
lldb_private::operator*
const Scalar operator*(Scalar lhs, Scalar rhs)
Definition: Scalar.cpp:556
lldb::SBPlatform
Definition: SBPlatform.h:93
lldb::SBBreakpointName
Definition: SBBreakpointName.h:18
lldb
Definition: SBAddress.h:15
lldb::SBReproducer
The SBReproducer class is special because it bootstraps the capture and replay of SB API calls.
Definition: SBReproducer.h:40
LLDB_API
#define LLDB_API
Definition: SBDefines.h:26