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 
104*914f4e70SJim Ingham uint32_t
105*914f4e70SJim Ingham SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds () const
106*914f4e70SJim Ingham {
107*914f4e70SJim Ingham     return m_opaque_ap->GetOneThreadTimeoutUsec ();
108*914f4e70SJim Ingham }
109*914f4e70SJim Ingham 
110*914f4e70SJim Ingham void
111*914f4e70SJim Ingham SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds (uint32_t timeout)
112*914f4e70SJim Ingham {
113*914f4e70SJim Ingham     m_opaque_ap->SetOneThreadTimeoutUsec (timeout);
114*914f4e70SJim Ingham }
115*914f4e70SJim 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 
15235e1bda6SJim Ingham EvaluateExpressionOptions *
15335e1bda6SJim Ingham SBExpressionOptions::get() const
15435e1bda6SJim Ingham {
15535e1bda6SJim Ingham     return m_opaque_ap.get();
15635e1bda6SJim Ingham }
15735e1bda6SJim Ingham 
15835e1bda6SJim Ingham EvaluateExpressionOptions &
15935e1bda6SJim Ingham SBExpressionOptions::ref () const
16035e1bda6SJim Ingham {
16135e1bda6SJim Ingham     return *(m_opaque_ap.get());
16235e1bda6SJim Ingham }
163