1 //===-- SBEvent.h -----------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_SBExpressionOptions_h_
11 #define LLDB_SBExpressionOptions_h_
12 
13 #include "lldb/API/SBDefines.h"
14 
15 #include <vector>
16 
17 namespace lldb {
18 
19 class LLDB_API SBExpressionOptions {
20 public:
21   SBExpressionOptions();
22 
23   SBExpressionOptions(const lldb::SBExpressionOptions &rhs);
24 
25   ~SBExpressionOptions();
26 
27   const SBExpressionOptions &operator=(const lldb::SBExpressionOptions &rhs);
28 
29   bool GetCoerceResultToId() const;
30 
31   void SetCoerceResultToId(bool coerce = true);
32 
33   bool GetUnwindOnError() const;
34 
35   void SetUnwindOnError(bool unwind = true);
36 
37   bool GetIgnoreBreakpoints() const;
38 
39   void SetIgnoreBreakpoints(bool ignore = true);
40 
41   lldb::DynamicValueType GetFetchDynamicValue() const;
42 
43   void SetFetchDynamicValue(
44       lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
45 
46   uint32_t GetTimeoutInMicroSeconds() const;
47 
48   // Set the timeout for the expression, 0 means wait forever.
49   void SetTimeoutInMicroSeconds(uint32_t timeout = 0);
50 
51   uint32_t GetOneThreadTimeoutInMicroSeconds() const;
52 
53   // Set the timeout for running on one thread, 0 means use the default
54   // behavior. If you set this higher than the overall timeout, you'll get an
55   // error when you try to run the expression.
56   void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout = 0);
57 
58   bool GetTryAllThreads() const;
59 
60   void SetTryAllThreads(bool run_others = true);
61 
62   bool GetStopOthers() const;
63 
64   void SetStopOthers(bool stop_others = true);
65 
66   bool GetTrapExceptions() const;
67 
68   void SetTrapExceptions(bool trap_exceptions = true);
69 
70   void SetLanguage(lldb::LanguageType language);
71 
72   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
73 
74   bool GetGenerateDebugInfo();
75 
76   void SetGenerateDebugInfo(bool b = true);
77 
78   bool GetSuppressPersistentResult();
79 
80   void SetSuppressPersistentResult(bool b = false);
81 
82   const char *GetPrefix() const;
83 
84   void SetPrefix(const char *prefix);
85 
86   void SetAutoApplyFixIts(bool b = true);
87 
88   bool GetAutoApplyFixIts();
89 
90   bool GetTopLevel();
91 
92   void SetTopLevel(bool b = true);
93 
94   // Gets whether we will JIT an expression if it cannot be interpreted
95   bool GetAllowJIT();
96 
97   // Sets whether we will JIT an expression if it cannot be interpreted
98   void SetAllowJIT(bool allow);
99 
100 protected:
101   SBExpressionOptions(
102       lldb_private::EvaluateExpressionOptions &expression_options);
103 
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_ap;
115 };
116 
117 } // namespace lldb
118 
119 #endif // LLDB_SBExpressionOptions_h_
120