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 
19*cced1566SGreg Clayton SBExpressionOptions::SBExpressionOptions () :
20*cced1566SGreg 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
45*cced1566SGreg Clayton SBExpressionOptions::GetCoerceResultToId () const
4635e1bda6SJim Ingham {
4735e1bda6SJim Ingham     return m_opaque_ap->DoesCoerceToId ();
4835e1bda6SJim Ingham }
4935e1bda6SJim Ingham 
5035e1bda6SJim Ingham void
51*cced1566SGreg Clayton SBExpressionOptions::SetCoerceResultToId (bool coerce)
5235e1bda6SJim Ingham {
5335e1bda6SJim Ingham     m_opaque_ap->SetCoerceToId (coerce);
5435e1bda6SJim Ingham }
5535e1bda6SJim Ingham 
5635e1bda6SJim Ingham bool
57*cced1566SGreg 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 
6835e1bda6SJim Ingham lldb::DynamicValueType
69*cced1566SGreg Clayton SBExpressionOptions::GetFetchDynamicValue () const
7035e1bda6SJim Ingham {
7135e1bda6SJim Ingham     return m_opaque_ap->GetUseDynamic ();
7235e1bda6SJim Ingham }
7335e1bda6SJim Ingham 
7435e1bda6SJim Ingham void
75*cced1566SGreg Clayton SBExpressionOptions::SetFetchDynamicValue (lldb::DynamicValueType dynamic)
7635e1bda6SJim Ingham {
7735e1bda6SJim Ingham     m_opaque_ap->SetUseDynamic (dynamic);
7835e1bda6SJim Ingham }
7935e1bda6SJim Ingham 
8035e1bda6SJim Ingham uint32_t
81*cced1566SGreg Clayton SBExpressionOptions::GetTimeoutInMicroSeconds () const
8235e1bda6SJim Ingham {
8335e1bda6SJim Ingham     return m_opaque_ap->GetTimeoutUsec ();
8435e1bda6SJim Ingham }
8535e1bda6SJim Ingham 
8635e1bda6SJim Ingham void
87*cced1566SGreg Clayton SBExpressionOptions::SetTimeoutInMicroSeconds (uint32_t timeout)
8835e1bda6SJim Ingham {
8935e1bda6SJim Ingham     m_opaque_ap->SetTimeoutUsec (timeout);
9035e1bda6SJim Ingham }
9135e1bda6SJim Ingham 
9235e1bda6SJim Ingham bool
93*cced1566SGreg Clayton SBExpressionOptions::GetTryAllThreads () const
9435e1bda6SJim Ingham {
9535e1bda6SJim Ingham     return m_opaque_ap->GetRunOthers ();
9635e1bda6SJim Ingham }
9735e1bda6SJim Ingham 
9835e1bda6SJim Ingham void
99*cced1566SGreg Clayton SBExpressionOptions::SetTryAllThreads (bool run_others)
10035e1bda6SJim Ingham {
10135e1bda6SJim Ingham     m_opaque_ap->SetRunOthers (run_others);
10235e1bda6SJim Ingham }
10335e1bda6SJim Ingham 
10435e1bda6SJim Ingham EvaluateExpressionOptions *
10535e1bda6SJim Ingham SBExpressionOptions::get() const
10635e1bda6SJim Ingham {
10735e1bda6SJim Ingham     return m_opaque_ap.get();
10835e1bda6SJim Ingham }
10935e1bda6SJim Ingham 
11035e1bda6SJim Ingham EvaluateExpressionOptions &
11135e1bda6SJim Ingham SBExpressionOptions::ref () const
11235e1bda6SJim Ingham {
11335e1bda6SJim Ingham     return *(m_opaque_ap.get());
11435e1bda6SJim Ingham }
115