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 
26  ~SBError();
27 
28  const SBError &operator=(const lldb::SBError &rhs);
29 
30  const char *GetCString() const;
31 
32  void Clear();
33 
34  bool Fail() const;
35 
36  bool Success() const;
37 
38  uint32_t GetError() const;
39 
40  lldb::ErrorType GetType() const;
41 
42  void SetError(uint32_t err, lldb::ErrorType type);
43 
44  void SetErrorToErrno();
45 
46  void SetErrorToGenericError();
47 
48  void SetErrorString(const char *err_str);
49 
50  int SetErrorStringWithFormat(const char *format, ...)
51  __attribute__((format(printf, 2, 3)));
52 
53  explicit operator bool() const;
54 
55  bool IsValid() const;
56 
57  bool GetDescription(lldb::SBStream &description);
58 
59 protected:
60  friend class SBBreakpoint;
61  friend class SBBreakpointLocation;
62  friend class SBBreakpointName;
63  friend class SBCommandReturnObject;
64  friend class SBCommunication;
65  friend class SBData;
66  friend class SBDebugger;
67  friend class SBHostOS;
68  friend class SBPlatform;
69  friend class SBProcess;
70  friend class SBReproducer;
71  friend class SBStructuredData;
72  friend class SBTarget;
73  friend class SBThread;
74  friend class SBTrace;
75  friend class SBValue;
76  friend class SBWatchpoint;
77  friend class SBFile;
78 
80 
81  lldb_private::Status *get();
82 
83  lldb_private::Status *operator->();
84 
85  const lldb_private::Status &operator*() const;
86 
87  lldb_private::Status &ref();
88 
89  void SetError(const lldb_private::Status &lldb_error);
90 
91 private:
92  std::unique_ptr<lldb_private::Status> m_opaque_up;
93 
94  void CreateIfNeeded();
95 };
96 
97 } // namespace lldb
98 
99 #endif // LLDB_API_SBERROR_H
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:40
lldb::SBCommandReturnObject
Definition: SBCommandReturnObject.h:24
lldb::SBError
Definition: SBError.h:20
lldb::SBValue
Definition: SBValue.h:21
LLDB_API
#define LLDB_API
Definition: lldb-defines.h:23
lldb::SBProcess
Definition: SBProcess.h:23
lldb::SBHostOS
Definition: SBHostOS.h:17
lldb::SBTrace
Definition: SBTrace.h:19
lldb::SBTarget
Definition: SBTarget.h:29
lldb::SBFile
Definition: SBFile.h:16
lldb::SBDebugger
Definition: SBDebugger.h:34
lldb::ErrorType
ErrorType
Definition: lldb-enumerations.h:306
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
SetError
static void SetError(CommandReturnObject &result, Error err)
Definition: CommandObjectReproducer.cpp:140
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:92
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:43