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 
10435e1bda6SJim Ingham bool
105cced1566SGreg Clayton SBExpressionOptions::GetTryAllThreads () const
10635e1bda6SJim Ingham {
1076fbc48bcSJim Ingham     return m_opaque_ap->GetTryAllThreads ();
10835e1bda6SJim Ingham }
10935e1bda6SJim Ingham 
11035e1bda6SJim Ingham void
111cced1566SGreg Clayton SBExpressionOptions::SetTryAllThreads (bool run_others)
11235e1bda6SJim Ingham {
1136fbc48bcSJim Ingham     m_opaque_ap->SetTryAllThreads (run_others);
1146fbc48bcSJim Ingham }
1156fbc48bcSJim Ingham 
1166fbc48bcSJim Ingham bool
117*286fb1efSJim Ingham SBExpressionOptions::GetStopOthers () const
118*286fb1efSJim Ingham {
119*286fb1efSJim Ingham     return m_opaque_ap->GetStopOthers ();
120*286fb1efSJim Ingham }
121*286fb1efSJim Ingham 
122*286fb1efSJim Ingham void
123*286fb1efSJim Ingham SBExpressionOptions::SetStopOthers (bool run_others)
124*286fb1efSJim Ingham {
125*286fb1efSJim Ingham     m_opaque_ap->SetStopOthers (run_others);
126*286fb1efSJim Ingham }
127*286fb1efSJim Ingham 
128*286fb1efSJim Ingham bool
1296fbc48bcSJim Ingham SBExpressionOptions::GetTrapExceptions () const
1306fbc48bcSJim Ingham {
1316fbc48bcSJim Ingham     return m_opaque_ap->GetTrapExceptions ();
1326fbc48bcSJim Ingham }
1336fbc48bcSJim Ingham 
1346fbc48bcSJim Ingham void
1356fbc48bcSJim Ingham SBExpressionOptions::SetTrapExceptions (bool trap_exceptions)
1366fbc48bcSJim Ingham {
1376fbc48bcSJim Ingham     m_opaque_ap->SetTrapExceptions (trap_exceptions);
13835e1bda6SJim Ingham }
13935e1bda6SJim Ingham 
14035e1bda6SJim Ingham EvaluateExpressionOptions *
14135e1bda6SJim Ingham SBExpressionOptions::get() const
14235e1bda6SJim Ingham {
14335e1bda6SJim Ingham     return m_opaque_ap.get();
14435e1bda6SJim Ingham }
14535e1bda6SJim Ingham 
14635e1bda6SJim Ingham EvaluateExpressionOptions &
14735e1bda6SJim Ingham SBExpressionOptions::ref () const
14835e1bda6SJim Ingham {
14935e1bda6SJim Ingham     return *(m_opaque_ap.get());
15035e1bda6SJim Ingham }
151