135e1bda6SJim Ingham //===-- SBExpressionOptions.cpp ---------------------------------------------*- C++ -*-===//
235e1bda6SJim Ingham //
335e1bda6SJim Ingham //                     The LLVM Compiler Infrastructure
435e1bda6SJim Ingham //
535e1bda6SJim Ingham // This file is distributed under the University of Illinois Open Source
635e1bda6SJim Ingham // License. See LICENSE.TXT for details.
735e1bda6SJim Ingham //
835e1bda6SJim Ingham //===----------------------------------------------------------------------===//
935e1bda6SJim Ingham 
1035e1bda6SJim Ingham #include "lldb/API/SBExpressionOptions.h"
1135e1bda6SJim Ingham #include "lldb/API/SBStream.h"
1235e1bda6SJim Ingham 
1335e1bda6SJim Ingham #include "lldb/Target/Target.h"
1435e1bda6SJim Ingham 
1535e1bda6SJim Ingham using namespace lldb;
1635e1bda6SJim Ingham using namespace lldb_private;
1735e1bda6SJim Ingham 
1835e1bda6SJim Ingham 
19cced1566SGreg Clayton SBExpressionOptions::SBExpressionOptions () :
20cced1566SGreg Clayton     m_opaque_ap(new EvaluateExpressionOptions())
2135e1bda6SJim Ingham {
2235e1bda6SJim Ingham }
2335e1bda6SJim Ingham 
2435e1bda6SJim Ingham SBExpressionOptions::SBExpressionOptions (const SBExpressionOptions &rhs)
2535e1bda6SJim Ingham {
2635e1bda6SJim Ingham     m_opaque_ap.reset(new EvaluateExpressionOptions());
2735e1bda6SJim Ingham     *(m_opaque_ap.get()) = rhs.ref();
2835e1bda6SJim Ingham }
2935e1bda6SJim Ingham 
3035e1bda6SJim Ingham const SBExpressionOptions &
3135e1bda6SJim Ingham SBExpressionOptions::operator = (const SBExpressionOptions &rhs)
3235e1bda6SJim Ingham {
3335e1bda6SJim Ingham     if (this != &rhs)
3435e1bda6SJim Ingham     {
3535e1bda6SJim Ingham         this->ref() = rhs.ref();
3635e1bda6SJim Ingham     }
3735e1bda6SJim Ingham     return *this;
3835e1bda6SJim Ingham }
3935e1bda6SJim Ingham 
4035e1bda6SJim Ingham SBExpressionOptions::~SBExpressionOptions()
4135e1bda6SJim Ingham {
4235e1bda6SJim Ingham }
4335e1bda6SJim Ingham 
4435e1bda6SJim Ingham bool
45cced1566SGreg Clayton SBExpressionOptions::GetCoerceResultToId () const
4635e1bda6SJim Ingham {
4735e1bda6SJim Ingham     return m_opaque_ap->DoesCoerceToId ();
4835e1bda6SJim Ingham }
4935e1bda6SJim Ingham 
5035e1bda6SJim Ingham void
51cced1566SGreg Clayton SBExpressionOptions::SetCoerceResultToId (bool coerce)
5235e1bda6SJim Ingham {
5335e1bda6SJim Ingham     m_opaque_ap->SetCoerceToId (coerce);
5435e1bda6SJim Ingham }
5535e1bda6SJim Ingham 
5635e1bda6SJim Ingham bool
57cced1566SGreg Clayton SBExpressionOptions::GetUnwindOnError () const
5835e1bda6SJim Ingham {
5935e1bda6SJim Ingham     return m_opaque_ap->DoesUnwindOnError ();
6035e1bda6SJim Ingham }
6135e1bda6SJim Ingham 
6235e1bda6SJim Ingham void
6335e1bda6SJim Ingham SBExpressionOptions::SetUnwindOnError (bool unwind)
6435e1bda6SJim Ingham {
6535e1bda6SJim Ingham     m_opaque_ap->SetUnwindOnError (unwind);
6635e1bda6SJim Ingham }
6735e1bda6SJim Ingham 
68184e9811SJim Ingham bool
69184e9811SJim Ingham SBExpressionOptions::GetIgnoreBreakpoints () const
70184e9811SJim Ingham {
71184e9811SJim Ingham     return m_opaque_ap->DoesIgnoreBreakpoints ();
72184e9811SJim Ingham }
73184e9811SJim Ingham 
74184e9811SJim Ingham void
75184e9811SJim Ingham SBExpressionOptions::SetIgnoreBreakpoints (bool ignore)
76184e9811SJim Ingham {
77184e9811SJim Ingham     m_opaque_ap->SetIgnoreBreakpoints (ignore);
78184e9811SJim Ingham }
79184e9811SJim Ingham 
8035e1bda6SJim Ingham lldb::DynamicValueType
81cced1566SGreg Clayton SBExpressionOptions::GetFetchDynamicValue () const
8235e1bda6SJim Ingham {
8335e1bda6SJim Ingham     return m_opaque_ap->GetUseDynamic ();
8435e1bda6SJim Ingham }
8535e1bda6SJim Ingham 
8635e1bda6SJim Ingham void
87cced1566SGreg Clayton SBExpressionOptions::SetFetchDynamicValue (lldb::DynamicValueType dynamic)
8835e1bda6SJim Ingham {
8935e1bda6SJim Ingham     m_opaque_ap->SetUseDynamic (dynamic);
9035e1bda6SJim Ingham }
9135e1bda6SJim Ingham 
9235e1bda6SJim Ingham uint32_t
93cced1566SGreg Clayton SBExpressionOptions::GetTimeoutInMicroSeconds () const
9435e1bda6SJim Ingham {
9535e1bda6SJim Ingham     return m_opaque_ap->GetTimeoutUsec ();
9635e1bda6SJim Ingham }
9735e1bda6SJim Ingham 
9835e1bda6SJim Ingham void
99cced1566SGreg Clayton SBExpressionOptions::SetTimeoutInMicroSeconds (uint32_t timeout)
10035e1bda6SJim Ingham {
10135e1bda6SJim Ingham     m_opaque_ap->SetTimeoutUsec (timeout);
10235e1bda6SJim Ingham }
10335e1bda6SJim Ingham 
104914f4e70SJim Ingham uint32_t
105914f4e70SJim Ingham SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds () const
106914f4e70SJim Ingham {
107914f4e70SJim Ingham     return m_opaque_ap->GetOneThreadTimeoutUsec ();
108914f4e70SJim Ingham }
109914f4e70SJim Ingham 
110914f4e70SJim Ingham void
111914f4e70SJim Ingham SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds (uint32_t timeout)
112914f4e70SJim Ingham {
113914f4e70SJim Ingham     m_opaque_ap->SetOneThreadTimeoutUsec (timeout);
114914f4e70SJim Ingham }
115914f4e70SJim Ingham 
11635e1bda6SJim Ingham bool
117cced1566SGreg Clayton SBExpressionOptions::GetTryAllThreads () const
11835e1bda6SJim Ingham {
1196fbc48bcSJim Ingham     return m_opaque_ap->GetTryAllThreads ();
12035e1bda6SJim Ingham }
12135e1bda6SJim Ingham 
12235e1bda6SJim Ingham void
123cced1566SGreg Clayton SBExpressionOptions::SetTryAllThreads (bool run_others)
12435e1bda6SJim Ingham {
1256fbc48bcSJim Ingham     m_opaque_ap->SetTryAllThreads (run_others);
1266fbc48bcSJim Ingham }
1276fbc48bcSJim Ingham 
1286fbc48bcSJim Ingham bool
129286fb1efSJim Ingham SBExpressionOptions::GetStopOthers () const
130286fb1efSJim Ingham {
131286fb1efSJim Ingham     return m_opaque_ap->GetStopOthers ();
132286fb1efSJim Ingham }
133286fb1efSJim Ingham 
134286fb1efSJim Ingham void
135286fb1efSJim Ingham SBExpressionOptions::SetStopOthers (bool run_others)
136286fb1efSJim Ingham {
137286fb1efSJim Ingham     m_opaque_ap->SetStopOthers (run_others);
138286fb1efSJim Ingham }
139286fb1efSJim Ingham 
140286fb1efSJim Ingham bool
1416fbc48bcSJim Ingham SBExpressionOptions::GetTrapExceptions () const
1426fbc48bcSJim Ingham {
1436fbc48bcSJim Ingham     return m_opaque_ap->GetTrapExceptions ();
1446fbc48bcSJim Ingham }
1456fbc48bcSJim Ingham 
1466fbc48bcSJim Ingham void
1476fbc48bcSJim Ingham SBExpressionOptions::SetTrapExceptions (bool trap_exceptions)
1486fbc48bcSJim Ingham {
1496fbc48bcSJim Ingham     m_opaque_ap->SetTrapExceptions (trap_exceptions);
15035e1bda6SJim Ingham }
15135e1bda6SJim Ingham 
1521624a2d3SJim Ingham void
153705b1809SJason Molenda SBExpressionOptions::SetLanguage (lldb::LanguageType language)
154705b1809SJason Molenda {
155705b1809SJason Molenda     m_opaque_ap->SetLanguage(language);
156705b1809SJason Molenda }
157705b1809SJason Molenda 
158705b1809SJason Molenda void
1591624a2d3SJim Ingham SBExpressionOptions::SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton)
1601624a2d3SJim Ingham {
1611624a2d3SJim Ingham     m_opaque_ap->SetCancelCallback (callback, baton);
1621624a2d3SJim Ingham }
1631624a2d3SJim Ingham 
164205ca1e8SGreg Clayton bool
165205ca1e8SGreg Clayton SBExpressionOptions::GetGenerateDebugInfo ()
166205ca1e8SGreg Clayton {
167205ca1e8SGreg Clayton     return m_opaque_ap->GetGenerateDebugInfo();
168205ca1e8SGreg Clayton }
169205ca1e8SGreg Clayton 
170205ca1e8SGreg Clayton void
171205ca1e8SGreg Clayton SBExpressionOptions::SetGenerateDebugInfo (bool b)
172205ca1e8SGreg Clayton {
173205ca1e8SGreg Clayton     return m_opaque_ap->SetGenerateDebugInfo(b);
174205ca1e8SGreg Clayton }
175205ca1e8SGreg Clayton 
1767ab079b6SJim Ingham bool
1777ab079b6SJim Ingham SBExpressionOptions::GetSuppressPersistentResult ()
1787ab079b6SJim Ingham {
1797ab079b6SJim Ingham     return m_opaque_ap->GetResultIsInternal ();
1807ab079b6SJim Ingham }
1817ab079b6SJim Ingham 
1827ab079b6SJim Ingham void
1837ab079b6SJim Ingham SBExpressionOptions::SetSuppressPersistentResult (bool b)
1847ab079b6SJim Ingham {
1857ab079b6SJim Ingham     return m_opaque_ap->SetResultIsInternal (b);
1867ab079b6SJim Ingham }
1877ab079b6SJim Ingham 
188*4e1042e1SGreg Clayton const char *
189*4e1042e1SGreg Clayton SBExpressionOptions::GetPrefix () const
190*4e1042e1SGreg Clayton {
191*4e1042e1SGreg Clayton     return m_opaque_ap->GetPrefix();
192*4e1042e1SGreg Clayton }
193*4e1042e1SGreg Clayton 
194*4e1042e1SGreg Clayton void
195*4e1042e1SGreg Clayton SBExpressionOptions::SetPrefix (const char *prefix)
196*4e1042e1SGreg Clayton {
197*4e1042e1SGreg Clayton     return m_opaque_ap->SetPrefix(prefix);
198*4e1042e1SGreg Clayton }
1997ab079b6SJim Ingham 
20035e1bda6SJim Ingham EvaluateExpressionOptions *
20135e1bda6SJim Ingham SBExpressionOptions::get() const
20235e1bda6SJim Ingham {
20335e1bda6SJim Ingham     return m_opaque_ap.get();
20435e1bda6SJim Ingham }
20535e1bda6SJim Ingham 
20635e1bda6SJim Ingham EvaluateExpressionOptions &
20735e1bda6SJim Ingham SBExpressionOptions::ref () const
20835e1bda6SJim Ingham {
20935e1bda6SJim Ingham     return *(m_opaque_ap.get());
21035e1bda6SJim Ingham }
211