xref: /freebsd/contrib/llvm-project/lldb/include/lldb/API/SBExpressionOptions.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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 #include "lldb/API/SBLanguages.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   /// Set the language using a pair of language code and version as
72   /// defined by the DWARF 6 specification.
73   /// WARNING: These codes may change until DWARF 6 is finalized.
74   void SetLanguage(lldb::SBSourceLanguageName name, uint32_t version);
75 
76 #ifndef SWIG
77   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
78 #endif
79 
80   bool GetGenerateDebugInfo();
81 
82   void SetGenerateDebugInfo(bool b = true);
83 
84   bool GetSuppressPersistentResult();
85 
86   void SetSuppressPersistentResult(bool b = false);
87 
88   const char *GetPrefix() const;
89 
90   void SetPrefix(const char *prefix);
91 
92   void SetAutoApplyFixIts(bool b = true);
93 
94   bool GetAutoApplyFixIts();
95 
96   void SetRetriesWithFixIts(uint64_t retries);
97 
98   uint64_t GetRetriesWithFixIts();
99 
100   bool GetTopLevel();
101 
102   void SetTopLevel(bool b = true);
103 
104   // Gets whether we will JIT an expression if it cannot be interpreted
105   bool GetAllowJIT();
106 
107   // Sets whether we will JIT an expression if it cannot be interpreted
108   void SetAllowJIT(bool allow);
109 
110 protected:
111   lldb_private::EvaluateExpressionOptions *get() const;
112 
113   lldb_private::EvaluateExpressionOptions &ref() const;
114 
115   friend class SBFrame;
116   friend class SBValue;
117   friend class SBTarget;
118 
119 private:
120   // This auto_pointer is made in the constructor and is always valid.
121   mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_up;
122 };
123 
124 } // namespace lldb
125 
126 #endif // LLDB_API_SBEXPRESSIONOPTIONS_H
127