1359575Sdim//===-- SWIG interface for SBExpressionOptions -----------------------------------------------*- C++ -*-===//
2359575Sdim//
3359575Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4359575Sdim// See https://llvm.org/LICENSE.txt for license information.
5359575Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6359575Sdim//
7359575Sdim//===----------------------------------------------------------------------===//
8359575Sdim
9359575Sdimnamespace lldb {
10359575Sdim
11359575Sdim%feature("docstring",
12359575Sdim"A container for options to use when evaluating expressions."
13359575Sdim) SBExpressionOptions;
14359575Sdim
15359575Sdimclass SBExpressionOptions
16359575Sdim{
17359575Sdimfriend class SBFrame;
18359575Sdimfriend class SBValue;
19359575Sdim
20359575Sdimpublic:
21359575Sdim    SBExpressionOptions();
22359575Sdim
23359575Sdim    SBExpressionOptions (const lldb::SBExpressionOptions &rhs);
24359575Sdim
25359575Sdim    ~SBExpressionOptions();
26359575Sdim
27359575Sdim    bool
28359575Sdim    GetCoerceResultToId () const;
29359575Sdim
30359575Sdim    %feature("docstring", "Sets whether to coerce the expression result to ObjC id type after evaluation.") SetCoerceResultToId;
31359575Sdim
32359575Sdim    void
33359575Sdim    SetCoerceResultToId (bool coerce = true);
34359575Sdim
35359575Sdim    bool
36359575Sdim    GetUnwindOnError () const;
37359575Sdim
38359575Sdim    %feature("docstring", "Sets whether to unwind the expression stack on error.") SetUnwindOnError;
39359575Sdim
40359575Sdim    void
41359575Sdim    SetUnwindOnError (bool unwind = true);
42359575Sdim
43359575Sdim    bool
44359575Sdim    GetIgnoreBreakpoints () const;
45359575Sdim
46359575Sdim    %feature("docstring", "Sets whether to ignore breakpoint hits while running expressions.") SetUnwindOnError;
47359575Sdim
48359575Sdim    void
49359575Sdim    SetIgnoreBreakpoints (bool ignore = true);
50359575Sdim
51359575Sdim    lldb::DynamicValueType
52359575Sdim    GetFetchDynamicValue () const;
53359575Sdim
54359575Sdim    %feature("docstring", "Sets whether to cast the expression result to its dynamic type.") SetFetchDynamicValue;
55359575Sdim
56359575Sdim    void
57359575Sdim    SetFetchDynamicValue (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
58359575Sdim
59359575Sdim    uint32_t
60359575Sdim    GetTimeoutInMicroSeconds () const;
61359575Sdim
62359575Sdim    %feature("docstring", "Sets the timeout in microseconds to run the expression for. If try all threads is set to true and the expression doesn't complete within the specified timeout, all threads will be resumed for the same timeout to see if the expresson will finish.") SetTimeoutInMicroSeconds;
63359575Sdim    void
64359575Sdim    SetTimeoutInMicroSeconds (uint32_t timeout = 0);
65359575Sdim
66359575Sdim    uint32_t
67359575Sdim    GetOneThreadTimeoutInMicroSeconds () const;
68359575Sdim
69359575Sdim    %feature("docstring", "Sets the timeout in microseconds to run the expression on one thread before either timing out or trying all threads.") SetTimeoutInMicroSeconds;
70359575Sdim    void
71359575Sdim    SetOneThreadTimeoutInMicroSeconds (uint32_t timeout = 0);
72359575Sdim
73359575Sdim    bool
74359575Sdim    GetTryAllThreads () const;
75359575Sdim
76359575Sdim    %feature("docstring", "Sets whether to run all threads if the expression does not complete on one thread.") SetTryAllThreads;
77359575Sdim    void
78359575Sdim    SetTryAllThreads (bool run_others = true);
79359575Sdim
80359575Sdim    bool
81359575Sdim    GetStopOthers () const;
82359575Sdim
83359575Sdim    %feature("docstring", "Sets whether to stop other threads at all while running expressins.  If false, TryAllThreads does nothing.") SetTryAllThreads;
84359575Sdim    void
85359575Sdim    SetStopOthers (bool stop_others = true);
86359575Sdim
87359575Sdim    bool
88359575Sdim    GetTrapExceptions () const;
89359575Sdim
90359575Sdim    %feature("docstring", "Sets whether to abort expression evaluation if an exception is thrown while executing.  Don't set this to false unless you know the function you are calling traps all exceptions itself.") SetTryAllThreads;
91359575Sdim    void
92359575Sdim    SetTrapExceptions (bool trap_exceptions = true);
93359575Sdim
94359575Sdim    %feature ("docstring", "Sets the language that LLDB should assume the expression is written in") SetLanguage;
95359575Sdim    void
96359575Sdim    SetLanguage (lldb::LanguageType language);
97359575Sdim
98359575Sdim    bool
99359575Sdim    GetGenerateDebugInfo ();
100359575Sdim
101359575Sdim    %feature("docstring", "Sets whether to generate debug information for the expression and also controls if a SBModule is generated.") SetGenerateDebugInfo;
102359575Sdim    void
103359575Sdim    SetGenerateDebugInfo (bool b = true);
104359575Sdim
105359575Sdim    bool
106359575Sdim    GetSuppressPersistentResult ();
107359575Sdim
108359575Sdim    %feature("docstring", "Sets whether to produce a persistent result that can be used in future expressions.") SetSuppressPersistentResult;
109359575Sdim    void
110359575Sdim    SetSuppressPersistentResult (bool b = false);
111359575Sdim
112359575Sdim
113359575Sdim    %feature("docstring", "Gets the prefix to use for this expression.") GetPrefix;
114359575Sdim    const char *
115359575Sdim    GetPrefix () const;
116359575Sdim
117359575Sdim    %feature("docstring", "Sets the prefix to use for this expression. This prefix gets inserted after the 'target.expr-prefix' prefix contents, but before the wrapped expression function body.") SetPrefix;
118359575Sdim    void
119359575Sdim    SetPrefix (const char *prefix);
120359575Sdim
121359575Sdim    %feature("docstring", "Sets whether to auto-apply fix-it hints to the expression being evaluated.") SetAutoApplyFixIts;
122359575Sdim    void
123359575Sdim    SetAutoApplyFixIts(bool b = true);
124359575Sdim
125359575Sdim    %feature("docstring", "Gets whether to auto-apply fix-it hints to an expression.") GetAutoApplyFixIts;
126359575Sdim    bool
127359575Sdim    GetAutoApplyFixIts();
128359575Sdim
129359575Sdim    bool
130359575Sdim    GetTopLevel();
131359575Sdim
132359575Sdim    void
133359575Sdim    SetTopLevel(bool b = true);
134359575Sdim
135359575Sdim    %feature("docstring", "Gets whether to JIT an expression if it cannot be interpreted.") GetAllowJIT;
136359575Sdim    bool
137359575Sdim    GetAllowJIT();
138359575Sdim
139359575Sdim    %feature("docstring", "Sets whether to JIT an expression if it cannot be interpreted.") SetAllowJIT;
140359575Sdim    void
141359575Sdim    SetAllowJIT(bool allow);
142359575Sdim
143359575Sdimprotected:
144359575Sdim
145359575Sdim    SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
146359575Sdim
147359575Sdim    lldb_private::EvaluateExpressionOptions *
148359575Sdim    get () const;
149359575Sdim
150359575Sdim    lldb_private::EvaluateExpressionOptions &
151359575Sdim    ref () const;
152359575Sdim
153359575Sdimprivate:
154359575Sdim    // This auto_pointer is made in the constructor and is always valid.
155359575Sdim    mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
156359575Sdim};
157359575Sdim
158359575Sdim} // namespace lldb
159