1 //===-- SBExpressionOptions.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_SBEXPRESSIONOPTIONS_H
10 #define LLDB_API_SBEXPRESSIONOPTIONS_H
11 
12 #include "lldb/API/SBDefines.h"
13 
14 #include <vector>
15 
16 namespace lldb {
17 
18 class LLDB_API SBExpressionOptions {
19 public:
20   SBExpressionOptions();
21 
22   SBExpressionOptions(const lldb::SBExpressionOptions &rhs);
23 
24   ~SBExpressionOptions();
25 
26   const SBExpressionOptions &operator=(const lldb::SBExpressionOptions &rhs);
27 
28   bool GetCoerceResultToId() const;
29 
30   void SetCoerceResultToId(bool coerce = true);
31 
32   bool GetUnwindOnError() const;
33 
34   void SetUnwindOnError(bool unwind = true);
35 
36   bool GetIgnoreBreakpoints() const;
37 
38   void SetIgnoreBreakpoints(bool ignore = true);
39 
40   lldb::DynamicValueType GetFetchDynamicValue() const;
41 
42   void SetFetchDynamicValue(
43       lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
44 
45   uint32_t GetTimeoutInMicroSeconds() const;
46 
47   // Set the timeout for the expression, 0 means wait forever.
48   void SetTimeoutInMicroSeconds(uint32_t timeout = 0);
49 
50   uint32_t GetOneThreadTimeoutInMicroSeconds() const;
51 
52   // Set the timeout for running on one thread, 0 means use the default
53   // behavior. If you set this higher than the overall timeout, you'll get an
54   // error when you try to run the expression.
55   void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout = 0);
56 
57   bool GetTryAllThreads() const;
58 
59   void SetTryAllThreads(bool run_others = true);
60 
61   bool GetStopOthers() const;
62 
63   void SetStopOthers(bool stop_others = true);
64 
65   bool GetTrapExceptions() const;
66 
67   void SetTrapExceptions(bool trap_exceptions = true);
68 
69   void SetLanguage(lldb::LanguageType language);
70 
71 #ifndef SWIG
72   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
73 #endif
74 
75   bool GetGenerateDebugInfo();
76 
77   void SetGenerateDebugInfo(bool b = true);
78 
79   bool GetSuppressPersistentResult();
80 
81   void SetSuppressPersistentResult(bool b = false);
82 
83   const char *GetPrefix() const;
84 
85   void SetPrefix(const char *prefix);
86 
87   void SetAutoApplyFixIts(bool b = true);
88 
89   bool GetAutoApplyFixIts();
90 
91   void SetRetriesWithFixIts(uint64_t retries);
92 
93   uint64_t GetRetriesWithFixIts();
94 
95   bool GetTopLevel();
96 
97   void SetTopLevel(bool b = true);
98 
99   // Gets whether we will JIT an expression if it cannot be interpreted
100   bool GetAllowJIT();
101 
102   // Sets whether we will JIT an expression if it cannot be interpreted
103   void SetAllowJIT(bool allow);
104 
105 protected:
106   lldb_private::EvaluateExpressionOptions *get() const;
107 
108   lldb_private::EvaluateExpressionOptions &ref() const;
109 
110   friend class SBFrame;
111   friend class SBValue;
112   friend class SBTarget;
113 
114 private:
115   // This auto_pointer is made in the constructor and is always valid.
116   mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_up;
117 };
118 
119 } // namespace lldb
120 
121 #endif // LLDB_API_SBEXPRESSIONOPTIONS_H
122