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 {
107*6fbc48bcSJim Ingham     return m_opaque_ap->GetTryAllThreads ();
10835e1bda6SJim Ingham }
10935e1bda6SJim Ingham 
11035e1bda6SJim Ingham void
111cced1566SGreg Clayton SBExpressionOptions::SetTryAllThreads (bool run_others)
11235e1bda6SJim Ingham {
113*6fbc48bcSJim Ingham     m_opaque_ap->SetTryAllThreads (run_others);
114*6fbc48bcSJim Ingham }
115*6fbc48bcSJim Ingham 
116*6fbc48bcSJim Ingham bool
117*6fbc48bcSJim Ingham SBExpressionOptions::GetTrapExceptions () const
118*6fbc48bcSJim Ingham {
119*6fbc48bcSJim Ingham     return m_opaque_ap->GetTrapExceptions ();
120*6fbc48bcSJim Ingham }
121*6fbc48bcSJim Ingham 
122*6fbc48bcSJim Ingham void
123*6fbc48bcSJim Ingham SBExpressionOptions::SetTrapExceptions (bool trap_exceptions)
124*6fbc48bcSJim Ingham {
125*6fbc48bcSJim Ingham     m_opaque_ap->SetTrapExceptions (trap_exceptions);
12635e1bda6SJim Ingham }
12735e1bda6SJim Ingham 
12835e1bda6SJim Ingham EvaluateExpressionOptions *
12935e1bda6SJim Ingham SBExpressionOptions::get() const
13035e1bda6SJim Ingham {
13135e1bda6SJim Ingham     return m_opaque_ap.get();
13235e1bda6SJim Ingham }
13335e1bda6SJim Ingham 
13435e1bda6SJim Ingham EvaluateExpressionOptions &
13535e1bda6SJim Ingham SBExpressionOptions::ref () const
13635e1bda6SJim Ingham {
13735e1bda6SJim Ingham     return *(m_opaque_ap.get());
13835e1bda6SJim Ingham }
139