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   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
72 
73   bool GetGenerateDebugInfo();
74 
75   void SetGenerateDebugInfo(bool b = true);
76 
77   bool GetSuppressPersistentResult();
78 
79   void SetSuppressPersistentResult(bool b = false);
80 
81   const char *GetPrefix() const;
82 
83   void SetPrefix(const char *prefix);
84 
85   void SetAutoApplyFixIts(bool b = true);
86 
87   bool GetAutoApplyFixIts();
88 
89   void SetRetriesWithFixIts(uint64_t retries);
90 
91   uint64_t GetRetriesWithFixIts();
92 
93   bool GetTopLevel();
94 
95   void SetTopLevel(bool b = true);
96 
97   // Gets whether we will JIT an expression if it cannot be interpreted
98   bool GetAllowJIT();
99 
100   // Sets whether we will JIT an expression if it cannot be interpreted
101   void SetAllowJIT(bool allow);
102 
103 protected:
104   lldb_private::EvaluateExpressionOptions *get() const;
105 
106   lldb_private::EvaluateExpressionOptions &ref() const;
107 
108   friend class SBFrame;
109   friend class SBValue;
110   friend class SBTarget;
111 
112 private:
113   // This auto_pointer is made in the constructor and is always valid.
114   mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_up;
115 };
116 
117 } // namespace lldb
118 
119 #endif // LLDB_API_SBEXPRESSIONOPTIONS_H
120